/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { config.disableNativeSpellChecker = false; config.pasteFromWordPromptCleanup = true; config.bodyClass = 'ck_body'; config.toolbar = 'Default'; // allow i tags to be empty (for FontAwesome) CKEDITOR.dtd.$removeEmpty['i'] = false; // ck finder config.filebrowserBrowseUrl = CKEDITOR.basePath + 'ckfinder/ckfinder.html'; config.filebrowserImageBrowseUrl = CKEDITOR.basePath + 'ckfinder/ckfinder.html?type=Images'; config.filebrowserFlashBrowseUrl = CKEDITOR.basePath + 'ckfinder/ckfinder.html?type=Flash'; config.filebrowserUploadUrl = CKEDITOR.basePath + 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files'; config.filebrowserImageUploadUrl = CKEDITOR.basePath + 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'; config.filebrowserFlashUploadUrl = CKEDITOR.basePath + 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'; config.colorButton_colors = '000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,' + 'B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,' + 'F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,' + 'FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,' + 'FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF'; config.fontSize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;13/13px;14/14px;15/15px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;32/32px;36/36px;42/42px;48/48px;54/54px;72/72px'; config.font_names = 'Arial/Arial, Helvetica, sans-serif;' + 'Comic Sans MS/Comic Sans MS, cursive;' + 'Courier New/Courier New, Courier, monospace;' + 'Georgia/Georgia, serif;' + 'Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;' + 'Tahoma/Tahoma, Geneva, sans-serif;' + 'Times New Roman/Times New Roman, Times, serif;' + 'Trebuchet MS/Trebuchet MS, Helvetica, sans-serif;' + 'Verdana/Verdana, Geneva, sans-serif'; config.toolbar_Default = [ { name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] }, { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] }, { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] }, /* { name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] }, */ '/', { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] }, { name: 'links', items : [ 'Link','Unlink','Anchor' ] }, { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak' ] }, '/', { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] }, { name: 'colors', items : [ 'TextColor','BGColor' ] }, { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] } ]; config.toolbar_Basic = [ { name: 'baskctoolbar', items : [ 'Source','-','Bold','Italic','-','NumberedList','BulletedList','-','Link','Unlink','Anchor' ] } ]; config.toolbar_Smarty = [ { name: 'document', items : [ 'Source','-','Bold','Italic','Underline' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] }, { name: 'links', items : [ 'Link','Unlink','Anchor','-','Image','TextColor','BGColor' ] }, { name: 'styles', items : [ 'Format','Font','FontSize' ] } ]; config.toolbar_Flash = [ { name: 'document', items : [ 'Source','-','Bold','Italic','Underline' ] }, { name: 'justify', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Link','Unlink','Image','TextColor' ] }, { name: 'styles', items : [ 'Format','Font','FontSize' ] } ]; (function () { /* * Load simpleTemplate plugin */ var jsPath = CKEDITOR.basePath.substr(0, CKEDITOR.basePath.indexOf("ckeditor/")); config.extraPlugins += (config.extraPlugins ? ',' : '') + 'simpleTemplate'; CKEDITOR.plugins.addExternal('simpleTemplate', jsPath + 'lib/ck-plugin/simple-template/', 'simpleTemplate.js'); config.toolbar_DefaultTemplate = Array.prototype.slice.call(config.toolbar_Default); config.toolbar_DefaultTemplate.push({name: 'simpleTemplateBar', items: ['simpleTemplate', 'simpleTemplateRemove']}); config.toolbar_BasicTemplate = Array.prototype.slice.call(config.toolbar_Basic); config.toolbar_BasicTemplate.push({name: 'simpleTemplateBar', items: ['simpleTemplate', 'simpleTemplateRemove']}); })(); }; CKEDITOR.on('instanceReady', function (ev) { ev.editor.dataProcessor.htmlFilter.addRules({ elements: { $: function (element) { /* фікс проблеми з порожніми "longdesc" для картинок */ if (element.name == 'img') { if (element.attributes.longdesc != undefined && !element.attributes.longdesc) { delete element.attributes.longdesc; } } /* фікс XSS (http://www.exploit-db.com/exploits/25493/) */ if (element.name == 'iframe') { var src = decodeURIComponent(element.attributes.src + ''); if (-1 != src.indexOf('