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
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import EditorInterface from '../interface/editor';
|
|
2
|
+
|
|
3
|
+
class Events extends EditorInterface {
|
|
4
|
+
onload: (reload: boolean) => void;
|
|
5
|
+
onScroll: EventFn;
|
|
6
|
+
onFocus: EventFn;
|
|
7
|
+
onMouseDown: EventFn;
|
|
8
|
+
onClick: EventFn;
|
|
9
|
+
onInput: EventFn;
|
|
10
|
+
onMouseLeave: EventFn;
|
|
11
|
+
onKeyDown: EventFn;
|
|
12
|
+
onKeyUp: EventFn;
|
|
13
|
+
onChange: (content: string) => void;
|
|
14
|
+
onBlur: (e: FocusEvent) => void;
|
|
15
|
+
onDrop: (e: Event, cleanData: string, maxCharCount: number) => boolean | string;
|
|
16
|
+
onPaste: (e: Event, cleanData: string, maxCharCount: number) => boolean | string;
|
|
17
|
+
onCopy: (e: Event, clipboardData: any) => boolean;
|
|
18
|
+
onCut: (e: Event, clipboardData: any) => boolean;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description Called just after the save was executed.
|
|
22
|
+
* @param content Editor content
|
|
23
|
+
* @param core Core object
|
|
24
|
+
*/
|
|
25
|
+
onSave: (content: string, core: Core) => void;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @description Called just before the inline toolbar is positioned and displayed on the screen.
|
|
29
|
+
* @param toolbar Toolbar Element
|
|
30
|
+
*/
|
|
31
|
+
onShowToolbar: (toolbar: Element) => void;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @description Called just after the controller is positioned and displayed on the screen.
|
|
35
|
+
* controller - editing elements displayed on the screen [image resizing, table editor, link editor..]]
|
|
36
|
+
* @param name The name of the plugin that called the controller
|
|
37
|
+
* @param controllers Array of Controller elements
|
|
38
|
+
* @param core Core object
|
|
39
|
+
*/
|
|
40
|
+
onShowController: (name: string, controllers: Controllers) => void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @description It replaces the default callback function of the image upload
|
|
44
|
+
* @param xmlHttp xmlHttpRequest object
|
|
45
|
+
* @param info Input information
|
|
46
|
+
* - linkValue: Link url value
|
|
47
|
+
* - linkNewWindow: Open in new window Check Value
|
|
48
|
+
* - inputWidth: Value of width input
|
|
49
|
+
* - inputHeight: Value of height input
|
|
50
|
+
* - align: Align Check Value
|
|
51
|
+
* - isUpdate: Update image if true, create image if false
|
|
52
|
+
* - element: If isUpdate is true, the currently selected image.
|
|
53
|
+
* @param core Core object
|
|
54
|
+
*/
|
|
55
|
+
imageUploadHandler: (xmlHttp: XMLHttpRequest, info: imageInputInformation) => void;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @description It replaces the default callback function of the video upload
|
|
59
|
+
* @param xmlHttp xmlHttpRequest object
|
|
60
|
+
* @param info Input information
|
|
61
|
+
* - inputWidth: Value of width input
|
|
62
|
+
* - inputHeight: Value of height input
|
|
63
|
+
* - align: Align Check Value
|
|
64
|
+
* - isUpdate: Update video if true, create video if false
|
|
65
|
+
* - element: If isUpdate is true, the currently selected video.
|
|
66
|
+
* @param core Core object
|
|
67
|
+
*/
|
|
68
|
+
videoUploadHandler: (xmlHttp: XMLHttpRequest, info: videoInputInformation) => void;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @description It replaces the default callback function of the audio upload
|
|
72
|
+
* @param xmlHttp xmlHttpRequest object
|
|
73
|
+
* @param info Input information
|
|
74
|
+
* - isUpdate: Update audio if true, create audio if false
|
|
75
|
+
* - element: If isUpdate is true, the currently selected audio.
|
|
76
|
+
* @param core Core object
|
|
77
|
+
*/
|
|
78
|
+
audioUploadHandler: (xmlHttp: XMLHttpRequest, info: audioInputInformation) => void;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @description An event when toggling between code view and wysiwyg view.
|
|
82
|
+
* @param isCodeView Whether the current code view mode
|
|
83
|
+
* @param core Core object
|
|
84
|
+
*/
|
|
85
|
+
onToggleCodeView: (isCodeView: boolean) => void;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @description An event when toggling full screen.
|
|
89
|
+
* @param isFullScreen Whether the current full screen mode
|
|
90
|
+
* @param core Core object
|
|
91
|
+
*/
|
|
92
|
+
onToggleFullScreen: (isFullScreen: boolean) => void;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @description Called before the image is uploaded
|
|
96
|
+
* If true is returned, the internal upload process runs normally.
|
|
97
|
+
* If false is returned, no image upload is performed.
|
|
98
|
+
* If new fileList are returned, replaced the previous fileList
|
|
99
|
+
* If undefined is returned, it waits until "uploadHandler" is executed.
|
|
100
|
+
* @param files Files array
|
|
101
|
+
* @param info Input information
|
|
102
|
+
* @param core Core object
|
|
103
|
+
* @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
|
|
104
|
+
* "uploadHandler" is an upload function with "core" and "info" bound.
|
|
105
|
+
* [upload files] : uploadHandler(files or [new File(...),])
|
|
106
|
+
* [error] : uploadHandler("Error message")
|
|
107
|
+
* [Just finish] : uploadHandler()
|
|
108
|
+
* [directly register] : uploadHandler(response) // Same format as "imageUploadUrl" response
|
|
109
|
+
* ex) {
|
|
110
|
+
* // "errorMessage": "insert error message",
|
|
111
|
+
* "result": [ { "url": "...", "name": "...", "size": "999" }, ]
|
|
112
|
+
* }
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
onImageUploadBefore: (files: any[], info: imageInputInformation, uploadHandler: Function) => boolean | any[] | undefined;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @description Called before the video is uploaded
|
|
119
|
+
* If true is returned, the internal upload process runs normally.
|
|
120
|
+
* If false is returned, no video upload is performed.
|
|
121
|
+
* If new fileList are returned, replaced the previous fileList
|
|
122
|
+
* If undefined is returned, it waits until "uploadHandler" is executed.
|
|
123
|
+
* @param files Files array
|
|
124
|
+
* @param info Input information
|
|
125
|
+
* @param core Core object
|
|
126
|
+
* @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
|
|
127
|
+
* "uploadHandler" is an upload function with "core" and "info" bound.
|
|
128
|
+
* [upload files] : uploadHandler(files or [new File(...),])
|
|
129
|
+
* [error] : uploadHandler("Error message")
|
|
130
|
+
* [Just finish] : uploadHandler()
|
|
131
|
+
* [directly register] : uploadHandler(response) // Same format as "videoUploadUrl" response
|
|
132
|
+
* ex) {
|
|
133
|
+
* // "errorMessage": "insert error message",
|
|
134
|
+
* "result": [ { "url": "...", "name": "...", "size": "999" }, ]
|
|
135
|
+
* }
|
|
136
|
+
* @returns
|
|
137
|
+
*/
|
|
138
|
+
onVideoUploadBefore: (files: any[], info: videoInputInformation, uploadHandler: Function) => boolean | any[] | undefined;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @description Called before the audio is uploaded
|
|
142
|
+
* If true is returned, the internal upload process runs normally.
|
|
143
|
+
* If false is returned, no audio upload is performed.
|
|
144
|
+
* If new fileList are returned, replaced the previous fileList
|
|
145
|
+
* If undefined is returned, it waits until "uploadHandler" is executed.
|
|
146
|
+
* @param files Files array
|
|
147
|
+
* @param info Input information
|
|
148
|
+
* @param core Core object
|
|
149
|
+
* @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
|
|
150
|
+
* "uploadHandler" is an upload function with "core" and "info" bound.
|
|
151
|
+
* [upload files] : uploadHandler(files or [new File(...),])
|
|
152
|
+
* [error] : uploadHandler("Error message")
|
|
153
|
+
* [Just finish] : uploadHandler()
|
|
154
|
+
* [directly register] : uploadHandler(response) // Same format as "audioUploadUrl" response
|
|
155
|
+
* ex) {
|
|
156
|
+
* // "errorMessage": "insert error message",
|
|
157
|
+
* "result": [ { "url": "...", "name": "...", "size": "999" }, ]
|
|
158
|
+
* }
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
onAudioUploadBefore: (files: any[], info: audioInputInformation, uploadHandler: Function) => boolean | any[] | undefined;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @description Called when the image is uploaded, updated, deleted
|
|
165
|
+
* @param targetElement Target element
|
|
166
|
+
* @param index Uploaded index
|
|
167
|
+
* @param state Upload status ('create', 'update', 'delete')
|
|
168
|
+
* @param info Info object
|
|
169
|
+
* - index: data index
|
|
170
|
+
* - name: file name
|
|
171
|
+
* - size: file size
|
|
172
|
+
* - select: select function
|
|
173
|
+
* - delete: delete function
|
|
174
|
+
* - element: target element
|
|
175
|
+
* - src: src attribute of tag
|
|
176
|
+
* @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
|
|
177
|
+
* @param core Core object
|
|
178
|
+
*/
|
|
179
|
+
onImageAction: (targetElement: HTMLImageElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number) => void;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @description Called when the video(iframe, video) is uploaded, updated, deleted
|
|
183
|
+
* @param targetElement Target element
|
|
184
|
+
* @param index Uploaded index
|
|
185
|
+
* @param state Upload status ('create', 'update', 'delete')
|
|
186
|
+
* @param info Info object
|
|
187
|
+
* - index: data index
|
|
188
|
+
* - name: file name
|
|
189
|
+
* - size: file size
|
|
190
|
+
* - select: select function
|
|
191
|
+
* - delete: delete function
|
|
192
|
+
* - element: target element
|
|
193
|
+
* - src: src attribute of tag
|
|
194
|
+
* @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
|
|
195
|
+
* @param core Core object
|
|
196
|
+
*/
|
|
197
|
+
onVideoAction: (targetElement: HTMLIFrameElement | HTMLVideoElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number) => void;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @description Called when the audio is uploaded, updated, deleted
|
|
201
|
+
* @param targetElement Target element
|
|
202
|
+
* @param index Uploaded index
|
|
203
|
+
* @param state Upload status ('create', 'update', 'delete')
|
|
204
|
+
* @param info Info object
|
|
205
|
+
* - index: data index
|
|
206
|
+
* - name: file name
|
|
207
|
+
* - size: file size
|
|
208
|
+
* - select: select function
|
|
209
|
+
* - delete: delete function
|
|
210
|
+
* - element: target element
|
|
211
|
+
* - src: src attribute of tag
|
|
212
|
+
* @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
|
|
213
|
+
* @param core Core object
|
|
214
|
+
*/
|
|
215
|
+
onAudioAction: (targetElement: HTMLAudioElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number) => void;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @description Called when the image is upload failed
|
|
219
|
+
* @param errorMessage Error message
|
|
220
|
+
* @param result Response Object
|
|
221
|
+
* @param core Core object
|
|
222
|
+
* @returns
|
|
223
|
+
*/
|
|
224
|
+
onImageUploadError: (errorMessage: string, result: any) => boolean;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @description Called when the video(iframe, video) upload failed
|
|
228
|
+
* @param errorMessage Error message
|
|
229
|
+
* @param result Response Object
|
|
230
|
+
* @param core Core object
|
|
231
|
+
* @returns
|
|
232
|
+
*/
|
|
233
|
+
onVideoUploadError: (errorMessage: string, result: any) => boolean;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @description Called when the audio upload failed
|
|
237
|
+
* @param errorMessage Error message
|
|
238
|
+
* @param result Response Object
|
|
239
|
+
* @param core Core object
|
|
240
|
+
* @returns
|
|
241
|
+
*/
|
|
242
|
+
onAudioUploadError: (errorMessage: string, result: any) => boolean;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @description Called when the audio upload failed
|
|
246
|
+
* @param height Height after resized (px)
|
|
247
|
+
* @param prevHeight Prev height before resized (px)
|
|
248
|
+
* @param resizeObserverEntry ResizeObserverEntry object
|
|
249
|
+
* @returns
|
|
250
|
+
*/
|
|
251
|
+
onResizeEditor: (height: number, prevHeight: number, core: Core, resizeObserverEntry: ResizeObserverEntry | null) => {};
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @description Called after the "setToolbarButtons" invocation.
|
|
255
|
+
* Can be used to tweak buttons properties (useful for custom buttons)
|
|
256
|
+
* @param buttonTray Button tray element
|
|
257
|
+
* @param core Core object
|
|
258
|
+
*/
|
|
259
|
+
onSetToolbarButtons: (buttonTray: Element, core: Core) => void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export default Events;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Module } from '../Module';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description This is a required module of fileBrowser plugin.
|
|
5
|
+
Require context properties when using fileBrowser module:
|
|
6
|
+
title(@Required): "File browser window title",
|
|
7
|
+
url(@Required): "File server url",
|
|
8
|
+
listClass(@Required): "Class name of list div",
|
|
9
|
+
itemTemplateHandler(@Required): "Function that defines the HTML of an file item",
|
|
10
|
+
selectorHandler(@Required): "Function that action when item click",
|
|
11
|
+
columnSize(@Option): "Number of "div.se-file-item-column" to be created (default: 4)"
|
|
12
|
+
*/
|
|
13
|
+
declare interface fileBrowser extends Module {
|
|
14
|
+
/**
|
|
15
|
+
* @description Open a file browser window
|
|
16
|
+
* @param pluginName Plugin name using the file browser
|
|
17
|
+
* @param selectorHandler When the function comes as an argument value, it substitutes "context.selectorHandler".
|
|
18
|
+
* @example this.plugins.fileBrowser.open.call(this, 'imageGallery', (selectorHandler || null));
|
|
19
|
+
*/
|
|
20
|
+
open(kind: string, update: boolean): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @description Define the HTML of the item to be put in "div.se-file-item-column".
|
|
24
|
+
* @param item Item of the response data's array
|
|
25
|
+
*/
|
|
26
|
+
drawItems: (item: object) => string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @description Close a file browser window
|
|
30
|
+
* The plugin's "init" method is called.
|
|
31
|
+
* @example this.plugins.fileBrowser.close.call(this);
|
|
32
|
+
*/
|
|
33
|
+
close(): void;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @description This method is called when the file browser window is closed.
|
|
37
|
+
* Initialize the properties.
|
|
38
|
+
*/
|
|
39
|
+
init?: () => void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default fileBrowser;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Module } from '../Module';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Require context properties when fileManager module
|
|
5
|
+
_infoList: [],
|
|
6
|
+
_infoIndex: 0,
|
|
7
|
+
_uploadFileLength: 0
|
|
8
|
+
*/
|
|
9
|
+
declare interface fileManager extends Module {
|
|
10
|
+
/**
|
|
11
|
+
* @description Upload the file to the server.
|
|
12
|
+
* @param uploadUrl Upload server url
|
|
13
|
+
* @param uploadHeader Request header
|
|
14
|
+
* @param formData FormData in body
|
|
15
|
+
* @param callBack Success call back function
|
|
16
|
+
* @param errorCallBack Error call back function
|
|
17
|
+
* @example this.plugins.fileManager.upload.call(this, imageUploadUrl, this.options.imageUploadHeader, formData, this.plugins.image.callBack_imgUpload.bind(this, info), this.events.onImageUploadError);
|
|
18
|
+
*/
|
|
19
|
+
upload(uploadUrl: string, uploadHeader: Record<string, string> | null, formData: FormData, callBack: Function | null, errorCallBack: Function | null): void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @description Checke the file's information and modify the tag that does not fit the format.
|
|
23
|
+
* @param pluginName Plugin name
|
|
24
|
+
* @param tagNames Tag array to check
|
|
25
|
+
* @param uploadEventHandler Event handler to process updated file info after checking (used in "setInfo")
|
|
26
|
+
* @param modifyHandler A function to modify a tag that does not fit the format (Argument value: Tag element)
|
|
27
|
+
* @param resizing True if the plugin is using a resizing module
|
|
28
|
+
* @example
|
|
29
|
+
* const modifyHandler = function (tag) {
|
|
30
|
+
* imagePlugin.onModifyMode.call(this, tag, null);
|
|
31
|
+
* imagePlugin.openModify.call(this, true);
|
|
32
|
+
* imagePlugin.update_image.call(this, true, false, true);
|
|
33
|
+
* }.bind(this);
|
|
34
|
+
* this.plugins.fileManager.checkInfo.call(this, 'image', ['img'], this.events.onImageUpload, modifyHandler, true);
|
|
35
|
+
*/
|
|
36
|
+
checkInfo(pluginName: string, tagNames: string[], uploadEventHandler: Function | null, modifyHandler: Function | null, resizing: boolean): void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @description Create info object of file and add it to "_infoList" (this.context[pluginName]._infoList[])
|
|
40
|
+
* @param pluginName Plugin name
|
|
41
|
+
* @param element
|
|
42
|
+
* @param uploadEventHandler Event handler to process updated file info (created in setInfo)
|
|
43
|
+
* @param file
|
|
44
|
+
* @param resizing True if the plugin is using a resizing module
|
|
45
|
+
* @example
|
|
46
|
+
* uploadCallBack {.. file = { name: fileList[i].name, size: fileList[i].size };
|
|
47
|
+
* this.plugins.fileManager.setInfo.call(this, 'image', oImg, this.events.onImageUpload, file, true);
|
|
48
|
+
*/
|
|
49
|
+
setInfo(pluginName: string, element, uploadEventHandler: Function | null, file: Record<string, string | number> | null, resizing: boolean): void;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @description Delete info object at "_infoList"
|
|
53
|
+
* @param pluginName Plugin name
|
|
54
|
+
* @param index index of info object (this.context[pluginName]._infoList[].index)
|
|
55
|
+
* @param uploadEventHandler Event handler to process updated file info (created in setInfo)
|
|
56
|
+
*/
|
|
57
|
+
deleteInfo(pluginName: string, index, uploadEventHandler: Function | null): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @description Reset info object and "_infoList = []", "_infoIndex = 0"
|
|
61
|
+
* @param pluginName Plugin name
|
|
62
|
+
* @param uploadEventHandler Event handler to process updated file info (created in setInfo)
|
|
63
|
+
*/
|
|
64
|
+
resetInfo(pluginName: string, uploadEventHandler: Function | null): void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default fileManager;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import EditorInterface from '../../interface/editor';
|
|
2
|
+
|
|
3
|
+
class Format extends EditorInterface {
|
|
4
|
+
/**
|
|
5
|
+
* @description Replace the line tag of the current selection.
|
|
6
|
+
* @param element Line element (P, DIV..)
|
|
7
|
+
*/
|
|
8
|
+
setLine(element: Element): void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description If a parent node that contains an argument node finds a format node (format.isLine), it returns that node.
|
|
12
|
+
* @param node Reference node.
|
|
13
|
+
* @param validation Additional validation function.
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
getLine(node: Node, validation?: Function | null): Element | null;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @description Replace the br-line tag of the current selection.
|
|
20
|
+
* @param element Line element (P, DIV..)
|
|
21
|
+
*/
|
|
22
|
+
setBrLine(element: Element);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @description If a parent node that contains an argument node finds a free format node (format.isBrLine), it returns that node.
|
|
26
|
+
* @param element Reference node.
|
|
27
|
+
* @param validation Additional validation function.
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
getBrLine(node: Node, validation?: Function | null): Element | null;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @description Append format element to sibling node of argument element.
|
|
34
|
+
* If the "formatNodeName" argument value is present, the tag of that argument value is inserted,
|
|
35
|
+
* If not, the currently selected format tag is inserted.
|
|
36
|
+
* @param element Insert as siblings of that element
|
|
37
|
+
* @param formatNode Node name or node obejct to be inserted
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
addLine(element: Element, formatNode?: string | Element): Element;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @description If a parent node that contains an argument node finds a format node (editor.format.isBlock), it returns that node.
|
|
44
|
+
* @param element Reference node.
|
|
45
|
+
* @param validation Additional validation function.
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
getBlock(element: Node, validation?: Function): Element | null;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @description Appended all selected format Element to the argument element and insert
|
|
52
|
+
* @param block Element of wrap the arguments (BLOCKQUOTE...)
|
|
53
|
+
*/
|
|
54
|
+
applyBlock(block: Element): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @description The elements of the "selectedFormats" array are detached from the "rangeElement" element. ("LI" tags are converted to "P" tags)
|
|
58
|
+
* When "selectedFormats" is null, all elements are detached and return {cc: parentNode, sc: nextSibling, ec: previousSibling, removeArray: [Array of removed elements]}.
|
|
59
|
+
* @param rangeElement Range format element (PRE, BLOCKQUOTE, OL, UL...)
|
|
60
|
+
* @param selectedFormats Array of format elements (P, DIV, LI...) to remove.
|
|
61
|
+
* If null, Applies to all elements and return {cc: parentNode, sc: nextSibling, ec: previousSibling}
|
|
62
|
+
* @param newRangeElement The node(rangeElement) to replace the currently wrapped node.
|
|
63
|
+
* @param remove If true, deleted without detached.
|
|
64
|
+
* @param notHistoryPush When true, it does not update the history stack and the selection object and return EdgeNodes (util.getEdgeChildNodes)
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
removeBlock(rangeElement: Element, selectedFormats: Element[] | null, newRangeElement: Element | null, remove: boolean, notHistoryPush: boolean): { cc: Node; sc: Node; ec: Node; removeArray: Element[] };
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @description Append all selected format Element to the list and insert.
|
|
71
|
+
* @param type List type. (bullet | numbered):[listStyleType]
|
|
72
|
+
* @param selectedCells Format elements or list cells.
|
|
73
|
+
* @param nested If true, indenting existing list cells.
|
|
74
|
+
*/
|
|
75
|
+
applyList(type: string, selectedCells: Element[], nested: boolean);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @description "selectedCells" array are detached from the list element.
|
|
79
|
+
* The return value is applied when the first and last lines of "selectedFormats" are "LI" respectively.
|
|
80
|
+
* @param selectedCells Array of format elements (LI, P...) to remove.
|
|
81
|
+
* @param remove If true, It does not just remove the list, it deletes the content.
|
|
82
|
+
* @returns {sc: <LI>, ec: <LI>}.
|
|
83
|
+
*/
|
|
84
|
+
removeList(selectedCells: Element[], remove: boolean): { sc: Element; ec: Element };
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @description Indent more the selected lines.
|
|
88
|
+
* margin size - "status.indentSize"px
|
|
89
|
+
*/
|
|
90
|
+
indent(): void;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @description Indent less the selected lines.
|
|
94
|
+
* margin size - "status.indentSize"px
|
|
95
|
+
*/
|
|
96
|
+
outdent(): void;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @description Add, update, and delete style node from selected text. (a, span, strong, ect.)
|
|
100
|
+
* 1. If there is a node in the "styleNode" argument, a node with the same tags and attributes as "styleNode" is added to the selection text.
|
|
101
|
+
* 2. If it is in the same tag, only the tag's attributes are changed without adding a tag.
|
|
102
|
+
* 3. If the "styleNode" argument is null, the node of the selection is update or remove without adding a new node.
|
|
103
|
+
* 4. The same style as the style attribute of the "styleArray" argument is deleted.
|
|
104
|
+
* (Styles should be put with attribute names from css. ["background-color"])
|
|
105
|
+
* 5. The same class name as the class attribute of the "styleArray" argument is deleted.
|
|
106
|
+
* (The class name is preceded by "." [".className"])
|
|
107
|
+
* 6. Use a list of styles and classes of "styleNode" in "styleArray" to avoid duplicate property values.
|
|
108
|
+
* 7. If a node with all styles and classes removed has the same tag name as "styleNode" or "removeNodeArray", or "styleNode" is null, that node is deleted.
|
|
109
|
+
* 8. Regardless of the style and class of the node, the tag with the same name as the "removeNodeArray" argument value is deleted.
|
|
110
|
+
* 9. If the "strictRemove" argument is true, only nodes with all styles and classes removed from the nodes of "removeNodeArray" are removed.
|
|
111
|
+
* 10. It won't work if the parent node has the same class and same value style.
|
|
112
|
+
* However, if there is a value in "removeNodeArray", it works and the text node is separated even if there is no node to replace.
|
|
113
|
+
* @param styleNode The element to be added to the selection. If it is null, only delete the node.
|
|
114
|
+
* @param styleArray The style or className attribute name Array to check (['font-size'], ['.className'], ['font-family', 'color', '.className']...])
|
|
115
|
+
* @param removeNodeArray An array of node names to remove types from, remove all formats when "styleNode" is null and there is an empty array or null value. (['span'], ['strong', 'em'] ...])
|
|
116
|
+
* @param strictRemove If true, only nodes with all styles and classes removed from the nodes of "removeNodeArray" are removed.
|
|
117
|
+
*/
|
|
118
|
+
applyTextStyle(styleNode?: Element, styleArray?: string[], removeNodeArray?: string[], strictRemove?: boolean): void;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @description Remove format of the currently selected text
|
|
122
|
+
*/
|
|
123
|
+
removeTextStyle(): void;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @description Check if the container and offset values are the edges of the "line"
|
|
127
|
+
* @param container The container property of the selection object.
|
|
128
|
+
* @param offset The offset property of the selection object.
|
|
129
|
+
* @param dir Select check point - "front": Front edge, "end": End edge, undefined: Both edge.
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
isEdgeLine(container: Node, offset: number, dir: 'front' | 'end'): boolean;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @description It is judged whether it is a node related to the text style.
|
|
136
|
+
* (strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label)
|
|
137
|
+
* @param element The node to check
|
|
138
|
+
* @returns
|
|
139
|
+
*/
|
|
140
|
+
isTextStyleNode(element: Node): boolean;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @description It is judged whether it is the format element (P, DIV, H[1-6], PRE, LI | class="__se__format__line_xxx")
|
|
144
|
+
* Format element also contain "free format Element"
|
|
145
|
+
* @param element The node to check
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
isLine(element: Node): boolean;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @description It is judged whether it is the free format element. (PRE | class="__se__format__br_line_xxx")
|
|
152
|
+
* Free format elements is included in the format element.
|
|
153
|
+
* Free format elements's line break is "BR" tag.
|
|
154
|
+
* ※ Entering the Enter key in the space on the last line ends "Free Format" and appends "Format".
|
|
155
|
+
* @param element The node to check
|
|
156
|
+
* @returns
|
|
157
|
+
*/
|
|
158
|
+
isBrLine(element: Node): boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @description It is judged whether it is the closure free format element. (class="__se__format__br_line__closure_xxx")
|
|
162
|
+
* Closure free format elements is included in the free format element.
|
|
163
|
+
* - Closure free format elements's line break is "BR" tag.
|
|
164
|
+
* ※ You cannot exit this format with the Enter key.
|
|
165
|
+
* ※ Use it only in special cases. ([ex] format of table cells)
|
|
166
|
+
* @param element The node to check
|
|
167
|
+
* @returns
|
|
168
|
+
*/
|
|
169
|
+
isClosureBrLine(element: Node): boolean;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @description It is judged whether it is the range format element. (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__block_xxx")
|
|
173
|
+
* * Range format element is wrap the line element
|
|
174
|
+
* @param element The node to check
|
|
175
|
+
* @returns
|
|
176
|
+
*/
|
|
177
|
+
isBlock(element: Node): boolean;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @description It is judged whether it is the closure range format element. (TH, TD | class="__se__format__block_closure_xxx")
|
|
181
|
+
* Closure range format elements is included in the range format element.
|
|
182
|
+
* - Closure range format element is wrap the "format element" and "component"
|
|
183
|
+
* ※ You cannot exit this format with the Enter key or Backspace key.
|
|
184
|
+
* ※ Use it only in special cases. ([ex] format of table cells)
|
|
185
|
+
* @param element The node to check
|
|
186
|
+
* @returns
|
|
187
|
+
*/
|
|
188
|
+
isClosureBlock(element: Node): boolean;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export default Format;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Core } from './editor';
|
|
2
|
+
|
|
3
|
+
export interface History {
|
|
4
|
+
/**
|
|
5
|
+
* @description History stack
|
|
6
|
+
*/
|
|
7
|
+
stack: any[];
|
|
8
|
+
/**
|
|
9
|
+
* @description Saving the current status to the history object stack
|
|
10
|
+
* If "delay" is true, it will be saved after (options.historyStackDelayTime || 400) miliseconds
|
|
11
|
+
* If the function is called again with the "delay" argument true before it is saved, the delay time is renewal
|
|
12
|
+
* You can specify the delay time by sending a number.
|
|
13
|
+
* @param {boolean} delay If true, Add stack without delay time.
|
|
14
|
+
*/
|
|
15
|
+
push: (delay: boolean | number) => void;
|
|
16
|
+
/**
|
|
17
|
+
* @description Undo function
|
|
18
|
+
*/
|
|
19
|
+
undo: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* @description Redo function
|
|
22
|
+
*/
|
|
23
|
+
redo: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* @description Go to the history stack for that index.
|
|
26
|
+
* If "index" is -1, go to the last stack
|
|
27
|
+
* @param {number} index Stack index
|
|
28
|
+
*/
|
|
29
|
+
go: (index: number) => void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Get the current history stack index.
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
getCurrentIndex: () => number;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description Reset the history object
|
|
39
|
+
*/
|
|
40
|
+
reset: (ignoreChangeEvent: any) => void;
|
|
41
|
+
/**
|
|
42
|
+
* @description Remove all stacks and remove the timeout function.
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
destroy: () => void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default function _default(core: Core, change: any): History;
|