suneditor 3.0.0-alpha.9 → 3.0.0-beta.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/CONTRIBUTING.md +170 -22
- package/{LICENSE.txt → LICENSE} +9 -9
- package/README.md +168 -30
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +47 -21
- package/src/assets/design/color.css +121 -0
- package/src/assets/design/index.css +3 -0
- package/src/assets/design/size.css +35 -0
- package/src/assets/design/typography.css +37 -0
- package/src/assets/icons/defaultIcons.js +232 -0
- package/src/assets/suneditor-contents.css +181 -46
- package/src/assets/suneditor.css +1403 -650
- package/src/core/base/eventHandlers/handler_toolbar.js +35 -14
- package/src/core/base/eventHandlers/handler_ww_clipboard.js +23 -4
- package/src/core/base/eventHandlers/handler_ww_dragDrop.js +49 -10
- package/src/core/base/eventHandlers/handler_ww_key_input.js +422 -224
- package/src/core/base/eventHandlers/handler_ww_mouse.js +83 -36
- package/src/core/base/eventManager.js +520 -179
- package/src/core/base/history.js +95 -41
- package/src/core/class/char.js +26 -11
- package/src/core/class/component.js +345 -137
- package/src/core/class/format.js +683 -519
- package/src/core/class/html.js +485 -305
- package/src/core/class/menu.js +133 -47
- package/src/core/class/nodeTransform.js +90 -71
- package/src/core/class/offset.js +408 -92
- package/src/core/class/selection.js +216 -106
- package/src/core/class/shortcuts.js +68 -8
- package/src/core/class/toolbar.js +106 -116
- package/src/core/class/ui.js +422 -0
- package/src/core/class/viewer.js +178 -74
- package/src/core/editor.js +496 -389
- package/src/core/section/actives.js +123 -27
- package/src/core/section/constructor.js +615 -206
- package/src/core/section/context.js +28 -23
- package/src/core/section/documentType.js +561 -0
- package/src/editorInjector/_classes.js +19 -5
- package/src/editorInjector/_core.js +71 -7
- package/src/editorInjector/index.js +63 -1
- package/src/events.js +622 -0
- package/src/helper/clipboard.js +59 -0
- package/src/helper/converter.js +202 -26
- package/src/helper/dom/domCheck.js +304 -0
- package/src/helper/dom/domQuery.js +669 -0
- package/src/helper/dom/domUtils.js +557 -0
- package/src/helper/dom/index.js +12 -0
- package/src/helper/env.js +46 -56
- package/src/helper/index.js +10 -4
- package/src/helper/keyCodeMap.js +183 -0
- package/src/helper/numbers.js +12 -8
- package/src/helper/unicode.js +9 -5
- package/src/langs/ckb.js +74 -4
- package/src/langs/cs.js +72 -2
- package/src/langs/da.js +73 -3
- package/src/langs/de.js +73 -4
- package/src/langs/en.js +23 -3
- package/src/langs/es.js +73 -4
- package/src/langs/fa.js +75 -3
- package/src/langs/fr.js +73 -3
- package/src/langs/he.js +73 -4
- package/src/langs/hu.js +230 -0
- package/src/langs/index.js +7 -3
- package/src/langs/it.js +70 -1
- package/src/langs/ja.js +72 -4
- package/src/langs/km.js +230 -0
- package/src/langs/ko.js +22 -2
- package/src/langs/lv.js +74 -5
- package/src/langs/nl.js +73 -4
- package/src/langs/pl.js +73 -4
- package/src/langs/pt_br.js +70 -1
- package/src/langs/ro.js +74 -5
- package/src/langs/ru.js +73 -4
- package/src/langs/se.js +73 -4
- package/src/langs/tr.js +73 -1
- package/src/langs/{ua.js → uk.js} +75 -6
- package/src/langs/ur.js +77 -8
- package/src/langs/zh_cn.js +74 -5
- package/src/modules/ApiManager.js +77 -54
- package/src/modules/Browser.js +667 -0
- package/src/modules/ColorPicker.js +162 -102
- package/src/modules/Controller.js +273 -142
- package/src/modules/Figure.js +925 -484
- package/src/modules/FileManager.js +121 -69
- package/src/modules/HueSlider.js +113 -61
- package/src/modules/Modal.js +291 -122
- package/src/modules/ModalAnchorEditor.js +383 -234
- package/src/modules/SelectMenu.js +270 -168
- package/src/modules/_DragHandle.js +2 -1
- package/src/modules/index.js +3 -3
- package/src/plugins/browser/audioGallery.js +83 -0
- package/src/plugins/browser/fileBrowser.js +103 -0
- package/src/plugins/browser/fileGallery.js +83 -0
- package/src/plugins/browser/imageGallery.js +81 -0
- package/src/plugins/browser/videoGallery.js +103 -0
- package/src/plugins/command/blockquote.js +40 -27
- package/src/plugins/command/exportPDF.js +134 -0
- package/src/plugins/command/fileUpload.js +229 -162
- package/src/plugins/command/list_bulleted.js +83 -47
- package/src/plugins/command/list_numbered.js +83 -47
- package/src/plugins/dropdown/align.js +66 -54
- package/src/plugins/dropdown/backgroundColor.js +63 -49
- package/src/plugins/dropdown/font.js +71 -47
- package/src/plugins/dropdown/fontColor.js +63 -48
- package/src/plugins/dropdown/formatBlock.js +70 -33
- package/src/plugins/dropdown/hr.js +92 -51
- package/src/plugins/dropdown/layout.js +37 -26
- package/src/plugins/dropdown/lineHeight.js +54 -38
- package/src/plugins/dropdown/list.js +60 -45
- package/src/plugins/dropdown/paragraphStyle.js +51 -30
- package/src/plugins/dropdown/table.js +2003 -813
- package/src/plugins/dropdown/template.js +38 -26
- package/src/plugins/dropdown/textStyle.js +43 -31
- package/src/plugins/field/mention.js +147 -86
- package/src/plugins/index.js +32 -6
- package/src/plugins/input/fontSize.js +161 -108
- package/src/plugins/input/pageNavigator.js +70 -0
- package/src/plugins/modal/audio.js +358 -173
- package/src/plugins/modal/drawing.js +531 -0
- package/src/plugins/modal/embed.js +886 -0
- package/src/plugins/modal/image.js +674 -362
- package/src/plugins/modal/link.js +100 -71
- package/src/plugins/modal/math.js +367 -167
- package/src/plugins/modal/video.js +691 -335
- package/src/plugins/popup/anchor.js +222 -0
- package/src/suneditor.js +50 -13
- package/src/themes/dark.css +122 -0
- package/src/typedef.js +130 -0
- package/types/assets/icons/defaultIcons.d.ts +153 -0
- package/types/core/base/eventHandlers/handler_toolbar.d.ts +41 -0
- package/types/core/base/eventHandlers/handler_ww_clipboard.d.ts +40 -0
- package/types/core/base/eventHandlers/handler_ww_dragDrop.d.ts +35 -0
- package/types/core/base/eventHandlers/handler_ww_key_input.d.ts +45 -0
- package/types/core/base/eventHandlers/handler_ww_mouse.d.ts +39 -0
- package/types/core/base/eventManager.d.ts +385 -0
- package/types/core/base/history.d.ts +81 -0
- package/types/core/class/char.d.ts +60 -0
- package/types/core/class/component.d.ts +212 -0
- package/types/core/class/format.d.ts +616 -0
- package/types/core/class/html.d.ts +422 -0
- package/types/core/class/menu.d.ts +126 -0
- package/types/core/class/nodeTransform.d.ts +93 -0
- package/types/core/class/offset.d.ts +522 -0
- package/types/core/class/selection.d.ts +188 -0
- package/types/core/class/shortcuts.d.ts +142 -0
- package/types/core/class/toolbar.d.ts +189 -0
- package/types/core/class/ui.d.ts +164 -0
- package/types/core/class/viewer.d.ts +140 -0
- package/types/core/editor.d.ts +610 -0
- package/types/core/section/actives.d.ts +46 -0
- package/types/core/section/constructor.d.ts +777 -0
- package/types/core/section/context.d.ts +45 -0
- package/types/core/section/documentType.d.ts +178 -0
- package/types/editorInjector/_classes.d.ts +41 -0
- package/types/editorInjector/_core.d.ts +92 -0
- package/types/editorInjector/index.d.ts +71 -0
- package/types/events.d.ts +273 -0
- package/types/helper/clipboard.d.ts +12 -0
- package/types/helper/converter.d.ts +197 -0
- package/types/helper/dom/domCheck.d.ts +189 -0
- package/types/helper/dom/domQuery.d.ts +223 -0
- package/types/helper/dom/domUtils.d.ts +226 -0
- package/types/helper/dom/index.d.ts +9 -0
- package/types/helper/env.d.ts +132 -0
- package/types/helper/index.d.ts +174 -0
- package/types/helper/keyCodeMap.d.ts +110 -0
- package/types/helper/numbers.d.ts +46 -0
- package/types/helper/unicode.d.ts +28 -0
- package/types/index.d.ts +120 -0
- package/{typings/Lang.d.ts → types/langs/_Lang.d.ts} +173 -103
- package/types/langs/ckb.d.ts +3 -0
- package/types/langs/cs.d.ts +3 -0
- package/types/langs/da.d.ts +3 -0
- package/types/langs/de.d.ts +3 -0
- package/types/langs/en.d.ts +3 -0
- package/types/langs/es.d.ts +3 -0
- package/types/langs/fa.d.ts +3 -0
- package/types/langs/fr.d.ts +3 -0
- package/types/langs/he.d.ts +3 -0
- package/types/langs/hu.d.ts +3 -0
- package/types/langs/index.d.ts +54 -0
- package/types/langs/it.d.ts +3 -0
- package/types/langs/ja.d.ts +3 -0
- package/types/langs/km.d.ts +3 -0
- package/types/langs/ko.d.ts +3 -0
- package/types/langs/lv.d.ts +3 -0
- package/types/langs/nl.d.ts +3 -0
- package/types/langs/pl.d.ts +3 -0
- package/types/langs/pt_br.d.ts +3 -0
- package/types/langs/ro.d.ts +3 -0
- package/types/langs/ru.d.ts +3 -0
- package/types/langs/se.d.ts +3 -0
- package/types/langs/tr.d.ts +3 -0
- package/types/langs/uk.d.ts +3 -0
- package/types/langs/ur.d.ts +3 -0
- package/types/langs/zh_cn.d.ts +3 -0
- package/types/modules/ApiManager.d.ts +125 -0
- package/types/modules/Browser.d.ts +326 -0
- package/types/modules/ColorPicker.d.ts +131 -0
- package/types/modules/Controller.d.ts +251 -0
- package/types/modules/Figure.d.ts +517 -0
- package/types/modules/FileManager.d.ts +202 -0
- package/types/modules/HueSlider.d.ts +136 -0
- package/types/modules/Modal.d.ts +111 -0
- package/types/modules/ModalAnchorEditor.d.ts +236 -0
- package/types/modules/SelectMenu.d.ts +194 -0
- package/types/modules/_DragHandle.d.ts +7 -0
- package/types/modules/index.d.ts +26 -0
- package/types/plugins/browser/audioGallery.d.ts +55 -0
- package/types/plugins/browser/fileBrowser.d.ts +64 -0
- package/types/plugins/browser/fileGallery.d.ts +55 -0
- package/types/plugins/browser/imageGallery.d.ts +51 -0
- package/types/plugins/browser/videoGallery.d.ts +57 -0
- package/types/plugins/command/blockquote.d.ts +28 -0
- package/types/plugins/command/exportPDF.d.ts +46 -0
- package/types/plugins/command/fileUpload.d.ts +156 -0
- package/types/plugins/command/list_bulleted.d.ts +46 -0
- package/types/plugins/command/list_numbered.d.ts +46 -0
- package/types/plugins/dropdown/align.d.ts +60 -0
- package/types/plugins/dropdown/backgroundColor.d.ts +63 -0
- package/types/plugins/dropdown/font.d.ts +54 -0
- package/types/plugins/dropdown/fontColor.d.ts +63 -0
- package/types/plugins/dropdown/formatBlock.d.ts +54 -0
- package/types/plugins/dropdown/hr.d.ts +71 -0
- package/types/plugins/dropdown/layout.d.ts +40 -0
- package/types/plugins/dropdown/lineHeight.d.ts +50 -0
- package/types/plugins/dropdown/list.d.ts +39 -0
- package/types/plugins/dropdown/paragraphStyle.d.ts +54 -0
- package/types/plugins/dropdown/table.d.ts +627 -0
- package/types/plugins/dropdown/template.d.ts +40 -0
- package/types/plugins/dropdown/textStyle.d.ts +41 -0
- package/types/plugins/field/mention.d.ts +102 -0
- package/types/plugins/index.d.ts +107 -0
- package/types/plugins/input/fontSize.d.ts +170 -0
- package/types/plugins/input/pageNavigator.d.ts +28 -0
- package/types/plugins/modal/audio.d.ts +269 -0
- package/types/plugins/modal/drawing.d.ts +246 -0
- package/types/plugins/modal/embed.d.ts +387 -0
- package/types/plugins/modal/image.d.ts +451 -0
- package/types/plugins/modal/link.d.ts +128 -0
- package/types/plugins/modal/math.d.ts +193 -0
- package/types/plugins/modal/video.d.ts +485 -0
- package/types/plugins/popup/anchor.d.ts +56 -0
- package/types/suneditor.d.ts +51 -0
- package/types/typedef.d.ts +233 -0
- package/.eslintignore +0 -7
- package/.eslintrc.json +0 -64
- package/src/assets/icons/_default.js +0 -194
- package/src/core/base/events.js +0 -320
- package/src/core/class/notice.js +0 -42
- package/src/helper/domUtils.js +0 -1177
- package/src/modules/FileBrowser.js +0 -271
- package/src/plugins/command/exportPdf.js +0 -168
- package/src/plugins/fileBrowser/imageGallery.js +0 -81
- package/src/themes/test.css +0 -61
- package/typings/CommandPlugin.d.ts +0 -8
- package/typings/DialogPlugin.d.ts +0 -20
- package/typings/FileBrowserPlugin.d.ts +0 -30
- package/typings/Module.d.ts +0 -15
- package/typings/Plugin.d.ts +0 -42
- package/typings/SubmenuPlugin.d.ts +0 -8
- package/typings/_classes.d.ts +0 -17
- package/typings/_colorPicker.d.ts +0 -60
- package/typings/_core.d.ts +0 -55
- package/typings/align.d.ts +0 -5
- package/typings/audio.d.ts +0 -5
- package/typings/backgroundColor.d.ts +0 -5
- package/typings/blockquote.d.ts +0 -5
- package/typings/char.d.ts +0 -39
- package/typings/component.d.ts +0 -38
- package/typings/context.d.ts +0 -39
- package/typings/converter.d.ts +0 -33
- package/typings/dialog.d.ts +0 -28
- package/typings/domUtils.d.ts +0 -361
- package/typings/editor.d.ts +0 -7
- package/typings/editor.ts +0 -542
- package/typings/env.d.ts +0 -70
- package/typings/eventManager.d.ts +0 -37
- package/typings/events.d.ts +0 -262
- package/typings/fileBrowser.d.ts +0 -42
- package/typings/fileManager.d.ts +0 -67
- package/typings/font.d.ts +0 -5
- package/typings/fontColor.d.ts +0 -5
- package/typings/fontSize.d.ts +0 -5
- package/typings/format.d.ts +0 -191
- package/typings/formatBlock.d.ts +0 -5
- package/typings/history.d.ts +0 -48
- package/typings/horizontalRule.d.ts +0 -5
- package/typings/image.d.ts +0 -5
- package/typings/imageGallery.d.ts +0 -5
- package/typings/index.d.ts +0 -21
- package/typings/index.modules.d.ts +0 -11
- package/typings/index.plugins.d.ts +0 -58
- package/typings/lineHeight.d.ts +0 -5
- package/typings/link.d.ts +0 -5
- package/typings/list.d.ts +0 -5
- package/typings/math.d.ts +0 -5
- package/typings/mediaContainer.d.ts +0 -25
- package/typings/mention.d.ts +0 -5
- package/typings/node.d.ts +0 -57
- package/typings/notice.d.ts +0 -16
- package/typings/numbers.d.ts +0 -29
- package/typings/offset.d.ts +0 -24
- package/typings/options.d.ts +0 -589
- package/typings/paragraphStyle.d.ts +0 -5
- package/typings/resizing.d.ts +0 -141
- package/typings/selection.d.ts +0 -94
- package/typings/shortcuts.d.ts +0 -13
- package/typings/suneditor.d.ts +0 -9
- package/typings/table.d.ts +0 -5
- package/typings/template.d.ts +0 -5
- package/typings/textStyle.d.ts +0 -5
- package/typings/toolbar.d.ts +0 -32
- package/typings/unicode.d.ts +0 -25
- package/typings/video.d.ts +0 -5
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
export default Figure;
|
|
2
|
+
export type FigureParams = {
|
|
3
|
+
/**
|
|
4
|
+
* Size unit
|
|
5
|
+
*/
|
|
6
|
+
sizeUnit?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Auto ratio { current: '00%', default: '00%' }
|
|
9
|
+
*/
|
|
10
|
+
autoRatio?: {
|
|
11
|
+
current: string;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type FigureInfo = {
|
|
16
|
+
/**
|
|
17
|
+
* Target element (img, iframe, video, audio, table, etc.)
|
|
18
|
+
*/
|
|
19
|
+
target: HTMLElement;
|
|
20
|
+
/**
|
|
21
|
+
* Container element (div.se-component|span.se-component.se-inline-component)
|
|
22
|
+
*/
|
|
23
|
+
container: HTMLElement;
|
|
24
|
+
/**
|
|
25
|
+
* Cover element (FIGURE|null)
|
|
26
|
+
*/
|
|
27
|
+
cover: HTMLElement | null;
|
|
28
|
+
/**
|
|
29
|
+
* Inline cover element (span.se-inline-component)
|
|
30
|
+
*/
|
|
31
|
+
inlineCover: HTMLElement | null;
|
|
32
|
+
/**
|
|
33
|
+
* Caption element (FIGCAPTION)
|
|
34
|
+
*/
|
|
35
|
+
caption: HTMLElement | null;
|
|
36
|
+
};
|
|
37
|
+
export type FigureTargetInfo = {
|
|
38
|
+
/**
|
|
39
|
+
* Container element (div.se-component|span.se-component.se-inline-component)
|
|
40
|
+
*/
|
|
41
|
+
container: HTMLElement;
|
|
42
|
+
/**
|
|
43
|
+
* Cover element (FIGURE|null)
|
|
44
|
+
*/
|
|
45
|
+
cover?: (HTMLElement | null) | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Caption element (FIGCAPTION)
|
|
48
|
+
*/
|
|
49
|
+
caption?: (HTMLElement | null) | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* - Alignment of the element.
|
|
52
|
+
*/
|
|
53
|
+
align?: string;
|
|
54
|
+
/**
|
|
55
|
+
* - The aspect ratio of the element.
|
|
56
|
+
*/
|
|
57
|
+
ratio?: {
|
|
58
|
+
w: number;
|
|
59
|
+
h: number;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* - Width of the element.
|
|
63
|
+
*/
|
|
64
|
+
w?: string | number;
|
|
65
|
+
/**
|
|
66
|
+
* - Height of the element.
|
|
67
|
+
*/
|
|
68
|
+
h?: string | number;
|
|
69
|
+
/**
|
|
70
|
+
* - Top position.
|
|
71
|
+
*/
|
|
72
|
+
t?: number;
|
|
73
|
+
/**
|
|
74
|
+
* - Left position.
|
|
75
|
+
*/
|
|
76
|
+
l?: number;
|
|
77
|
+
/**
|
|
78
|
+
* - Width, can be a number or 'auto'.
|
|
79
|
+
*/
|
|
80
|
+
width: string | number;
|
|
81
|
+
/**
|
|
82
|
+
* - Height, can be a number or 'auto'.
|
|
83
|
+
*/
|
|
84
|
+
height: string | number;
|
|
85
|
+
/**
|
|
86
|
+
* - Original width from `naturalWidth` or `offsetWidth`.
|
|
87
|
+
*/
|
|
88
|
+
originWidth?: number;
|
|
89
|
+
/**
|
|
90
|
+
* - Original height from `naturalHeight` or `offsetHeight`.
|
|
91
|
+
*/
|
|
92
|
+
originHeight?: number;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* "mirror". "rotate", "caption", "revert", "edit", "copy", "remove", "as", "resize_auto,[number]"
|
|
96
|
+
*/
|
|
97
|
+
export type FigureControls = Array<
|
|
98
|
+
Array<
|
|
99
|
+
| string
|
|
100
|
+
| {
|
|
101
|
+
action: (element: Node, value: string, target: Node) => void;
|
|
102
|
+
command: string;
|
|
103
|
+
value: string;
|
|
104
|
+
title: string;
|
|
105
|
+
icon: string;
|
|
106
|
+
}
|
|
107
|
+
>
|
|
108
|
+
>;
|
|
109
|
+
/**
|
|
110
|
+
* @typedef {Object} FigureParams
|
|
111
|
+
* @property {string} [sizeUnit="px"] Size unit
|
|
112
|
+
* @property {{ current: string, default: string }} [autoRatio=null] Auto ratio { current: '00%', default: '00%' }
|
|
113
|
+
*/
|
|
114
|
+
/**
|
|
115
|
+
* @typedef {Object} FigureInfo
|
|
116
|
+
* @property {HTMLElement} target Target element (img, iframe, video, audio, table, etc.)
|
|
117
|
+
* @property {HTMLElement} container Container element (div.se-component|span.se-component.se-inline-component)
|
|
118
|
+
* @property {?HTMLElement} cover Cover element (FIGURE|null)
|
|
119
|
+
* @property {?HTMLElement} inlineCover Inline cover element (span.se-inline-component)
|
|
120
|
+
* @property {?HTMLElement} caption Caption element (FIGCAPTION)
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* @typedef {Object} FigureTargetInfo
|
|
124
|
+
* @property {HTMLElement} container Container element (div.se-component|span.se-component.se-inline-component)
|
|
125
|
+
* @property {?HTMLElement=} cover Cover element (FIGURE|null)
|
|
126
|
+
* @property {?HTMLElement=} caption Caption element (FIGCAPTION)
|
|
127
|
+
* @property {string} [align] - Alignment of the element.
|
|
128
|
+
* @property {{w:number, h:number}} [ratio] - The aspect ratio of the element.
|
|
129
|
+
* @property {string|number} [w] - Width of the element.
|
|
130
|
+
* @property {string|number} [h] - Height of the element.
|
|
131
|
+
* @property {number} [t] - Top position.
|
|
132
|
+
* @property {number} [l] - Left position.
|
|
133
|
+
* @property {string|number} width - Width, can be a number or 'auto'.
|
|
134
|
+
* @property {string|number} height - Height, can be a number or 'auto'.
|
|
135
|
+
* @property {number} [originWidth] - Original width from `naturalWidth` or `offsetWidth`.
|
|
136
|
+
* @property {number} [originHeight] - Original height from `naturalHeight` or `offsetHeight`.
|
|
137
|
+
*/
|
|
138
|
+
/**
|
|
139
|
+
* @typedef {Array<Array<
|
|
140
|
+
* string |
|
|
141
|
+
* {
|
|
142
|
+
* action: (element: Node, value: string, target: Node) => void,
|
|
143
|
+
* command: string,
|
|
144
|
+
* value: string,
|
|
145
|
+
* title: string,
|
|
146
|
+
* icon: string
|
|
147
|
+
* }
|
|
148
|
+
* >>} FigureControls
|
|
149
|
+
* "mirror". "rotate", "caption", "revert", "edit", "copy", "remove", "as", "resize_auto,[number]"
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* @class
|
|
153
|
+
* @description Controller module class
|
|
154
|
+
*/
|
|
155
|
+
declare class Figure extends EditorInjector {
|
|
156
|
+
/**
|
|
157
|
+
* @description Create a container for the resizing component and insert the element.
|
|
158
|
+
* @param {Node} element Target element
|
|
159
|
+
* @param {string=} className Class name of container (fixed: se-component)
|
|
160
|
+
* @returns {FigureInfo} {target, container, cover, inlineCover, caption}
|
|
161
|
+
*/
|
|
162
|
+
static CreateContainer(element: Node, className?: string | undefined): FigureInfo;
|
|
163
|
+
/**
|
|
164
|
+
* @description Create a container for the inline resizing component and insert the element.
|
|
165
|
+
* @param {Node} element Target element
|
|
166
|
+
* @param {string} [className] Class name of container (fixed: se-component se-inline-component)
|
|
167
|
+
* @returns {FigureInfo} {target, container, cover, inlineCover, caption}
|
|
168
|
+
*/
|
|
169
|
+
static CreateInlineContainer(element: Node, className?: string): FigureInfo;
|
|
170
|
+
/**
|
|
171
|
+
* @description Return HTML string of caption(FIGCAPTION) element
|
|
172
|
+
* @param {Node} cover Cover element(FIGURE). "CreateContainer().cover"
|
|
173
|
+
* @returns {HTMLElement} caption element
|
|
174
|
+
*/
|
|
175
|
+
static CreateCaption(cover: Node, text: any): HTMLElement;
|
|
176
|
+
/**
|
|
177
|
+
* @description Get the element's container(.se-component) info.
|
|
178
|
+
* @param {Node} element Target element
|
|
179
|
+
* @returns {FigureInfo} {target, container, cover, inlineCover, caption}
|
|
180
|
+
*/
|
|
181
|
+
static GetContainer(element: Node): FigureInfo;
|
|
182
|
+
/**
|
|
183
|
+
* @description Ratio calculation
|
|
184
|
+
* @param {string|number} w Width size
|
|
185
|
+
* @param {string|number} h Height size
|
|
186
|
+
* @param {?string=} [defaultSizeUnit="px"] Default size unit (default: "px")
|
|
187
|
+
* @return {{w: number, h: number}}
|
|
188
|
+
*/
|
|
189
|
+
static GetRatio(
|
|
190
|
+
w: string | number,
|
|
191
|
+
h: string | number,
|
|
192
|
+
defaultSizeUnit?: (string | null) | undefined
|
|
193
|
+
): {
|
|
194
|
+
w: number;
|
|
195
|
+
h: number;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* @description Ratio calculation
|
|
199
|
+
* @param {string|number} w Width size
|
|
200
|
+
* @param {string|number} h Height size
|
|
201
|
+
* @param {string} defaultSizeUnit Default size unit (default: "px")
|
|
202
|
+
* @param {{w: number, h: number}} ratio Ratio size (Figure.GetRatio)
|
|
203
|
+
* @return {{w: string|number, h: string|number}}
|
|
204
|
+
*/
|
|
205
|
+
static CalcRatio(
|
|
206
|
+
w: string | number,
|
|
207
|
+
h: string | number,
|
|
208
|
+
defaultSizeUnit: string,
|
|
209
|
+
ratio: {
|
|
210
|
+
w: number;
|
|
211
|
+
h: number;
|
|
212
|
+
}
|
|
213
|
+
): {
|
|
214
|
+
w: string | number;
|
|
215
|
+
h: string | number;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* @description It is judged whether it is the component[img, iframe, video, audio, table] cover(class="se-component") and table, hr
|
|
219
|
+
* @param {Node} element Target element
|
|
220
|
+
* @returns {boolean}
|
|
221
|
+
*/
|
|
222
|
+
static is(element: Node): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* @constructor
|
|
225
|
+
* @param {*} inst The instance object that called the constructor.
|
|
226
|
+
* @param {FigureControls} controls Controller button array
|
|
227
|
+
* @param {FigureParams} params Figure options
|
|
228
|
+
*/
|
|
229
|
+
constructor(inst: any, controls: FigureControls, params: FigureParams);
|
|
230
|
+
kind: any;
|
|
231
|
+
_alignIcons: {
|
|
232
|
+
none: string;
|
|
233
|
+
left: string;
|
|
234
|
+
right: string;
|
|
235
|
+
center: string;
|
|
236
|
+
};
|
|
237
|
+
/** @type {Object<string, *>} */
|
|
238
|
+
_action: {
|
|
239
|
+
[x: string]: any;
|
|
240
|
+
};
|
|
241
|
+
controller: Controller;
|
|
242
|
+
alignButton: Element;
|
|
243
|
+
selectMenu_align: SelectMenu;
|
|
244
|
+
asButton: Element;
|
|
245
|
+
selectMenu_as: SelectMenu;
|
|
246
|
+
resizeButton: Element;
|
|
247
|
+
selectMenu_resize: SelectMenu;
|
|
248
|
+
inst: any;
|
|
249
|
+
sizeUnit: string;
|
|
250
|
+
autoRatio: {
|
|
251
|
+
current: string;
|
|
252
|
+
default: string;
|
|
253
|
+
};
|
|
254
|
+
isVertical: boolean;
|
|
255
|
+
percentageButtons: NodeListOf<Element>;
|
|
256
|
+
captionButton: Element;
|
|
257
|
+
align: string;
|
|
258
|
+
as: string;
|
|
259
|
+
_element: HTMLElement;
|
|
260
|
+
_cover: HTMLElement;
|
|
261
|
+
_inlineCover: HTMLElement;
|
|
262
|
+
_container: HTMLElement;
|
|
263
|
+
_caption: any;
|
|
264
|
+
_width: string;
|
|
265
|
+
_height: string;
|
|
266
|
+
_resize_w: number;
|
|
267
|
+
_resize_h: number;
|
|
268
|
+
_element_w: number;
|
|
269
|
+
_element_h: number;
|
|
270
|
+
_element_l: number;
|
|
271
|
+
_element_t: number;
|
|
272
|
+
_resizeClientX: number;
|
|
273
|
+
_resizeClientY: number;
|
|
274
|
+
_resize_direction: string;
|
|
275
|
+
_floatClassStr: string;
|
|
276
|
+
__preventSizechange: boolean;
|
|
277
|
+
__revertSize: {
|
|
278
|
+
w: string;
|
|
279
|
+
h: string;
|
|
280
|
+
};
|
|
281
|
+
/** @type {{left?: number, top?: number}} */
|
|
282
|
+
__offset: {
|
|
283
|
+
left?: number;
|
|
284
|
+
top?: number;
|
|
285
|
+
};
|
|
286
|
+
__offContainer: any;
|
|
287
|
+
__containerResizing: any;
|
|
288
|
+
__containerResizingOff: any;
|
|
289
|
+
__containerResizingESC: any;
|
|
290
|
+
__onContainerEvent: any;
|
|
291
|
+
__offContainerEvent: any;
|
|
292
|
+
__onResizeESCEvent: __se__GlobalEventInfo;
|
|
293
|
+
__fileManagerInfo: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* @description Close the figure's controller
|
|
296
|
+
*/
|
|
297
|
+
close(): void;
|
|
298
|
+
/**
|
|
299
|
+
* @description Open the figure's controller
|
|
300
|
+
* @param {Node} targetNode Target element
|
|
301
|
+
* @param {Object} params params
|
|
302
|
+
* @param {boolean} [params.nonResizing=false] Do not display the resizing button
|
|
303
|
+
* @param {boolean} [params.nonSizeInfo=false] Do not display the size information
|
|
304
|
+
* @param {boolean} [params.nonBorder=false] Do not display the selected style line
|
|
305
|
+
* @param {boolean} [params.figureTarget=false] If true, the target is a figure element
|
|
306
|
+
* @param {boolean} [params.__fileManagerInfo=false] If true, the file manager is called
|
|
307
|
+
* @returns {FigureTargetInfo|undefined} figure target info
|
|
308
|
+
*/
|
|
309
|
+
open(
|
|
310
|
+
targetNode: Node,
|
|
311
|
+
{
|
|
312
|
+
nonResizing,
|
|
313
|
+
nonSizeInfo,
|
|
314
|
+
nonBorder,
|
|
315
|
+
figureTarget,
|
|
316
|
+
__fileManagerInfo
|
|
317
|
+
}: {
|
|
318
|
+
nonResizing?: boolean;
|
|
319
|
+
nonSizeInfo?: boolean;
|
|
320
|
+
nonBorder?: boolean;
|
|
321
|
+
figureTarget?: boolean;
|
|
322
|
+
__fileManagerInfo?: boolean;
|
|
323
|
+
}
|
|
324
|
+
): FigureTargetInfo | undefined;
|
|
325
|
+
/**
|
|
326
|
+
* @description Hide the controller
|
|
327
|
+
*/
|
|
328
|
+
controllerHide(): void;
|
|
329
|
+
/**
|
|
330
|
+
* @description Hide the controller
|
|
331
|
+
*/
|
|
332
|
+
controllerShow(): void;
|
|
333
|
+
/**
|
|
334
|
+
* @description Open the figure's controller
|
|
335
|
+
* @param {Node} target Target element
|
|
336
|
+
* @param {Object} [params={}] params
|
|
337
|
+
* @param {boolean=} params.isWWTarget If the controller is in the WYSIWYG area, set it to true.
|
|
338
|
+
* @param {() => void=} params.initMethod Method to be called when the controller is closed.
|
|
339
|
+
* @param {boolean=} params.disabled If true, the controller is disabled.
|
|
340
|
+
* @param {{left: number, top: number}=} params.addOffset Additional offset values
|
|
341
|
+
*/
|
|
342
|
+
controllerOpen(
|
|
343
|
+
target: Node,
|
|
344
|
+
params?: {
|
|
345
|
+
isWWTarget?: boolean | undefined;
|
|
346
|
+
initMethod?: (() => void) | undefined;
|
|
347
|
+
disabled?: boolean | undefined;
|
|
348
|
+
addOffset?:
|
|
349
|
+
| {
|
|
350
|
+
left: number;
|
|
351
|
+
top: number;
|
|
352
|
+
}
|
|
353
|
+
| undefined;
|
|
354
|
+
}
|
|
355
|
+
): void;
|
|
356
|
+
/**
|
|
357
|
+
* @description Set the element's container size
|
|
358
|
+
* @param {string|number} w Width size
|
|
359
|
+
* @param {string|number} h Height size
|
|
360
|
+
*/
|
|
361
|
+
setSize(w: string | number, h: string | number): void;
|
|
362
|
+
/**
|
|
363
|
+
* @description Gets the Figure size
|
|
364
|
+
* @param {?Node=} targetNode Target element, default is the current element
|
|
365
|
+
* @returns {{w: string, h: string}}
|
|
366
|
+
*/
|
|
367
|
+
getSize(targetNode?: (Node | null) | undefined): {
|
|
368
|
+
w: string;
|
|
369
|
+
h: string;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* @description Align the container.
|
|
373
|
+
* @param {?Node} targetNode Target element
|
|
374
|
+
* @param {string} align "none"|"left"|"center"|"right"
|
|
375
|
+
*/
|
|
376
|
+
setAlign(targetNode: Node | null, align: string): void;
|
|
377
|
+
/**
|
|
378
|
+
* @description As style[block, inline] the component
|
|
379
|
+
* @param {?Node} targetNode Target element
|
|
380
|
+
* @param {"block"|"inline"} formatStyle Format style
|
|
381
|
+
*/
|
|
382
|
+
convertAsFormat(targetNode: Node | null, formatStyle: 'block' | 'inline'): void;
|
|
383
|
+
/**
|
|
384
|
+
* @private
|
|
385
|
+
* @description Handles format conversion (block/inline) for the figure component and applies size changes.
|
|
386
|
+
* @param {FigureInfo} figureinfo {target, container, cover, inlineCover, caption}
|
|
387
|
+
* @param {string|number} w Width value.
|
|
388
|
+
* @param {string|number} h Height value.
|
|
389
|
+
*/
|
|
390
|
+
private _asFormatChange;
|
|
391
|
+
/**
|
|
392
|
+
* @description Controller button action
|
|
393
|
+
* @param {HTMLButtonElement} target Target button element
|
|
394
|
+
* @returns
|
|
395
|
+
*/
|
|
396
|
+
controllerAction(target: HTMLButtonElement): void;
|
|
397
|
+
/**
|
|
398
|
+
* @description Inspect the figure component format and change it to the correct format.
|
|
399
|
+
* @param {Node} container - The container element of the figure component.
|
|
400
|
+
* @param {Node} originEl - The original element of the figure component.
|
|
401
|
+
* @param {Node} anchorCover - The anchor cover element of the figure component.
|
|
402
|
+
* @param {import('./FileManager').default} [fileManagerInst=null] - FileManager module instance, if used.
|
|
403
|
+
*/
|
|
404
|
+
retainFigureFormat(container: Node, originEl: Node, anchorCover: Node, fileManagerInst?: import('./FileManager').default): void;
|
|
405
|
+
/**
|
|
406
|
+
* @description Initialize the transform style (rotation) of the element.
|
|
407
|
+
* @param {?Node=} node Target element, default is the current element
|
|
408
|
+
*/
|
|
409
|
+
deleteTransform(node?: (Node | null) | undefined): void;
|
|
410
|
+
/**
|
|
411
|
+
* @description Set the transform style (rotation) of the element.
|
|
412
|
+
* @param {Node} node Target element
|
|
413
|
+
* @param {?string|number} width Element's width size
|
|
414
|
+
* @param {?string|number} height Element's height size
|
|
415
|
+
*/
|
|
416
|
+
setTransform(node: Node, width: (string | number) | null, height: (string | number) | null, deg: any): void;
|
|
417
|
+
/**
|
|
418
|
+
* @private
|
|
419
|
+
* @description Sets figure component properties such as cover, container, caption, and alignment.
|
|
420
|
+
* @param {FigureInfo} figureInfo - {target, container, cover, inlineCover, caption}
|
|
421
|
+
*/
|
|
422
|
+
private _setFigureInfo;
|
|
423
|
+
/**
|
|
424
|
+
* @private
|
|
425
|
+
* @description Applies rotation transformation to the target element.
|
|
426
|
+
* @param {HTMLElement} element Target element.
|
|
427
|
+
* @param {number} r Rotation degree.
|
|
428
|
+
* @param {number} x X-axis rotation value.
|
|
429
|
+
* @param {number} y Y-axis rotation value.
|
|
430
|
+
*/
|
|
431
|
+
private _setRotate;
|
|
432
|
+
/**
|
|
433
|
+
* @private
|
|
434
|
+
* @description Applies size adjustments to the figure element.
|
|
435
|
+
* @param {string|number} w Width value.
|
|
436
|
+
* @param {string|number} h Height value.
|
|
437
|
+
* @param {string} direction Resize direction.
|
|
438
|
+
*/
|
|
439
|
+
private _applySize;
|
|
440
|
+
/**
|
|
441
|
+
* @private
|
|
442
|
+
* @description Sets padding-bottom for cover elements based on width and height.
|
|
443
|
+
* @param {string} w Width value.
|
|
444
|
+
* @param {string} h Height value.
|
|
445
|
+
*/
|
|
446
|
+
private __setCoverPaddingBottom;
|
|
447
|
+
/**
|
|
448
|
+
* @private
|
|
449
|
+
* @description Sets the figure element to its auto size.
|
|
450
|
+
*/
|
|
451
|
+
private _setAutoSize;
|
|
452
|
+
/**
|
|
453
|
+
* @private
|
|
454
|
+
* @description Sets the figure element's size in percentage.
|
|
455
|
+
* @param {string|number} w Width percentage.
|
|
456
|
+
* @param {string|number} h Height percentage.
|
|
457
|
+
*/
|
|
458
|
+
private _setPercentSize;
|
|
459
|
+
/**
|
|
460
|
+
* @private
|
|
461
|
+
* @description Deletes percentage-based sizing from the figure element.
|
|
462
|
+
*/
|
|
463
|
+
private _deletePercentSize;
|
|
464
|
+
/**
|
|
465
|
+
* @private
|
|
466
|
+
* @description Reverts the figure element to its previously saved size.
|
|
467
|
+
*/
|
|
468
|
+
private _setRevert;
|
|
469
|
+
/**
|
|
470
|
+
* @private
|
|
471
|
+
* @description Updates the figure's alignment icon.
|
|
472
|
+
*/
|
|
473
|
+
private _setAlignIcon;
|
|
474
|
+
/**
|
|
475
|
+
* @private
|
|
476
|
+
* @description Updates the figure's block/inline format icon.
|
|
477
|
+
*/
|
|
478
|
+
private _setAsIcon;
|
|
479
|
+
/**
|
|
480
|
+
* @private
|
|
481
|
+
* @description Saves the current size of the figure component.
|
|
482
|
+
*/
|
|
483
|
+
private _saveCurrentSize;
|
|
484
|
+
/**
|
|
485
|
+
* @private
|
|
486
|
+
* @description Adjusts the position of the caption within the figure.
|
|
487
|
+
* @param {HTMLElement} element Target element.
|
|
488
|
+
*/
|
|
489
|
+
private _setCaptionPosition;
|
|
490
|
+
/**
|
|
491
|
+
* @private
|
|
492
|
+
* @description Removes the margin top property from the figure caption.
|
|
493
|
+
* @param {HTMLElement} element Target element.
|
|
494
|
+
*/
|
|
495
|
+
private _deleteCaptionPosition;
|
|
496
|
+
/**
|
|
497
|
+
* @private
|
|
498
|
+
* @description Displays or hides the resize handles of the figure component.
|
|
499
|
+
* @param {boolean} display Whether to display resize handles.
|
|
500
|
+
*/
|
|
501
|
+
private _displayResizeHandles;
|
|
502
|
+
/**
|
|
503
|
+
* @private
|
|
504
|
+
* @description Removes the resize event listeners.
|
|
505
|
+
*/
|
|
506
|
+
private _offResizeEvent;
|
|
507
|
+
/**
|
|
508
|
+
* @private
|
|
509
|
+
* @description Sets up drag event handling for the figure component.
|
|
510
|
+
* @param {Node} figureMain The main figure container element.
|
|
511
|
+
*/
|
|
512
|
+
private _setDragEvent;
|
|
513
|
+
#private;
|
|
514
|
+
}
|
|
515
|
+
import EditorInjector from '../editorInjector';
|
|
516
|
+
import { Controller } from '../modules';
|
|
517
|
+
import { SelectMenu } from '../modules';
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export default FileManager;
|
|
2
|
+
export type FileStateInfo = {
|
|
3
|
+
/**
|
|
4
|
+
* File source
|
|
5
|
+
*/
|
|
6
|
+
src: string;
|
|
7
|
+
/**
|
|
8
|
+
* File index
|
|
9
|
+
*/
|
|
10
|
+
index: number;
|
|
11
|
+
/**
|
|
12
|
+
* File name
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* File size
|
|
17
|
+
*/
|
|
18
|
+
size: number;
|
|
19
|
+
};
|
|
20
|
+
export type FileStateParams = {
|
|
21
|
+
/**
|
|
22
|
+
* - The root editor instance
|
|
23
|
+
*/
|
|
24
|
+
editor: __se__EditorCore;
|
|
25
|
+
/**
|
|
26
|
+
* File element
|
|
27
|
+
*/
|
|
28
|
+
element: Node;
|
|
29
|
+
/**
|
|
30
|
+
* File index
|
|
31
|
+
*/
|
|
32
|
+
index: number;
|
|
33
|
+
/**
|
|
34
|
+
* File state ("create"|"update"|"delete")
|
|
35
|
+
*/
|
|
36
|
+
state: string;
|
|
37
|
+
/**
|
|
38
|
+
* File information
|
|
39
|
+
*/
|
|
40
|
+
info: FileStateInfo;
|
|
41
|
+
/**
|
|
42
|
+
* Remaining file count
|
|
43
|
+
*/
|
|
44
|
+
remainingFilesCount: number;
|
|
45
|
+
/**
|
|
46
|
+
* Plugin name
|
|
47
|
+
*/
|
|
48
|
+
pluginName: string;
|
|
49
|
+
};
|
|
50
|
+
export type FileManagerParams = {
|
|
51
|
+
/**
|
|
52
|
+
* The query selector used to find file elements in the editor
|
|
53
|
+
*/
|
|
54
|
+
query: string;
|
|
55
|
+
/**
|
|
56
|
+
* A function to handle the loaded file information
|
|
57
|
+
*/
|
|
58
|
+
loadHandler?: ((params: Array<FileStateInfo>) => void) | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* A function to handle file-related events
|
|
61
|
+
*/
|
|
62
|
+
eventHandler?: ((info: FileStateParams) => void) | undefined;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {Object} FileStateInfo
|
|
66
|
+
* @property {string} src File source
|
|
67
|
+
* @property {number} index File index
|
|
68
|
+
* @property {string} name File name
|
|
69
|
+
* @property {number} size File size
|
|
70
|
+
*/
|
|
71
|
+
/**
|
|
72
|
+
* @typedef {Object} FileStateParams
|
|
73
|
+
* @property {__se__EditorCore} editor - The root editor instance
|
|
74
|
+
* @property {Node} element File element
|
|
75
|
+
* @property {number} index File index
|
|
76
|
+
* @property {string} state File state ("create"|"update"|"delete")
|
|
77
|
+
* @property {FileStateInfo} info File information
|
|
78
|
+
* @property {number} remainingFilesCount Remaining file count
|
|
79
|
+
* @property {string} pluginName Plugin name
|
|
80
|
+
*/
|
|
81
|
+
/**
|
|
82
|
+
* @typedef {Object} FileManagerParams
|
|
83
|
+
* @property {string} query The query selector used to find file elements in the editor
|
|
84
|
+
* @property {(params: Array<FileStateInfo>) => void=} loadHandler A function to handle the loaded file information
|
|
85
|
+
* @property {(info: FileStateParams) => void=} eventHandler A function to handle file-related events
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* @class
|
|
89
|
+
* @description This module manages the file information of the editor.
|
|
90
|
+
*/
|
|
91
|
+
declare class FileManager extends CoreInjector {
|
|
92
|
+
/**
|
|
93
|
+
* @constructor
|
|
94
|
+
* @param {*} inst The instance object that called the constructor.
|
|
95
|
+
* @param {FileManagerParams} params FileManager options
|
|
96
|
+
*/
|
|
97
|
+
constructor(inst: any, params: FileManagerParams);
|
|
98
|
+
ui: import('../core/class/ui').default;
|
|
99
|
+
kind: any;
|
|
100
|
+
inst: any;
|
|
101
|
+
component: any;
|
|
102
|
+
query: string;
|
|
103
|
+
loadHandler: (params: Array<FileStateInfo>) => void;
|
|
104
|
+
eventHandler: (info: FileStateParams) => void;
|
|
105
|
+
infoList: any[];
|
|
106
|
+
infoIndex: number;
|
|
107
|
+
uploadFileLength: number;
|
|
108
|
+
__updateTags: any[];
|
|
109
|
+
apiManager: ApiManager;
|
|
110
|
+
/**
|
|
111
|
+
* @description Upload the file to the server.
|
|
112
|
+
* @param {string} uploadUrl Upload server url
|
|
113
|
+
* @param {?Object<string, string>} uploadHeader Request header
|
|
114
|
+
* @param {FileList|File[]|{formData: FormData, size: number}} data FormData in body or Files array
|
|
115
|
+
* @param {?(xmlHttp: XMLHttpRequest) => boolean=} callBack Success call back function
|
|
116
|
+
* @param {?(res: *, xmlHttp: XMLHttpRequest) => string=} errorCallBack Error call back function
|
|
117
|
+
*/
|
|
118
|
+
upload(
|
|
119
|
+
uploadUrl: string,
|
|
120
|
+
uploadHeader: {
|
|
121
|
+
[x: string]: string;
|
|
122
|
+
} | null,
|
|
123
|
+
data:
|
|
124
|
+
| FileList
|
|
125
|
+
| File[]
|
|
126
|
+
| {
|
|
127
|
+
formData: FormData;
|
|
128
|
+
size: number;
|
|
129
|
+
},
|
|
130
|
+
callBack?: (((xmlHttp: XMLHttpRequest) => boolean) | null) | undefined,
|
|
131
|
+
errorCallBack?: (((res: any, xmlHttp: XMLHttpRequest) => string) | null) | undefined
|
|
132
|
+
): void;
|
|
133
|
+
/**
|
|
134
|
+
* @description Upload the file to the server.
|
|
135
|
+
* @param {string} uploadUrl Upload server url
|
|
136
|
+
* @param {?Object<string, string>} uploadHeader Request header
|
|
137
|
+
* @param {FileList|File[]|{formData: FormData, size: number}} data FormData in body or Files array
|
|
138
|
+
* @returns {Promise<XMLHttpRequest>}
|
|
139
|
+
*/
|
|
140
|
+
asyncUpload(
|
|
141
|
+
uploadUrl: string,
|
|
142
|
+
uploadHeader: {
|
|
143
|
+
[x: string]: string;
|
|
144
|
+
} | null,
|
|
145
|
+
data:
|
|
146
|
+
| FileList
|
|
147
|
+
| File[]
|
|
148
|
+
| {
|
|
149
|
+
formData: FormData;
|
|
150
|
+
size: number;
|
|
151
|
+
}
|
|
152
|
+
): Promise<XMLHttpRequest>;
|
|
153
|
+
/**
|
|
154
|
+
* @description Set the file information to the element.
|
|
155
|
+
* @param {Node} element File information element
|
|
156
|
+
* @param {Object} params
|
|
157
|
+
* @param {string} params.name File name
|
|
158
|
+
* @param {number} params.size File size
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
setFileData(
|
|
162
|
+
element: Node,
|
|
163
|
+
{
|
|
164
|
+
name,
|
|
165
|
+
size
|
|
166
|
+
}: {
|
|
167
|
+
name: string;
|
|
168
|
+
size: number;
|
|
169
|
+
}
|
|
170
|
+
): void;
|
|
171
|
+
/**
|
|
172
|
+
* @private
|
|
173
|
+
* @description Create info object of file and add it to "infoList"
|
|
174
|
+
* @param {HTMLMediaElement} element
|
|
175
|
+
* @param {{name: string, size: number}|null} file File information
|
|
176
|
+
*/
|
|
177
|
+
private _setInfo;
|
|
178
|
+
/**
|
|
179
|
+
* @description Gets the sum of the sizes of the currently saved files.
|
|
180
|
+
* @returns {number} Size
|
|
181
|
+
*/
|
|
182
|
+
getSize(): number;
|
|
183
|
+
/**
|
|
184
|
+
* @private
|
|
185
|
+
* @description Checke the file's information and modify the tag that does not fit the format.
|
|
186
|
+
* @param {boolean} loaded Whether the editor is loaded
|
|
187
|
+
*/
|
|
188
|
+
private _checkInfo;
|
|
189
|
+
/**
|
|
190
|
+
* @private
|
|
191
|
+
* @description Reset info object and "infoList = []", "infoIndex = 0"
|
|
192
|
+
*/
|
|
193
|
+
private _resetInfo;
|
|
194
|
+
/**
|
|
195
|
+
* @private
|
|
196
|
+
* @description Delete info object at "infoList"
|
|
197
|
+
* @param {number} index index of info object infoList[].index)
|
|
198
|
+
*/
|
|
199
|
+
private _deleteInfo;
|
|
200
|
+
}
|
|
201
|
+
import CoreInjector from '../editorInjector/_core';
|
|
202
|
+
import ApiManager from './ApiManager';
|