biso24-editor 1.3.0
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/.eslintrc.json +4 -0
- package/CKEditor4/CHANGES.md +2182 -0
- package/CKEditor4/LICENSE.md +1436 -0
- package/CKEditor4/README.md +39 -0
- package/CKEditor4/SECURITY.md +10 -0
- package/CKEditor4/adapters/jquery.js +158 -0
- package/CKEditor4/bender-runner.config.json +16 -0
- package/CKEditor4/build-config.js +100 -0
- package/CKEditor4/ckeditor.js +30065 -0
- package/CKEditor4/config.js +39 -0
- package/CKEditor4/contents.css +161 -0
- package/CKEditor4/lang/vi.js +475 -0
- package/CKEditor4/plugins/a11yhelp/dialogs/a11yhelp.js +143 -0
- package/CKEditor4/plugins/a11yhelp/dialogs/lang/vi.js +122 -0
- package/CKEditor4/plugins/ajax/plugin.js +241 -0
- package/CKEditor4/plugins/autocomplete/plugin.js +1655 -0
- package/CKEditor4/plugins/autocomplete/skins/default.css +38 -0
- package/CKEditor4/plugins/custompaste/plugin.js +57 -0
- package/CKEditor4/plugins/dialog/dialogDefinition.js +4 -0
- package/CKEditor4/plugins/dialog/styles/dialog.css +18 -0
- package/CKEditor4/plugins/font/lang/vi.js +14 -0
- package/CKEditor4/plugins/font/plugin.js +535 -0
- package/CKEditor4/plugins/icons.png +0 -0
- package/CKEditor4/plugins/icons_hidpi.png +0 -0
- package/CKEditor4/plugins/image2/dialogs/image2.js +558 -0
- package/CKEditor4/plugins/image2/icons/hidpi/image.png +0 -0
- package/CKEditor4/plugins/image2/icons/image.png +0 -0
- package/CKEditor4/plugins/image2/lang/vi.js +21 -0
- package/CKEditor4/plugins/image2/plugin.js +1708 -0
- package/CKEditor4/plugins/justify/icons/hidpi/justifyblock.png +0 -0
- package/CKEditor4/plugins/justify/icons/hidpi/justifycenter.png +0 -0
- package/CKEditor4/plugins/justify/icons/hidpi/justifyleft.png +0 -0
- package/CKEditor4/plugins/justify/icons/hidpi/justifyright.png +0 -0
- package/CKEditor4/plugins/justify/icons/justifyblock.png +0 -0
- package/CKEditor4/plugins/justify/icons/justifycenter.png +0 -0
- package/CKEditor4/plugins/justify/icons/justifyleft.png +0 -0
- package/CKEditor4/plugins/justify/icons/justifyright.png +0 -0
- package/CKEditor4/plugins/justify/plugin.js +266 -0
- package/CKEditor4/plugins/justify_group/icons/hidpi/justifycenter.png +0 -0
- package/CKEditor4/plugins/justify_group/icons/justifycenter.png +0 -0
- package/CKEditor4/plugins/justify_group/plugin.js +64 -0
- package/CKEditor4/plugins/lineheight/LICENSE +22 -0
- package/CKEditor4/plugins/lineheight/README.md +2 -0
- package/CKEditor4/plugins/lineheight/lang/vi.js +3 -0
- package/CKEditor4/plugins/lineheight/plugin.js +99 -0
- package/CKEditor4/plugins/lineheight/readme.txt +30 -0
- package/CKEditor4/plugins/link/dialogs/anchor.js +82 -0
- package/CKEditor4/plugins/link/dialogs/link.js +777 -0
- package/CKEditor4/plugins/link/images/anchor.png +0 -0
- package/CKEditor4/plugins/link/images/hidpi/anchor.png +0 -0
- package/CKEditor4/plugins/magicline/images/hidpi/icon-rtl.png +0 -0
- package/CKEditor4/plugins/magicline/images/hidpi/icon.png +0 -0
- package/CKEditor4/plugins/magicline/images/icon-rtl.png +0 -0
- package/CKEditor4/plugins/magicline/images/icon.png +0 -0
- package/CKEditor4/plugins/mentions/plugin.js +471 -0
- package/CKEditor4/plugins/menubutton/plugin.js +99 -0
- package/CKEditor4/plugins/pastefromword/filter/default.js +849 -0
- package/CKEditor4/plugins/pastetools/filter/common.js +445 -0
- package/CKEditor4/plugins/pastetools/filter/image.js +163 -0
- package/CKEditor4/plugins/pdffile/icons/exporttopdf.png +0 -0
- package/CKEditor4/plugins/pdffile/icons/hidpi/exporttopdf.png +0 -0
- package/CKEditor4/plugins/pdffile/plugin.js +36 -0
- package/CKEditor4/plugins/placeholder_button/plugin.js +31 -0
- package/CKEditor4/plugins/sourcedialog/dialogs/sourcedialog.js +88 -0
- package/CKEditor4/plugins/sourcedialog/icons/hidpi/sourcedialog-rtl.png +0 -0
- package/CKEditor4/plugins/sourcedialog/icons/hidpi/sourcedialog.png +0 -0
- package/CKEditor4/plugins/sourcedialog/icons/sourcedialog-rtl.png +0 -0
- package/CKEditor4/plugins/sourcedialog/icons/sourcedialog.png +0 -0
- package/CKEditor4/plugins/sourcedialog/lang/vi.js +9 -0
- package/CKEditor4/plugins/sourcedialog/plugin.js +30 -0
- package/CKEditor4/plugins/textmatch/plugin.js +331 -0
- package/CKEditor4/plugins/textwatcher/plugin.js +295 -0
- package/CKEditor4/plugins/widget/images/handle.png +0 -0
- package/CKEditor4/plugins/wordfile/icons/exporttoword.png +0 -0
- package/CKEditor4/plugins/wordfile/icons/hidpi/exporttoword.png +0 -0
- package/CKEditor4/plugins/wordfile/icons/hidpi/importfromword.png +0 -0
- package/CKEditor4/plugins/wordfile/icons/importfromword.png +0 -0
- package/CKEditor4/plugins/wordfile/plugin.js +161 -0
- package/CKEditor4/skins/moono-lisa/dialog.css +685 -0
- package/CKEditor4/skins/moono-lisa/dialog_ie.css +721 -0
- package/CKEditor4/skins/moono-lisa/dialog_ie8.css +746 -0
- package/CKEditor4/skins/moono-lisa/dialog_iequirks.css +724 -0
- package/CKEditor4/skins/moono-lisa/editor.css +1551 -0
- package/CKEditor4/skins/moono-lisa/editor_gecko.css +1556 -0
- package/CKEditor4/skins/moono-lisa/editor_ie.css +1588 -0
- package/CKEditor4/skins/moono-lisa/editor_ie8.css +1639 -0
- package/CKEditor4/skins/moono-lisa/editor_iequirks.css +1632 -0
- package/CKEditor4/skins/moono-lisa/icons.png +0 -0
- package/CKEditor4/skins/moono-lisa/icons_hidpi.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/arrow.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/close.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/hidpi/close.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/hidpi/lock-open.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/hidpi/lock.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/hidpi/refresh.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/lock-open.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/lock.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/refresh.png +0 -0
- package/CKEditor4/skins/moono-lisa/images/spinner.gif +0 -0
- package/CKEditor4/skins/moono-lisa/readme.md +46 -0
- package/CKEditor4/styles.js +136 -0
- package/CKEditor4/vendor/promise.js +385 -0
- package/README.md +3 -0
- package/package.json +9 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +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
|
+
*/
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +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
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Kamlesh Kushwaha
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
function addCombo(editor, comboName, styleType, lang, entries, defaultLabel, styleDefinition, order) {
|
|
3
|
+
var config = editor.config,
|
|
4
|
+
style = new CKEDITOR.style(styleDefinition);
|
|
5
|
+
var names = entries.split(';'),
|
|
6
|
+
values = [];
|
|
7
|
+
var styles = {};
|
|
8
|
+
for (var i = 0; i < names.length; i++) {
|
|
9
|
+
var parts = names[i];
|
|
10
|
+
if (parts) {
|
|
11
|
+
parts = parts.split('/');
|
|
12
|
+
var vars = {},
|
|
13
|
+
name = (names[i] = parts[0]);
|
|
14
|
+
vars[styleType] = values[i] = parts[1] || name;
|
|
15
|
+
styles[name] = new CKEDITOR.style(styleDefinition, vars);
|
|
16
|
+
styles[name]._.definition.name = name;
|
|
17
|
+
} else names.splice(i--, 1);
|
|
18
|
+
}
|
|
19
|
+
editor.ui.addRichCombo(comboName, {
|
|
20
|
+
label: editor.lang.lineheight.title,
|
|
21
|
+
title: editor.lang.lineheight.title,
|
|
22
|
+
toolbar: 'styles,' + order,
|
|
23
|
+
allowedContent: style,
|
|
24
|
+
requiredContent: style,
|
|
25
|
+
panel: {
|
|
26
|
+
css: [CKEDITOR.skin.getPath('editor')].concat(config.contentsCss),
|
|
27
|
+
multiSelect: false,
|
|
28
|
+
attributes: { 'aria-label': editor.lang.lineheight.title },
|
|
29
|
+
},
|
|
30
|
+
init: function () {
|
|
31
|
+
this.startGroup(editor.lang.lineheight.title);
|
|
32
|
+
for (var i = 0; i < names.length; i++) {
|
|
33
|
+
var name = names[i];
|
|
34
|
+
this.add(name, styles[name].buildPreview(), name);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
onClick: function (value) {
|
|
38
|
+
editor.focus();
|
|
39
|
+
editor.fire('saveSnapshot');
|
|
40
|
+
var style = styles[value];
|
|
41
|
+
editor[this.getValue() == value ? 'removeStyle' : 'applyStyle'](style);
|
|
42
|
+
editor.fire('saveSnapshot');
|
|
43
|
+
},
|
|
44
|
+
onRender: function () {
|
|
45
|
+
editor.on(
|
|
46
|
+
'selectionChange',
|
|
47
|
+
function (ev) {
|
|
48
|
+
var currentValue = this.getValue();
|
|
49
|
+
var elementPath = ev.data.path,
|
|
50
|
+
elements = elementPath.elements;
|
|
51
|
+
for (var i = 0, element; i < elements.length; i++) {
|
|
52
|
+
element = elements[i];
|
|
53
|
+
for (var value in styles) {
|
|
54
|
+
if (styles[value].checkElementMatch(element, true, editor)) {
|
|
55
|
+
if (value != currentValue) this.setValue(value);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
this.setValue('', defaultLabel);
|
|
61
|
+
},
|
|
62
|
+
this,
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
refresh: function () {
|
|
66
|
+
if (!editor.activeFilter.check(style)) this.setState(CKEDITOR.TRISTATE_DISABLED);
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
CKEDITOR.plugins.add('lineheight', {
|
|
71
|
+
requires: 'richcombo',
|
|
72
|
+
lang: 'vi,en',
|
|
73
|
+
init: function (editor) {
|
|
74
|
+
var config = editor.config;
|
|
75
|
+
var defaultText = '(' + editor.lang.common.optionDefault + ')';
|
|
76
|
+
addCombo(
|
|
77
|
+
editor,
|
|
78
|
+
'lineheight',
|
|
79
|
+
'size',
|
|
80
|
+
editor.lang.lineheight.title,
|
|
81
|
+
config.line_height,
|
|
82
|
+
editor.lang.lineheight.title,
|
|
83
|
+
config.lineHeight_style,
|
|
84
|
+
40,
|
|
85
|
+
);
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
})();
|
|
89
|
+
CKEDITOR.config.line_height = '1;1.1;1.25;1.5;1.75;2;2.5;3';
|
|
90
|
+
CKEDITOR.config.lineHeight_style = {
|
|
91
|
+
element: 'span',
|
|
92
|
+
styles: { 'line-height': '#(size)' },
|
|
93
|
+
overrides: [
|
|
94
|
+
{
|
|
95
|
+
element: 'line-height',
|
|
96
|
+
attributes: { size: null },
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
lineheight
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
CKEDITOR Line-height plugin documentation
|
|
5
|
+
----------------------------------------------
|
|
6
|
+
|
|
7
|
+
Installation Notes:
|
|
8
|
+
|
|
9
|
+
Adding plugin into the toolbar:
|
|
10
|
+
Using CKBuilder is a recommended solution, however, if you have plugins developed by yourself or by third parties, you can add plugins to your local installation manually by following the steps described below:
|
|
11
|
+
Extract the plugin .zip archive.
|
|
12
|
+
Copy the plugin files to the plugins folder of your CKEditor installation. Each plugin must be placed in a sub-folder that matches its "technical" name.
|
|
13
|
+
|
|
14
|
+
For example, the lineheight plugin would be installed into this folder: <CKEditor folder>/plugins/lineheight.
|
|
15
|
+
Check and resolve plugin dependencies. If a plugin needs others to work, you will need to add these manually as well.
|
|
16
|
+
Enable the plugin. Use the extraPlugins setting to add the plugin to your confiuration:
|
|
17
|
+
|
|
18
|
+
config.extraPlugins = 'lineheight';
|
|
19
|
+
|
|
20
|
+
Refer this link for configuring the toolbar: http://docs.ckeditor.com/#!/guide/dev_toolbar
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
Customizing the lineheight values in the dropdown
|
|
24
|
+
-------------------------------------------------------
|
|
25
|
+
In order to have custom values of line-height instead of the default, you can add following line in the config.js file:
|
|
26
|
+
|
|
27
|
+
config.line_height="1em;1.1em;1.2em;1.3em;1.4em;1.5em";
|
|
28
|
+
|
|
29
|
+
Here, "em" is the unit of line-height which you can change to "px","%" or any other allowed unit for line-height.
|
|
30
|
+
You can also change the numbers based on your requirements. You can have more range or low range , it all depends on your requirements.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
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
|
+
CKEDITOR.dialog.add('anchor', function (c) {
|
|
6
|
+
function f(b, a) {
|
|
7
|
+
return b.createFakeElement(b.document.createElement('a', { attributes: a }), 'cke_anchor', 'anchor');
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
title: c.lang.link.anchor.title,
|
|
11
|
+
minWidth: 300,
|
|
12
|
+
minHeight: 60,
|
|
13
|
+
getModel: function (b) {
|
|
14
|
+
var a = b.getSelection();
|
|
15
|
+
b = a.getRanges()[0];
|
|
16
|
+
a = a.getSelectedElement();
|
|
17
|
+
b.shrink(CKEDITOR.SHRINK_ELEMENT);
|
|
18
|
+
(a = b.getEnclosedNode()) && a.type === CKEDITOR.NODE_TEXT && (a = a.getParent());
|
|
19
|
+
a && !a.is('a') && (a = a.getAscendant('a') || a);
|
|
20
|
+
b =
|
|
21
|
+
a && a.type === CKEDITOR.NODE_ELEMENT && ('anchor' === a.data('cke-real-element-type') || a.is('a'))
|
|
22
|
+
? a
|
|
23
|
+
: void 0;
|
|
24
|
+
return b || null;
|
|
25
|
+
},
|
|
26
|
+
onOk: function () {
|
|
27
|
+
var b = CKEDITOR.tools.trim(this.getValueOf('info', 'txtName')),
|
|
28
|
+
b = { id: b, name: b, 'data-cke-saved-name': b },
|
|
29
|
+
a = this.getModel(c);
|
|
30
|
+
if (a)
|
|
31
|
+
a.data('cke-realelement')
|
|
32
|
+
? ((b = f(c, b)), b.replace(a), CKEDITOR.env.ie && c.getSelection().selectElement(b))
|
|
33
|
+
: a.setAttributes(b);
|
|
34
|
+
else if (((a = (a = c.getSelection()) && a.getRanges()[0]), a.collapsed)) (b = f(c, b)), a.insertNode(b);
|
|
35
|
+
else {
|
|
36
|
+
CKEDITOR.env.ie && 9 > CKEDITOR.env.version && (b['class'] = 'cke_anchor');
|
|
37
|
+
var d = a.clone();
|
|
38
|
+
d.enlarge(CKEDITOR.ENLARGE_ELEMENT);
|
|
39
|
+
for (
|
|
40
|
+
var e = new CKEDITOR.dom.walker(d), d = d.collapsed ? d.startContainer : e.next(), g = a.createBookmark();
|
|
41
|
+
d;
|
|
42
|
+
|
|
43
|
+
)
|
|
44
|
+
d.type === CKEDITOR.NODE_ELEMENT && d.getAttribute('data-cke-saved-name') && (d.remove(!0), e.reset()),
|
|
45
|
+
(d = e.next());
|
|
46
|
+
a.moveToBookmark(g);
|
|
47
|
+
b = new CKEDITOR.style({ element: 'a', attributes: b });
|
|
48
|
+
b.type = CKEDITOR.STYLE_INLINE;
|
|
49
|
+
b.applyToRange(a);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
onShow: function () {
|
|
53
|
+
var b = c.getSelection(),
|
|
54
|
+
a = this.getModel(c),
|
|
55
|
+
d = a && a.data('cke-realelement');
|
|
56
|
+
if ((a = d ? CKEDITOR.plugins.link.tryRestoreFakeAnchor(c, a) : CKEDITOR.plugins.link.getSelectedLink(c))) {
|
|
57
|
+
var e = a.data('cke-saved-name');
|
|
58
|
+
this.setValueOf('info', 'txtName', e || '');
|
|
59
|
+
!d && b.selectElement(a);
|
|
60
|
+
}
|
|
61
|
+
this.getContentElement('info', 'txtName').focus();
|
|
62
|
+
},
|
|
63
|
+
contents: [
|
|
64
|
+
{
|
|
65
|
+
id: 'info',
|
|
66
|
+
label: c.lang.link.anchor.title,
|
|
67
|
+
accessKey: 'I',
|
|
68
|
+
elements: [
|
|
69
|
+
{
|
|
70
|
+
type: 'text',
|
|
71
|
+
id: 'txtName',
|
|
72
|
+
label: c.lang.link.anchor.name,
|
|
73
|
+
required: !0,
|
|
74
|
+
validate: function () {
|
|
75
|
+
return this.getValue() ? !0 : (alert(c.lang.link.anchor.errorName), !1);
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
});
|