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,193 @@
|
|
|
1
|
+
export default Math_;
|
|
2
|
+
export type MathPluginOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* - Whether the math modal can be resized.
|
|
5
|
+
*/
|
|
6
|
+
canResize?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* - Whether to automatically adjust the height of the modal.
|
|
9
|
+
*/
|
|
10
|
+
autoHeight?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* - A list of font size options for rendering math expressions.
|
|
13
|
+
*/
|
|
14
|
+
fontSizeList?: Array<object>;
|
|
15
|
+
/**
|
|
16
|
+
* - A callback function to handle paste events in the math input area.
|
|
17
|
+
*/
|
|
18
|
+
onPaste?: (...args: any) => any;
|
|
19
|
+
/**
|
|
20
|
+
* - An object specifying the dimensions for the math modal.
|
|
21
|
+
*/
|
|
22
|
+
formSize?: {
|
|
23
|
+
width?: string;
|
|
24
|
+
height?: string;
|
|
25
|
+
maxWidth?: string;
|
|
26
|
+
maxHeight?: string;
|
|
27
|
+
minWidth?: string;
|
|
28
|
+
minHeight?: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {Object} MathPluginOptions
|
|
33
|
+
* @property {boolean} [canResize=true] - Whether the math modal can be resized.
|
|
34
|
+
* @property {boolean} [autoHeight=false] - Whether to automatically adjust the height of the modal.
|
|
35
|
+
* @property {Array<object>} [fontSizeList] - A list of font size options for rendering math expressions.
|
|
36
|
+
* @property {(...args: *) => *} [onPaste] - A callback function to handle paste events in the math input area.
|
|
37
|
+
* @property {Object} [formSize={}] - An object specifying the dimensions for the math modal.
|
|
38
|
+
* @property {string} [formSize.width="460px"] - The default width of the math modal.
|
|
39
|
+
* @property {string} [formSize.height="14em"] - The default height of the math modal.
|
|
40
|
+
* @property {string} [formSize.maxWidth] - The maximum width of the math modal.
|
|
41
|
+
* @property {string} [formSize.maxHeight] - The maximum height of the math modal.
|
|
42
|
+
* @property {string} [formSize.minWidth="400px"] - The minimum width of the math modal.
|
|
43
|
+
* @property {string} [formSize.minHeight="40px"] - The minimum height of the math modal.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @class
|
|
47
|
+
* @description Math plugin.
|
|
48
|
+
* - This plugin provides support for rendering mathematical expressions using either the KaTeX or MathJax libraries.
|
|
49
|
+
* - If external library is provided, a warning is issued.
|
|
50
|
+
*/
|
|
51
|
+
declare class Math_ extends EditorInjector {
|
|
52
|
+
static key: string;
|
|
53
|
+
static type: string;
|
|
54
|
+
static className: string;
|
|
55
|
+
/**
|
|
56
|
+
* @this {Math_}
|
|
57
|
+
* @param {HTMLElement} node - The node to check.
|
|
58
|
+
* @returns {HTMLElement|null} Returns a node if the node is a valid component.
|
|
59
|
+
*/
|
|
60
|
+
static component(this: Math_, node: HTMLElement): HTMLElement | null;
|
|
61
|
+
/**
|
|
62
|
+
* @constructor
|
|
63
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
64
|
+
* @param {MathPluginOptions} pluginOptions
|
|
65
|
+
*/
|
|
66
|
+
constructor(editor: __se__EditorCore, pluginOptions: MathPluginOptions);
|
|
67
|
+
title: any;
|
|
68
|
+
icon: string;
|
|
69
|
+
katex: any;
|
|
70
|
+
mathjax: any;
|
|
71
|
+
pluginOptions: {
|
|
72
|
+
formSize: {
|
|
73
|
+
/**
|
|
74
|
+
* - The default width of the math modal.
|
|
75
|
+
*/
|
|
76
|
+
width: string;
|
|
77
|
+
/**
|
|
78
|
+
* - The default height of the math modal.
|
|
79
|
+
*/
|
|
80
|
+
height: string;
|
|
81
|
+
/**
|
|
82
|
+
* - The maximum width of the math modal.
|
|
83
|
+
*/
|
|
84
|
+
maxWidth: string;
|
|
85
|
+
/**
|
|
86
|
+
* - The maximum height of the math modal.
|
|
87
|
+
*/
|
|
88
|
+
maxHeight: string;
|
|
89
|
+
/**
|
|
90
|
+
* - The minimum width of the math modal.
|
|
91
|
+
*/
|
|
92
|
+
minWidth: string;
|
|
93
|
+
/**
|
|
94
|
+
* - The minimum height of the math modal.
|
|
95
|
+
*/
|
|
96
|
+
minHeight: string;
|
|
97
|
+
};
|
|
98
|
+
canResize: boolean;
|
|
99
|
+
autoHeight: boolean;
|
|
100
|
+
fontSizeList: any[];
|
|
101
|
+
onPaste: (...args: any) => any;
|
|
102
|
+
};
|
|
103
|
+
defaultFontSize: any;
|
|
104
|
+
modal: Modal;
|
|
105
|
+
controller: Controller;
|
|
106
|
+
/** @type {HTMLTextAreaElement} */
|
|
107
|
+
textArea: HTMLTextAreaElement;
|
|
108
|
+
/** @type {HTMLPreElement} */
|
|
109
|
+
previewElement: HTMLPreElement;
|
|
110
|
+
/** @type {HTMLSelectElement} */
|
|
111
|
+
fontSizeElement: HTMLSelectElement;
|
|
112
|
+
isUpdateState: boolean;
|
|
113
|
+
_element: HTMLElement;
|
|
114
|
+
/**
|
|
115
|
+
* @editorMethod Editor.component
|
|
116
|
+
* @description Executes the method that is called when a component of a plugin is selected.
|
|
117
|
+
* @param {HTMLElement} target Target component element
|
|
118
|
+
*/
|
|
119
|
+
select(target: HTMLElement): void;
|
|
120
|
+
/**
|
|
121
|
+
* @editorMethod Modules.Controller
|
|
122
|
+
* @description This function is called before the "controller" before it is closed.
|
|
123
|
+
*/
|
|
124
|
+
close(): void;
|
|
125
|
+
/**
|
|
126
|
+
* @editorMethod Editor.core
|
|
127
|
+
* @description This method is used to validate and preserve the format of the component within the editor.
|
|
128
|
+
* - It ensures that the structure and attributes of the element are maintained and secure.
|
|
129
|
+
* - The method checks if the element is already wrapped in a valid container and updates its attributes if necessary.
|
|
130
|
+
* - If the element isn't properly contained, a new container is created to retain the format.
|
|
131
|
+
* @returns {{query: string, method: (element: HTMLElement) => void}} The format retention object containing the query and method to process the element.
|
|
132
|
+
* - query: The selector query to identify the relevant elements (in this case, 'audio').
|
|
133
|
+
* - method:The function to execute on the element to validate and preserve its format.
|
|
134
|
+
* - The function takes the element as an argument, checks if it is contained correctly, and applies necessary adjustments.
|
|
135
|
+
*/
|
|
136
|
+
retainFormat(): {
|
|
137
|
+
query: string;
|
|
138
|
+
method: (element: HTMLElement) => void;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* @editorMethod Modules.Modal
|
|
142
|
+
* @description Executes the method that is called when a "Modal" module's is opened.
|
|
143
|
+
*/
|
|
144
|
+
open(): void;
|
|
145
|
+
/**
|
|
146
|
+
* @editorMethod Modules.Modal
|
|
147
|
+
* @description Executes the method that is called when a plugin's modal is opened.
|
|
148
|
+
* @param {boolean} isUpdate "Indicates whether the modal is for editing an existing component (true) or registering a new one (false)."
|
|
149
|
+
*/
|
|
150
|
+
on(isUpdate: boolean): void;
|
|
151
|
+
/**
|
|
152
|
+
* @editorMethod Modules.Modal
|
|
153
|
+
* @description This function is called when a form within a modal window is "submit".
|
|
154
|
+
* @returns {boolean} Success or failure
|
|
155
|
+
*/
|
|
156
|
+
modalAction(): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* @editorMethod Modules.Modal
|
|
159
|
+
* @description This function is called before the modal window is opened, but before it is closed.
|
|
160
|
+
*/
|
|
161
|
+
init(): void;
|
|
162
|
+
/**
|
|
163
|
+
* @editorMethod Modules.Controller
|
|
164
|
+
* @description Executes the method that is called when a button is clicked in the "controller".
|
|
165
|
+
* @param {HTMLButtonElement} target Target button element
|
|
166
|
+
*/
|
|
167
|
+
controllerAction(target: HTMLButtonElement): void;
|
|
168
|
+
/**
|
|
169
|
+
* @editorMethod Editor.Component
|
|
170
|
+
* @description Method to delete a component of a plugin, called by the "FileManager", "Controller" module.
|
|
171
|
+
* @param {Node} target Target element
|
|
172
|
+
*/
|
|
173
|
+
destroy(target: Node): void;
|
|
174
|
+
/**
|
|
175
|
+
* @private
|
|
176
|
+
* @description Renders the given math expression using KaTeX or MathJax.
|
|
177
|
+
* @param {string} exp - The math expression to render.
|
|
178
|
+
* @returns {string} - The rendered math expression as HTML.
|
|
179
|
+
*/
|
|
180
|
+
private _renderer;
|
|
181
|
+
/**
|
|
182
|
+
* @private
|
|
183
|
+
* @description Escapes or unescapes backslashes in a given string.
|
|
184
|
+
* @param {string} str - The input string.
|
|
185
|
+
* @param {boolean} decode - If true, decodes escaped backslashes; otherwise, encodes them.
|
|
186
|
+
* @returns {string} - The processed string.
|
|
187
|
+
*/
|
|
188
|
+
private _escapeBackslashes;
|
|
189
|
+
#private;
|
|
190
|
+
}
|
|
191
|
+
import EditorInjector from '../../editorInjector';
|
|
192
|
+
import { Modal } from '../../modules';
|
|
193
|
+
import { Controller } from '../../modules';
|
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
export default Video;
|
|
2
|
+
export type ModalReturns_video = {
|
|
3
|
+
html: HTMLElement;
|
|
4
|
+
alignForm: HTMLElement;
|
|
5
|
+
fileModalWrapper: HTMLElement;
|
|
6
|
+
videoInputFile: HTMLInputElement;
|
|
7
|
+
videoUrlFile: HTMLInputElement;
|
|
8
|
+
previewSrc: HTMLElement;
|
|
9
|
+
galleryButton: HTMLButtonElement;
|
|
10
|
+
proportion: HTMLInputElement;
|
|
11
|
+
frameRatioOption: HTMLSelectElement;
|
|
12
|
+
inputX: HTMLInputElement;
|
|
13
|
+
inputY: HTMLInputElement;
|
|
14
|
+
revertBtn: HTMLButtonElement;
|
|
15
|
+
fileRemoveBtn: HTMLButtonElement;
|
|
16
|
+
};
|
|
17
|
+
export type VideoInfo_video = import('../../events').VideoInfo;
|
|
18
|
+
export type FigureControls_video = import('../../modules/Figure').FigureControls;
|
|
19
|
+
export type VideoPluginOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* - Whether the video element can be resized.
|
|
22
|
+
*/
|
|
23
|
+
canResize?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* - Whether to display the height input field.
|
|
26
|
+
*/
|
|
27
|
+
showHeightInput?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* - The default width of the video element. If a number is provided, "px" will be appended.
|
|
30
|
+
*/
|
|
31
|
+
defaultWidth?: string;
|
|
32
|
+
/**
|
|
33
|
+
* - The default height of the video element. If a number is provided, "px" will be appended.
|
|
34
|
+
*/
|
|
35
|
+
defaultHeight?: string;
|
|
36
|
+
/**
|
|
37
|
+
* - Whether to allow only percentage-based sizing.
|
|
38
|
+
*/
|
|
39
|
+
percentageOnlySize?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* - Whether to create a file input element for video uploads.
|
|
42
|
+
*/
|
|
43
|
+
createFileInput?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* - Whether to create a URL input element for video embedding.
|
|
46
|
+
*/
|
|
47
|
+
createUrlInput?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* - The URL endpoint for video file uploads.
|
|
50
|
+
*/
|
|
51
|
+
uploadUrl?: string;
|
|
52
|
+
/**
|
|
53
|
+
* - Additional headers to include in the video upload request.
|
|
54
|
+
*/
|
|
55
|
+
uploadHeaders?: {
|
|
56
|
+
[x: string]: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* - The total upload size limit for videos in bytes.
|
|
60
|
+
*/
|
|
61
|
+
uploadSizeLimit?: number;
|
|
62
|
+
/**
|
|
63
|
+
* - The single file upload size limit for videos in bytes.
|
|
64
|
+
*/
|
|
65
|
+
uploadSingleSizeLimit?: number;
|
|
66
|
+
/**
|
|
67
|
+
* - Whether multiple video uploads are allowed.
|
|
68
|
+
*/
|
|
69
|
+
allowMultiple?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* - Accepted file formats for video uploads.
|
|
72
|
+
*/
|
|
73
|
+
acceptedFormats?: string;
|
|
74
|
+
/**
|
|
75
|
+
* - The default aspect ratio for the video (e.g., 16:9 is 0.5625).
|
|
76
|
+
*/
|
|
77
|
+
defaultRatio?: number;
|
|
78
|
+
/**
|
|
79
|
+
* - Whether to display the ratio option in the modal.
|
|
80
|
+
*/
|
|
81
|
+
showRatioOption?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* - Custom ratio options for video resizing.
|
|
84
|
+
*/
|
|
85
|
+
ratioOptions?: any[];
|
|
86
|
+
/**
|
|
87
|
+
* - Additional attributes to set on the video tag.
|
|
88
|
+
*/
|
|
89
|
+
videoTagAttributes?: {
|
|
90
|
+
[x: string]: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* - Additional attributes to set on the iframe tag.
|
|
94
|
+
*/
|
|
95
|
+
iframeTagAttributes?: {
|
|
96
|
+
[x: string]: string;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* - Additional query parameters for YouTube embedding.
|
|
100
|
+
*/
|
|
101
|
+
query_youtube?: string;
|
|
102
|
+
/**
|
|
103
|
+
* - Additional query parameters for Vimeo embedding.
|
|
104
|
+
*/
|
|
105
|
+
query_vimeo?: string;
|
|
106
|
+
/**
|
|
107
|
+
* - Custom query objects for additional embedding services.
|
|
108
|
+
*/
|
|
109
|
+
embedQuery?: {
|
|
110
|
+
[x: string]: {
|
|
111
|
+
pattern: RegExp;
|
|
112
|
+
action: (url: string) => string;
|
|
113
|
+
tag: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* - Additional URL patterns for video embedding.
|
|
118
|
+
*/
|
|
119
|
+
urlPatterns?: Array<RegExp>;
|
|
120
|
+
/**
|
|
121
|
+
* - Additional file extensions to be recognized for video uploads.
|
|
122
|
+
*/
|
|
123
|
+
extensions?: Array<string>;
|
|
124
|
+
/**
|
|
125
|
+
* - Figure controls.
|
|
126
|
+
*/
|
|
127
|
+
controls?: FigureControls_video;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* @typedef {import('../../events').VideoInfo} VideoInfo_video
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* @typedef {import('../../modules/Figure').FigureControls} FigureControls_video
|
|
134
|
+
*/
|
|
135
|
+
/**
|
|
136
|
+
* @typedef {Object} VideoPluginOptions
|
|
137
|
+
* @property {boolean} [canResize=true] - Whether the video element can be resized.
|
|
138
|
+
* @property {boolean} [showHeightInput=true] - Whether to display the height input field.
|
|
139
|
+
* @property {string} [defaultWidth] - The default width of the video element. If a number is provided, "px" will be appended.
|
|
140
|
+
* @property {string} [defaultHeight] - The default height of the video element. If a number is provided, "px" will be appended.
|
|
141
|
+
* @property {boolean} [percentageOnlySize=false] - Whether to allow only percentage-based sizing.
|
|
142
|
+
* @property {boolean} [createFileInput=false] - Whether to create a file input element for video uploads.
|
|
143
|
+
* @property {boolean} [createUrlInput=true] - Whether to create a URL input element for video embedding.
|
|
144
|
+
* @property {string} [uploadUrl] - The URL endpoint for video file uploads.
|
|
145
|
+
* @property {Object<string, string>} [uploadHeaders] - Additional headers to include in the video upload request.
|
|
146
|
+
* @property {number} [uploadSizeLimit] - The total upload size limit for videos in bytes.
|
|
147
|
+
* @property {number} [uploadSingleSizeLimit] - The single file upload size limit for videos in bytes.
|
|
148
|
+
* @property {boolean} [allowMultiple=false] - Whether multiple video uploads are allowed.
|
|
149
|
+
* @property {string} [acceptedFormats="video/*"] - Accepted file formats for video uploads.
|
|
150
|
+
* @property {number} [defaultRatio=0.5625] - The default aspect ratio for the video (e.g., 16:9 is 0.5625).
|
|
151
|
+
* @property {boolean} [showRatioOption=true] - Whether to display the ratio option in the modal.
|
|
152
|
+
* @property {Array} [ratioOptions] - Custom ratio options for video resizing.
|
|
153
|
+
* @property {Object<string, string>} [videoTagAttributes] - Additional attributes to set on the video tag.
|
|
154
|
+
* @property {Object<string, string>} [iframeTagAttributes] - Additional attributes to set on the iframe tag.
|
|
155
|
+
* @property {string} [query_youtube=""] - Additional query parameters for YouTube embedding.
|
|
156
|
+
* @property {string} [query_vimeo=""] - Additional query parameters for Vimeo embedding.
|
|
157
|
+
* @property {Object<string, {pattern: RegExp, action: (url: string) => string, tag: string}>} [embedQuery] - Custom query objects for additional embedding services.
|
|
158
|
+
* @property {Array<RegExp>} [urlPatterns] - Additional URL patterns for video embedding.
|
|
159
|
+
* @property {Array<string>} [extensions] - Additional file extensions to be recognized for video uploads.
|
|
160
|
+
* @property {FigureControls_video} [controls] - Figure controls.
|
|
161
|
+
*/
|
|
162
|
+
/**
|
|
163
|
+
* @class
|
|
164
|
+
* @description Video plugin.
|
|
165
|
+
* - This plugin provides video embedding functionality within the editor.
|
|
166
|
+
* - It also supports embedding from popular video services
|
|
167
|
+
*/
|
|
168
|
+
declare class Video extends EditorInjector {
|
|
169
|
+
static key: string;
|
|
170
|
+
static type: string;
|
|
171
|
+
static className: string;
|
|
172
|
+
/**
|
|
173
|
+
* @this {Video}
|
|
174
|
+
* @param {HTMLElement} node - The node to check.
|
|
175
|
+
* @returns {HTMLElement|null} Returns a node if the node is a valid component.
|
|
176
|
+
*/
|
|
177
|
+
static component(this: Video, node: HTMLElement): HTMLElement | null;
|
|
178
|
+
/**
|
|
179
|
+
* @constructor
|
|
180
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
181
|
+
* @param {VideoPluginOptions} pluginOptions
|
|
182
|
+
*/
|
|
183
|
+
constructor(editor: __se__EditorCore, pluginOptions: VideoPluginOptions);
|
|
184
|
+
title: any;
|
|
185
|
+
icon: string;
|
|
186
|
+
pluginOptions: {
|
|
187
|
+
canResize: boolean;
|
|
188
|
+
showHeightInput: boolean;
|
|
189
|
+
defaultWidth: string;
|
|
190
|
+
defaultHeight: string;
|
|
191
|
+
percentageOnlySize: boolean;
|
|
192
|
+
createFileInput: boolean;
|
|
193
|
+
createUrlInput: boolean;
|
|
194
|
+
uploadUrl: string;
|
|
195
|
+
uploadHeaders: {
|
|
196
|
+
[x: string]: string;
|
|
197
|
+
};
|
|
198
|
+
uploadSizeLimit: number;
|
|
199
|
+
uploadSingleSizeLimit: number;
|
|
200
|
+
allowMultiple: boolean;
|
|
201
|
+
acceptedFormats: string;
|
|
202
|
+
defaultRatio: number;
|
|
203
|
+
showRatioOption: boolean;
|
|
204
|
+
ratioOptions: any[];
|
|
205
|
+
videoTagAttributes: {
|
|
206
|
+
[x: string]: string;
|
|
207
|
+
};
|
|
208
|
+
iframeTagAttributes: {
|
|
209
|
+
[x: string]: string;
|
|
210
|
+
};
|
|
211
|
+
query_youtube: string;
|
|
212
|
+
query_vimeo: string;
|
|
213
|
+
};
|
|
214
|
+
modal: Modal;
|
|
215
|
+
figure: Figure;
|
|
216
|
+
fileManager: FileManager;
|
|
217
|
+
fileModalWrapper: HTMLElement;
|
|
218
|
+
videoInputFile: HTMLInputElement;
|
|
219
|
+
videoUrlFile: HTMLInputElement;
|
|
220
|
+
focusElement: HTMLInputElement;
|
|
221
|
+
previewSrc: HTMLElement;
|
|
222
|
+
_linkValue: string;
|
|
223
|
+
_align: string;
|
|
224
|
+
_frameRatio: string;
|
|
225
|
+
_defaultRatio: string;
|
|
226
|
+
_defaultSizeX: string;
|
|
227
|
+
_defaultSizeY: string;
|
|
228
|
+
sizeUnit: string;
|
|
229
|
+
proportion: HTMLInputElement;
|
|
230
|
+
frameRatioOption: HTMLSelectElement;
|
|
231
|
+
inputX: HTMLInputElement;
|
|
232
|
+
inputY: HTMLInputElement;
|
|
233
|
+
_element: any;
|
|
234
|
+
_cover: HTMLElement;
|
|
235
|
+
_container: any;
|
|
236
|
+
_ratio: {
|
|
237
|
+
w: number;
|
|
238
|
+
h: number;
|
|
239
|
+
};
|
|
240
|
+
_origin_w: string;
|
|
241
|
+
_origin_h: string;
|
|
242
|
+
_resizing: boolean;
|
|
243
|
+
_onlyPercentage: boolean;
|
|
244
|
+
_nonResizing: boolean;
|
|
245
|
+
query: {
|
|
246
|
+
youtube: {
|
|
247
|
+
pattern: RegExp;
|
|
248
|
+
action: (url: any) => string;
|
|
249
|
+
tag: string;
|
|
250
|
+
};
|
|
251
|
+
vimeo: {
|
|
252
|
+
pattern: RegExp;
|
|
253
|
+
action: (url: any) => string;
|
|
254
|
+
tag: string;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
extensions: string[];
|
|
258
|
+
urlPatterns: RegExp[];
|
|
259
|
+
/**
|
|
260
|
+
* @editorMethod Modules.Modal
|
|
261
|
+
* @description Executes the method that is called when a "Modal" module's is opened.
|
|
262
|
+
*/
|
|
263
|
+
open(): void;
|
|
264
|
+
/**
|
|
265
|
+
* @editorMethod Modules.Controller(Figure)
|
|
266
|
+
* @description Executes the method that is called when a target component is edited.
|
|
267
|
+
*/
|
|
268
|
+
edit(): void;
|
|
269
|
+
/**
|
|
270
|
+
* @editorMethod Modules.Modal
|
|
271
|
+
* @description Executes the method that is called when a plugin's modal is opened.
|
|
272
|
+
* @param {boolean} isUpdate "Indicates whether the modal is for editing an existing component (true) or registering a new one (false)."
|
|
273
|
+
*/
|
|
274
|
+
on(isUpdate: boolean): void;
|
|
275
|
+
/**
|
|
276
|
+
* @editorMethod Editor.EventManager
|
|
277
|
+
* @description Executes the event function of "paste" or "drop".
|
|
278
|
+
* @param {Object} params { frameContext, event, file }
|
|
279
|
+
* @param {__se__FrameContext} params.frameContext Frame context
|
|
280
|
+
* @param {ClipboardEvent} params.event Event object
|
|
281
|
+
* @param {File} params.file File object
|
|
282
|
+
* @returns {boolean} - If return false, the file upload will be canceled
|
|
283
|
+
*/
|
|
284
|
+
onFilePasteAndDrop({ file }: { frameContext: __se__FrameContext; event: ClipboardEvent; file: File }): boolean;
|
|
285
|
+
/**
|
|
286
|
+
* @editorMethod Modules.Modal
|
|
287
|
+
* @description This function is called when a form within a modal window is "submit".
|
|
288
|
+
* @returns {Promise<boolean>} Success / failure
|
|
289
|
+
*/
|
|
290
|
+
modalAction(): Promise<boolean>;
|
|
291
|
+
/**
|
|
292
|
+
* @editorMethod Editor.core
|
|
293
|
+
* @description This method is used to validate and preserve the format of the component within the editor.
|
|
294
|
+
* - It ensures that the structure and attributes of the element are maintained and secure.
|
|
295
|
+
* - The method checks if the element is already wrapped in a valid container and updates its attributes if necessary.
|
|
296
|
+
* - If the element isn't properly contained, a new container is created to retain the format.
|
|
297
|
+
* @returns {{query: string, method: (element: HTMLIFrameElement|HTMLVideoElement) => void}} The format retention object containing the query and method to process the element.
|
|
298
|
+
* - query: The selector query to identify the relevant elements (in this case, 'audio').
|
|
299
|
+
* - method:The function to execute on the element to validate and preserve its format.
|
|
300
|
+
* - The function takes the element as an argument, checks if it is contained correctly, and applies necessary adjustments.
|
|
301
|
+
*/
|
|
302
|
+
retainFormat(): {
|
|
303
|
+
query: string;
|
|
304
|
+
method: (element: HTMLIFrameElement | HTMLVideoElement) => void;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* @editorMethod Modules.Modal
|
|
308
|
+
* @description This function is called before the modal window is opened, but before it is closed.
|
|
309
|
+
*/
|
|
310
|
+
init(): void;
|
|
311
|
+
/**
|
|
312
|
+
* @editorMethod Editor.component
|
|
313
|
+
* @description Executes the method that is called when a component of a plugin is selected.
|
|
314
|
+
* @param {HTMLIFrameElement|HTMLVideoElement} target Target component element
|
|
315
|
+
*/
|
|
316
|
+
select(target: HTMLIFrameElement | HTMLVideoElement): void;
|
|
317
|
+
/**
|
|
318
|
+
* @private
|
|
319
|
+
* @description Prepares the component for selection.
|
|
320
|
+
* - Ensures that the controller is properly positioned and initialized.
|
|
321
|
+
* - Prevents duplicate event handling if the component is already selected.
|
|
322
|
+
* @param {HTMLIFrameElement|HTMLVideoElement} target - The selected element.
|
|
323
|
+
*/
|
|
324
|
+
private _ready;
|
|
325
|
+
/**
|
|
326
|
+
* @editorMethod Editor.Component
|
|
327
|
+
* @description Method to delete a component of a plugin, called by the "FileManager", "Controller" module.
|
|
328
|
+
* @param {HTMLElement} target Target element
|
|
329
|
+
* @returns {Promise<void>}
|
|
330
|
+
*/
|
|
331
|
+
destroy(target: HTMLElement): Promise<void>;
|
|
332
|
+
/**
|
|
333
|
+
* @description Checks if the given URL matches any of the defined URL patterns.
|
|
334
|
+
* @param {string} url - The URL to check.
|
|
335
|
+
* @returns {boolean} True if the URL matches a known pattern; otherwise, false.
|
|
336
|
+
*/
|
|
337
|
+
checkContentType(url: string): boolean;
|
|
338
|
+
/**
|
|
339
|
+
* @description Finds and processes the URL for video by matching it against known service patterns.
|
|
340
|
+
* @param {string} url - The original URL.
|
|
341
|
+
* @returns {{origin: string, url: string, tag: string}|null} An object containing the original URL, the processed URL, and the tag type (e.g., 'iframe'),
|
|
342
|
+
* or null if no matching pattern is found.
|
|
343
|
+
*/
|
|
344
|
+
findProcessUrl(url: string): {
|
|
345
|
+
origin: string;
|
|
346
|
+
url: string;
|
|
347
|
+
tag: string;
|
|
348
|
+
} | null;
|
|
349
|
+
/**
|
|
350
|
+
* @description Converts a YouTube URL into an embeddable URL.
|
|
351
|
+
* - If the URL does not start with "http", it prepends "https://". It also replaces "watch?v=" with the embed path.
|
|
352
|
+
* @param {string} url - The original YouTube URL.
|
|
353
|
+
* @returns {string} The converted YouTube embed URL.
|
|
354
|
+
*/
|
|
355
|
+
convertUrlYoutube(url: string): string;
|
|
356
|
+
/**
|
|
357
|
+
* @description Converts a Vimeo URL into an embeddable URL.
|
|
358
|
+
* - Removes any trailing slash and extracts the video ID from the URL.
|
|
359
|
+
* @param {string} url - The original Vimeo URL.
|
|
360
|
+
* @returns {string} The converted Vimeo embed URL.
|
|
361
|
+
*/
|
|
362
|
+
convertUrlVimeo(url: string): string;
|
|
363
|
+
/**
|
|
364
|
+
* @description Adds query parameters to a URL.
|
|
365
|
+
* - If the URL already contains a query string, the provided query is appended with an "&".
|
|
366
|
+
* @param {string} url - The original URL.
|
|
367
|
+
* @param {string} query - The query string to append.
|
|
368
|
+
* @returns {string} The URL with the appended query parameters.
|
|
369
|
+
*/
|
|
370
|
+
addQuery(url: string, query: string): string;
|
|
371
|
+
/**
|
|
372
|
+
* @description Creates or updates a video embed component.
|
|
373
|
+
* - When updating, it replaces the existing element if necessary and applies the new source, size, and alignment.
|
|
374
|
+
* - When creating, it wraps the provided element in a figure container.
|
|
375
|
+
* @param {HTMLIFrameElement|HTMLVideoElement} oFrame - The existing video element (for update) or a newly created one.
|
|
376
|
+
* @param {string} src - The source URL for the video.
|
|
377
|
+
* @param {string} width - The desired width for the video element.
|
|
378
|
+
* @param {string} height - The desired height for the video element.
|
|
379
|
+
* @param {string} align - The alignment to apply to the video element (e.g., 'left', 'center', 'right').
|
|
380
|
+
* @param {boolean} isUpdate - Indicates whether this is an update to an existing component (true) or a new creation (false).
|
|
381
|
+
* @param {{name: string, size: number}} file - File metadata associated with the video
|
|
382
|
+
*/
|
|
383
|
+
create(
|
|
384
|
+
oFrame: HTMLIFrameElement | HTMLVideoElement,
|
|
385
|
+
src: string,
|
|
386
|
+
width: string,
|
|
387
|
+
height: string,
|
|
388
|
+
align: string,
|
|
389
|
+
isUpdate: boolean,
|
|
390
|
+
file: {
|
|
391
|
+
name: string;
|
|
392
|
+
size: number;
|
|
393
|
+
}
|
|
394
|
+
): void;
|
|
395
|
+
/**
|
|
396
|
+
* @description Creates a new iframe element for video embedding.
|
|
397
|
+
* - Applies any additional properties provided and sets the necessary attributes for embedding.
|
|
398
|
+
* @param {Object<string, string>} [props] - An optional object containing properties to assign to the iframe.
|
|
399
|
+
* @returns {HTMLIFrameElement} The newly created iframe element.
|
|
400
|
+
*/
|
|
401
|
+
createIframeTag(props?: { [x: string]: string }): HTMLIFrameElement;
|
|
402
|
+
/**
|
|
403
|
+
* @description Creates a new video element for video embedding.
|
|
404
|
+
* - Applies any additional properties provided and sets the necessary attributes.
|
|
405
|
+
* @param {Object<string, string>} [props] - An optional object containing properties to assign to the video element.
|
|
406
|
+
* @returns {HTMLVideoElement} The newly created video element.
|
|
407
|
+
*/
|
|
408
|
+
createVideoTag(props?: { [x: string]: string }): HTMLVideoElement;
|
|
409
|
+
/**
|
|
410
|
+
* @private
|
|
411
|
+
* @description Sets the size of the video element.
|
|
412
|
+
* @param {string|number} w - The width of the video.
|
|
413
|
+
* @param {string|number} h - The height of the video.
|
|
414
|
+
*/
|
|
415
|
+
private _applySize;
|
|
416
|
+
/**
|
|
417
|
+
* @private
|
|
418
|
+
* @description Retrieves video information including size and alignment.
|
|
419
|
+
* @returns {*} Video information object.
|
|
420
|
+
*/
|
|
421
|
+
private _getInfo;
|
|
422
|
+
/**
|
|
423
|
+
* @description Create an "video" component using the provided files.
|
|
424
|
+
* @param {FileList|File[]} fileList File object list
|
|
425
|
+
* @returns {Promise<boolean>} If return false, the file upload will be canceled
|
|
426
|
+
*/
|
|
427
|
+
submitFile(fileList: FileList | File[]): Promise<boolean>;
|
|
428
|
+
/**
|
|
429
|
+
* @description Create an "video" component using the provided url.
|
|
430
|
+
* @param {string} url File url
|
|
431
|
+
* @returns {Promise<boolean>} If return false, the file upload will be canceled
|
|
432
|
+
*/
|
|
433
|
+
submitURL(url: string): Promise<boolean>;
|
|
434
|
+
/**
|
|
435
|
+
* @private
|
|
436
|
+
* @description Updates the video component within the editor.
|
|
437
|
+
* @param {HTMLIFrameElement|HTMLVideoElement} oFrame - The video element to update.
|
|
438
|
+
*/
|
|
439
|
+
private _update;
|
|
440
|
+
/**
|
|
441
|
+
* @private
|
|
442
|
+
* @description Registers the uploaded video in the editor.
|
|
443
|
+
* @param {VideoInfo_video} info - Video information object.
|
|
444
|
+
* @param {Object<string, *>} response - Server response containing video data.
|
|
445
|
+
*/
|
|
446
|
+
private _register;
|
|
447
|
+
/**
|
|
448
|
+
* @private
|
|
449
|
+
* @description Uploads a video to the server using an external upload handler.
|
|
450
|
+
* @param {VideoInfo_video} info - Video information object.
|
|
451
|
+
* @param {FileList} files - The video files to upload.
|
|
452
|
+
*/
|
|
453
|
+
private _serverUpload;
|
|
454
|
+
/**
|
|
455
|
+
* @private
|
|
456
|
+
* @description Sets attributes for the video tag.
|
|
457
|
+
* @param {HTMLVideoElement} element - The video element.
|
|
458
|
+
*/
|
|
459
|
+
private _setTagAttrs;
|
|
460
|
+
/**
|
|
461
|
+
* @private
|
|
462
|
+
* @description Sets attributes for the iframe tag.
|
|
463
|
+
* @param {HTMLIFrameElement} element - The iframe element.
|
|
464
|
+
*/
|
|
465
|
+
private _setIframeAttrs;
|
|
466
|
+
/**
|
|
467
|
+
* @private
|
|
468
|
+
* @description Selects a ratio option in the ratio dropdown.
|
|
469
|
+
* @param {string|number} value - The selected ratio value.
|
|
470
|
+
* @returns {boolean} Returns true if a ratio was selected.
|
|
471
|
+
*/
|
|
472
|
+
private _setRatioSelect;
|
|
473
|
+
/**
|
|
474
|
+
* @private
|
|
475
|
+
* @description Handles video upload errors.
|
|
476
|
+
* @param {Object<string, *>} response - The error response object.
|
|
477
|
+
* @returns {Promise<void>}
|
|
478
|
+
*/
|
|
479
|
+
private _error;
|
|
480
|
+
#private;
|
|
481
|
+
}
|
|
482
|
+
import EditorInjector from '../../editorInjector';
|
|
483
|
+
import { Modal } from '../../modules';
|
|
484
|
+
import { Figure } from '../../modules';
|
|
485
|
+
import { FileManager } from '../../modules';
|