suneditor 2.46.2 → 3.0.0-alpha.2
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/.eslintignore +7 -0
- package/.eslintrc.json +64 -0
- package/CONTRIBUTING.md +36 -0
- package/LICENSE.txt +1 -1
- package/README.md +11 -1560
- package/package.json +94 -70
- package/src/assets/icons/_default.js +194 -0
- package/src/assets/suneditor-content.css +642 -0
- package/src/assets/suneditor.css +3378 -0
- package/src/core/base/eventHandlers/handler_toolbar.js +114 -0
- package/src/core/base/eventHandlers/handler_ww_clipboard.js +31 -0
- package/src/core/base/eventHandlers/handler_ww_dragDrop.js +69 -0
- package/src/core/base/eventHandlers/handler_ww_key_input.js +978 -0
- package/src/core/base/eventHandlers/handler_ww_mouse.js +118 -0
- package/src/core/base/eventManager.js +1129 -0
- package/src/core/base/events.js +320 -0
- package/src/core/base/history.js +301 -0
- package/src/core/class/char.js +146 -0
- package/src/core/class/component.js +624 -0
- package/src/core/class/format.js +3255 -0
- package/src/core/class/html.js +1621 -0
- package/src/core/class/menu.js +260 -0
- package/src/core/class/nodeTransform.js +379 -0
- package/src/core/class/notice.js +42 -0
- package/src/core/class/offset.js +578 -0
- package/src/core/class/selection.js +508 -0
- package/src/core/class/shortcuts.js +38 -0
- package/src/core/class/toolbar.js +440 -0
- package/src/core/class/viewer.js +646 -0
- package/src/core/editor.js +1588 -0
- package/src/core/section/actives.js +107 -0
- package/src/core/section/constructor.js +1237 -0
- package/src/core/section/context.js +97 -0
- package/src/editorInjector/_classes.js +22 -0
- package/src/editorInjector/_core.js +28 -0
- package/src/editorInjector/index.js +13 -0
- package/src/helper/converter.js +313 -0
- package/src/helper/domUtils.js +1177 -0
- package/src/helper/env.js +250 -0
- package/src/helper/index.js +19 -0
- package/src/helper/numbers.js +68 -0
- package/src/helper/unicode.js +43 -0
- package/src/langs/ckb.js +161 -0
- package/src/langs/cs.js +161 -0
- package/src/langs/da.js +161 -0
- package/src/langs/de.js +162 -0
- package/src/langs/en.js +199 -0
- package/src/langs/es.js +162 -0
- package/src/langs/fa.js +159 -0
- package/src/langs/fr.js +161 -0
- package/src/langs/he.js +162 -0
- package/src/{lang → langs}/index.js +0 -2
- package/src/langs/it.js +162 -0
- package/src/langs/ja.js +162 -0
- package/src/langs/ko.js +162 -0
- package/src/langs/lv.js +162 -0
- package/src/langs/nl.js +162 -0
- package/src/langs/pl.js +162 -0
- package/src/langs/pt_br.js +162 -0
- package/src/langs/ro.js +162 -0
- package/src/langs/ru.js +162 -0
- package/src/langs/se.js +162 -0
- package/src/langs/tr.js +159 -0
- package/src/langs/ua.js +162 -0
- package/src/langs/ur.js +162 -0
- package/src/langs/zh_cn.js +162 -0
- package/src/modules/ApiManager.js +168 -0
- package/src/modules/ColorPicker.js +302 -0
- package/src/modules/Controller.js +315 -0
- package/src/modules/Figure.js +1174 -0
- package/src/modules/FileBrowser.js +271 -0
- package/src/modules/FileManager.js +290 -0
- package/src/modules/HueSlider.js +513 -0
- package/src/modules/Modal.js +177 -0
- package/src/modules/ModalAnchorEditor.js +494 -0
- package/src/modules/SelectMenu.js +447 -0
- package/src/modules/_DragHandle.js +16 -0
- package/src/modules/index.js +14 -0
- package/src/plugins/command/blockquote.js +47 -47
- package/src/plugins/command/exportPdf.js +168 -0
- package/src/plugins/command/fileUpload.js +389 -0
- package/src/plugins/command/list_bulleted.js +112 -0
- package/src/plugins/command/list_numbered.js +115 -0
- package/src/plugins/dropdown/align.js +143 -0
- package/src/plugins/dropdown/backgroundColor.js +73 -0
- package/src/plugins/dropdown/font.js +113 -0
- package/src/plugins/dropdown/fontColor.js +73 -0
- package/src/plugins/dropdown/formatBlock.js +141 -0
- package/src/plugins/dropdown/hr.js +111 -0
- package/src/plugins/dropdown/layout.js +72 -0
- package/src/plugins/dropdown/lineHeight.js +114 -0
- package/src/plugins/dropdown/list.js +107 -0
- package/src/plugins/dropdown/paragraphStyle.js +117 -0
- package/src/plugins/dropdown/table.js +2810 -0
- package/src/plugins/dropdown/template.js +71 -0
- package/src/plugins/dropdown/textStyle.js +137 -0
- package/src/plugins/field/mention.js +172 -0
- package/src/plugins/fileBrowser/imageGallery.js +76 -59
- package/src/plugins/index.js +86 -24
- package/src/plugins/input/fontSize.js +357 -0
- package/src/plugins/modal/audio.js +492 -0
- package/src/plugins/modal/image.js +1062 -0
- package/src/plugins/modal/link.js +211 -0
- package/src/plugins/modal/math.js +347 -0
- package/src/plugins/modal/video.js +870 -0
- package/src/suneditor.js +62 -67
- package/src/themes/test.css +61 -0
- package/typings/CommandPlugin.d.ts +8 -0
- package/typings/DialogPlugin.d.ts +20 -0
- package/typings/FileBrowserPlugin.d.ts +30 -0
- package/typings/Lang.d.ts +124 -0
- package/typings/Module.d.ts +15 -0
- package/typings/Plugin.d.ts +42 -0
- package/typings/SubmenuPlugin.d.ts +8 -0
- package/typings/_classes.d.ts +17 -0
- package/typings/_colorPicker.d.ts +60 -0
- package/typings/_core.d.ts +55 -0
- package/typings/align.d.ts +5 -0
- package/{src/plugins/dialog → typings}/audio.d.ts +1 -1
- package/typings/backgroundColor.d.ts +5 -0
- package/{src/plugins/command → typings}/blockquote.d.ts +1 -1
- package/typings/char.d.ts +39 -0
- package/typings/component.d.ts +38 -0
- package/typings/context.d.ts +39 -0
- package/typings/converter.d.ts +33 -0
- package/typings/dialog.d.ts +28 -0
- package/typings/domUtils.d.ts +361 -0
- package/typings/editor.d.ts +7 -0
- package/typings/editor.ts +542 -0
- package/typings/env.d.ts +70 -0
- package/typings/eventManager.d.ts +37 -0
- package/typings/events.d.ts +262 -0
- package/typings/fileBrowser.d.ts +42 -0
- package/typings/fileManager.d.ts +67 -0
- package/typings/font.d.ts +5 -0
- package/typings/fontColor.d.ts +5 -0
- package/typings/fontSize.d.ts +5 -0
- package/typings/format.d.ts +191 -0
- package/typings/formatBlock.d.ts +5 -0
- package/typings/history.d.ts +48 -0
- package/typings/horizontalRule.d.ts +5 -0
- package/{src/plugins/dialog → typings}/image.d.ts +1 -1
- package/{src/plugins/fileBrowser → typings}/imageGallery.d.ts +1 -1
- package/typings/index.d.ts +21 -0
- package/{src/plugins/modules/index.d.ts → typings/index.modules.d.ts} +3 -3
- package/typings/index.plugins.d.ts +58 -0
- package/typings/lineHeight.d.ts +5 -0
- package/{src/plugins/dialog → typings}/link.d.ts +1 -1
- package/typings/list.d.ts +5 -0
- package/{src/plugins/dialog → typings}/math.d.ts +1 -1
- package/typings/mediaContainer.d.ts +25 -0
- package/typings/node.d.ts +57 -0
- package/typings/notice.d.ts +16 -0
- package/typings/numbers.d.ts +29 -0
- package/typings/offset.d.ts +24 -0
- package/typings/options.d.ts +589 -0
- package/typings/paragraphStyle.d.ts +5 -0
- package/typings/resizing.d.ts +141 -0
- package/typings/selection.d.ts +94 -0
- package/typings/shortcuts.d.ts +13 -0
- package/typings/suneditor.d.ts +9 -0
- package/typings/table.d.ts +5 -0
- package/typings/template.d.ts +5 -0
- package/typings/textStyle.d.ts +5 -0
- package/typings/toolbar.d.ts +32 -0
- package/typings/unicode.d.ts +25 -0
- package/{src/plugins/dialog → typings}/video.d.ts +1 -1
- package/dist/css/suneditor.min.css +0 -1
- package/dist/suneditor.min.js +0 -2
- package/src/assets/css/suneditor-contents.css +0 -562
- package/src/assets/css/suneditor.css +0 -566
- package/src/assets/defaultIcons.js +0 -103
- package/src/lang/Lang.d.ts +0 -144
- package/src/lang/ckb.d.ts +0 -5
- package/src/lang/ckb.js +0 -188
- package/src/lang/cs.d.ts +0 -5
- package/src/lang/cs.js +0 -188
- package/src/lang/da.d.ts +0 -5
- package/src/lang/da.js +0 -191
- package/src/lang/de.d.ts +0 -5
- package/src/lang/de.js +0 -188
- package/src/lang/en.d.ts +0 -5
- package/src/lang/en.js +0 -188
- package/src/lang/es.d.ts +0 -5
- package/src/lang/es.js +0 -188
- package/src/lang/fa.d.ts +0 -5
- package/src/lang/fa.js +0 -188
- package/src/lang/fr.d.ts +0 -5
- package/src/lang/fr.js +0 -188
- package/src/lang/he.d.ts +0 -5
- package/src/lang/he.js +0 -188
- package/src/lang/index.d.ts +0 -23
- package/src/lang/it.d.ts +0 -5
- package/src/lang/it.js +0 -188
- package/src/lang/ja.d.ts +0 -5
- package/src/lang/ja.js +0 -188
- package/src/lang/ko.d.ts +0 -5
- package/src/lang/ko.js +0 -188
- package/src/lang/lv.d.ts +0 -5
- package/src/lang/lv.js +0 -188
- package/src/lang/nl.d.ts +0 -5
- package/src/lang/nl.js +0 -188
- package/src/lang/pl.d.ts +0 -5
- package/src/lang/pl.js +0 -188
- package/src/lang/pt_br.d.ts +0 -5
- package/src/lang/pt_br.js +0 -189
- package/src/lang/ro.d.ts +0 -5
- package/src/lang/ro.js +0 -188
- package/src/lang/ru.d.ts +0 -5
- package/src/lang/ru.js +0 -188
- package/src/lang/se.d.ts +0 -5
- package/src/lang/se.js +0 -191
- package/src/lang/tr.d.ts +0 -5
- package/src/lang/tr.js +0 -191
- package/src/lang/ua.d.ts +0 -5
- package/src/lang/ua.js +0 -188
- package/src/lang/ur.d.ts +0 -5
- package/src/lang/ur.js +0 -188
- package/src/lang/zh_cn.d.ts +0 -5
- package/src/lang/zh_cn.js +0 -187
- package/src/lib/constructor.js +0 -954
- package/src/lib/context.d.ts +0 -42
- package/src/lib/context.js +0 -71
- package/src/lib/core.d.ts +0 -1135
- package/src/lib/core.js +0 -9395
- package/src/lib/history.d.ts +0 -48
- package/src/lib/history.js +0 -219
- package/src/lib/util.d.ts +0 -678
- package/src/lib/util.js +0 -2131
- package/src/options.d.ts +0 -608
- package/src/plugins/CommandPlugin.d.ts +0 -8
- package/src/plugins/DialogPlugin.d.ts +0 -20
- package/src/plugins/FileBrowserPlugin.d.ts +0 -30
- package/src/plugins/Module.d.ts +0 -15
- package/src/plugins/Plugin.d.ts +0 -42
- package/src/plugins/SubmenuPlugin.d.ts +0 -8
- package/src/plugins/dialog/audio.js +0 -559
- package/src/plugins/dialog/image.js +0 -1126
- package/src/plugins/dialog/link.js +0 -223
- package/src/plugins/dialog/math.js +0 -295
- package/src/plugins/dialog/mention.js +0 -242
- package/src/plugins/dialog/video.js +0 -979
- package/src/plugins/index.d.ts +0 -79
- package/src/plugins/modules/_anchor.js +0 -461
- package/src/plugins/modules/_colorPicker.d.ts +0 -60
- package/src/plugins/modules/_colorPicker.js +0 -201
- package/src/plugins/modules/_notice.d.ts +0 -21
- package/src/plugins/modules/_notice.js +0 -72
- package/src/plugins/modules/_selectMenu.js +0 -119
- package/src/plugins/modules/component.d.ts +0 -25
- package/src/plugins/modules/component.js +0 -81
- package/src/plugins/modules/dialog.d.ts +0 -28
- package/src/plugins/modules/dialog.js +0 -175
- package/src/plugins/modules/fileBrowser.d.ts +0 -42
- package/src/plugins/modules/fileBrowser.js +0 -374
- package/src/plugins/modules/fileManager.d.ts +0 -67
- package/src/plugins/modules/fileManager.js +0 -326
- package/src/plugins/modules/index.js +0 -9
- package/src/plugins/modules/resizing.d.ts +0 -154
- package/src/plugins/modules/resizing.js +0 -903
- package/src/plugins/submenu/align.d.ts +0 -5
- package/src/plugins/submenu/align.js +0 -160
- package/src/plugins/submenu/font.d.ts +0 -5
- package/src/plugins/submenu/font.js +0 -123
- package/src/plugins/submenu/fontColor.d.ts +0 -5
- package/src/plugins/submenu/fontColor.js +0 -101
- package/src/plugins/submenu/fontSize.d.ts +0 -5
- package/src/plugins/submenu/fontSize.js +0 -112
- package/src/plugins/submenu/formatBlock.d.ts +0 -5
- package/src/plugins/submenu/formatBlock.js +0 -273
- package/src/plugins/submenu/hiliteColor.d.ts +0 -5
- package/src/plugins/submenu/hiliteColor.js +0 -102
- package/src/plugins/submenu/horizontalRule.d.ts +0 -5
- package/src/plugins/submenu/horizontalRule.js +0 -98
- package/src/plugins/submenu/lineHeight.d.ts +0 -5
- package/src/plugins/submenu/lineHeight.js +0 -104
- package/src/plugins/submenu/list.d.ts +0 -5
- package/src/plugins/submenu/list.js +0 -456
- package/src/plugins/submenu/paragraphStyle.d.ts +0 -5
- package/src/plugins/submenu/paragraphStyle.js +0 -135
- package/src/plugins/submenu/table.d.ts +0 -5
- package/src/plugins/submenu/table.js +0 -1431
- package/src/plugins/submenu/template.d.ts +0 -5
- package/src/plugins/submenu/template.js +0 -72
- package/src/plugins/submenu/textStyle.d.ts +0 -5
- package/src/plugins/submenu/textStyle.js +0 -167
- package/src/suneditor.d.ts +0 -9
- package/src/suneditor_build.js +0 -18
- /package/{src/plugins/dialog → typings}/mention.d.ts +0 -0
package/src/suneditor.js
CHANGED
|
@@ -1,75 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
* wysiwyg web editor
|
|
3
|
-
*
|
|
4
|
-
* suneditor.js
|
|
5
|
-
* Copyright 2017 JiHong Lee.
|
|
6
|
-
* MIT license.
|
|
7
|
-
*/
|
|
8
|
-
'use strict';
|
|
1
|
+
import Editor from './core/editor';
|
|
9
2
|
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
3
|
+
import EditorInjector from './editorInjector';
|
|
4
|
+
import Plugins from './plugins';
|
|
5
|
+
import Langs from './langs';
|
|
6
|
+
import Modules from './modules';
|
|
7
|
+
import Helper from './helper';
|
|
14
8
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* @returns {Object}
|
|
21
|
-
*/
|
|
22
|
-
init: function (init_options) {
|
|
23
|
-
return {
|
|
24
|
-
create: function (idOrElement, options) {
|
|
25
|
-
return this.create(idOrElement, options, init_options);
|
|
26
|
-
}.bind(this)
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @description Create the suneditor
|
|
32
|
-
* @param {String|Element} idOrElement textarea Id or textarea element
|
|
33
|
-
* @param {JSON|Object} options user options
|
|
34
|
-
* @returns {Object}
|
|
35
|
-
*/
|
|
36
|
-
create: function (idOrElement, options, _init_options) {
|
|
37
|
-
util._propertiesInit();
|
|
9
|
+
export const editorInjector = EditorInjector;
|
|
10
|
+
export const plugins = Plugins;
|
|
11
|
+
export const modules = Modules;
|
|
12
|
+
export const langs = Langs;
|
|
13
|
+
export const helper = Helper;
|
|
38
14
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return init;
|
|
54
|
-
}, {});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const element = typeof idOrElement === 'string' ? document.getElementById(idOrElement) : idOrElement;
|
|
58
|
-
|
|
59
|
-
if (!element) {
|
|
60
|
-
if (typeof idOrElement === 'string') {
|
|
61
|
-
throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"' + idOrElement + '")');
|
|
62
|
-
}
|
|
15
|
+
export default {
|
|
16
|
+
/**
|
|
17
|
+
* @description Returns the create function with preset options.
|
|
18
|
+
* If the options overlap, the options of the 'create' function take precedence.
|
|
19
|
+
* @param {Json} options Initialization options
|
|
20
|
+
* @returns {Object}
|
|
21
|
+
*/
|
|
22
|
+
init(init_options) {
|
|
23
|
+
return {
|
|
24
|
+
create: (targets, options) => this.create(targets, options, init_options)
|
|
25
|
+
};
|
|
26
|
+
},
|
|
63
27
|
|
|
64
|
-
|
|
65
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @description Create the suneditor
|
|
30
|
+
* @param {string|Element|Array.<string|Element>} target textarea Id or textarea element
|
|
31
|
+
* @param {JSON|Object} options user options
|
|
32
|
+
* @returns {Object}
|
|
33
|
+
*/
|
|
34
|
+
create(target, options, _init_options) {
|
|
35
|
+
if (typeof options !== 'object') options = {};
|
|
36
|
+
if (_init_options) {
|
|
37
|
+
options = (() => {
|
|
38
|
+
return [_init_options, options].reduce((init, option) => {
|
|
39
|
+
Object.entries(option).forEach(([key, value]) => {
|
|
40
|
+
if (key === 'plugins' && value && init[key]) {
|
|
41
|
+
const i = Array.isArray(init[key]) ? init[key] : Object.values(init[key]);
|
|
42
|
+
const o = Array.isArray(value) ? value : Object.values(value);
|
|
43
|
+
init[key] = [...o.filter((val) => !i.includes(val)), ...i];
|
|
44
|
+
} else {
|
|
45
|
+
init[key] = value;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return init;
|
|
49
|
+
}, {});
|
|
50
|
+
})();
|
|
51
|
+
}
|
|
66
52
|
|
|
67
|
-
|
|
53
|
+
if (!target) throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element");
|
|
68
54
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
const multiTargets = [];
|
|
56
|
+
if (target.nodeType === 1) {
|
|
57
|
+
multiTargets.push({ target: target });
|
|
58
|
+
} else {
|
|
59
|
+
let props;
|
|
60
|
+
for (const key in target) {
|
|
61
|
+
props = target[key];
|
|
62
|
+
if (!props.target || props.target.nodeType !== 1) throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');
|
|
63
|
+
props.key = key;
|
|
64
|
+
multiTargets.push(props);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
return new Editor(multiTargets, options);
|
|
69
|
+
}
|
|
75
70
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.sun-editor button > svg,
|
|
2
|
+
.sun-editor .se-svg {
|
|
3
|
+
width: 14px;
|
|
4
|
+
height: 14px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/** se-btn button */
|
|
8
|
+
.sun-editor .se-btn {
|
|
9
|
+
width: 32px;
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
line-height: 1.8;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.sun-editor .close > svg,
|
|
15
|
+
.sun-editor .se-modal .se-close-btn > svg {
|
|
16
|
+
width: 10px;
|
|
17
|
+
height: 10px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* se-select-btn icon */
|
|
21
|
+
.sun-editor .se-btn-select > svg {
|
|
22
|
+
width: 8px;
|
|
23
|
+
height: 8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* se-btn-list inner icon */
|
|
27
|
+
.sun-editor .se-btn-list > .se-list-icon {
|
|
28
|
+
width: 12px;
|
|
29
|
+
height: 14px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* modal */
|
|
33
|
+
.sun-editor .se-modal .se-modal-inner .se-modal-form input,
|
|
34
|
+
.sun-editor .se-modal .se-modal-inner .se-modal-form select {
|
|
35
|
+
height: 32px;
|
|
36
|
+
font-size: 13px;
|
|
37
|
+
line-height: 1.7;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.sun-editor .se-modal .se-modal-inner .se-modal-content .se-btn-primary {
|
|
41
|
+
padding: 5px 11px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sun-editor .se-modal .se-modal-inner .se-modal-footer > div {
|
|
45
|
+
line-height: 1.7;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.sun-editor .se-line-breaker-component {
|
|
49
|
+
width: 22px;
|
|
50
|
+
height: 22px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.sun-editor .se-modal label,
|
|
54
|
+
.sun-editor .se-modal input,
|
|
55
|
+
.sun-editor .se-modal button {
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.sun-editor .se-modal .se-modal-inner .se-modal-header .se-modal-title {
|
|
60
|
+
font-size: 15px;
|
|
61
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Plugin } from './Plugin';
|
|
2
|
+
|
|
3
|
+
export interface DialogPlugin extends Plugin {
|
|
4
|
+
/**
|
|
5
|
+
* @description This method is called when the plugin button is clicked.
|
|
6
|
+
* Open the modal window here.
|
|
7
|
+
*/
|
|
8
|
+
open: () => void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Called after the dropdown has been rendered
|
|
12
|
+
*/
|
|
13
|
+
on?: () => void;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @description This method is called when the dialog window is closed.
|
|
17
|
+
* Initialize the properties.
|
|
18
|
+
*/
|
|
19
|
+
init: () => void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Plugin } from './Plugin';
|
|
2
|
+
|
|
3
|
+
export interface FileBrowserPlugin extends Plugin {
|
|
4
|
+
/**
|
|
5
|
+
* @description Open a file browser window
|
|
6
|
+
* @param pluginName Plugin name using the file browser
|
|
7
|
+
* @param selectorHandler When the function comes as an argument value, it substitutes "context.selectorHandler".
|
|
8
|
+
* @example this.plugins.fileBrowser.open.call(this, 'imageGallery', (selectorHandler || null));
|
|
9
|
+
*/
|
|
10
|
+
open(kind: string, update: boolean): void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description Define the HTML of the item to be put in "div.se-file-item-column".
|
|
14
|
+
* @param item Item of the response data's array
|
|
15
|
+
*/
|
|
16
|
+
drawItems: (item: object) => string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @description Close a file browser window
|
|
20
|
+
* The plugin's "init" method is called.
|
|
21
|
+
* @example this.plugins.fileBrowser.close.call(this);
|
|
22
|
+
*/
|
|
23
|
+
close(): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @description This method is called when the file browser window is closed.
|
|
27
|
+
* Initialize the properties.
|
|
28
|
+
*/
|
|
29
|
+
init?: () => void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export interface Lang {
|
|
2
|
+
code: string;
|
|
3
|
+
default: string;
|
|
4
|
+
save: string;
|
|
5
|
+
font: string;
|
|
6
|
+
formats: string;
|
|
7
|
+
fontSize: string;
|
|
8
|
+
bold: string;
|
|
9
|
+
underline: string;
|
|
10
|
+
italic: string;
|
|
11
|
+
strike: string;
|
|
12
|
+
subscript: string;
|
|
13
|
+
superscript: string;
|
|
14
|
+
removeFormat: string;
|
|
15
|
+
fontColor: string;
|
|
16
|
+
backgroundColor: string;
|
|
17
|
+
indent: string;
|
|
18
|
+
outdent: string;
|
|
19
|
+
align: string;
|
|
20
|
+
alignLeft: string;
|
|
21
|
+
alignRight: string;
|
|
22
|
+
alignCenter: string;
|
|
23
|
+
alignJustify: string;
|
|
24
|
+
list: string;
|
|
25
|
+
numberedList: string;
|
|
26
|
+
bulletedList: string;
|
|
27
|
+
horizontalLine: string;
|
|
28
|
+
hr_solid: string;
|
|
29
|
+
hr_dotted: string;
|
|
30
|
+
hr_dashed: string;
|
|
31
|
+
table: string;
|
|
32
|
+
link: string;
|
|
33
|
+
math: string;
|
|
34
|
+
image: string;
|
|
35
|
+
video: string;
|
|
36
|
+
audio: string;
|
|
37
|
+
fullScreen: string;
|
|
38
|
+
showBlocks: string;
|
|
39
|
+
codeView: string;
|
|
40
|
+
undo: string;
|
|
41
|
+
redo: string;
|
|
42
|
+
preview: string;
|
|
43
|
+
print: string;
|
|
44
|
+
tag_p: string;
|
|
45
|
+
tag_div: string;
|
|
46
|
+
tag_h: string;
|
|
47
|
+
tag_blockquote: string;
|
|
48
|
+
tag_pre: string;
|
|
49
|
+
template: string;
|
|
50
|
+
lineHeight: string;
|
|
51
|
+
paragraphStyle: string;
|
|
52
|
+
textStyle: string;
|
|
53
|
+
imageGallery: string;
|
|
54
|
+
dir_ltr: string;
|
|
55
|
+
dir_rtl: string;
|
|
56
|
+
mention: string;
|
|
57
|
+
tags: string;
|
|
58
|
+
search: string;
|
|
59
|
+
caption: string;
|
|
60
|
+
close: string;
|
|
61
|
+
submitButton: string;
|
|
62
|
+
revertButton: string;
|
|
63
|
+
proportion: string;
|
|
64
|
+
basic: string;
|
|
65
|
+
left: string;
|
|
66
|
+
right: string;
|
|
67
|
+
center: string;
|
|
68
|
+
width: string;
|
|
69
|
+
height: string;
|
|
70
|
+
size: string;
|
|
71
|
+
ratio: string;
|
|
72
|
+
edit: string;
|
|
73
|
+
unlink: string;
|
|
74
|
+
remove: string;
|
|
75
|
+
link_modal_title: string;
|
|
76
|
+
link_modal_url: string;
|
|
77
|
+
link_modal_text: string;
|
|
78
|
+
link_modal_newWindowCheck: string;
|
|
79
|
+
link_modal_downloadLinkCheck: string;
|
|
80
|
+
link_modal_bookmark: string;
|
|
81
|
+
math_modal_title: string;
|
|
82
|
+
math_modal_inputLabel: string;
|
|
83
|
+
math_modal_fontSizeLabel: string;
|
|
84
|
+
math_modal_previewLabel: string;
|
|
85
|
+
image_modal_title: string;
|
|
86
|
+
image_modal_file: string;
|
|
87
|
+
image_modal_url: string;
|
|
88
|
+
image_modal_altText: string;
|
|
89
|
+
video_modal_title: string;
|
|
90
|
+
video_modal_file: string;
|
|
91
|
+
video_modal_url: string;
|
|
92
|
+
audio_modal_title: string;
|
|
93
|
+
audio_modal_file: string;
|
|
94
|
+
audio_modal_url: string;
|
|
95
|
+
insertRowAbove: string;
|
|
96
|
+
insertRowBelow: string;
|
|
97
|
+
deleteRow: string;
|
|
98
|
+
insertColumnBefore: string;
|
|
99
|
+
insertColumnAfter: string;
|
|
100
|
+
deleteColumn: string;
|
|
101
|
+
fixedColumnWidth: string;
|
|
102
|
+
resize100: string;
|
|
103
|
+
resize75: string;
|
|
104
|
+
resize50: string;
|
|
105
|
+
resize25: string;
|
|
106
|
+
autoSize: string;
|
|
107
|
+
mirrorHorizontal: string;
|
|
108
|
+
mirrorVertical: string;
|
|
109
|
+
rotateLeft: string;
|
|
110
|
+
rotateRight: string;
|
|
111
|
+
maxSize: string;
|
|
112
|
+
minSize: string;
|
|
113
|
+
tableHeader: string;
|
|
114
|
+
mergeCells: string;
|
|
115
|
+
splitCells: string;
|
|
116
|
+
horizontalSplit: string;
|
|
117
|
+
verticalSplit: string;
|
|
118
|
+
menu_spaced: string;
|
|
119
|
+
menu_bordered: string;
|
|
120
|
+
menu_neon: string;
|
|
121
|
+
menu_translucent: string;
|
|
122
|
+
menu_shadow: string;
|
|
123
|
+
menu_code: string;
|
|
124
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import SunEditor from '../lib/core';
|
|
2
|
+
|
|
3
|
+
export interface Module {
|
|
4
|
+
/**
|
|
5
|
+
* @description Module name
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @description Constructor, It will run automatically.
|
|
11
|
+
* @param core Core object
|
|
12
|
+
* @example core.addModule([dialog, resizing, fileManager])
|
|
13
|
+
*/
|
|
14
|
+
add?: (core: SunEditor) => void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface Plugin {
|
|
2
|
+
/**
|
|
3
|
+
* @description Plugin name
|
|
4
|
+
*/
|
|
5
|
+
name: string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description Plugin type ('container', 'command', 'dropdown', 'dialog')
|
|
9
|
+
*/
|
|
10
|
+
display: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description Constructor
|
|
14
|
+
* @param core Core object
|
|
15
|
+
* @param targetElement Target button Element
|
|
16
|
+
*/
|
|
17
|
+
add: (core: any, targetElement?: any) => void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @description Plugins with active methods load immediately when the editor loads.
|
|
21
|
+
* Called each time the selection is moved.
|
|
22
|
+
* @param element Selected elements
|
|
23
|
+
*/
|
|
24
|
+
active?: (element: any) => boolean;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description TML title attribute (tooltip) - default: plugin's name
|
|
28
|
+
*/
|
|
29
|
+
title?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description HTML to be append to button (icon)
|
|
33
|
+
* Recommend using the inline svg icon. - default: "<span class="se-icon-text">!</span>"
|
|
34
|
+
*/
|
|
35
|
+
innerHTML?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description The class of the button. - default: "se-btn"
|
|
39
|
+
* Do not recommend using it unless it is a special situation.
|
|
40
|
+
*/
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class ClassInterface {
|
|
2
|
+
char: any;
|
|
3
|
+
component: any;
|
|
4
|
+
format: any;
|
|
5
|
+
html: any;
|
|
6
|
+
menu: any;
|
|
7
|
+
nodeTransform: any;
|
|
8
|
+
notice: any;
|
|
9
|
+
offset: any;
|
|
10
|
+
selection: any;
|
|
11
|
+
shortcuts: any;
|
|
12
|
+
toolbar: any;
|
|
13
|
+
viewer: any;
|
|
14
|
+
subToolbar?: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default ClassInterface;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import SunEditor from '../../lib/core';
|
|
2
|
+
import { Module } from '../Module';
|
|
3
|
+
|
|
4
|
+
declare interface _colorPicker extends Module {
|
|
5
|
+
/**
|
|
6
|
+
* @description Create color list
|
|
7
|
+
* @param core Core object
|
|
8
|
+
* @param makeColor this._makeColorList
|
|
9
|
+
* @returns HTML string
|
|
10
|
+
*/
|
|
11
|
+
createColorList(core: SunEditor, makeColor: (color: string) => string): string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @description Displays or resets the currently selected color at color list.
|
|
15
|
+
* @param node Current Selected node
|
|
16
|
+
* @param color Color value
|
|
17
|
+
*/
|
|
18
|
+
init(node: Node, color: string): void;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description Store color values
|
|
22
|
+
* @param hexColorStr Hax color value
|
|
23
|
+
*/
|
|
24
|
+
setCurrentColor(hexColorStr: string): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description Set color at input element
|
|
28
|
+
* @param hexColorStr Hax color value
|
|
29
|
+
*/
|
|
30
|
+
setInputText(hexColorStr: string): void;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @description Gets color value at color property of node
|
|
34
|
+
* @param node Selected node
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
getColorInNode(node: Node): string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description Function to check hex format color
|
|
41
|
+
* @param str Color value
|
|
42
|
+
*/
|
|
43
|
+
isHexColor(str: string): boolean;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @description Function to convert hex format to a rgb color
|
|
47
|
+
* @param rgb RGB color format
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
rgb2hex(rgb: string): string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @description Converts color values of other formats to hex color values and returns.
|
|
54
|
+
* @param colorName Color value
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
colorName2hex(colorName: string): string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default _colorPicker;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Core, status } from '../lib/core.d';
|
|
2
|
+
import { Lang } from '../langs/Lang.d';
|
|
3
|
+
import { Plugin } from '../plugins/Plugin.d';
|
|
4
|
+
import { SunEditorOptions } from '../options.d';
|
|
5
|
+
import { Context } from '../lib/context.d';
|
|
6
|
+
import { History } from '../lib/history.d';
|
|
7
|
+
import Helper from '../helper/index.d';
|
|
8
|
+
|
|
9
|
+
class CoreInterface {
|
|
10
|
+
editor: Core;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description window object.
|
|
14
|
+
*/
|
|
15
|
+
_w: Window;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @description document object.
|
|
19
|
+
*/
|
|
20
|
+
_d: Document;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @description window obejct.(If in iframe mode, the window object of the iframe )
|
|
24
|
+
*/
|
|
25
|
+
_ww: Document;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @description document object.(If in iframe mode, the document object of the iframe )
|
|
29
|
+
*/
|
|
30
|
+
_wd: Window;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @description Closest ShadowRoot to editor if found
|
|
34
|
+
*/
|
|
35
|
+
shadowRoot: Document;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description Loaded plugins
|
|
39
|
+
*/
|
|
40
|
+
plugins: Record<string, Plugin>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @description Default icons object
|
|
44
|
+
*/
|
|
45
|
+
icons: Record<string, string>;
|
|
46
|
+
|
|
47
|
+
status: status;
|
|
48
|
+
options: SunEditorOptions;
|
|
49
|
+
context: Context;
|
|
50
|
+
history: History;
|
|
51
|
+
lang: Lang;
|
|
52
|
+
helper: Helper;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default CoreInterface;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import EditorDependency from '../src/editorInjector';
|
|
2
|
+
|
|
3
|
+
class Char extends EditorDependency {
|
|
4
|
+
/**
|
|
5
|
+
* @description Returns false if char count is greater than "options.charCounter_max" when "html" is added to the current editor.
|
|
6
|
+
* @param element Element node or String.
|
|
7
|
+
*/
|
|
8
|
+
check(html: Node | string): boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Get the [content]'s number of characters or binary data size. (options.charCounter_type)
|
|
12
|
+
* If [content] is undefined, get the current editor's number of characters or binary data size.
|
|
13
|
+
* @param content Content to count. (defalut: this.editor.frameContext.get('wysiwyg'))
|
|
14
|
+
*/
|
|
15
|
+
getLength(content?: string): number;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @descriptionGets Get the length in bytes of a string.
|
|
19
|
+
* @param text String text
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
getByteLength(text: string): number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @description Set the char count to charCounter element textContent.
|
|
26
|
+
*/
|
|
27
|
+
display(): void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @description Returns false if char count is greater than "options.charCounter_max" when "inputText" is added to the current editor.
|
|
31
|
+
* If the current number of characters is greater than "charCounter_max", the excess characters are removed.
|
|
32
|
+
* And call the char.display()
|
|
33
|
+
* @param inputText Text added.
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
test(inputText: string): boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default Char;
|