biso24-editor 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CKEditor4/CHANGES.md +2182 -2182
- package/CKEditor4/LICENSE.md +1436 -1436
- package/CKEditor4/README.md +39 -39
- package/CKEditor4/SECURITY.md +10 -10
- package/CKEditor4/adapters/jquery.js +158 -158
- package/CKEditor4/bender-runner.config.json +16 -16
- package/CKEditor4/build-config.js +100 -100
- package/CKEditor4/ckeditor.js +30065 -30065
- package/CKEditor4/config.js +39 -39
- package/CKEditor4/contents.css +161 -161
- package/CKEditor4/lang/vi.js +475 -475
- package/CKEditor4/plugins/a11yhelp/dialogs/a11yhelp.js +143 -143
- package/CKEditor4/plugins/a11yhelp/dialogs/lang/vi.js +122 -122
- package/CKEditor4/plugins/custompaste/plugin.js +57 -57
- package/CKEditor4/plugins/dialog/dialogDefinition.js +4 -4
- package/CKEditor4/plugins/dialog/styles/dialog.css +18 -18
- package/CKEditor4/plugins/font/lang/vi.js +14 -14
- package/CKEditor4/plugins/font/plugin.js +535 -535
- package/CKEditor4/plugins/image2/dialogs/image2.js +558 -558
- package/CKEditor4/plugins/image2/lang/vi.js +21 -21
- package/CKEditor4/plugins/image2/plugin.js +1715 -1708
- package/CKEditor4/plugins/justify/plugin.js +266 -266
- package/CKEditor4/plugins/justify_group/plugin.js +64 -64
- package/CKEditor4/plugins/lineheight/LICENSE +22 -22
- package/CKEditor4/plugins/lineheight/README.md +2 -2
- package/CKEditor4/plugins/lineheight/lang/vi.js +3 -3
- package/CKEditor4/plugins/lineheight/plugin.js +99 -99
- package/CKEditor4/plugins/lineheight/readme.txt +30 -30
- package/CKEditor4/plugins/link/dialogs/anchor.js +82 -82
- package/CKEditor4/plugins/link/dialogs/link.js +777 -777
- package/CKEditor4/plugins/menubutton/plugin.js +99 -99
- package/CKEditor4/plugins/pastefromword/filter/default.js +849 -849
- package/CKEditor4/plugins/pastetools/filter/common.js +445 -445
- package/CKEditor4/plugins/pastetools/filter/image.js +163 -163
- package/CKEditor4/plugins/pdffile/plugin.js +36 -36
- package/CKEditor4/plugins/placeholder_button/plugin.js +31 -31
- package/CKEditor4/plugins/sourcedialog/dialogs/sourcedialog.js +88 -88
- package/CKEditor4/plugins/sourcedialog/lang/vi.js +9 -9
- package/CKEditor4/plugins/sourcedialog/plugin.js +30 -30
- package/CKEditor4/plugins/wordfile/plugin.js +161 -161
- package/CKEditor4/skins/moono-lisa/dialog.css +685 -685
- package/CKEditor4/skins/moono-lisa/dialog_ie.css +721 -721
- package/CKEditor4/skins/moono-lisa/dialog_ie8.css +746 -746
- package/CKEditor4/skins/moono-lisa/dialog_iequirks.css +724 -724
- package/CKEditor4/skins/moono-lisa/editor.css +1551 -1551
- package/CKEditor4/skins/moono-lisa/editor_gecko.css +1556 -1556
- package/CKEditor4/skins/moono-lisa/editor_ie.css +1588 -1588
- package/CKEditor4/skins/moono-lisa/editor_ie8.css +1639 -1639
- package/CKEditor4/skins/moono-lisa/editor_iequirks.css +1632 -1632
- package/CKEditor4/skins/moono-lisa/readme.md +46 -46
- package/CKEditor4/styles.js +136 -136
- package/CKEditor4/vendor/promise.js +385 -385
- package/package.json +1 -1
|
@@ -1,266 +1,266 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @fileOverview Justify commands.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
(function () {
|
|
11
|
-
function getAlignment(element, useComputedState) {
|
|
12
|
-
var align;
|
|
13
|
-
if (useComputedState) align = element.getComputedStyle('text-align');
|
|
14
|
-
else {
|
|
15
|
-
while (!element.hasAttribute || !(element.hasAttribute('align') || element.getStyle('text-align'))) {
|
|
16
|
-
var parent = element.getParent();
|
|
17
|
-
if (!parent) break;
|
|
18
|
-
element = parent;
|
|
19
|
-
}
|
|
20
|
-
align = element.getStyle('text-align') || element.getAttribute('align') || '';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Sometimes computed values doesn't tell.
|
|
24
|
-
align && (align = align.replace(/(?:-(?:moz|webkit)-)?(?:start|auto)/i, ''));
|
|
25
|
-
|
|
26
|
-
!align && useComputedState && (align = element.getComputedStyle('direction') == 'rtl' ? 'right' : 'left');
|
|
27
|
-
|
|
28
|
-
return align;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function justifyCommand(editor, name, value) {
|
|
32
|
-
this.editor = editor;
|
|
33
|
-
this.name = name;
|
|
34
|
-
this.value = value;
|
|
35
|
-
this.context = 'p';
|
|
36
|
-
var classes = editor.config.justifyClasses,
|
|
37
|
-
blockTag = editor.config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div';
|
|
38
|
-
|
|
39
|
-
if (classes) {
|
|
40
|
-
switch (value) {
|
|
41
|
-
case 'left':
|
|
42
|
-
this.cssClassName = classes[0];
|
|
43
|
-
break;
|
|
44
|
-
case 'center':
|
|
45
|
-
this.cssClassName = classes[1];
|
|
46
|
-
break;
|
|
47
|
-
case 'right':
|
|
48
|
-
this.cssClassName = classes[2];
|
|
49
|
-
break;
|
|
50
|
-
case 'justify':
|
|
51
|
-
this.cssClassName = classes[3];
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
this.cssClassRegex = new RegExp('(?:^|\\s+)(?:' + classes.join('|') + ')(?=$|\\s)');
|
|
56
|
-
this.requiredContent = blockTag + '(' + this.cssClassName + ')';
|
|
57
|
-
} else {
|
|
58
|
-
this.requiredContent = blockTag + '{text-align}';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this.allowedContent = {
|
|
62
|
-
'caption div h1 h2 h3 h4 h5 h6 p pre td th li': {
|
|
63
|
-
// Do not add elements, but only text-align style if element is validated by other rule.
|
|
64
|
-
propertiesOnly: true,
|
|
65
|
-
styles: this.cssClassName ? null : 'text-align',
|
|
66
|
-
classes: this.cssClassName || null,
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// In enter mode BR we need to allow here for div, because when non other
|
|
71
|
-
// feature allows div justify is the only plugin that uses it.
|
|
72
|
-
if (editor.config.enterMode == CKEDITOR.ENTER_BR) this.allowedContent.div = true;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function onDirChanged(e) {
|
|
76
|
-
var editor = e.editor;
|
|
77
|
-
|
|
78
|
-
var range = editor.createRange();
|
|
79
|
-
range.setStartBefore(e.data.node);
|
|
80
|
-
range.setEndAfter(e.data.node);
|
|
81
|
-
|
|
82
|
-
var walker = new CKEDITOR.dom.walker(range),
|
|
83
|
-
node;
|
|
84
|
-
|
|
85
|
-
while ((node = walker.next())) {
|
|
86
|
-
if (node.type == CKEDITOR.NODE_ELEMENT) {
|
|
87
|
-
// A child with the defined dir is to be ignored.
|
|
88
|
-
if (!node.equals(e.data.node) && node.getDirection()) {
|
|
89
|
-
range.setStartAfter(node);
|
|
90
|
-
walker = new CKEDITOR.dom.walker(range);
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Switch the alignment.
|
|
95
|
-
var classes = editor.config.justifyClasses;
|
|
96
|
-
if (classes) {
|
|
97
|
-
// The left align class.
|
|
98
|
-
if (node.hasClass(classes[0])) {
|
|
99
|
-
node.removeClass(classes[0]);
|
|
100
|
-
node.addClass(classes[2]);
|
|
101
|
-
}
|
|
102
|
-
// The right align class.
|
|
103
|
-
else if (node.hasClass(classes[2])) {
|
|
104
|
-
node.removeClass(classes[2]);
|
|
105
|
-
node.addClass(classes[0]);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Always switch CSS margins.
|
|
110
|
-
var style = 'text-align';
|
|
111
|
-
var align = node.getStyle(style);
|
|
112
|
-
|
|
113
|
-
if (align == 'left') node.setStyle(style, 'right');
|
|
114
|
-
else if (align == 'right') node.setStyle(style, 'left');
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
justifyCommand.prototype = {
|
|
120
|
-
exec: function (editor) {
|
|
121
|
-
var selection = editor.getSelection(),
|
|
122
|
-
enterMode = editor.config.enterMode;
|
|
123
|
-
|
|
124
|
-
if (!selection) return;
|
|
125
|
-
|
|
126
|
-
var bookmarks = selection.createBookmarks(),
|
|
127
|
-
ranges = selection.getRanges();
|
|
128
|
-
|
|
129
|
-
var cssClassName = this.cssClassName,
|
|
130
|
-
iterator,
|
|
131
|
-
block;
|
|
132
|
-
|
|
133
|
-
var useComputedState = editor.config.useComputedState;
|
|
134
|
-
|
|
135
|
-
for (var i = ranges.length - 1; i >= 0; i--) {
|
|
136
|
-
iterator = ranges[i].createIterator();
|
|
137
|
-
iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR;
|
|
138
|
-
|
|
139
|
-
while ((block = iterator.getNextParagraph(enterMode == CKEDITOR.ENTER_P ? 'p' : 'div'))) {
|
|
140
|
-
if (block.isReadOnly()) continue;
|
|
141
|
-
|
|
142
|
-
// Check if style or class might be applied to currently processed element (#455).
|
|
143
|
-
var tag = block.getName(),
|
|
144
|
-
isAllowedTextAlign,
|
|
145
|
-
isAllowedCssClass;
|
|
146
|
-
|
|
147
|
-
isAllowedTextAlign = editor.activeFilter.check(tag + '{text-align}');
|
|
148
|
-
isAllowedCssClass = editor.activeFilter.check(tag + '(' + cssClassName + ')');
|
|
149
|
-
|
|
150
|
-
if (!isAllowedCssClass && !isAllowedTextAlign) {
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
block.removeAttribute('align');
|
|
155
|
-
block.removeStyle('text-align');
|
|
156
|
-
|
|
157
|
-
// Remove any of the alignment classes from the className.
|
|
158
|
-
var className =
|
|
159
|
-
cssClassName &&
|
|
160
|
-
(block.$.className = CKEDITOR.tools.ltrim(block.$.className.replace(this.cssClassRegex, '')));
|
|
161
|
-
|
|
162
|
-
var apply =
|
|
163
|
-
this.state == CKEDITOR.TRISTATE_OFF && (!useComputedState || getAlignment(block, true) != this.value);
|
|
164
|
-
|
|
165
|
-
if (cssClassName && isAllowedCssClass) {
|
|
166
|
-
// Append the desired class name.
|
|
167
|
-
if (apply) block.addClass(cssClassName);
|
|
168
|
-
else if (!className) block.removeAttribute('class');
|
|
169
|
-
} else if (apply && isAllowedTextAlign) {
|
|
170
|
-
block.setStyle('text-align', this.value);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
editor.focus();
|
|
176
|
-
editor.forceNextSelectionCheck();
|
|
177
|
-
selection.selectBookmarks(bookmarks);
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
refresh: function (editor, path) {
|
|
181
|
-
var firstBlock = path.block || path.blockLimit,
|
|
182
|
-
name = firstBlock.getName(),
|
|
183
|
-
isEditable = firstBlock.equals(editor.editable()),
|
|
184
|
-
isStylable = this.cssClassName
|
|
185
|
-
? editor.activeFilter.check(name + '(' + this.cssClassName + ')')
|
|
186
|
-
: editor.activeFilter.check(name + '{text-align}');
|
|
187
|
-
|
|
188
|
-
// #455
|
|
189
|
-
// 1. Check if we are directly in editbale. Justification should be always allowed, and not highlighted.
|
|
190
|
-
// Checking situation `body > ul` where ul is selected and path.blockLimit returns editable.
|
|
191
|
-
// 2. Check if current element can have applied specific class.
|
|
192
|
-
// 3. Check if current element can have applied text-align style.
|
|
193
|
-
if (isEditable && !CKEDITOR.dtd.$list[path.lastElement.getName()]) {
|
|
194
|
-
this.setState(CKEDITOR.TRISTATE_OFF);
|
|
195
|
-
} else if (!isEditable && isStylable) {
|
|
196
|
-
// 2 & 3 in one condition.
|
|
197
|
-
this.setState(
|
|
198
|
-
getAlignment(firstBlock, this.editor.config.useComputedState) == this.value
|
|
199
|
-
? CKEDITOR.TRISTATE_ON
|
|
200
|
-
: CKEDITOR.TRISTATE_OFF,
|
|
201
|
-
);
|
|
202
|
-
} else {
|
|
203
|
-
this.setState(CKEDITOR.TRISTATE_DISABLED);
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
CKEDITOR.plugins.add('justify', {
|
|
209
|
-
icons: 'justifyblock,justifycenter,justifyleft,justifyright', // %REMOVE_LINE_CORE%
|
|
210
|
-
hidpi: true, // %REMOVE_LINE_CORE%
|
|
211
|
-
init: function (editor) {
|
|
212
|
-
if (editor.blockless) return;
|
|
213
|
-
|
|
214
|
-
var left = new justifyCommand(editor, 'justifyleft', 'left'),
|
|
215
|
-
center = new justifyCommand(editor, 'justifycenter', 'center'),
|
|
216
|
-
right = new justifyCommand(editor, 'justifyright', 'right'),
|
|
217
|
-
justify = new justifyCommand(editor, 'justifyblock', 'justify');
|
|
218
|
-
|
|
219
|
-
editor.addCommand('justifyleft', left);
|
|
220
|
-
editor.addCommand('justifycenter', center);
|
|
221
|
-
editor.addCommand('justifyright', right);
|
|
222
|
-
editor.addCommand('justifyblock', justify);
|
|
223
|
-
|
|
224
|
-
if (editor.ui.addButton) {
|
|
225
|
-
editor.ui.addButton('JustifyLeft', {
|
|
226
|
-
isToggle: true,
|
|
227
|
-
label: editor.lang.common.alignLeft,
|
|
228
|
-
command: 'justifyleft',
|
|
229
|
-
toolbar: 'justifyleft',
|
|
230
|
-
});
|
|
231
|
-
editor.ui.addButton('JustifyCenter', {
|
|
232
|
-
isToggle: true,
|
|
233
|
-
label: editor.lang.common.center,
|
|
234
|
-
command: 'justifycenter',
|
|
235
|
-
toolbar: 'justifycenter',
|
|
236
|
-
});
|
|
237
|
-
editor.ui.addButton('JustifyRight', {
|
|
238
|
-
isToggle: true,
|
|
239
|
-
label: editor.lang.common.alignRight,
|
|
240
|
-
command: 'justifyright',
|
|
241
|
-
toolbar: 'justifyright',
|
|
242
|
-
});
|
|
243
|
-
editor.ui.addButton('JustifyBlock', {
|
|
244
|
-
isToggle: true,
|
|
245
|
-
label: editor.lang.common.justify,
|
|
246
|
-
command: 'justifyblock',
|
|
247
|
-
toolbar: 'justifyblock',
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
editor.on('dirChanged', onDirChanged);
|
|
251
|
-
},
|
|
252
|
-
});
|
|
253
|
-
})();
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* List of classes to use for aligning the contents. If it's `null`, no classes will be used
|
|
257
|
-
* and instead the corresponding CSS values will be used.
|
|
258
|
-
*
|
|
259
|
-
* The array should contain 4 members, in the following order: left, center, right, justify.
|
|
260
|
-
*
|
|
261
|
-
* // Use the classes 'AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify'
|
|
262
|
-
* config.justifyClasses = [ 'AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify' ];
|
|
263
|
-
*
|
|
264
|
-
* @cfg {Array} [justifyClasses=null]
|
|
265
|
-
* @member CKEDITOR.config
|
|
266
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @fileOverview Justify commands.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
(function () {
|
|
11
|
+
function getAlignment(element, useComputedState) {
|
|
12
|
+
var align;
|
|
13
|
+
if (useComputedState) align = element.getComputedStyle('text-align');
|
|
14
|
+
else {
|
|
15
|
+
while (!element.hasAttribute || !(element.hasAttribute('align') || element.getStyle('text-align'))) {
|
|
16
|
+
var parent = element.getParent();
|
|
17
|
+
if (!parent) break;
|
|
18
|
+
element = parent;
|
|
19
|
+
}
|
|
20
|
+
align = element.getStyle('text-align') || element.getAttribute('align') || '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Sometimes computed values doesn't tell.
|
|
24
|
+
align && (align = align.replace(/(?:-(?:moz|webkit)-)?(?:start|auto)/i, ''));
|
|
25
|
+
|
|
26
|
+
!align && useComputedState && (align = element.getComputedStyle('direction') == 'rtl' ? 'right' : 'left');
|
|
27
|
+
|
|
28
|
+
return align;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function justifyCommand(editor, name, value) {
|
|
32
|
+
this.editor = editor;
|
|
33
|
+
this.name = name;
|
|
34
|
+
this.value = value;
|
|
35
|
+
this.context = 'p';
|
|
36
|
+
var classes = editor.config.justifyClasses,
|
|
37
|
+
blockTag = editor.config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div';
|
|
38
|
+
|
|
39
|
+
if (classes) {
|
|
40
|
+
switch (value) {
|
|
41
|
+
case 'left':
|
|
42
|
+
this.cssClassName = classes[0];
|
|
43
|
+
break;
|
|
44
|
+
case 'center':
|
|
45
|
+
this.cssClassName = classes[1];
|
|
46
|
+
break;
|
|
47
|
+
case 'right':
|
|
48
|
+
this.cssClassName = classes[2];
|
|
49
|
+
break;
|
|
50
|
+
case 'justify':
|
|
51
|
+
this.cssClassName = classes[3];
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this.cssClassRegex = new RegExp('(?:^|\\s+)(?:' + classes.join('|') + ')(?=$|\\s)');
|
|
56
|
+
this.requiredContent = blockTag + '(' + this.cssClassName + ')';
|
|
57
|
+
} else {
|
|
58
|
+
this.requiredContent = blockTag + '{text-align}';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.allowedContent = {
|
|
62
|
+
'caption div h1 h2 h3 h4 h5 h6 p pre td th li': {
|
|
63
|
+
// Do not add elements, but only text-align style if element is validated by other rule.
|
|
64
|
+
propertiesOnly: true,
|
|
65
|
+
styles: this.cssClassName ? null : 'text-align',
|
|
66
|
+
classes: this.cssClassName || null,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// In enter mode BR we need to allow here for div, because when non other
|
|
71
|
+
// feature allows div justify is the only plugin that uses it.
|
|
72
|
+
if (editor.config.enterMode == CKEDITOR.ENTER_BR) this.allowedContent.div = true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function onDirChanged(e) {
|
|
76
|
+
var editor = e.editor;
|
|
77
|
+
|
|
78
|
+
var range = editor.createRange();
|
|
79
|
+
range.setStartBefore(e.data.node);
|
|
80
|
+
range.setEndAfter(e.data.node);
|
|
81
|
+
|
|
82
|
+
var walker = new CKEDITOR.dom.walker(range),
|
|
83
|
+
node;
|
|
84
|
+
|
|
85
|
+
while ((node = walker.next())) {
|
|
86
|
+
if (node.type == CKEDITOR.NODE_ELEMENT) {
|
|
87
|
+
// A child with the defined dir is to be ignored.
|
|
88
|
+
if (!node.equals(e.data.node) && node.getDirection()) {
|
|
89
|
+
range.setStartAfter(node);
|
|
90
|
+
walker = new CKEDITOR.dom.walker(range);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Switch the alignment.
|
|
95
|
+
var classes = editor.config.justifyClasses;
|
|
96
|
+
if (classes) {
|
|
97
|
+
// The left align class.
|
|
98
|
+
if (node.hasClass(classes[0])) {
|
|
99
|
+
node.removeClass(classes[0]);
|
|
100
|
+
node.addClass(classes[2]);
|
|
101
|
+
}
|
|
102
|
+
// The right align class.
|
|
103
|
+
else if (node.hasClass(classes[2])) {
|
|
104
|
+
node.removeClass(classes[2]);
|
|
105
|
+
node.addClass(classes[0]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Always switch CSS margins.
|
|
110
|
+
var style = 'text-align';
|
|
111
|
+
var align = node.getStyle(style);
|
|
112
|
+
|
|
113
|
+
if (align == 'left') node.setStyle(style, 'right');
|
|
114
|
+
else if (align == 'right') node.setStyle(style, 'left');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
justifyCommand.prototype = {
|
|
120
|
+
exec: function (editor) {
|
|
121
|
+
var selection = editor.getSelection(),
|
|
122
|
+
enterMode = editor.config.enterMode;
|
|
123
|
+
|
|
124
|
+
if (!selection) return;
|
|
125
|
+
|
|
126
|
+
var bookmarks = selection.createBookmarks(),
|
|
127
|
+
ranges = selection.getRanges();
|
|
128
|
+
|
|
129
|
+
var cssClassName = this.cssClassName,
|
|
130
|
+
iterator,
|
|
131
|
+
block;
|
|
132
|
+
|
|
133
|
+
var useComputedState = editor.config.useComputedState;
|
|
134
|
+
|
|
135
|
+
for (var i = ranges.length - 1; i >= 0; i--) {
|
|
136
|
+
iterator = ranges[i].createIterator();
|
|
137
|
+
iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR;
|
|
138
|
+
|
|
139
|
+
while ((block = iterator.getNextParagraph(enterMode == CKEDITOR.ENTER_P ? 'p' : 'div'))) {
|
|
140
|
+
if (block.isReadOnly()) continue;
|
|
141
|
+
|
|
142
|
+
// Check if style or class might be applied to currently processed element (#455).
|
|
143
|
+
var tag = block.getName(),
|
|
144
|
+
isAllowedTextAlign,
|
|
145
|
+
isAllowedCssClass;
|
|
146
|
+
|
|
147
|
+
isAllowedTextAlign = editor.activeFilter.check(tag + '{text-align}');
|
|
148
|
+
isAllowedCssClass = editor.activeFilter.check(tag + '(' + cssClassName + ')');
|
|
149
|
+
|
|
150
|
+
if (!isAllowedCssClass && !isAllowedTextAlign) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
block.removeAttribute('align');
|
|
155
|
+
block.removeStyle('text-align');
|
|
156
|
+
|
|
157
|
+
// Remove any of the alignment classes from the className.
|
|
158
|
+
var className =
|
|
159
|
+
cssClassName &&
|
|
160
|
+
(block.$.className = CKEDITOR.tools.ltrim(block.$.className.replace(this.cssClassRegex, '')));
|
|
161
|
+
|
|
162
|
+
var apply =
|
|
163
|
+
this.state == CKEDITOR.TRISTATE_OFF && (!useComputedState || getAlignment(block, true) != this.value);
|
|
164
|
+
|
|
165
|
+
if (cssClassName && isAllowedCssClass) {
|
|
166
|
+
// Append the desired class name.
|
|
167
|
+
if (apply) block.addClass(cssClassName);
|
|
168
|
+
else if (!className) block.removeAttribute('class');
|
|
169
|
+
} else if (apply && isAllowedTextAlign) {
|
|
170
|
+
block.setStyle('text-align', this.value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
editor.focus();
|
|
176
|
+
editor.forceNextSelectionCheck();
|
|
177
|
+
selection.selectBookmarks(bookmarks);
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
refresh: function (editor, path) {
|
|
181
|
+
var firstBlock = path.block || path.blockLimit,
|
|
182
|
+
name = firstBlock.getName(),
|
|
183
|
+
isEditable = firstBlock.equals(editor.editable()),
|
|
184
|
+
isStylable = this.cssClassName
|
|
185
|
+
? editor.activeFilter.check(name + '(' + this.cssClassName + ')')
|
|
186
|
+
: editor.activeFilter.check(name + '{text-align}');
|
|
187
|
+
|
|
188
|
+
// #455
|
|
189
|
+
// 1. Check if we are directly in editbale. Justification should be always allowed, and not highlighted.
|
|
190
|
+
// Checking situation `body > ul` where ul is selected and path.blockLimit returns editable.
|
|
191
|
+
// 2. Check if current element can have applied specific class.
|
|
192
|
+
// 3. Check if current element can have applied text-align style.
|
|
193
|
+
if (isEditable && !CKEDITOR.dtd.$list[path.lastElement.getName()]) {
|
|
194
|
+
this.setState(CKEDITOR.TRISTATE_OFF);
|
|
195
|
+
} else if (!isEditable && isStylable) {
|
|
196
|
+
// 2 & 3 in one condition.
|
|
197
|
+
this.setState(
|
|
198
|
+
getAlignment(firstBlock, this.editor.config.useComputedState) == this.value
|
|
199
|
+
? CKEDITOR.TRISTATE_ON
|
|
200
|
+
: CKEDITOR.TRISTATE_OFF,
|
|
201
|
+
);
|
|
202
|
+
} else {
|
|
203
|
+
this.setState(CKEDITOR.TRISTATE_DISABLED);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
CKEDITOR.plugins.add('justify', {
|
|
209
|
+
icons: 'justifyblock,justifycenter,justifyleft,justifyright', // %REMOVE_LINE_CORE%
|
|
210
|
+
hidpi: true, // %REMOVE_LINE_CORE%
|
|
211
|
+
init: function (editor) {
|
|
212
|
+
if (editor.blockless) return;
|
|
213
|
+
|
|
214
|
+
var left = new justifyCommand(editor, 'justifyleft', 'left'),
|
|
215
|
+
center = new justifyCommand(editor, 'justifycenter', 'center'),
|
|
216
|
+
right = new justifyCommand(editor, 'justifyright', 'right'),
|
|
217
|
+
justify = new justifyCommand(editor, 'justifyblock', 'justify');
|
|
218
|
+
|
|
219
|
+
editor.addCommand('justifyleft', left);
|
|
220
|
+
editor.addCommand('justifycenter', center);
|
|
221
|
+
editor.addCommand('justifyright', right);
|
|
222
|
+
editor.addCommand('justifyblock', justify);
|
|
223
|
+
|
|
224
|
+
if (editor.ui.addButton) {
|
|
225
|
+
editor.ui.addButton('JustifyLeft', {
|
|
226
|
+
isToggle: true,
|
|
227
|
+
label: editor.lang.common.alignLeft,
|
|
228
|
+
command: 'justifyleft',
|
|
229
|
+
toolbar: 'justifyleft',
|
|
230
|
+
});
|
|
231
|
+
editor.ui.addButton('JustifyCenter', {
|
|
232
|
+
isToggle: true,
|
|
233
|
+
label: editor.lang.common.center,
|
|
234
|
+
command: 'justifycenter',
|
|
235
|
+
toolbar: 'justifycenter',
|
|
236
|
+
});
|
|
237
|
+
editor.ui.addButton('JustifyRight', {
|
|
238
|
+
isToggle: true,
|
|
239
|
+
label: editor.lang.common.alignRight,
|
|
240
|
+
command: 'justifyright',
|
|
241
|
+
toolbar: 'justifyright',
|
|
242
|
+
});
|
|
243
|
+
editor.ui.addButton('JustifyBlock', {
|
|
244
|
+
isToggle: true,
|
|
245
|
+
label: editor.lang.common.justify,
|
|
246
|
+
command: 'justifyblock',
|
|
247
|
+
toolbar: 'justifyblock',
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
editor.on('dirChanged', onDirChanged);
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
})();
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* List of classes to use for aligning the contents. If it's `null`, no classes will be used
|
|
257
|
+
* and instead the corresponding CSS values will be used.
|
|
258
|
+
*
|
|
259
|
+
* The array should contain 4 members, in the following order: left, center, right, justify.
|
|
260
|
+
*
|
|
261
|
+
* // Use the classes 'AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify'
|
|
262
|
+
* config.justifyClasses = [ 'AlignLeft', 'AlignCenter', 'AlignRight', 'AlignJustify' ];
|
|
263
|
+
*
|
|
264
|
+
* @cfg {Array} [justifyClasses=null]
|
|
265
|
+
* @member CKEDITOR.config
|
|
266
|
+
*/
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A plugin to enable placeholder tokens to be inserted into the CKEditor message. Use on its own or with teh placeholder plugin.
|
|
3
|
-
* The default format is compatible with the placeholders syntex
|
|
4
|
-
*
|
|
5
|
-
* @version 0.1
|
|
6
|
-
* @Author Troy Lutton
|
|
7
|
-
* @license MIT
|
|
8
|
-
*
|
|
9
|
-
* This is a pure modification for the placeholders plugin. All credit goes to Stuart Sillitoe for creating the original (stuartsillitoe.co.uk)
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
CKEDITOR.plugins.add('justify_group', {
|
|
14
|
-
icons: 'justifycenter',
|
|
15
|
-
hidpi: true,
|
|
16
|
-
init: function (editor) {
|
|
17
|
-
const items = {
|
|
18
|
-
justifyleft: {
|
|
19
|
-
label: editor.lang.common.alignLeft,
|
|
20
|
-
command: 'justifyleft',
|
|
21
|
-
group: 'alignment',
|
|
22
|
-
icon: 'justifyleft',
|
|
23
|
-
order: 1,
|
|
24
|
-
},
|
|
25
|
-
justifyright: {
|
|
26
|
-
label: editor.lang.common.alignRight,
|
|
27
|
-
command: 'justifyright',
|
|
28
|
-
group: 'alignment',
|
|
29
|
-
icon: 'justifyright',
|
|
30
|
-
order: 2,
|
|
31
|
-
},
|
|
32
|
-
justifycenter: {
|
|
33
|
-
label: editor.lang.common.alignCenter,
|
|
34
|
-
command: 'justifycenter',
|
|
35
|
-
group: 'alignment',
|
|
36
|
-
icon: 'justifycenter',
|
|
37
|
-
order: 3,
|
|
38
|
-
},
|
|
39
|
-
justify: {
|
|
40
|
-
label: editor.lang.common.justify,
|
|
41
|
-
command: 'justifyblock',
|
|
42
|
-
group: 'alignment',
|
|
43
|
-
icon: 'justifyblock',
|
|
44
|
-
order: 4,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
editor.addMenuGroup('alignment');
|
|
48
|
-
editor.addMenuItems(items);
|
|
49
|
-
|
|
50
|
-
editor.ui.add('justify-dropdown', window.CKEDITOR.UI_MENUBUTTON, {
|
|
51
|
-
label: 'Căn lề văn bản',
|
|
52
|
-
toolbar: 'alignment',
|
|
53
|
-
icon: 'justifycenter',
|
|
54
|
-
onMenu: () => {
|
|
55
|
-
const active = {};
|
|
56
|
-
|
|
57
|
-
for (const p in items) {
|
|
58
|
-
active[p] = window.CKEDITOR.TRISTATE_OFF;
|
|
59
|
-
}
|
|
60
|
-
return active;
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
});
|
|
1
|
+
/**
|
|
2
|
+
* A plugin to enable placeholder tokens to be inserted into the CKEditor message. Use on its own or with teh placeholder plugin.
|
|
3
|
+
* The default format is compatible with the placeholders syntex
|
|
4
|
+
*
|
|
5
|
+
* @version 0.1
|
|
6
|
+
* @Author Troy Lutton
|
|
7
|
+
* @license MIT
|
|
8
|
+
*
|
|
9
|
+
* This is a pure modification for the placeholders plugin. All credit goes to Stuart Sillitoe for creating the original (stuartsillitoe.co.uk)
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
CKEDITOR.plugins.add('justify_group', {
|
|
14
|
+
icons: 'justifycenter',
|
|
15
|
+
hidpi: true,
|
|
16
|
+
init: function (editor) {
|
|
17
|
+
const items = {
|
|
18
|
+
justifyleft: {
|
|
19
|
+
label: editor.lang.common.alignLeft,
|
|
20
|
+
command: 'justifyleft',
|
|
21
|
+
group: 'alignment',
|
|
22
|
+
icon: 'justifyleft',
|
|
23
|
+
order: 1,
|
|
24
|
+
},
|
|
25
|
+
justifyright: {
|
|
26
|
+
label: editor.lang.common.alignRight,
|
|
27
|
+
command: 'justifyright',
|
|
28
|
+
group: 'alignment',
|
|
29
|
+
icon: 'justifyright',
|
|
30
|
+
order: 2,
|
|
31
|
+
},
|
|
32
|
+
justifycenter: {
|
|
33
|
+
label: editor.lang.common.alignCenter,
|
|
34
|
+
command: 'justifycenter',
|
|
35
|
+
group: 'alignment',
|
|
36
|
+
icon: 'justifycenter',
|
|
37
|
+
order: 3,
|
|
38
|
+
},
|
|
39
|
+
justify: {
|
|
40
|
+
label: editor.lang.common.justify,
|
|
41
|
+
command: 'justifyblock',
|
|
42
|
+
group: 'alignment',
|
|
43
|
+
icon: 'justifyblock',
|
|
44
|
+
order: 4,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
editor.addMenuGroup('alignment');
|
|
48
|
+
editor.addMenuItems(items);
|
|
49
|
+
|
|
50
|
+
editor.ui.add('justify-dropdown', window.CKEDITOR.UI_MENUBUTTON, {
|
|
51
|
+
label: 'Căn lề văn bản',
|
|
52
|
+
toolbar: 'alignment',
|
|
53
|
+
icon: 'justifycenter',
|
|
54
|
+
onMenu: () => {
|
|
55
|
+
const active = {};
|
|
56
|
+
|
|
57
|
+
for (const p in items) {
|
|
58
|
+
active[p] = window.CKEDITOR.TRISTATE_OFF;
|
|
59
|
+
}
|
|
60
|
+
return active;
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
});
|