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:

JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/**
 * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
 */
 
CKEDITOR.dtd.$removeEmpty['i'] = false;
CKEDITOR.dtd.$removeEmpty['span'] = false;
 
CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here.
    // For complete reference see:
    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';
};