Forums / National / Russian / Тех. поддержка / Запросы документации

Принимаем вопросы от населения

Kopusha
#47265 2023-10-16 09:04
#47262 Kort:

Предупреждать надо)))

я кстати у себя не победил error что редактор привязан к нескольким текстэреа одновременно, мне очень долго поднимать чистый текстовый котонти. Мож включи у себя на тестовом rcomm и ткни носом где включил)

Added 22 seconds later:

#47264 Kort:

Новый -- это какой? Коробочный же такого не делает.

Коробочный но с сильно поменяными config

Added 59 seconds later:

/**
 * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see https://ckeditor.com/legal/ckeditor-oss-license
 */

CKEDITOR.dtd.$removeEmpty['i'] = false;
CKEDITOR.dtd.$removeEmpty['span'] = false;

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here.
	// For complete reference see:
	// https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html
	config.keystrokes = [
        // copy here all keystrokes from _source/plugins/keystrokes/plugin.js
        // [ CKEDITOR.CTRL + 86, 'pastetext' ] //Fires new dialogue window for CTRL-C CTRL-V pasting text, remove if necessary 
    ];
    config.fillEmptyBlocks = false;
	config.basicEntities = false;
	config.autoParagraph = true;//Whether automatically create wrapping blocks around inline contents inside document body, this helps to ensure the integrality of the block enter mode.
	config.pasteFromWordPromptCleanup = true;//чистим копипаст с ворда
	config.pasteFromWordRemoveFontStyles = true;//чистим копипаст с ворда
	config.forcePasteAsPlainText = true;//чистим копипаст 
	config.ignoreEmptyParagraph = true;//Whether the editor must output an empty value ("") if it's contents is made by an empty paragraph only.
	config.removeFormatAttributes = true;//A comma separated list of elements attributes to be removed when executing the "remove format" command
	config.toolbar = 'Full';
	config.extraPlugins = 'wordcount,more,emojione,print,oembed,widget,syntaxhighlight,specialchar,mentions,codemirror';
	//config.extraPlugins = 'wordcount,more,oembed,syntaxhighlight,codemirror,emojione';
	config.wordcount = {
		// Whether or not you want to show the Paragraphs Count
		    showParagraphs: true,
		
		    // Whether or not you want to show the Word Count
		    showWordCount: true,
		
		    // Whether or not you want to show the Char Count
		    showCharCount: true,
		
		    // Whether or not you want to count Spaces as Chars
		    countSpacesAsChars: false,
		
		    // Whether or not to include Html chars in the Char Count
		    countHTML: false,
		    
		    // Maximum allowed Word Count, -1 is default for unlimited
		    maxWordCount: -1,
		
		    // Maximum allowed Char Count, -1 is default for unlimited
		    maxCharCount: -1,
		
		    // Add filter to add or remove element before counting (see CKEDITOR.htmlParser.filter), Default value : null (no filter)
		    filter: new CKEDITOR.htmlParser.filter({
		        elements: {
		            div: function( element ) {
		                if(element.attributes.class == 'mediaembed') {
		                    return false;
		                }
		            }
		        }
		    })
    	};
    	
    	
