VitaLemon 2012-09-25
代码如下:
<link rel="stylesheet" type="text/css" href="/syntaxhighlighter/styles/shCoreDefault.css" /> <script language="javascript" type="text/javascript" src="/syntaxhighlighter/scripts/shCore.js"></script> <script language="javascript" type="text/javascript" src="/syntaxhighlighter/scripts/shBrushSeaYee.js"></script>
代码如下:
CKEDITOR.plugins.add('insertcode', { init: function(editor) { //plugin code goes here var pluginName = 'Insertcode'; CKEDITOR.dialog.add(pluginName, this.path + 'insertcode.js'); editor.config.flv_path = editor.config.flv_path || (this.path); editor.addCommand(pluginName, new CKEDITOR.dialogCommand(pluginName)); editor.ui.addButton('Insertcode', { label: '插入代码', command: pluginName, icon: this.path + 'insertcode.gif' }); } });
代码如下:
CKEDITOR.dialog.add('Insertcode', function(editor){ var escape = function(value){return value;}; return{ title: '插入代码', resizable: CKEDITOR.DIALOG_RESIZE_BOTH, minWidth: 720, minHeight: 520, contents: [{ id: 'cb', name: 'cb', label: 'cb', title: 'cb', elements: [{ type: 'select', label: 'Language', id: 'lang', required: true, 'default': 'csharp', items: [['ActionScript3', 'as3'], ['Bash/shell', 'bash'], ['ColdFusion', 'cf'], ['C#', 'csharp'], ['C++', 'cpp'], ['CSS', 'css'], ['Delphi', 'delphi'], ['Diff', 'diff'], ['Groovy', 'groovy'], ['JavaScript', 'js'], ['Java', 'java'], ['JavaFX', 'jfx'], ['Perl', 'perl'], ['PHP', 'php'], ['Plain Text', 'plain'], ['PowerShell', 'ps'], ['Python', 'py'], ['Ruby', 'rails'], ['Scala', 'scala'], ['SQL', 'sql'], ['Visual Basic', 'vb'], ['XML', 'xml']] }, { type: 'textarea', style: 'width:718px;height:450px', label: 'Code', id: 'code', rows: 31, 'default': '' }] }], onOk: function(){ code = this.getValueOf('cb', 'code'); lang = this.getValueOf('cb', 'lang'); html = '' + escape(code) + ''; editor.insertHtml("<pre class=\"brush:" + lang + ";\">" + html + "</pre>"); }, onLoad: function(){} }; });
代码如下:
config.extraPlugins = 'insertcode';
$oFCKeditor->Value = 'This is some <strong>sample text</strong>' ;<textarea name="content" style=&qu