Files
AtomicOld/simpla/design/js/ckeditor/config.js
2026-02-14 19:50:25 +03:00

119 lines
4.6 KiB
JavaScript

/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.language = 'ru';
// config.uiColor = '#AADC6E';
config.toolbar = 'common';
config.contentsCss = ['https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/slate/bootstrap.min.css', '/design/carheart/css/styles.css', '/design/carheart/css/ckeditor.css?v=455668'];
//config.contentsCss = [ '/php/ckeditor/contents.css'];
config.toolbar_common =
[
['Source','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks','-','About'],
['jQuerySpellChecker']
];
config.toolbar = 'common';
config.toolbar_basic =
[
['Source'],
['Paste','PasteText','PasteFromWord','RemoveFormat'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink'],
['Image','Table','SpecialChar'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks','-','About']
];
config.indentClasses = ["ul-grey", "ul-red", "text-red", "ul-content-red", "circle", "style-none", "decimal", "paragraph-portfolio-top", "ul-portfolio-top", "url-portfolio-top", "text-grey"];
config.protectedSource.push(/<(style)[^>]*>.*<\/style>/ig);
config.protectedSource.push(/<(script)[^>]*>.*<\/script>/ig);// ðàçðåøèòü òåãè <script>
//config.protectedSource.push(/<\?[\s\S]*?\?>/g);// ðàçðåøèòü php-êîä
config.protectedSource.push(/<!--dev-->[\s\S]*<!--\/dev-->/g);
config.allowedContent = true; /* all tags */
// CKEDITOR.plugins.load('pgrfilemanager');
config.filebrowserBrowseUrl = '/simpla/design/js/elfinder/elfinder.php';
//config.filebrowserBrowseUrl = 'includes/elFinder/elfinder.html';
config.extraPlugins = 'jqueryspellchecker';
config.disableNativeSpellChecker = false;
};
CKEDITOR.on('instanceReady', function (ev) {
// Ends self closing tags the HTML4 way, like <br>.
ev.editor.dataProcessor.htmlFilter.addRules(
{
elements:
{
$: function (element) {
// Output dimensions of images as width and height
if (element.name == 'img') {
var style = element.attributes.style;
if (style) {
// Get the width from the style.
var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec(style),
width = match && match[1];
// Get the height from the style.
match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec(style);
var height = match && match[1];
// Get the float from the style.
match = /(?:^|\s)float\s*:\s*(\w+)/i.exec(style);
var float = match && match[1];
if (width) {
element.attributes.style = element.attributes.style.replace(/(?:^|\s)width\s*:\s*(\d+)px;?/i, '');
//element.attributes.width = width;
}
if (height) {
element.attributes.style = element.attributes.style.replace(/(?:^|\s)height\s*:\s*(\d+)px;?/i, '');
//element.attributes.height = height;
}
if (float) {
element.attributes.style = element.attributes.style.replace(/(?:^|\s)float\s*:\s*(\w+)/i, '');
element.attributes.align = float;
}
}
}
if (!element.attributes.style)
delete element.attributes.style;
return element;
}
}
});
});