suneditor 2.46.1 → 3.0.0-alpha.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/.eslintignore +7 -0
- package/.eslintrc.json +64 -0
- package/CONTRIBUTING.md +36 -0
- package/LICENSE.txt +1 -1
- package/README.md +174 -805
- package/dist/suneditor.min.css +1 -0
- package/dist/suneditor.min.js +1 -2
- package/package.json +96 -70
- package/src/assets/icons/_default.js +194 -0
- package/src/assets/suneditor-content.css +646 -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 +975 -0
- package/src/core/base/eventHandlers/handler_ww_mouse.js +118 -0
- package/src/core/base/eventManager.js +1115 -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 +627 -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 +1593 -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 +1160 -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 +510 -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/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
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import type * as CSS from 'csstype';
|
|
2
|
+
import { History } from './history';
|
|
3
|
+
import { Plugin } from '../src/plugins/Plugin';
|
|
4
|
+
import { Lang } from './Lang';
|
|
5
|
+
import { SunEditorOptions } from '../src/options';
|
|
6
|
+
import { Context } from '../src/core/context';
|
|
7
|
+
import { Module } from '../src/plugins/Module';
|
|
8
|
+
import _Notice from './notice';
|
|
9
|
+
|
|
10
|
+
export type Controllers = Array<string | Function | Element>;
|
|
11
|
+
export type fileInfo = {
|
|
12
|
+
index: number;
|
|
13
|
+
name: string;
|
|
14
|
+
size: string | number;
|
|
15
|
+
select: Function;
|
|
16
|
+
delete: Function;
|
|
17
|
+
element: Element;
|
|
18
|
+
src: string;
|
|
19
|
+
};
|
|
20
|
+
export type seledtedFileInfo = { target: Element; component: Element; pluginName: string };
|
|
21
|
+
export type commands =
|
|
22
|
+
| 'selectAll'
|
|
23
|
+
| 'codeView'
|
|
24
|
+
| 'fullScreen'
|
|
25
|
+
| 'indent'
|
|
26
|
+
| 'outdent'
|
|
27
|
+
| 'undo'
|
|
28
|
+
| 'redo'
|
|
29
|
+
| 'removeFormat'
|
|
30
|
+
| 'print'
|
|
31
|
+
| 'preview'
|
|
32
|
+
| 'showBlocks'
|
|
33
|
+
| 'save'
|
|
34
|
+
| 'bold'
|
|
35
|
+
| 'underline'
|
|
36
|
+
| 'italic'
|
|
37
|
+
| 'strike'
|
|
38
|
+
| 'subscript'
|
|
39
|
+
| 'superscript'
|
|
40
|
+
| 'copy'
|
|
41
|
+
| 'cut'
|
|
42
|
+
| 'paste';
|
|
43
|
+
export type status = {};
|
|
44
|
+
|
|
45
|
+
export interface Core {
|
|
46
|
+
/**
|
|
47
|
+
* @description Functions object
|
|
48
|
+
*/
|
|
49
|
+
functions: SunEditor;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @description Editor options
|
|
53
|
+
*/
|
|
54
|
+
options: SunEditorOptions;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @description Computed style of the wysiwyg area window.getComputedStyle(this.editor.frameContext('wysiwyg'))
|
|
58
|
+
*/
|
|
59
|
+
wwComputedStyle: any;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @description Notice object
|
|
63
|
+
*/
|
|
64
|
+
notice: _Notice;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @description Default icons object
|
|
68
|
+
*/
|
|
69
|
+
icons: Record<string, string>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @description History object for undo, redo
|
|
73
|
+
*/
|
|
74
|
+
history: History;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @description Elements and user options parameters of the suneditor
|
|
78
|
+
*/
|
|
79
|
+
context: Context;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @description Plugin buttons
|
|
83
|
+
*/
|
|
84
|
+
pluginCallButtons: Record<string, Element>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @description Loaded plugins
|
|
88
|
+
*/
|
|
89
|
+
plugins: Record<string, Plugin>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @description loaded language
|
|
93
|
+
*/
|
|
94
|
+
lang: Lang;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @description The selection node (selection.getNode()) to which the effect was last applied
|
|
98
|
+
*/
|
|
99
|
+
effectNode: Node;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @description dropdown element
|
|
103
|
+
*/
|
|
104
|
+
dropdown: Element;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @description container element
|
|
108
|
+
*/
|
|
109
|
+
container: Element;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @description active button element in dropdown
|
|
113
|
+
*/
|
|
114
|
+
currentDropdownActiveButton: Element;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @description active button element in container
|
|
118
|
+
*/
|
|
119
|
+
currentContainerActiveButton: Element;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @description The elements array to be processed unvisible when the controllerOff function is executed (resizing, link modified button, table controller)
|
|
123
|
+
*/
|
|
124
|
+
currentControllerItems: Controllers;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @description The name of the plugin that called the currently active controller
|
|
128
|
+
*/
|
|
129
|
+
currentControllerName: string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @description The target element of current controller
|
|
133
|
+
*/
|
|
134
|
+
currentControllerTarget: Element;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @description The file component object of current selected file tag (component.get(): {target, component, pluginName})
|
|
138
|
+
*/
|
|
139
|
+
currentFileComponentInfo: seledtedFileInfo;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @description Editor tags whitelist (RegExp object)
|
|
143
|
+
* util.createElementWhitelist(options._editorElementWhitelist)
|
|
144
|
+
*/
|
|
145
|
+
_elementWhitelistRegExp: RegExp;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @description Editor tags blacklist (RegExp object)
|
|
149
|
+
* util.createElementBlacklist(options.elementBlacklist)
|
|
150
|
+
*/
|
|
151
|
+
_elementBlacklistRegExp: RegExp;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @description Plugins array with "active" method.
|
|
155
|
+
* "activeCommands" runs the "add" method when creating the editor.
|
|
156
|
+
*/
|
|
157
|
+
activeCommands: Plugin[];
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @description Plugins array with "checkFiletInfo" and "resetFileInfo" methods.
|
|
161
|
+
* "fileInfoPlugins" runs the "add" method when creating the editor.
|
|
162
|
+
* "checkFileInfo" method is always call just before the "change" event.
|
|
163
|
+
*/
|
|
164
|
+
fileInfoPlugins: Function[];
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @description Elements that need to change text or className for each selection change
|
|
168
|
+
* After creating the editor, "activeCommands" are added.
|
|
169
|
+
* @property STRONG bold button
|
|
170
|
+
* @property U underline button
|
|
171
|
+
* @property EM italic button
|
|
172
|
+
* @property DEL strike button
|
|
173
|
+
* @property SUB subscript button
|
|
174
|
+
* @property SUP superscript button
|
|
175
|
+
* @property OUTDENT outdent button
|
|
176
|
+
* @property INDENT indent button
|
|
177
|
+
*/
|
|
178
|
+
commandMap: Record<string, Element>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @description If the plugin is not added, add the plugin and call the 'add' function.
|
|
182
|
+
* If the plugin is added call callBack function.
|
|
183
|
+
* @param pluginName The name of the plugin to call
|
|
184
|
+
* @param callBackFunction Function to be executed immediately after module call
|
|
185
|
+
* @param target Plugin target button (This is not necessary if you have a button list when creating the editor)
|
|
186
|
+
*/
|
|
187
|
+
registerPlugin(pluginName: string, callBackFunction: Function, target?: Element): void;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @description If the module is not added, add the module and call the 'add' function
|
|
191
|
+
* @param moduleArray module object's Array
|
|
192
|
+
*/
|
|
193
|
+
addModule(moduleArray: Module[]): void;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @description Method for managing dropdown element.
|
|
197
|
+
* You must add the "dropdown" element using the this method at custom plugin.
|
|
198
|
+
* @param pluginName Plugin name
|
|
199
|
+
* @param target Target button
|
|
200
|
+
* @param menu Dropdown element
|
|
201
|
+
*/
|
|
202
|
+
initMenuTarget(pluginName: string, target: Element | null, menu: Element): void;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @description Enable dropdown
|
|
206
|
+
* @param element Dropdown's button element to call
|
|
207
|
+
*/
|
|
208
|
+
dropdownOn(element: Element): void;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @description Disable dropdown
|
|
212
|
+
*/
|
|
213
|
+
dropdownOff(): void;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @description Disable more layer
|
|
217
|
+
*/
|
|
218
|
+
moreLayerOff(): void;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @description Enable container
|
|
222
|
+
* @param element Container's button element to call
|
|
223
|
+
*/
|
|
224
|
+
containerOn(element: Element): void;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @description Disable container
|
|
228
|
+
*/
|
|
229
|
+
containerOff(): void;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @description Show controller at editor area (controller elements, function, "controller target element(@Required)", "controller name(@Required)", etc..)
|
|
233
|
+
* @param arguments controller elements, function.
|
|
234
|
+
*/
|
|
235
|
+
controllerOn(...arguments: Controllers): void;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @description Hide controller at editor area (link button, image resize button..)
|
|
239
|
+
* @param e Event object when called from mousedown and keydown events registered in "core.controllerOn"
|
|
240
|
+
*/
|
|
241
|
+
controllerOff(e?: KeyboardEvent | MouseEvent): void;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @description Specify the position of the controller.
|
|
245
|
+
* @param controller Controller element.
|
|
246
|
+
* @param referEl Element that is the basis of the controller's position.
|
|
247
|
+
* @param position Type of position ("top" | "bottom")
|
|
248
|
+
* When using the "top" position, there should not be an arrow on the controller.
|
|
249
|
+
* When using the "bottom" position there should be an arrow on the controller.
|
|
250
|
+
* @param addOffset These are the left and top values that need to be added specially.
|
|
251
|
+
* This argument is required. - {left: 0, top: 0}
|
|
252
|
+
* Please enter the value based on ltr mode.
|
|
253
|
+
* Calculated automatically in rtl mode.
|
|
254
|
+
*/
|
|
255
|
+
setControllerPosition(controller: Element, referEl: Element, position: 'top' | 'bottom', addOffset: { left: number; top: number }): void;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @description javascript execCommand
|
|
259
|
+
* @param command javascript execCommand function property
|
|
260
|
+
* @param showDefaultUI javascript execCommand function property
|
|
261
|
+
* @param value javascript execCommand function property
|
|
262
|
+
*/
|
|
263
|
+
execCommand(command: string, showDefaultUI?: boolean, value?: string): void;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* @description Focus to wysiwyg area using "native focus function"
|
|
267
|
+
*/
|
|
268
|
+
_nativeFocus(): void;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @description Focus to wysiwyg area
|
|
272
|
+
*/
|
|
273
|
+
focus(): void;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @description If "focusEl" is a component, then that component is selected; if it is a format element, the last text is selected
|
|
277
|
+
* If "focusEdge" is null, then selected last element
|
|
278
|
+
* @param focusEl Focus element
|
|
279
|
+
*/
|
|
280
|
+
focusEdge(focusEl: Element | null): void;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* @description Focusout to wysiwyg area (.blur())
|
|
284
|
+
*/
|
|
285
|
+
blur(): void;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @description Show loading box
|
|
289
|
+
*/
|
|
290
|
+
showLoading(): void;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* @description Close loading box
|
|
294
|
+
*/
|
|
295
|
+
hideLoading(): void;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @description Run plugin calls and basic commands.
|
|
299
|
+
* @param command Command string
|
|
300
|
+
* @param display Display type string ('command', 'dropdown', 'dialog', 'container')
|
|
301
|
+
* @param target The element of command button
|
|
302
|
+
*/
|
|
303
|
+
runPlugin(command: string, display: 'command' | 'dropdown' | 'dialog' | 'container', target: Element): void;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @description Execute command of command button(All Buttons except dropdown and dialog)
|
|
307
|
+
* (undo, redo, bold, underline, italic, strikethrough, subscript, superscript, removeFormat, indent, outdent, fullscreen, showBlocks, codeview, preview, print, copy, cut, paste)
|
|
308
|
+
* @param command Property of command button (data-value)
|
|
309
|
+
* @param target The element of command button
|
|
310
|
+
*/
|
|
311
|
+
commandHandler(command: commands, target: Element | null): void;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @description Add or remove the class name of "body" so that the code block is visible
|
|
315
|
+
* @param value true/false, If undefined toggle the codeView mode.
|
|
316
|
+
*/
|
|
317
|
+
showBlocks(value: boolean | undefined): void;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @description Changes to code view or wysiwyg view
|
|
321
|
+
* @param value true/false, If undefined toggle the codeView mode.
|
|
322
|
+
*/
|
|
323
|
+
codeView(value: boolean | undefined): void;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @description Changes to full screen or default screen
|
|
327
|
+
* @param value true/false, If undefined toggle the codeView mode.
|
|
328
|
+
*/
|
|
329
|
+
fullScreen(value: boolean | undefined): void;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* @description Prints the current content of the editor.
|
|
333
|
+
*/
|
|
334
|
+
print(): void;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @description Open the preview window.
|
|
338
|
+
*/
|
|
339
|
+
preview(): void;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @description Set direction to "rtl" or "ltr".
|
|
343
|
+
* @param dir "rtl" or "ltr"
|
|
344
|
+
*/
|
|
345
|
+
setDir(dir: 'rtl' | 'ltr'): void;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @description Sets the HTML string
|
|
349
|
+
* @param html HTML string
|
|
350
|
+
*/
|
|
351
|
+
setContent(html: string): void;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* @description Sets the content of the iframe's head tag and body tag when using the "iframe" or "iframe_fullPage" option.
|
|
355
|
+
* @param ctx { head: HTML string, body: HTML string}
|
|
356
|
+
*/
|
|
357
|
+
setFullPageContent(ctx: { head?: string; body?: string }): void;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* @description Gets the current content
|
|
361
|
+
* @param onlyContent Return only the content of the body without headers when the "iframe_fullPage" option is true
|
|
362
|
+
* @returns
|
|
363
|
+
*/
|
|
364
|
+
getContent(onlyContent: boolean): string;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* @description Gets the clean HTML code for editor
|
|
368
|
+
* @param html HTML string
|
|
369
|
+
* @param whitelist Regular expression of allowed tags.
|
|
370
|
+
* RegExp object is create by util.createElementWhitelist method.
|
|
371
|
+
* @param blacklist Regular expression of disallowed tags.
|
|
372
|
+
* RegExp object is create by util.createElementBlacklist method.
|
|
373
|
+
* @returns
|
|
374
|
+
*/
|
|
375
|
+
cleanHTML(html: string, whitelist?: string | RegExp, blacklist?: string | RegExp): string;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* @description Converts content into a format that can be placed in an editor
|
|
379
|
+
* @param content content
|
|
380
|
+
* @returns
|
|
381
|
+
*/
|
|
382
|
+
convertContentForEditor(content: string): string;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* @description Converts wysiwyg area element into a format that can be placed in an editor of code view mode
|
|
386
|
+
* @param html WYSIWYG element (this.editor.frameContext.get('wysiwyg')) or HTML string.
|
|
387
|
+
* @param comp If true, does not line break and indentation of tags.
|
|
388
|
+
* @returns
|
|
389
|
+
*/
|
|
390
|
+
_convertHTMLToCode(html: Element | string, comp?: boolean): string;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface Toolbar {
|
|
394
|
+
/**
|
|
395
|
+
* @description Disable the toolbar
|
|
396
|
+
*/
|
|
397
|
+
disable(): void;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* @description Enable the toolbar
|
|
401
|
+
*/
|
|
402
|
+
enable(): void;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* @description Show the toolbar
|
|
406
|
+
*/
|
|
407
|
+
show(): void;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* @description Hide the toolbar
|
|
411
|
+
*/
|
|
412
|
+
hide(): void;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
interface Wysiwyg {
|
|
416
|
+
/**
|
|
417
|
+
* @description Disable the wysiwyg area
|
|
418
|
+
*/
|
|
419
|
+
disable(): void;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @description Enable the wysiwyg area
|
|
423
|
+
*/
|
|
424
|
+
enable(): void;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
type EventFn = (e: Event, core: Core) => void;
|
|
428
|
+
|
|
429
|
+
type imageInputInformation = { linkValue: string; linkNewWindow: Window; inputWidth: number; inputHeight: number; align: string; isUpdate: boolean; element: any };
|
|
430
|
+
type videoInputInformation = { inputWidth: number; inputHeight: number; align: string; isUpdate: boolean; element: any };
|
|
431
|
+
type audioInputInformation = { isUpdate: boolean; element: any };
|
|
432
|
+
|
|
433
|
+
export default class SunEditor {
|
|
434
|
+
constructor(context: Context, pluginCallButtons: Record<string, Element>, plugins: Record<string, Plugin>, lang: Lang, options: SunEditorOptions, _icons: Record<string, string>);
|
|
435
|
+
|
|
436
|
+
core: Core;
|
|
437
|
+
util: Util;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* @description Add or reset option property
|
|
441
|
+
* @param options Options
|
|
442
|
+
*/
|
|
443
|
+
setOptions(options: SunEditorOptions): void;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @description Set "options.editorStyle" style.
|
|
447
|
+
* Define the style of the edit area
|
|
448
|
+
* It can also be defined with the "setOptions" method, but the "setEditorStyle" method does not render the editor again.
|
|
449
|
+
* @param style Style string
|
|
450
|
+
*/
|
|
451
|
+
setEditorStyle(style: string): void;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* @description Copying the content of the editor to the original textarea and execute onSave callback.
|
|
455
|
+
*/
|
|
456
|
+
save(): void;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* @description Gets the content of the suneditor
|
|
460
|
+
* @param onlyContent - Return only the content of the body without headers when the "iframe_fullPage" option is true
|
|
461
|
+
* @returns
|
|
462
|
+
*/
|
|
463
|
+
getContent(onlyContent: boolean): string;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* @description Gets only the text of the suneditor content
|
|
467
|
+
* @returns
|
|
468
|
+
*/
|
|
469
|
+
getText(): string;
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* @description Get the editor's number of characters or binary data size.
|
|
473
|
+
* You can use the "charCounter_type" option format.
|
|
474
|
+
* @param charCounter_type options - charCounter_type ('char', 'byte', 'byte-html')
|
|
475
|
+
* If argument is no value, the currently set "charCounter_type" option is used.
|
|
476
|
+
* @returns
|
|
477
|
+
*/
|
|
478
|
+
getCharCount(charCounter_type?: string): number;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* @description Gets uploaded files(plugin using fileManager) information list.
|
|
482
|
+
* image: [img], video: [video, iframe], audio: [audio]
|
|
483
|
+
* - index: data index
|
|
484
|
+
* - name: file name
|
|
485
|
+
* - size: file size
|
|
486
|
+
* - select: select function
|
|
487
|
+
* - delete: delete function
|
|
488
|
+
* - element: img element
|
|
489
|
+
* - src: src attribute of img tag
|
|
490
|
+
* @param pluginName Plugin name (image, video, audio)
|
|
491
|
+
* @returns
|
|
492
|
+
*/
|
|
493
|
+
getFilesInfo(pluginName: string): fileInfo[];
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* @description Change the content of the suneditor
|
|
497
|
+
* @param content Content to Input
|
|
498
|
+
*/
|
|
499
|
+
setContent(content: string): void;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* @description Add content to the end of content.
|
|
503
|
+
* @param content Content to Input
|
|
504
|
+
*/
|
|
505
|
+
addContent(content: string): void;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* @description Switch to or off "ReadOnly" mode.
|
|
509
|
+
* @param value "readOnly" boolean value.
|
|
510
|
+
*/
|
|
511
|
+
readOnly(value: boolean): void;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* @description Disable the suneditor
|
|
515
|
+
*/
|
|
516
|
+
disable(): void;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* @description Enable the suneditor
|
|
520
|
+
*/
|
|
521
|
+
enable(): void;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* @description Show the suneditor
|
|
525
|
+
*/
|
|
526
|
+
show(): void;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* @description Hide the suneditor
|
|
530
|
+
*/
|
|
531
|
+
hide(): void;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* @description Destroy the suneditor
|
|
535
|
+
*/
|
|
536
|
+
destroy(): void;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @description Toolbar methods
|
|
540
|
+
*/
|
|
541
|
+
toolbar: Toolbar;
|
|
542
|
+
}
|
package/typings/env.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
class env {
|
|
2
|
+
_w: Window;
|
|
3
|
+
_d: Document;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description Gets XMLHttpRequest object
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
getXMLHttpRequest(): XMLHttpRequest | ActiveXObject;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @description Returns the CSS text that has been applied to the current page.
|
|
13
|
+
* @param doc To get the CSS text of an document(core._wd). If null get the current document.
|
|
14
|
+
* @returns Styles string
|
|
15
|
+
*/
|
|
16
|
+
getPageStyle(doc?: Document): string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @description Get the the tag path of the arguments value
|
|
20
|
+
* If not found, return the first found value
|
|
21
|
+
* @param nameArray File name array
|
|
22
|
+
* @param extension js, css
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
getIncludePath(nameArray: string[], extension: string): string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Checks if User Agent is Edge
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
isEdge(): boolean;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Checks if platform is OSX or IOS
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
isOSX_IOS(): boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Checks if User Agent Blink engine.
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
isBlink(): boolean;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Checks if User Agent is Firefox (Gecko).
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
isGecko(): boolean;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Checks if User Agent is Chromium browser.
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
isChromium(): boolean;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Checks if User Agent is Safari.
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
isSafari(): boolean;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Checks if User Agent is Android mobile device.
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
isAndroid(): boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default env;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import EditorInterface from '../interface/editor';
|
|
2
|
+
class EventManager extends EditorInterface {
|
|
3
|
+
/**
|
|
4
|
+
* @description Register for an event.
|
|
5
|
+
* Only events registered with this method are unregistered or re-registered when methods such as "setOptions", "destroy" are called.
|
|
6
|
+
* @param target Target element
|
|
7
|
+
* @param type Event type
|
|
8
|
+
* @param handler Event handler
|
|
9
|
+
* @param useCapture Event useCapture option
|
|
10
|
+
*/
|
|
11
|
+
addEvent(target: Element, type: string, handler: Function, useCapture?: boolean): void;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @description Add an event to document.
|
|
15
|
+
* When created as an Iframe, the same event is added to the document in the Iframe.
|
|
16
|
+
* @param type Event type
|
|
17
|
+
* @param listener Event listener
|
|
18
|
+
* @param useCapture Use event capture
|
|
19
|
+
*/
|
|
20
|
+
addGlobalEvent(type: string, listener: EventListener, useCapture: boolean): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @description Remove events from document.
|
|
24
|
+
* When created as an Iframe, the event of the document inside the Iframe is also removed.
|
|
25
|
+
* @param type Event type
|
|
26
|
+
* @param listener Event listener
|
|
27
|
+
*/
|
|
28
|
+
removeGlobalEvent(type: string, listener: EventListener): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @description Activates the corresponding button with the tags information of the current cursor position,
|
|
32
|
+
* such as "bold", "underline", etc., and executes the "active" method of the plugins.
|
|
33
|
+
*/
|
|
34
|
+
applyTagEffect(): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default EventManager;
|