CKEDITOR.on( 'dialogDefinition', function( ev )
{
    // Take the dialog name and its definition from the event data.
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;

    // Check if the definition is from the dialog we're
    // interested in (the 'link' dialog).
    //if ( dialogName == 'link' )
    //{
        //dialogDefinition.getContents('info').get('protocol')['items'].splice(4, 1);
    //}    	
    
    if (dialogName == 'link') {
        var protocolField = dialogDefinition.getContents('info').get('protocol');
        var items = protocolField['items'];
        protocolField['items'] = items.slice(0, 2); // Оставляем только первые две опции
    }    
    
    
});    	
    	
	config.removePlugins = 'contextmenu,tabletools';//убирает всплывающее копипейстменю в андроиде
	//config.allowedContent = true; // disable ACF
	config.allowedContent = false; // disable ACF// судя по всему отключает вообще фильтрацию вводимого
	config.extraAllowedContent = 'span(*); a[!href, class](*); figure(*); figcaption(*); div(*); h2(*); h3(*); p[data-pullquote]';
	config.disallowedContent = '*[on*]';
	
	
	//SCAYT conf
	config.scayt_autoStartup = true;
	config.scayt_sLang = 'auto';
	var bodyElement = document.body;
	var langValue = bodyElement.getAttribute('data-lang');
	if (langValue === 'ru') {
		config.scayt_autoStartup = false;
	    config.language = 'ru';
	} else if (langValue === 'ua') {
		config.scayt_sLang = 'uk_UA';
	    config.language = 'uk';
	} else {
		config.scayt_sLang = 'en_US';
	    config.language = 'en';
	}	
	config.scayt_minWordLength = 5;
	config.scayt_handleCheckDirty = false;
	config.scayt_handleUndoRedo = false;
	//config.disableNativeSpellChecker = false;
	config.scayt_ignoreAllCapsWords =true;
	config.scayt_ignoreDomainNames =true;
	config.scayt_ignoreWordsWithMixedCases =true;
	config.scayt_ignoreWordsWithNumbers =true;
	//config.scayt_disableOptionsStorage = 'all';
	config.scayt_uiTabs ='0,1,0';
	//mentions conf
	config.mentions = [ 
			{
	            marker: '@',
	            minChars: 4,
	            feed: '/index.php?r=autocomplete&cke=1&q={encodedQuery}',
	            itemTemplate: '<li data-id="{id}"><img src="{avatar}" height="20" width="20" alt="{name}"> {name}</li>',
	            //outputTemplate: '<a class="alpha-user__avatar" href="https://photo.travel/ru/users/{id}?m=details"><img src="{avatar}" height="20" width="20" alt="{name}"></a><a class="alpha-user__link" href="https://photo.travel/ru/users/{id}?m=details">{name}</a> '
	            //itemTemplate: '<li data-id="{id}">{name}</li>',
	            outputTemplate: '<a class="alpha-user__link" target="_blank" href="https://photo.travel/ru/users/{id}?m=details">{name}</a> '
			},
			{
	            marker: '#',
	            minChars: 3,
	            feed: '/index.php?r=tags&cke=1&q={encodedQuery}',
	            itemTemplate: '<li data-id="{id}">{tag}</li>',
	            outputTemplate: '<a class="alpha-tag__link" target="_blank" href="https://photo.travel/ru/users/{id}?m=details">{tag}</a> '
			} 
	];


	// CKEditor toolbar sets for Cotonti
	config.toolbar_Full =
		[
			['Source','Maximize'],
			['Cut','Copy','PasteText'],
			['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
			['Image','HorizontalRule'],
			['Print','Preview','Scayt','Table','oembed','SpecialChar','Syntaxhighlight'],
			'/',
			['Bold','Italic','Underline','Strike'],
			['NumberedList','BulletedList','Blockquote'],
			['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
			['Link','Unlink'],
			['Styles','Format'],
			['Emojione'],
			['TextColor','BGColor']
		];

	config.toolbar_Medium = [
		['Bold','Italic','Underline','Strike'],
		['NumberedList','BulletedList','-','Blockquote'],
		['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
		['Image','Link','Unlink','HorizontalRule'],
		['TextColor','BGColor'],
		['SelectAll','Cut','Copy','PasteText'],
		['Undo','Redo'],['Source']
	];

	config.toolbar_Basic =
		[
			['Bold','Italic','Underline','Strike','Emojione','-','NumberedList','BulletedList'],['Undo','Redo','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],['Link','Unlink'],['Format'],['HorizontalRule','Maximize']
		];
		
	config.toolbar_Comments =
		[
			['Bold','Italic','Underline','Strike','Emojione','-','NumberedList','BulletedList'],['Source','Maximize']
		];
	// /CKEditor toolbar sets for Cotonti

	// The toolbar groups arrangement, optimized for two toolbar rows.
	// Example
	// config.toolbarGroups = [
	// 	{ name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
	// 	{ name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
	// 	{ name: 'links' },
	// 	{ name: 'insert' },
	// 	{ name: 'forms' },
	// 	{ name: 'tools' },
	// 	{ name: 'document',	   groups: [ 'mode', 'document', 'doctools' ] },
	// 	{ name: 'others' },
	// 	'/',
	// 	{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
	// 	{ name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
	// 	{ name: 'styles' },
	// 	{ name: 'colors' },
	// 	{ name: 'about' }
	// ];

	// Remove some buttons provided by the standard plugins, which are
	// not needed in the Standard(s) toolbar.
	//config.removeButtons = 'Underline,Subscript,Superscript';

	// Set the most common block elements.
	config.format_tags = 'h2;h3;h4;h5';

	// Simplify the dialog windows.
	config.removeDialogTabs = 'image:advanced;link:advanced';
};