CKEDITOR.dialog.add('pbckcodeDialog', function ( editor ) { // load JS file var head = document.getElementsByTagName('HEAD').item(0); var script= document.createElement("script"); script.type = "text/javascript"; script.src = CKEDITOR.plugins.getPath('pbckcode') + "dialogs/ace/ace.js"; head.appendChild(script); // load CSS file var link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = CKEDITOR.plugins.getPath('pbckcode') + "dialogs/style.css"; link.media = 'all'; head.appendChild(link); // default values of the plugin if(editor.config.pbckcode.cls == undefined) editor.config.pbckcode.cls = "prettyprint linenums"; if(editor.config.pbckcode.modes == undefined) editor.config.pbckcode.modes = [ ['PHP', 'php'], ['HTML', 'html'], ['CSS', 'css'] ] if(editor.config.pbckcode.defaultMode == undefined) editor.config.pbckcode.defaultMode = editor.config.pbckcode.modes[0][1]; if(editor.config.pbckcode.theme == undefined) editor.config.pbckcode.theme = 'textmate'; var AceEditor; return { // Basic properties of the dialog window: title, minimum size. title: editor.lang.pbckcode.title, minWidth: 600, minHeight: 400, // Dialog window contents definition. contents: [{ id : 'code-container', label : editor.lang.pbckcode.tabCode, elements : [{ type : 'select', id : 'code-select', items : editor.config.pbckcode.modes, defaultMode : editor.config.pbckcode.defaultMode, setup : function(element) { this.setValue(element.getAttribute("data-language")); }, commit : function(element) { element.setAttribute("data-language", this.getValue()); }, onChange: function(api) { AceEditor.getSession().setMode("ace/mode/" + this.getValue()); } }, { type : 'html', html : '
', setup : function(element) { // get the value of the editor code = element.getHtml(); code = code.replace(new RegExp('