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,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
CKEDITOR.plugins.add('sourcedialog', {
|
|
7
|
-
// jscs:disable maximumLineLength
|
|
8
|
-
lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
|
|
9
|
-
// jscs:enable maximumLineLength
|
|
10
|
-
requires: 'dialog',
|
|
11
|
-
icons: 'sourcedialog,sourcedialog-rtl', // %REMOVE_LINE_CORE%
|
|
12
|
-
hidpi: true, // %REMOVE_LINE_CORE%
|
|
13
|
-
|
|
14
|
-
init: function (editor) {
|
|
15
|
-
// Register the "source" command, which simply opens the "source" dialog.
|
|
16
|
-
editor.addCommand('sourcedialog', new CKEDITOR.dialogCommand('sourcedialog'));
|
|
17
|
-
|
|
18
|
-
// Register the "source" dialog.
|
|
19
|
-
CKEDITOR.dialog.add('sourcedialog', this.path + 'dialogs/sourcedialog.js');
|
|
20
|
-
|
|
21
|
-
// If the toolbar is available, create the "Source" button.
|
|
22
|
-
if (editor.ui.addButton) {
|
|
23
|
-
editor.ui.addButton('Sourcedialog', {
|
|
24
|
-
label: editor.lang.sourcedialog.toolbar,
|
|
25
|
-
command: 'sourcedialog',
|
|
26
|
-
toolbar: 'mode,10',
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
});
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* CKEditor 4 LTS ("Long Term Support") is available under the terms of the Extended Support Model.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
CKEDITOR.plugins.add('sourcedialog', {
|
|
7
|
+
// jscs:disable maximumLineLength
|
|
8
|
+
lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
|
|
9
|
+
// jscs:enable maximumLineLength
|
|
10
|
+
requires: 'dialog',
|
|
11
|
+
icons: 'sourcedialog,sourcedialog-rtl', // %REMOVE_LINE_CORE%
|
|
12
|
+
hidpi: true, // %REMOVE_LINE_CORE%
|
|
13
|
+
|
|
14
|
+
init: function (editor) {
|
|
15
|
+
// Register the "source" command, which simply opens the "source" dialog.
|
|
16
|
+
editor.addCommand('sourcedialog', new CKEDITOR.dialogCommand('sourcedialog'));
|
|
17
|
+
|
|
18
|
+
// Register the "source" dialog.
|
|
19
|
+
CKEDITOR.dialog.add('sourcedialog', this.path + 'dialogs/sourcedialog.js');
|
|
20
|
+
|
|
21
|
+
// If the toolbar is available, create the "Source" button.
|
|
22
|
+
if (editor.ui.addButton) {
|
|
23
|
+
editor.ui.addButton('Sourcedialog', {
|
|
24
|
+
label: editor.lang.sourcedialog.toolbar,
|
|
25
|
+
command: 'sourcedialog',
|
|
26
|
+
toolbar: 'mode,10',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -1,161 +1,161 @@
|
|
|
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
|
-
const INSERTHTMLFILE_ALLOWED_EXTENSIONS = ['docx', 'txt']; //, 'txt', 'htm', 'html'
|
|
13
|
-
|
|
14
|
-
CKEDITOR.plugins.add('wordfile', {
|
|
15
|
-
icons: 'exporttoword,importfromword',
|
|
16
|
-
hidpi: true,
|
|
17
|
-
init: function (editor) {
|
|
18
|
-
// add the menu to the editor
|
|
19
|
-
|
|
20
|
-
editor.addCommand('exporttoword', {
|
|
21
|
-
exec: function (editor) {
|
|
22
|
-
const preHtml = `
|
|
23
|
-
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
|
|
24
|
-
<head><meta charset="utf-8"><title></title></head><body>`;
|
|
25
|
-
const postHtml = '</body></html>';
|
|
26
|
-
const html = preHtml + (editor.getData() || '').toString() + postHtml;
|
|
27
|
-
|
|
28
|
-
const blob = new Blob(['\ufeff', html], {
|
|
29
|
-
type: 'application/msword',
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const link = document.createElement('a');
|
|
33
|
-
link.href = URL.createObjectURL(blob);
|
|
34
|
-
link.download = 'document.doc';
|
|
35
|
-
link.click();
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// editor.ui.addButton('exporttoword', {
|
|
40
|
-
// label: 'Xuất tệp Word',
|
|
41
|
-
// command: 'exporttoword',
|
|
42
|
-
// className: 'wordfile',
|
|
43
|
-
// toolbar: 'others',
|
|
44
|
-
// });
|
|
45
|
-
|
|
46
|
-
const inputElement = document.createElement('input');
|
|
47
|
-
inputElement.type = 'file';
|
|
48
|
-
inputElement.style.display = 'none';
|
|
49
|
-
inputElement.id = 'importfromword-input';
|
|
50
|
-
inputElement.setAttribute('accept', INSERTHTMLFILE_ALLOWED_EXTENSIONS.map((item) => `.${item}`).toString());
|
|
51
|
-
inputElement.onchange = async (event) => {
|
|
52
|
-
var file = event.target.files[0];
|
|
53
|
-
var fileUrl = URL.createObjectURL(file);
|
|
54
|
-
var extension = file.name.split('.').pop();
|
|
55
|
-
var rawFile = new XMLHttpRequest();
|
|
56
|
-
|
|
57
|
-
if (INSERTHTMLFILE_ALLOWED_EXTENSIONS.indexOf(extension) == -1) {
|
|
58
|
-
var extList = '';
|
|
59
|
-
for (var i in INSERTHTMLFILE_ALLOWED_EXTENSIONS) {
|
|
60
|
-
if (extList != '') {
|
|
61
|
-
extList = extList + ', ';
|
|
62
|
-
}
|
|
63
|
-
extList = extList + INSERTHTMLFILE_ALLOWED_EXTENSIONS[i];
|
|
64
|
-
}
|
|
65
|
-
alert(lang.extensionError + ' ' + extList + '');
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (['docx', 'doc'].includes(extension) && editor.getCommand('docx')) {
|
|
70
|
-
const docx = editor.getCommand('docx');
|
|
71
|
-
const tempContainer = document.createElement('div');
|
|
72
|
-
docx
|
|
73
|
-
.renderAsync(await (await fetch(fileUrl)).arrayBuffer(), tempContainer, null, {
|
|
74
|
-
className: '',
|
|
75
|
-
useBase64URL: true,
|
|
76
|
-
breakPages: true,
|
|
77
|
-
inWrapper: false,
|
|
78
|
-
ignoreWidth: true,
|
|
79
|
-
ignoreHeight: true,
|
|
80
|
-
renderHeaders: false,
|
|
81
|
-
renderFooters: false,
|
|
82
|
-
trimXmlDeclaration: true,
|
|
83
|
-
})
|
|
84
|
-
.then((x) => {
|
|
85
|
-
const spans = tempContainer.querySelectorAll('span');
|
|
86
|
-
|
|
87
|
-
spans.forEach((span) => {
|
|
88
|
-
if (span.querySelector('div') && span.children.length === 1) {
|
|
89
|
-
const div = document.createElement('div');
|
|
90
|
-
|
|
91
|
-
for (let i = 0; i < span.attributes.length; i++) {
|
|
92
|
-
div.setAttribute(span.attributes[i].name, span.attributes[i].value);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
while (span.firstChild) {
|
|
96
|
-
div.appendChild(span.firstChild);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
span.parentNode.replaceChild(div, span);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const pTags = tempContainer.querySelectorAll('p');
|
|
103
|
-
|
|
104
|
-
pTags.forEach((pTag) => {
|
|
105
|
-
if (pTag.querySelector('div') && pTag.children.length === 1) {
|
|
106
|
-
const div = document.createElement('div');
|
|
107
|
-
|
|
108
|
-
for (let i = 0; i < pTag.attributes.length; i++) {
|
|
109
|
-
div.setAttribute(pTag.attributes[i].name, pTag.attributes[i].value);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
while (pTag.firstChild) {
|
|
113
|
-
div.appendChild(pTag.firstChild);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
pTag.parentNode.replaceChild(div, pTag);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
const htmlValue = tempContainer.innerHTML;
|
|
121
|
-
editor.setData(htmlValue.replaceAll('application/octet-stream;', 'image/png;'));
|
|
122
|
-
});
|
|
123
|
-
} else {
|
|
124
|
-
rawFile.open('GET', fileUrl, false);
|
|
125
|
-
rawFile.onreadystatechange = function () {
|
|
126
|
-
if (rawFile.readyState === 4) {
|
|
127
|
-
if (rawFile.status === 200 || (rawFile.status == 0 && rawFile.responseText.length > 0)) {
|
|
128
|
-
editor.insertHtml(rawFile.responseText);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
rawFile.send(null);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
editor.addCommand('importfromword', {
|
|
137
|
-
exec: function (editor) {
|
|
138
|
-
const element = editor.element.$.querySelector('#importfromword-label');
|
|
139
|
-
if (element) {
|
|
140
|
-
editor.element.$.appendChild(inputElement);
|
|
141
|
-
element.click();
|
|
142
|
-
editor.element.$.removeChild(inputElement);
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
editor.ui.addButton('importfromword', {
|
|
147
|
-
label: 'Nhập tệp Word',
|
|
148
|
-
className: 'wordfile',
|
|
149
|
-
toolbar: 'others',
|
|
150
|
-
command: 'importfromword',
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
afterInit: function (editor) {
|
|
155
|
-
const labelElement = document.createElement('label');
|
|
156
|
-
labelElement.setAttribute('for', 'importfromword-input');
|
|
157
|
-
labelElement.id = 'importfromword-label';
|
|
158
|
-
|
|
159
|
-
editor.element.$.appendChild(labelElement);
|
|
160
|
-
},
|
|
161
|
-
});
|
|
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
|
+
const INSERTHTMLFILE_ALLOWED_EXTENSIONS = ['docx', 'txt']; //, 'txt', 'htm', 'html'
|
|
13
|
+
|
|
14
|
+
CKEDITOR.plugins.add('wordfile', {
|
|
15
|
+
icons: 'exporttoword,importfromword',
|
|
16
|
+
hidpi: true,
|
|
17
|
+
init: function (editor) {
|
|
18
|
+
// add the menu to the editor
|
|
19
|
+
|
|
20
|
+
editor.addCommand('exporttoword', {
|
|
21
|
+
exec: function (editor) {
|
|
22
|
+
const preHtml = `
|
|
23
|
+
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
|
|
24
|
+
<head><meta charset="utf-8"><title></title></head><body>`;
|
|
25
|
+
const postHtml = '</body></html>';
|
|
26
|
+
const html = preHtml + (editor.getData() || '').toString() + postHtml;
|
|
27
|
+
|
|
28
|
+
const blob = new Blob(['\ufeff', html], {
|
|
29
|
+
type: 'application/msword',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const link = document.createElement('a');
|
|
33
|
+
link.href = URL.createObjectURL(blob);
|
|
34
|
+
link.download = 'document.doc';
|
|
35
|
+
link.click();
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// editor.ui.addButton('exporttoword', {
|
|
40
|
+
// label: 'Xuất tệp Word',
|
|
41
|
+
// command: 'exporttoword',
|
|
42
|
+
// className: 'wordfile',
|
|
43
|
+
// toolbar: 'others',
|
|
44
|
+
// });
|
|
45
|
+
|
|
46
|
+
const inputElement = document.createElement('input');
|
|
47
|
+
inputElement.type = 'file';
|
|
48
|
+
inputElement.style.display = 'none';
|
|
49
|
+
inputElement.id = 'importfromword-input';
|
|
50
|
+
inputElement.setAttribute('accept', INSERTHTMLFILE_ALLOWED_EXTENSIONS.map((item) => `.${item}`).toString());
|
|
51
|
+
inputElement.onchange = async (event) => {
|
|
52
|
+
var file = event.target.files[0];
|
|
53
|
+
var fileUrl = URL.createObjectURL(file);
|
|
54
|
+
var extension = file.name.split('.').pop();
|
|
55
|
+
var rawFile = new XMLHttpRequest();
|
|
56
|
+
|
|
57
|
+
if (INSERTHTMLFILE_ALLOWED_EXTENSIONS.indexOf(extension) == -1) {
|
|
58
|
+
var extList = '';
|
|
59
|
+
for (var i in INSERTHTMLFILE_ALLOWED_EXTENSIONS) {
|
|
60
|
+
if (extList != '') {
|
|
61
|
+
extList = extList + ', ';
|
|
62
|
+
}
|
|
63
|
+
extList = extList + INSERTHTMLFILE_ALLOWED_EXTENSIONS[i];
|
|
64
|
+
}
|
|
65
|
+
alert(lang.extensionError + ' ' + extList + '');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (['docx', 'doc'].includes(extension) && editor.getCommand('docx')) {
|
|
70
|
+
const docx = editor.getCommand('docx');
|
|
71
|
+
const tempContainer = document.createElement('div');
|
|
72
|
+
docx
|
|
73
|
+
.renderAsync(await (await fetch(fileUrl)).arrayBuffer(), tempContainer, null, {
|
|
74
|
+
className: '',
|
|
75
|
+
useBase64URL: true,
|
|
76
|
+
breakPages: true,
|
|
77
|
+
inWrapper: false,
|
|
78
|
+
ignoreWidth: true,
|
|
79
|
+
ignoreHeight: true,
|
|
80
|
+
renderHeaders: false,
|
|
81
|
+
renderFooters: false,
|
|
82
|
+
trimXmlDeclaration: true,
|
|
83
|
+
})
|
|
84
|
+
.then((x) => {
|
|
85
|
+
const spans = tempContainer.querySelectorAll('span');
|
|
86
|
+
|
|
87
|
+
spans.forEach((span) => {
|
|
88
|
+
if (span.querySelector('div') && span.children.length === 1) {
|
|
89
|
+
const div = document.createElement('div');
|
|
90
|
+
|
|
91
|
+
for (let i = 0; i < span.attributes.length; i++) {
|
|
92
|
+
div.setAttribute(span.attributes[i].name, span.attributes[i].value);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
while (span.firstChild) {
|
|
96
|
+
div.appendChild(span.firstChild);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
span.parentNode.replaceChild(div, span);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
const pTags = tempContainer.querySelectorAll('p');
|
|
103
|
+
|
|
104
|
+
pTags.forEach((pTag) => {
|
|
105
|
+
if (pTag.querySelector('div') && pTag.children.length === 1) {
|
|
106
|
+
const div = document.createElement('div');
|
|
107
|
+
|
|
108
|
+
for (let i = 0; i < pTag.attributes.length; i++) {
|
|
109
|
+
div.setAttribute(pTag.attributes[i].name, pTag.attributes[i].value);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
while (pTag.firstChild) {
|
|
113
|
+
div.appendChild(pTag.firstChild);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
pTag.parentNode.replaceChild(div, pTag);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const htmlValue = tempContainer.innerHTML;
|
|
121
|
+
editor.setData(htmlValue.replaceAll('application/octet-stream;', 'image/png;'));
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
rawFile.open('GET', fileUrl, false);
|
|
125
|
+
rawFile.onreadystatechange = function () {
|
|
126
|
+
if (rawFile.readyState === 4) {
|
|
127
|
+
if (rawFile.status === 200 || (rawFile.status == 0 && rawFile.responseText.length > 0)) {
|
|
128
|
+
editor.insertHtml(rawFile.responseText);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
rawFile.send(null);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
editor.addCommand('importfromword', {
|
|
137
|
+
exec: function (editor) {
|
|
138
|
+
const element = editor.element.$.querySelector('#importfromword-label');
|
|
139
|
+
if (element) {
|
|
140
|
+
editor.element.$.appendChild(inputElement);
|
|
141
|
+
element.click();
|
|
142
|
+
editor.element.$.removeChild(inputElement);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
editor.ui.addButton('importfromword', {
|
|
147
|
+
label: 'Nhập tệp Word',
|
|
148
|
+
className: 'wordfile',
|
|
149
|
+
toolbar: 'others',
|
|
150
|
+
command: 'importfromword',
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
afterInit: function (editor) {
|
|
155
|
+
const labelElement = document.createElement('label');
|
|
156
|
+
labelElement.setAttribute('for', 'importfromword-input');
|
|
157
|
+
labelElement.id = 'importfromword-label';
|
|
158
|
+
|
|
159
|
+
editor.element.$.appendChild(labelElement);
|
|
160
|
+
},
|
|
161
|
+
});
|