editor_plugin_src.js

来自「community server 源码」· JavaScript 代码 · 共 60 行

JS
60
字号

tinyMCE.importPluginLanguagePack('contentselector', 'en,tr,sv,cs,zh_cn,fr_ca,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl,nl,fr,pt_br');

var TinyMCE_ContentSelectorPlugin = {
	_currentEditor : null,
	_currentBookmark : null,
	
	getInfo : function() {
		return {
			longname : 'Community Server Content Selector Plugin',
			author : 'Telligent Systems',
			authorurl : 'http://telligentsystems.com/',
			infourl : 'http://telligentsystems.com/',
			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
		};
	},

	initInstance : function(inst) {
		if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false))
			tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent);
	},

	getControlHTML : function(cn) { 
		switch (cn) { 
			case "contentselector":
				return tinyMCE.getButtonHTML(cn, 'lang_contentselector_desc', '{$pluginurl}/images/browse.gif', 'csContentSelector', true);
		} 

		return ''; 
	},

	execCommand : function(editor_id, element, command, user_interface, value) { 
		switch (command) { 
			case "csContentSelector": 
				TinyMCE_ContentSelectorPlugin._openContentSelector(editor_id);

				return true;
		} 

		// Pass to next handler in chain 
		return false; 
	},
		
	_openContentSelector : function(editor_id) {
		TinyMCE_ContentSelectorPlugin._currentEditor = tinyMCE.getInstanceById(editor_id);
		TinyMCE_ContentSelectorPlugin._currentBookmark = this._currentEditor.selection.getBookmark();
		
		if (tinyMCE_CommunityServerOptions)
			tinyMCE_CommunityServerOptions.ContentSelectorOpenFunction();	
	},
		
	_addContent : function(content) {
		TinyMCE_ContentSelectorPlugin._currentEditor.selection.moveToBookmark(this._currentBookmark);	
		TinyMCE_ContentSelectorPlugin._currentEditor.execCommand("mceInsertRawHTML", false, content)
	}
	
};

tinyMCE.addPlugin("contentselector", TinyMCE_ContentSelectorPlugin);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?