suneditor 3.0.0-beta.9 → 3.0.0-rc.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/README.md +65 -57
- package/dist/suneditor-contents.min.css +1 -0
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +110 -61
- package/src/assets/design/color.css +36 -17
- package/src/assets/design/size.css +2 -0
- package/src/assets/icons/defaultIcons.js +17 -2
- package/src/assets/suneditor-contents.css +51 -16
- package/src/assets/suneditor.css +116 -43
- package/src/core/config/contextProvider.js +288 -0
- package/src/core/config/eventManager.js +188 -0
- package/src/core/config/instanceCheck.js +59 -0
- package/src/core/config/optionProvider.js +452 -0
- package/src/core/editor.js +166 -1637
- package/src/core/event/actions/index.js +229 -0
- package/src/core/event/effects/common.registry.js +74 -0
- package/src/core/event/effects/keydown.registry.js +573 -0
- package/src/core/event/effects/ruleHelpers.js +148 -0
- package/src/core/event/eventOrchestrator.js +944 -0
- package/src/core/event/executor.js +27 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +27 -28
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +10 -8
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +22 -23
- package/src/core/event/handlers/handler_ww_input.js +75 -0
- package/src/core/event/handlers/handler_ww_key.js +228 -0
- package/src/core/event/handlers/handler_ww_mouse.js +166 -0
- package/src/core/event/ports.js +211 -0
- package/src/core/event/reducers/keydown.reducer.js +97 -0
- package/src/core/event/rules/keydown.rule.arrow.js +63 -0
- package/src/core/event/rules/keydown.rule.backspace.js +208 -0
- package/src/core/event/rules/keydown.rule.delete.js +132 -0
- package/src/core/event/rules/keydown.rule.enter.js +150 -0
- package/src/core/event/rules/keydown.rule.tab.js +35 -0
- package/src/core/event/support/defaultLineManager.js +136 -0
- package/src/core/event/support/selectionState.js +204 -0
- package/src/core/kernel/coreKernel.js +320 -0
- package/src/core/kernel/kernelInjector.js +19 -0
- package/src/core/kernel/store.js +173 -0
- package/src/core/{class → logic/dom}/char.js +42 -45
- package/src/core/logic/dom/format.js +1075 -0
- package/src/core/{class → logic/dom}/html.js +743 -624
- package/src/core/logic/dom/inline.js +1847 -0
- package/src/core/logic/dom/listFormat.js +601 -0
- package/src/core/{class → logic/dom}/nodeTransform.js +92 -72
- package/src/core/{class → logic/dom}/offset.js +254 -317
- package/src/core/logic/dom/selection.js +754 -0
- package/src/core/logic/panel/menu.js +389 -0
- package/src/core/logic/panel/toolbar.js +449 -0
- package/src/core/logic/panel/viewer.js +761 -0
- package/src/core/logic/shell/_commandExecutor.js +380 -0
- package/src/core/logic/shell/commandDispatcher.js +241 -0
- package/src/core/logic/shell/component.js +970 -0
- package/src/core/logic/shell/focusManager.js +110 -0
- package/src/core/{base → logic/shell}/history.js +110 -60
- package/src/core/logic/shell/pluginManager.js +363 -0
- package/src/core/logic/shell/shortcuts.js +130 -0
- package/src/core/logic/shell/ui.js +904 -0
- package/src/core/schema/context.js +66 -0
- package/src/core/schema/frameContext.js +160 -0
- package/src/core/schema/options.js +628 -0
- package/src/core/section/constructor.js +194 -500
- package/src/core/section/documentType.js +297 -222
- package/src/events.js +808 -543
- package/src/helper/clipboard.js +27 -16
- package/src/helper/converter.js +100 -78
- package/src/helper/dom/domCheck.js +56 -30
- package/src/helper/dom/domQuery.js +159 -89
- package/src/helper/dom/domUtils.js +114 -49
- package/src/helper/dom/index.js +5 -1
- package/src/helper/env.js +26 -26
- package/src/helper/index.js +1 -1
- package/src/helper/keyCodeMap.js +25 -28
- package/src/helper/numbers.js +4 -8
- package/src/helper/unicode.js +4 -8
- package/src/hooks/base.js +307 -0
- package/src/hooks/params.js +130 -0
- package/src/interfaces/contracts.js +227 -0
- package/src/interfaces/index.js +7 -0
- package/src/interfaces/plugins.js +239 -0
- package/src/langs/ckb.js +4 -4
- package/src/langs/cs.js +4 -4
- package/src/langs/da.js +4 -4
- package/src/langs/de.js +4 -4
- package/src/langs/en.js +4 -4
- package/src/langs/es.js +4 -4
- package/src/langs/fa.js +4 -4
- package/src/langs/fr.js +4 -4
- package/src/langs/he.js +4 -4
- package/src/langs/hu.js +4 -4
- package/src/langs/it.js +4 -4
- package/src/langs/ja.js +4 -4
- package/src/langs/km.js +4 -4
- package/src/langs/ko.js +4 -4
- package/src/langs/lv.js +4 -4
- package/src/langs/nl.js +4 -4
- package/src/langs/pl.js +4 -4
- package/src/langs/pt_br.js +13 -13
- package/src/langs/ro.js +4 -4
- package/src/langs/ru.js +4 -4
- package/src/langs/se.js +4 -4
- package/src/langs/tr.js +4 -4
- package/src/langs/uk.js +4 -4
- package/src/langs/ur.js +4 -4
- package/src/langs/zh_cn.js +4 -4
- package/src/modules/{Browser.js → contract/Browser.js} +119 -128
- package/src/modules/{ColorPicker.js → contract/ColorPicker.js} +132 -142
- package/src/modules/contract/Controller.js +589 -0
- package/src/modules/{Figure.js → contract/Figure.js} +591 -411
- package/src/modules/{HueSlider.js → contract/HueSlider.js} +125 -86
- package/src/modules/contract/Modal.js +357 -0
- package/src/modules/contract/index.js +9 -0
- package/src/modules/manager/ApiManager.js +197 -0
- package/src/modules/{FileManager.js → manager/FileManager.js} +128 -160
- package/src/modules/manager/index.js +5 -0
- package/src/modules/{ModalAnchorEditor.js → ui/ModalAnchorEditor.js} +108 -138
- package/src/modules/{SelectMenu.js → ui/SelectMenu.js} +119 -120
- package/src/modules/{_DragHandle.js → ui/_DragHandle.js} +1 -1
- package/src/modules/ui/index.js +6 -0
- package/src/plugins/browser/audioGallery.js +23 -26
- package/src/plugins/browser/fileBrowser.js +25 -28
- package/src/plugins/browser/fileGallery.js +20 -23
- package/src/plugins/browser/imageGallery.js +24 -23
- package/src/plugins/browser/videoGallery.js +27 -29
- package/src/plugins/command/blockquote.js +11 -17
- package/src/plugins/command/exportPDF.js +26 -26
- package/src/plugins/command/fileUpload.js +138 -133
- package/src/plugins/command/list_bulleted.js +48 -44
- package/src/plugins/command/list_numbered.js +48 -44
- package/src/plugins/dropdown/align.js +64 -50
- package/src/plugins/dropdown/backgroundColor.js +34 -35
- package/src/plugins/dropdown/{formatBlock.js → blockStyle.js} +43 -37
- package/src/plugins/dropdown/font.js +50 -36
- package/src/plugins/dropdown/fontColor.js +34 -35
- package/src/plugins/dropdown/hr.js +55 -50
- package/src/plugins/dropdown/layout.js +20 -15
- package/src/plugins/dropdown/lineHeight.js +46 -30
- package/src/plugins/dropdown/list.js +32 -33
- package/src/plugins/dropdown/paragraphStyle.js +40 -34
- package/src/plugins/dropdown/table/index.js +915 -0
- package/src/plugins/dropdown/table/render/table.html.js +308 -0
- package/src/plugins/dropdown/table/render/table.menu.js +121 -0
- package/src/plugins/dropdown/table/services/table.cell.js +465 -0
- package/src/plugins/dropdown/table/services/table.clipboard.js +414 -0
- package/src/plugins/dropdown/table/services/table.grid.js +504 -0
- package/src/plugins/dropdown/table/services/table.resize.js +463 -0
- package/src/plugins/dropdown/table/services/table.selection.js +466 -0
- package/src/plugins/dropdown/table/services/table.style.js +844 -0
- package/src/plugins/dropdown/table/shared/table.constants.js +109 -0
- package/src/plugins/dropdown/table/shared/table.utils.js +219 -0
- package/src/plugins/dropdown/template.js +20 -15
- package/src/plugins/dropdown/textStyle.js +28 -22
- package/src/plugins/field/mention.js +54 -49
- package/src/plugins/index.js +5 -5
- package/src/plugins/input/fontSize.js +100 -97
- package/src/plugins/input/pageNavigator.js +13 -10
- package/src/plugins/modal/audio.js +208 -219
- package/src/plugins/modal/drawing.js +99 -104
- package/src/plugins/modal/embed.js +323 -312
- package/src/plugins/modal/image/index.js +942 -0
- package/src/plugins/modal/image/render/image.html.js +150 -0
- package/src/plugins/modal/image/services/image.size.js +198 -0
- package/src/plugins/modal/image/services/image.upload.js +216 -0
- package/src/plugins/modal/image/shared/image.constants.js +20 -0
- package/src/plugins/modal/link.js +74 -54
- package/src/plugins/modal/math.js +126 -119
- package/src/plugins/modal/video/index.js +858 -0
- package/src/plugins/modal/video/render/video.html.js +131 -0
- package/src/plugins/modal/video/services/video.size.js +281 -0
- package/src/plugins/modal/video/services/video.upload.js +92 -0
- package/src/plugins/popup/anchor.js +57 -49
- package/src/suneditor.js +73 -61
- package/src/themes/cobalt.css +155 -0
- package/src/themes/dark.css +143 -120
- package/src/typedef.js +214 -63
- package/types/assets/icons/defaultIcons.d.ts +8 -0
- package/types/assets/suneditor-contents.css.d.ts +1 -0
- package/types/assets/suneditor.css.d.ts +1 -0
- package/types/core/config/contextProvider.d.ts +148 -0
- package/types/core/config/eventManager.d.ts +68 -0
- package/types/core/config/instanceCheck.d.ts +33 -0
- package/types/core/config/optionProvider.d.ts +147 -0
- package/types/core/editor.d.ts +27 -586
- package/types/core/event/actions/index.d.ts +50 -0
- package/types/core/event/effects/common.registry.d.ts +56 -0
- package/types/core/event/effects/keydown.registry.d.ts +80 -0
- package/types/core/event/effects/ruleHelpers.d.ts +36 -0
- package/types/core/event/eventOrchestrator.d.ts +191 -0
- package/types/core/event/executor.d.ts +13 -0
- package/types/core/event/handlers/handler_toolbar.d.ts +38 -0
- package/types/core/event/handlers/handler_ww_clipboard.d.ts +36 -0
- package/types/core/event/handlers/handler_ww_dragDrop.d.ts +26 -0
- package/types/core/event/handlers/handler_ww_input.d.ts +38 -0
- package/types/core/event/handlers/handler_ww_key.d.ts +40 -0
- package/types/core/event/handlers/handler_ww_mouse.d.ts +47 -0
- package/types/core/event/ports.d.ts +256 -0
- package/types/core/event/reducers/keydown.reducer.d.ts +84 -0
- package/types/core/event/rules/keydown.rule.arrow.d.ts +19 -0
- package/types/core/event/rules/keydown.rule.backspace.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.delete.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.enter.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.tab.d.ts +18 -0
- package/types/core/event/support/defaultLineManager.d.ts +22 -0
- package/types/core/event/support/selectionState.d.ts +29 -0
- package/types/core/kernel/coreKernel.d.ts +219 -0
- package/types/core/kernel/kernelInjector.d.ts +16 -0
- package/types/core/kernel/store.d.ts +170 -0
- package/types/core/logic/dom/char.d.ts +46 -0
- package/types/core/logic/dom/format.d.ts +234 -0
- package/types/core/logic/dom/html.d.ts +290 -0
- package/types/core/logic/dom/inline.d.ts +93 -0
- package/types/core/logic/dom/listFormat.d.ts +101 -0
- package/types/core/logic/dom/nodeTransform.d.ts +110 -0
- package/types/core/logic/dom/offset.d.ts +335 -0
- package/types/core/logic/dom/selection.d.ts +165 -0
- package/types/core/logic/panel/menu.d.ts +93 -0
- package/types/core/logic/panel/toolbar.d.ts +128 -0
- package/types/core/logic/panel/viewer.d.ts +89 -0
- package/types/core/logic/shell/_commandExecutor.d.ts +18 -0
- package/types/core/logic/shell/commandDispatcher.d.ts +65 -0
- package/types/core/logic/shell/component.d.ts +182 -0
- package/types/core/logic/shell/focusManager.d.ts +31 -0
- package/types/core/{base → logic/shell}/history.d.ts +13 -12
- package/types/core/logic/shell/pluginManager.d.ts +115 -0
- package/types/core/logic/shell/shortcuts.d.ts +131 -0
- package/types/core/logic/shell/ui.d.ts +261 -0
- package/types/core/schema/context.d.ts +104 -0
- package/types/core/schema/frameContext.d.ts +320 -0
- package/types/core/schema/options.d.ts +1241 -0
- package/types/core/section/constructor.d.ts +117 -652
- package/types/core/section/documentType.d.ts +43 -61
- package/types/events.d.ts +796 -65
- package/types/helper/clipboard.d.ts +5 -4
- package/types/helper/converter.d.ts +55 -43
- package/types/helper/dom/domCheck.d.ts +27 -19
- package/types/helper/dom/domQuery.d.ts +76 -57
- package/types/helper/dom/domUtils.d.ts +62 -39
- package/types/helper/dom/index.d.ts +87 -1
- package/types/helper/env.d.ts +16 -13
- package/types/helper/index.d.ts +8 -2
- package/types/helper/keyCodeMap.d.ts +24 -23
- package/types/helper/numbers.d.ts +4 -6
- package/types/helper/unicode.d.ts +4 -3
- package/types/hooks/base.d.ts +239 -0
- package/types/hooks/params.d.ts +65 -0
- package/types/index.d.ts +20 -117
- package/types/interfaces/contracts.d.ts +183 -0
- package/types/interfaces/index.d.ts +3 -0
- package/types/interfaces/plugins.d.ts +168 -0
- package/types/langs/_Lang.d.ts +2 -2
- package/types/langs/index.d.ts +2 -2
- package/types/modules/contract/Browser.d.ts +262 -0
- package/types/modules/contract/ColorPicker.d.ts +99 -0
- package/types/modules/contract/Controller.d.ts +204 -0
- package/types/modules/contract/Figure.d.ts +529 -0
- package/types/modules/{HueSlider.d.ts → contract/HueSlider.d.ts} +39 -28
- package/types/modules/contract/Modal.d.ts +62 -0
- package/types/modules/contract/index.d.ts +7 -0
- package/types/modules/manager/ApiManager.d.ts +106 -0
- package/types/modules/manager/FileManager.d.ts +124 -0
- package/types/modules/manager/index.d.ts +3 -0
- package/types/modules/ui/ModalAnchorEditor.d.ts +152 -0
- package/types/modules/ui/SelectMenu.d.ts +107 -0
- package/types/modules/{_DragHandle.d.ts → ui/_DragHandle.d.ts} +1 -0
- package/types/modules/ui/index.d.ts +4 -0
- package/types/plugins/browser/audioGallery.d.ts +33 -41
- package/types/plugins/browser/fileBrowser.d.ts +42 -50
- package/types/plugins/browser/fileGallery.d.ts +33 -41
- package/types/plugins/browser/imageGallery.d.ts +30 -37
- package/types/plugins/browser/videoGallery.d.ts +33 -41
- package/types/plugins/command/blockquote.d.ts +4 -21
- package/types/plugins/command/exportPDF.d.ts +23 -33
- package/types/plugins/command/fileUpload.d.ts +80 -100
- package/types/plugins/command/list_bulleted.d.ts +9 -35
- package/types/plugins/command/list_numbered.d.ts +9 -35
- package/types/plugins/dropdown/align.d.ts +23 -46
- package/types/plugins/dropdown/backgroundColor.d.ts +35 -53
- package/types/plugins/dropdown/blockStyle.d.ts +45 -0
- package/types/plugins/dropdown/font.d.ts +18 -41
- package/types/plugins/dropdown/fontColor.d.ts +35 -53
- package/types/plugins/dropdown/hr.d.ts +26 -52
- package/types/plugins/dropdown/layout.d.ts +19 -25
- package/types/plugins/dropdown/lineHeight.d.ts +21 -39
- package/types/plugins/dropdown/list.d.ts +6 -34
- package/types/plugins/dropdown/paragraphStyle.d.ts +34 -45
- package/types/plugins/dropdown/table/index.d.ts +158 -0
- package/types/plugins/dropdown/table/render/table.html.d.ts +71 -0
- package/types/plugins/dropdown/table/render/table.menu.d.ts +59 -0
- package/types/plugins/dropdown/table/services/table.cell.d.ts +76 -0
- package/types/plugins/dropdown/table/services/table.clipboard.d.ts +26 -0
- package/types/plugins/dropdown/table/services/table.grid.d.ts +77 -0
- package/types/plugins/dropdown/table/services/table.resize.d.ts +72 -0
- package/types/plugins/dropdown/table/services/table.selection.d.ts +59 -0
- package/types/plugins/dropdown/table/services/table.style.d.ts +162 -0
- package/types/plugins/dropdown/table/shared/table.constants.d.ts +134 -0
- package/types/plugins/dropdown/table/shared/table.utils.d.ts +91 -0
- package/types/plugins/dropdown/template.d.ts +19 -25
- package/types/plugins/dropdown/textStyle.d.ts +23 -30
- package/types/plugins/field/mention.d.ts +66 -72
- package/types/plugins/index.d.ts +41 -40
- package/types/plugins/input/fontSize.d.ts +57 -96
- package/types/plugins/input/pageNavigator.d.ts +5 -8
- package/types/plugins/modal/audio.d.ts +60 -153
- package/types/plugins/modal/drawing.d.ts +16 -118
- package/types/plugins/modal/embed.d.ts +46 -166
- package/types/plugins/modal/image/index.d.ts +281 -0
- package/types/plugins/modal/image/render/image.html.d.ts +45 -0
- package/types/plugins/modal/image/services/image.size.d.ts +55 -0
- package/types/plugins/modal/image/services/image.upload.d.ts +24 -0
- package/types/plugins/modal/image/shared/image.constants.d.ts +17 -0
- package/types/plugins/modal/link.d.ts +46 -66
- package/types/plugins/modal/math.d.ts +17 -86
- package/types/plugins/modal/{video.d.ts → video/index.d.ts} +89 -221
- package/types/plugins/modal/video/render/video.html.d.ts +37 -0
- package/types/plugins/modal/video/services/video.size.d.ts +74 -0
- package/types/plugins/modal/video/services/video.upload.d.ts +19 -0
- package/types/plugins/popup/anchor.d.ts +8 -38
- package/types/suneditor.d.ts +55 -24
- package/types/typedef.d.ts +344 -228
- package/CONTRIBUTING.md +0 -186
- package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
- package/src/core/base/eventHandlers/handler_ww_mouse.js +0 -194
- package/src/core/base/eventManager.js +0 -1523
- package/src/core/class/component.js +0 -856
- package/src/core/class/format.js +0 -3433
- package/src/core/class/menu.js +0 -346
- package/src/core/class/selection.js +0 -610
- package/src/core/class/shortcuts.js +0 -98
- package/src/core/class/toolbar.js +0 -431
- package/src/core/class/ui.js +0 -424
- package/src/core/class/viewer.js +0 -750
- package/src/core/section/actives.js +0 -266
- package/src/core/section/context.js +0 -102
- package/src/editorInjector/_classes.js +0 -36
- package/src/editorInjector/_core.js +0 -87
- package/src/editorInjector/index.js +0 -73
- package/src/modules/ApiManager.js +0 -191
- package/src/modules/Controller.js +0 -474
- package/src/modules/Modal.js +0 -346
- package/src/modules/index.js +0 -14
- package/src/plugins/dropdown/table.js +0 -4034
- package/src/plugins/modal/image.js +0 -1376
- package/src/plugins/modal/video.js +0 -1226
- package/types/core/base/eventHandlers/handler_toolbar.d.ts +0 -41
- package/types/core/base/eventHandlers/handler_ww_clipboard.d.ts +0 -40
- package/types/core/base/eventHandlers/handler_ww_dragDrop.d.ts +0 -35
- package/types/core/base/eventHandlers/handler_ww_key_input.d.ts +0 -45
- package/types/core/base/eventHandlers/handler_ww_mouse.d.ts +0 -39
- package/types/core/base/eventManager.d.ts +0 -401
- package/types/core/class/char.d.ts +0 -61
- package/types/core/class/component.d.ts +0 -213
- package/types/core/class/format.d.ts +0 -623
- package/types/core/class/html.d.ts +0 -430
- package/types/core/class/menu.d.ts +0 -126
- package/types/core/class/nodeTransform.d.ts +0 -93
- package/types/core/class/offset.d.ts +0 -522
- package/types/core/class/selection.d.ts +0 -188
- package/types/core/class/shortcuts.d.ts +0 -142
- package/types/core/class/toolbar.d.ts +0 -189
- package/types/core/class/ui.d.ts +0 -164
- package/types/core/class/viewer.d.ts +0 -140
- package/types/core/section/actives.d.ts +0 -46
- package/types/core/section/context.d.ts +0 -45
- package/types/editorInjector/_classes.d.ts +0 -41
- package/types/editorInjector/_core.d.ts +0 -87
- package/types/editorInjector/index.d.ts +0 -69
- package/types/modules/ApiManager.d.ts +0 -125
- package/types/modules/Browser.d.ts +0 -326
- package/types/modules/ColorPicker.d.ts +0 -135
- package/types/modules/Controller.d.ts +0 -251
- package/types/modules/Figure.d.ts +0 -517
- package/types/modules/FileManager.d.ts +0 -202
- package/types/modules/Modal.d.ts +0 -111
- package/types/modules/ModalAnchorEditor.d.ts +0 -236
- package/types/modules/SelectMenu.d.ts +0 -194
- package/types/modules/index.d.ts +0 -26
- package/types/plugins/dropdown/formatBlock.d.ts +0 -55
- package/types/plugins/dropdown/table.d.ts +0 -627
- package/types/plugins/modal/image.d.ts +0 -451
- /package/{LICENSE → LICENSE.txt} +0 -0
package/src/events.js
CHANGED
|
@@ -2,31 +2,22 @@
|
|
|
2
2
|
// This is a collection of functions that can be used in the editor's event callback.
|
|
3
3
|
// ---------
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import('./modules/Controller').default} ControllerInstance
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
5
|
// --- native events
|
|
10
6
|
/**
|
|
11
7
|
* @typedef {Object} BaseEvent
|
|
12
|
-
* @property {
|
|
13
|
-
* @property {
|
|
8
|
+
* @property {SunEditor.Deps} $ - Kernel dependencies
|
|
9
|
+
* @property {SunEditor.FrameContext} frameContext - frame context
|
|
14
10
|
* @property {Event} event - event object
|
|
15
11
|
*/
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* @typedef {Object} ClipboardEvent
|
|
19
|
-
* @property {
|
|
20
|
-
* @property {
|
|
15
|
+
* @property {SunEditor.Deps} $ - Kernel dependencies
|
|
16
|
+
* @property {SunEditor.FrameContext} frameContext - frame context
|
|
21
17
|
* @property {Event} event - event object
|
|
22
18
|
* @property {string} data - drop data
|
|
23
19
|
* @property {boolean} maxCharCount - is max char count
|
|
24
|
-
* @property {string} from - "SE"
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
// --- controller
|
|
28
|
-
/**
|
|
29
|
-
* @typedef {import('./modules/Controller').ControllerInfo} ControllerInfo_events
|
|
20
|
+
* @property {string} from - `"SE"`|`"MS"`|`""` - source
|
|
30
21
|
*/
|
|
31
22
|
|
|
32
23
|
// --- media
|
|
@@ -100,535 +91,809 @@
|
|
|
100
91
|
* @property {string} align - align value
|
|
101
92
|
* @property {boolean} isUpdate - new create or update
|
|
102
93
|
* @property {string} url - embed url
|
|
103
|
-
* @property {?HTMLElement} children - When the input source is stacked in an iframe
|
|
94
|
+
* @property {?HTMLElement} children - When the input source is stacked in an `iframe`, etc., the actual embedded DOM
|
|
104
95
|
* @property {?ProcessInfo} process - embed process info
|
|
105
96
|
*/
|
|
106
97
|
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
98
|
+
// ----------------- [handlers] ---------------------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @callback
|
|
102
|
+
* @description Fired when the editor has completed full initialization.
|
|
103
|
+
* This event is deferred via `setTimeout` to ensure all DOM layout calculations are complete,
|
|
104
|
+
* toolbar is visible, `ResizeObserver` is registered, and history stack is initialized.
|
|
105
|
+
* Use this event to safely call editor methods immediately after creation.
|
|
106
|
+
* @param {Object} params
|
|
107
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
108
|
+
*/
|
|
109
|
+
function onload(params) {}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @callback
|
|
113
|
+
* @description Fired when the editor content area is scrolled.
|
|
114
|
+
* Use this to sync UI elements with scroll position or implement custom scroll behaviors.
|
|
115
|
+
* @param {BaseEvent} params
|
|
116
|
+
*/
|
|
117
|
+
function onScroll(params) {}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @callback
|
|
121
|
+
* @description Fired when the user presses a mouse button down in the editor.
|
|
122
|
+
* Triggered before internal `mousedown` processing.
|
|
123
|
+
* Return `false` to prevent the default editor behavior.
|
|
124
|
+
* @param {BaseEvent} params
|
|
125
|
+
*/
|
|
126
|
+
function onMouseDown(params) {}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @callback
|
|
130
|
+
* @description Fired when the user clicks in the editor.
|
|
131
|
+
* Triggered before component selection and default `line` creation.
|
|
132
|
+
* Return `false` to prevent the default editor behavior.
|
|
133
|
+
* @param {BaseEvent} params
|
|
134
|
+
*/
|
|
135
|
+
function onClick(params) {}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @callback
|
|
139
|
+
* @description Fired before text input is inserted into the editor.
|
|
140
|
+
* Triggered after character count validation.
|
|
141
|
+
* Return `false` to prevent the input from being processed.
|
|
142
|
+
* @param {BaseEvent & {data: string}} params
|
|
143
|
+
*/
|
|
144
|
+
function onBeforeInput(params) {}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @callback
|
|
148
|
+
* @description Fired when text content is input into the editor (typing, composition, paste).
|
|
149
|
+
* Triggered after default `line` creation and selection initialization.
|
|
150
|
+
* Return `false` to prevent history push.
|
|
151
|
+
* @param {BaseEvent & {data: string}} params
|
|
152
|
+
*/
|
|
153
|
+
function onInput(params) {}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @callback
|
|
157
|
+
* @description Fired when the mouse cursor leaves the editor area.
|
|
158
|
+
* Return `false` to prevent the default editor behavior.
|
|
159
|
+
* @param {BaseEvent} params
|
|
160
|
+
*/
|
|
161
|
+
function onMouseLeave(params) {}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @callback
|
|
165
|
+
* @description Fired when the user releases a mouse button in the editor.
|
|
166
|
+
* Triggered after internal selection updates.
|
|
167
|
+
* Return `false` to prevent the default editor behavior.
|
|
168
|
+
* @param {BaseEvent} params
|
|
169
|
+
*/
|
|
170
|
+
function onMouseUp(params) {}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @callback
|
|
174
|
+
* @description Fired when a key is pressed down in the editor.
|
|
175
|
+
* Triggered before shortcut command execution and `keydown` reducers.
|
|
176
|
+
* Return `false` to prevent the default editor behavior including shortcuts, actions, and text input.
|
|
177
|
+
* @param {BaseEvent} params
|
|
178
|
+
*/
|
|
179
|
+
function onKeyDown(params) {}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @callback
|
|
183
|
+
* @description Fired when a key is released in the editor.
|
|
184
|
+
* Triggered after format tag cleanup and zero-width character removal.
|
|
185
|
+
* Return `false` to prevent history push for history-relevant keys.
|
|
186
|
+
* @param {BaseEvent} params
|
|
187
|
+
*/
|
|
188
|
+
function onKeyUp(params) {}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @callback
|
|
192
|
+
* @description Fired when the editor gains focus (managed focus via `editor.focusManager.focus()`).
|
|
193
|
+
* Triggered after toolbar display updates and status flags are set.
|
|
194
|
+
* This is different from `onNativeFocus` which fires on native DOM `focus` events.
|
|
195
|
+
* @param {BaseEvent} params
|
|
196
|
+
*/
|
|
197
|
+
function onFocus(params) {}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @callback
|
|
201
|
+
* @description Fired when the editor receives a native DOM `focus` event.
|
|
202
|
+
* Triggered before managed focus processing.
|
|
203
|
+
* This is the raw browser `focus` event, use `onFocus` for managed focus handling.
|
|
204
|
+
* @param {BaseEvent} params
|
|
205
|
+
*/
|
|
206
|
+
function onNativeFocus(params) {}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @callback
|
|
210
|
+
* @description Fired when the editor loses focus (managed blur via `editor.blur()`).
|
|
211
|
+
* Triggered after balloon toolbar is hidden and status flags are updated.
|
|
212
|
+
* This is different from `onNativeBlur` which fires on native DOM `blur` events.
|
|
213
|
+
* @param {BaseEvent} params
|
|
214
|
+
*/
|
|
215
|
+
function onBlur(params) {}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @callback
|
|
219
|
+
* @description Fired when the editor receives a native DOM `blur` event.
|
|
220
|
+
* Triggered before managed blur processing.
|
|
221
|
+
* This is the raw browser `blur` event, use `onBlur` for managed blur handling.
|
|
222
|
+
* @param {BaseEvent} params
|
|
223
|
+
*/
|
|
224
|
+
function onNativeBlur(params) {}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @callback
|
|
228
|
+
* @description Fired when the user attempts to copy content from the editor.
|
|
229
|
+
* Triggered before copying to clipboard.
|
|
230
|
+
* Return `false` to prevent the copy operation.
|
|
231
|
+
* @param {Object} params
|
|
232
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
233
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
234
|
+
* @param {Event} params.event - event object
|
|
235
|
+
* @param {Event} params.clipboardData - `clipboardData`
|
|
236
|
+
*/
|
|
237
|
+
function onCopy(params) {}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @callback
|
|
241
|
+
* @description Fired when the user attempts to cut content from the editor.
|
|
242
|
+
* Triggered before cutting to clipboard.
|
|
243
|
+
* Return `false` to prevent the cut operation and history push.
|
|
244
|
+
* @param {Object} params
|
|
245
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
246
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
247
|
+
* @param {Event} params.event - event object
|
|
248
|
+
* @param {Event} params.clipboardData - `clipboardData`
|
|
249
|
+
*/
|
|
250
|
+
function onCut(params) {}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @callback
|
|
254
|
+
* @description Fired when the editor content has changed.
|
|
255
|
+
* Triggered after history stack updates, undo/redo operations, and user edits.
|
|
256
|
+
* Use this to sync external state or validate content.
|
|
257
|
+
* The `data` parameter contains the current HTML content.
|
|
258
|
+
* @param {Object} params
|
|
259
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
260
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
261
|
+
* @param {string} params.data - editor HTML content
|
|
262
|
+
*/
|
|
263
|
+
function onChange(params) {}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* @callback
|
|
267
|
+
* @description Fired when a toolbar becomes visible.
|
|
268
|
+
* Triggered for balloon mode and inline mode toolbars.
|
|
269
|
+
* The `mode` parameter indicates the toolbar type (`balloon` or `inline`).
|
|
270
|
+
* @param {Object} params
|
|
271
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
272
|
+
* @param {HTMLElement} params.toolbar - Toolbar element
|
|
273
|
+
* @param {string} params.mode - Toolbar mode
|
|
274
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
275
|
+
*/
|
|
276
|
+
function onShowToolbar(params) {}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @callback
|
|
280
|
+
* @description Fired after a component controller (floating toolbar) is displayed.
|
|
281
|
+
* Triggered when components (images, videos, tables) are selected.
|
|
282
|
+
* The `caller` parameter indicates which plugin triggered the controller.
|
|
283
|
+
* @param {Object} params
|
|
284
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
285
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
286
|
+
* @param {string} params.caller - caller plugin name
|
|
287
|
+
* @param {SunEditor.Module.Controller.Info} params.info - info object
|
|
288
|
+
*/
|
|
289
|
+
function onShowController(params) {}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @callback
|
|
293
|
+
* @description Fired before a component controller (floating toolbar) is displayed.
|
|
294
|
+
* Triggered when components (images, videos, tables) are about to be selected.
|
|
295
|
+
* Return `false` to prevent the controller from showing.
|
|
296
|
+
* @param {Object} params
|
|
297
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
298
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
299
|
+
* @param {string} params.caller - caller plugin name
|
|
300
|
+
* @param {SunEditor.Module.Controller.Info} params.info - info object
|
|
301
|
+
*/
|
|
302
|
+
function onBeforeShowController(params) {}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @callback
|
|
306
|
+
* @description Fired when the editor switches between WYSIWYG view and code view.
|
|
307
|
+
* The `is` parameter indicates whether code view is now active (`true`) or WYSIWYG view is active (`false`).
|
|
308
|
+
* @param {Object} params
|
|
309
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
310
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
311
|
+
* @param {boolean} params.is - code view status
|
|
312
|
+
*/
|
|
313
|
+
function onToggleCodeView(params) {}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @callback
|
|
317
|
+
* @description Fired when the editor enters or exits fullscreen mode.
|
|
318
|
+
* The `is` parameter indicates whether fullscreen mode is now active (`true`) or normal mode is active (`false`).
|
|
319
|
+
* @param {Object} params
|
|
320
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
321
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
322
|
+
* @param {boolean} params.is - full screen status
|
|
323
|
+
*/
|
|
324
|
+
function onToggleFullScreen(params) {}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @callback
|
|
328
|
+
* @description Fired when the editor's wysiwyg area height changes.
|
|
329
|
+
* Triggered by `ResizeObserver`.
|
|
330
|
+
* Use this to sync external UI elements or implement custom resize behaviors.
|
|
331
|
+
* Parameters include current height, previous height, and the `ResizeObserverEntry`.
|
|
332
|
+
* @param {Object} params
|
|
333
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
334
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
335
|
+
* @param {number} params.height - wysiwyg area frame height
|
|
336
|
+
* @param {boolean} params.prevHeight - wysiwyg area previous height
|
|
337
|
+
* @param {ResizeObserverEntry} params.observerEntry - ResizeObserverEntry
|
|
338
|
+
*/
|
|
339
|
+
function onResizeEditor(params) {}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @callback
|
|
343
|
+
* @description Fired after toolbar buttons are created and rendered.
|
|
344
|
+
* Triggered during toolbar initialization and `resetToolbarButtons()`.
|
|
345
|
+
* Use this to customize toolbar DOM or add custom elements to the `buttonTray`.
|
|
346
|
+
* @param {Object} params
|
|
347
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
348
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
349
|
+
* @param {HTMLElement} params.buttonTray - button tray element
|
|
350
|
+
*/
|
|
351
|
+
function onSetToolbarButtons(params) {}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* @callback
|
|
355
|
+
* @description Fired when the save command is executed (Ctrl+S or save button).
|
|
356
|
+
* Use this to send editor content to a server or perform custom save logic.
|
|
357
|
+
* Return a Promise resolving to `false` to prevent the save operation from completing.
|
|
358
|
+
* @param {Object} params
|
|
359
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
360
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
361
|
+
* @param {Event} params.data - editor data
|
|
362
|
+
* @returns {PromiseLike<boolean>}
|
|
363
|
+
*/
|
|
364
|
+
function onSave(params) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @callback
|
|
370
|
+
* @description Fired when toolbar button states are reset.
|
|
371
|
+
* Triggered during undo/redo operations and history navigation.
|
|
372
|
+
* Use this to update custom toolbar buttons or external UI state.
|
|
373
|
+
* @param {Object} params
|
|
374
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
375
|
+
* @param {string} params.rootKey - frame key
|
|
376
|
+
*/
|
|
377
|
+
function onResetButtons(params) {}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @callback
|
|
381
|
+
* @description Fired before a font family change is applied to the selection.
|
|
382
|
+
* Triggered by font dropdown selection.
|
|
383
|
+
* Return a Promise resolving to `false` to cancel the font change operation.
|
|
384
|
+
* @param {Object} params
|
|
385
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
386
|
+
* @param {string} params.value - font value
|
|
387
|
+
* @returns {PromiseLike<boolean | void>}
|
|
388
|
+
*/
|
|
389
|
+
function onFontActionBefore(params) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @callback
|
|
395
|
+
* @description Fired when the user attempts to drop content into the editor.
|
|
396
|
+
* Triggered after HTML cleaning and character count validation.
|
|
397
|
+
* Return `false` to cancel drop, or return a string to replace the drop data.
|
|
398
|
+
* @param {ClipboardEvent} params
|
|
399
|
+
* @returns {PromiseLike<boolean | string>}
|
|
400
|
+
*/
|
|
401
|
+
function onDrop(params) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* @callback
|
|
407
|
+
* @description Fired when the user attempts to paste content into the editor.
|
|
408
|
+
* Triggered after HTML cleaning and character count validation.
|
|
409
|
+
* Return `false` to cancel paste, or return a string to replace the paste data.
|
|
410
|
+
* @param {ClipboardEvent} params
|
|
411
|
+
* @returns {PromiseLike<boolean | string | void>}
|
|
412
|
+
*/
|
|
413
|
+
function onPaste(params) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* @callback
|
|
419
|
+
* @description Custom handler for image upload requests.
|
|
420
|
+
* Fired after the `XMLHttpRequest` is sent but before default response processing.
|
|
421
|
+
* Return a Promise resolving to `true` if you handle the upload response yourself,
|
|
422
|
+
* or `false` to use default processing. The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
|
|
423
|
+
* @param {Object} params
|
|
424
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
425
|
+
* @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
|
|
426
|
+
* @param {ImageInfo} params.info - info object
|
|
427
|
+
* @returns {PromiseLike<boolean | void>}
|
|
428
|
+
*/
|
|
429
|
+
function imageUploadHandler(params) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* @callback
|
|
435
|
+
* @description Fired before an image is uploaded to the server.
|
|
436
|
+
* Use this to validate, resize, or modify image data before upload.
|
|
437
|
+
* Return `false` to cancel upload, return an `ImageInfo` object to modify the upload data,
|
|
438
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
439
|
+
* @param {Object} params
|
|
440
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
441
|
+
* @param {ImageInfo} params.info - info object
|
|
442
|
+
* @param {(newInfo?: ImageInfo | null) => void} params.handler - handler function
|
|
443
|
+
* @returns {PromiseLike<boolean | ImageInfo | void>}
|
|
444
|
+
*/
|
|
445
|
+
function onImageUploadBefore(params) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* @callback
|
|
451
|
+
* @description Fired after images are successfully loaded into the editor.
|
|
452
|
+
* Triggered after upload completion or URL-based image insertion.
|
|
453
|
+
* The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded images.
|
|
454
|
+
* @param {Object} params
|
|
455
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
456
|
+
* @param {Array<FileManagementInfo>} params.infoList - info list
|
|
457
|
+
*/
|
|
458
|
+
function onImageLoad(params) {}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* @callback
|
|
462
|
+
* @description Fired when an image is created, updated, or deleted in the editor.
|
|
463
|
+
* The `state` parameter indicates the action type (`create`, `update`, or `delete`).
|
|
464
|
+
* Use this to sync image state with external systems or track image modifications.
|
|
465
|
+
* @param {Object} params
|
|
466
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
467
|
+
* @param {FileManagementInfo} params.info - info object
|
|
468
|
+
* @param {HTMLElement | null} params.element - target element
|
|
469
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
470
|
+
* @param {number} params.index - data index
|
|
471
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
472
|
+
* @param {string} params.pluginName - plugin name
|
|
473
|
+
*/
|
|
474
|
+
function onImageAction(params) {}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* @callback
|
|
478
|
+
* @description Fired when an image upload fails due to size limits, server errors, or other issues.
|
|
479
|
+
* Return a Promise resolving to a custom error message string to override the default error message,
|
|
480
|
+
* or `undefined` to use the default message.
|
|
481
|
+
* @param {Object} params
|
|
482
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
483
|
+
* @param {string} params.error - error message
|
|
484
|
+
* @param {number} [params.limitSize] - limit size
|
|
485
|
+
* @param {number} [params.uploadSize] - upload size
|
|
486
|
+
* @param {number} [params.currentSize] - current size
|
|
487
|
+
* @param {File} [params.file] - File object
|
|
488
|
+
* @returns {PromiseLike<string | void>}
|
|
489
|
+
*/
|
|
490
|
+
function onImageUploadError(params) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* @callback
|
|
496
|
+
* @description Fired before an image is deleted from the editor.
|
|
497
|
+
* Use this to confirm deletion, notify server, or perform cleanup.
|
|
498
|
+
* Return a Promise resolving to `false` to prevent the image from being deleted.
|
|
499
|
+
* @param {Object} params
|
|
500
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
501
|
+
* @param {HTMLElement} params.element - target element
|
|
502
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
503
|
+
* @param {string} params.align - align value
|
|
504
|
+
* @param {string} params.alt - alt text value
|
|
505
|
+
* @param {?string} params.url - Anchor url, if it exists
|
|
506
|
+
* @returns {PromiseLike<boolean>}
|
|
507
|
+
*/
|
|
508
|
+
function onImageDeleteBefore(params) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @callback
|
|
514
|
+
* @description Custom handler for video upload requests.
|
|
515
|
+
* Fired after the `XMLHttpRequest` is sent but before default response processing.
|
|
516
|
+
* Return a Promise resolving to `true` if you handle the upload response yourself,
|
|
517
|
+
* or `false` to use default processing.
|
|
518
|
+
* The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
|
|
519
|
+
* @param {Object} params
|
|
520
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
521
|
+
* @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
|
|
522
|
+
* @param {VideoInfo} params.info - info object
|
|
523
|
+
* @returns {PromiseLike<boolean>}
|
|
524
|
+
*/
|
|
525
|
+
function videoUploadHandler(params) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* @callback
|
|
531
|
+
* @description Fired before a video is uploaded to the server.
|
|
532
|
+
* Use this to validate, transcode, or modify video data before upload.
|
|
533
|
+
* Return `false` to cancel upload, return a `VideoInfo` object to modify the upload data,
|
|
534
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
535
|
+
* @param {Object} params
|
|
536
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
537
|
+
* @param {VideoInfo} params.info - info object
|
|
538
|
+
* @param {(newInfo?: VideoInfo | null) => void} params.handler - handler function
|
|
539
|
+
* @returns {PromiseLike<boolean | VideoInfo | void>}
|
|
540
|
+
*/
|
|
541
|
+
function onVideoUploadBefore(params) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* @callback
|
|
547
|
+
* @description Fired after videos are successfully loaded into the editor.
|
|
548
|
+
* Triggered after upload completion or URL-based video insertion (iframe/video tag).
|
|
549
|
+
* The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded videos.
|
|
550
|
+
* @param {Object} params
|
|
551
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
552
|
+
* @param {Array<FileManagementInfo>} params.infoList - info list
|
|
553
|
+
*/
|
|
554
|
+
function onVideoLoad(params) {}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* @callback
|
|
558
|
+
* @description Fired when a video is created, updated, or deleted in the editor.
|
|
559
|
+
* The `state` parameter indicates the action type (`create`, `update`, or `delete`).
|
|
560
|
+
* Use this to sync video state with external systems or track video modifications.
|
|
561
|
+
* @param {Object} params
|
|
562
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
563
|
+
* @param {FileManagementInfo} params.info - info object
|
|
564
|
+
* @param {HTMLElement | null} params.element - target element
|
|
565
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
566
|
+
* @param {number} params.index - data index
|
|
567
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
568
|
+
* @param {string} params.pluginName - plugin name
|
|
569
|
+
*/
|
|
570
|
+
function onVideoAction(params) {}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* @callback
|
|
574
|
+
* @description Fired when a video upload fails due to size limits, server errors, or other issues.
|
|
575
|
+
* Return a Promise resolving to a custom error message string to override the default error message,
|
|
576
|
+
* or `undefined` to use the default message.
|
|
577
|
+
* @param {Object} params
|
|
578
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
579
|
+
* @param {string} params.error - error message
|
|
580
|
+
* @param {number} [params.limitSize] - limit size
|
|
581
|
+
* @param {number} [params.uploadSize] - upload size
|
|
582
|
+
* @param {number} [params.currentSize] - current size
|
|
583
|
+
* @param {File} [params.file] - File object
|
|
584
|
+
* @returns {PromiseLike<string | void>}
|
|
585
|
+
*/
|
|
586
|
+
function onVideoUploadError(params) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* @callback
|
|
592
|
+
* @description Fired before a video is deleted from the editor.
|
|
593
|
+
* Use this to confirm deletion, notify server, or perform cleanup.
|
|
594
|
+
* Return a Promise resolving to `false` to prevent the video from being deleted.
|
|
595
|
+
* @param {Object} params
|
|
596
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
597
|
+
* @param {HTMLElement} params.element - target element
|
|
598
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
599
|
+
* @param {string} params.align - align value
|
|
600
|
+
* @param {string} params.url - video url
|
|
601
|
+
* @returns {PromiseLike<boolean>}
|
|
602
|
+
*/
|
|
603
|
+
function onVideoDeleteBefore(params) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* @callback
|
|
609
|
+
* @description Custom handler for audio upload requests.
|
|
610
|
+
* Fired after the `XMLHttpRequest` is sent but before default response processing.
|
|
611
|
+
* Return a Promise resolving to `true` if you handle the upload response yourself,
|
|
612
|
+
* or `false` to use default processing.
|
|
613
|
+
* The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
|
|
614
|
+
* @param {Object} params
|
|
615
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
616
|
+
* @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
|
|
617
|
+
* @param {AudioInfo} params.info - info object
|
|
618
|
+
* @returns {PromiseLike<boolean>}
|
|
619
|
+
*/
|
|
620
|
+
function audioUploadHandler(params) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* @callback
|
|
626
|
+
* @description Fired before an audio file is uploaded to the server.
|
|
627
|
+
* Use this to validate, transcode, or modify audio data before upload.
|
|
628
|
+
* Return `false` to cancel upload, return an `AudioInfo` object to modify the upload data,
|
|
629
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
630
|
+
* @param {Object} params
|
|
631
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
632
|
+
* @param {AudioInfo} params.info - info object
|
|
633
|
+
* @param {(newInfo?: AudioInfo | null) => void} params.handler - handler function
|
|
634
|
+
* @returns {PromiseLike<boolean | AudioInfo| void>}
|
|
635
|
+
*/
|
|
636
|
+
function onAudioUploadBefore(params) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* @callback
|
|
642
|
+
* @description Fired when an audio upload fails due to size limits, server errors, or other issues.
|
|
643
|
+
* Return a Promise resolving to a custom error message string to override the default error message,
|
|
644
|
+
* or `undefined` to use the default message.
|
|
645
|
+
* @param {Object} params
|
|
646
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
647
|
+
* @param {string} params.error - error message
|
|
648
|
+
* @param {number} [params.limitSize] - limit size
|
|
649
|
+
* @param {number} [params.uploadSize] - upload size
|
|
650
|
+
* @param {number} [params.currentSize] - current size
|
|
651
|
+
* @param {File} [params.file] - File object
|
|
652
|
+
* @returns {PromiseLike<string | void>}
|
|
653
|
+
*/
|
|
654
|
+
function onAudioUploadError(params) {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* @callback
|
|
660
|
+
* @description Fired after audio files are successfully loaded into the editor.
|
|
661
|
+
* Triggered after upload completion or URL-based audio insertion.
|
|
662
|
+
* The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded audio files.
|
|
663
|
+
* @param {Object} params
|
|
664
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
665
|
+
* @param {Array<FileManagementInfo>} params.infoList - info list
|
|
666
|
+
*/
|
|
667
|
+
function onAudioLoad(params) {}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* @callback
|
|
671
|
+
* @description Fired when an audio element is created, updated, or deleted in the editor.
|
|
672
|
+
* The `state` parameter indicates the action type (`create`, `update`, or `delete`).
|
|
673
|
+
* Use this to sync audio state with external systems or track audio modifications.
|
|
674
|
+
* @param {Object} params
|
|
675
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
676
|
+
* @param {FileManagementInfo} params.info - info object
|
|
677
|
+
* @param {HTMLElement | null} params.element - target element
|
|
678
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
679
|
+
* @param {number} params.index - data index
|
|
680
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
681
|
+
* @param {string} params.pluginName - plugin name
|
|
682
|
+
*/
|
|
683
|
+
function onAudioAction(params) {}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* @callback
|
|
687
|
+
* @description Fired before an audio element is deleted from the editor.
|
|
688
|
+
* Use this to confirm deletion, notify server, or perform cleanup.
|
|
689
|
+
* Return a Promise resolving to `false` to prevent the audio from being deleted.
|
|
690
|
+
* @param {Object} params
|
|
691
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
692
|
+
* @param {HTMLElement} params.element - target element
|
|
693
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
694
|
+
* @param {string} params.url - audio url
|
|
695
|
+
* @returns {PromiseLike<boolean>}
|
|
696
|
+
*/
|
|
697
|
+
function onAudioDeleteBefore(params) {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* @callback
|
|
703
|
+
* @description Fired before a file is uploaded to the server (via `fileUpload` plugin).
|
|
704
|
+
* Use this to validate or modify file data before upload.
|
|
705
|
+
* Return `false` to cancel upload, return a `FileInfo` object to modify the upload data,
|
|
706
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
707
|
+
* @param {Object} params
|
|
708
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
709
|
+
* @param {FileInfo} params.info - info object
|
|
710
|
+
* @param {(newInfo?: FileInfo | null) => void} params.handler - handler function
|
|
711
|
+
* @returns {PromiseLike<boolean | FileInfo | void>}
|
|
712
|
+
*/
|
|
713
|
+
function onFileUploadBefore(params) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* @callback
|
|
719
|
+
* @description Fired after files are successfully uploaded and loaded into the editor.
|
|
720
|
+
* Triggered by the `fileUpload` plugin after upload completion.
|
|
721
|
+
* The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded files.
|
|
722
|
+
* @param {Object} params
|
|
723
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
724
|
+
* @param {Array<FileManagementInfo>} params.infoList - info list
|
|
725
|
+
*/
|
|
726
|
+
function onFileLoad(params) {}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* @callback
|
|
730
|
+
* @description Fired when a file link is created, updated, or deleted in the editor.
|
|
731
|
+
* The `state` parameter indicates the action type (`create`, `update`, or `delete`).
|
|
732
|
+
* Use this to sync file state with external systems or track file modifications.
|
|
733
|
+
* @param {Object} params
|
|
734
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
735
|
+
* @param {FileManagementInfo} params.info - info object
|
|
736
|
+
* @param {HTMLElement | null} params.element - target element
|
|
737
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
738
|
+
* @param {number} params.index - data index
|
|
739
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
740
|
+
* @param {string} params.pluginName - plugin name
|
|
741
|
+
*/
|
|
742
|
+
function onFileAction(params) {}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* @callback
|
|
746
|
+
* @description Fired when a file upload fails due to size limits, server errors, or other issues.
|
|
747
|
+
* Return a Promise resolving to a custom error message string to override the default error message,
|
|
748
|
+
* or `undefined` to use the default message.
|
|
749
|
+
* @param {Object} params
|
|
750
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
751
|
+
* @param {string} params.error - error message
|
|
752
|
+
* @param {number} [params.limitSize] - limit size
|
|
753
|
+
* @param {number} [params.uploadSize] - upload size
|
|
754
|
+
* @param {number} [params.currentSize] - current size
|
|
755
|
+
* @param {File} [params.file] - File object
|
|
756
|
+
* @returns {PromiseLike<string | void>}
|
|
757
|
+
*/
|
|
758
|
+
function onFileUploadError(params) {
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* @callback
|
|
764
|
+
* @description Fired before a file link is deleted from the editor.
|
|
765
|
+
* Use this to confirm deletion, notify server, or perform cleanup.
|
|
766
|
+
* Return a Promise resolving to `false` to prevent the file link from being deleted.
|
|
767
|
+
* @param {Object} params
|
|
768
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
769
|
+
* @param {HTMLElement} params.element - target element
|
|
770
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
771
|
+
* @param {string} params.url - file url
|
|
772
|
+
* @returns {PromiseLike<boolean>}
|
|
773
|
+
*/
|
|
774
|
+
function onFileDeleteBefore(params) {
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* @callback
|
|
780
|
+
* @description Fired before the editor content is exported to PDF.
|
|
781
|
+
* Use this to modify content, add metadata, or cancel the export.
|
|
782
|
+
* Return a Promise resolving to `false` to prevent the PDF export.
|
|
783
|
+
* @param {Object} params
|
|
784
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
785
|
+
* @param {HTMLElement} params.target - wysiwyg editable element
|
|
786
|
+
* @returns {PromiseLike<boolean>}
|
|
787
|
+
*/
|
|
788
|
+
function onExportPDFBefore(params) {
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* @callback
|
|
794
|
+
* @description Fired when any media element (image, video, audio, file) is created, updated, or deleted.
|
|
795
|
+
* This is a unified event that triggers for all media types.
|
|
796
|
+
* The `pluginName` parameter indicates which plugin triggered the action (`image`, `video`, `audio`, or `file`).
|
|
797
|
+
* @param {Object} params
|
|
798
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
799
|
+
* @param {FileManagementInfo} params.info - info object
|
|
800
|
+
* @param {HTMLElement | null} params.element - target element
|
|
801
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
802
|
+
* @param {number} params.index - data index
|
|
803
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
804
|
+
* @param {string} params.pluginName - plugin name
|
|
805
|
+
*/
|
|
806
|
+
function onFileManagerAction(params) {}
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* @callback
|
|
810
|
+
* @description Fired before an embed URL is processed and inserted into the editor.
|
|
811
|
+
* Use this to validate URLs, add custom embed processors, or modify embed parameters.
|
|
812
|
+
* Return `false` to cancel insertion, return an `EmbedInfo` object to modify the embed data,
|
|
813
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
814
|
+
* @param {EmbedInfo & {$: SunEditor.Deps, handler: (newInfo?: EmbedInfo | null) => void}} params
|
|
815
|
+
* @returns {PromiseLike<boolean | EmbedInfo | void>}
|
|
816
|
+
*/
|
|
817
|
+
function onEmbedInputBefore(params) {
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* @callback
|
|
823
|
+
* @description Fired before an embedded element (iframe, custom embed) is deleted from the editor.
|
|
824
|
+
* Use this to confirm deletion or perform cleanup.
|
|
825
|
+
* Return a Promise resolving to `false` to prevent the embed from being deleted.
|
|
826
|
+
* @param {Object} params
|
|
827
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
828
|
+
* @param {HTMLElement} params.element - target element
|
|
829
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
830
|
+
* @param {string} params.align - align value
|
|
831
|
+
* @param {string} params.url - embed url
|
|
832
|
+
* @returns {PromiseLike<boolean>}
|
|
833
|
+
*/
|
|
834
|
+
function onEmbedDeleteBefore(params) {
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// ------------------------------------------------ Exports ------------------------------------------------
|
|
839
|
+
/**
|
|
840
|
+
* @typedef {Object} EventHandlers
|
|
841
|
+
* @property {?onload} [onload]
|
|
842
|
+
* @property {?onScroll} [onScroll]
|
|
843
|
+
* @property {?onMouseDown} [onMouseDown]
|
|
844
|
+
* @property {?onClick} [onClick]
|
|
845
|
+
* @property {?onBeforeInput} [onBeforeInput]
|
|
846
|
+
* @property {?onInput} [onInput]
|
|
847
|
+
* @property {?onMouseLeave} [onMouseLeave]
|
|
848
|
+
* @property {?onMouseUp} [onMouseUp]
|
|
849
|
+
* @property {?onKeyDown} [onKeyDown]
|
|
850
|
+
* @property {?onKeyUp} [onKeyUp]
|
|
851
|
+
* @property {?onFocus} [onFocus]
|
|
852
|
+
* @property {?onNativeFocus} [onNativeFocus]
|
|
853
|
+
* @property {?onBlur} [onBlur]
|
|
854
|
+
* @property {?onNativeBlur} [onNativeBlur]
|
|
855
|
+
* @property {?onCopy} [onCopy]
|
|
856
|
+
* @property {?onCut} [onCut]
|
|
857
|
+
* @property {?onChange} [onChange]
|
|
858
|
+
* @property {?onShowToolbar} [onShowToolbar]
|
|
859
|
+
* @property {?onShowController} [onShowController]
|
|
860
|
+
* @property {?onBeforeShowController} [onBeforeShowController]
|
|
861
|
+
* @property {?onToggleCodeView} [onToggleCodeView]
|
|
862
|
+
* @property {?onToggleFullScreen} [onToggleFullScreen]
|
|
863
|
+
* @property {?onResizeEditor} [onResizeEditor]
|
|
864
|
+
* @property {?onSetToolbarButtons} [onSetToolbarButtons]
|
|
865
|
+
* @property {?onSave} [onSave]
|
|
866
|
+
* @property {?onResetButtons} [onResetButtons]
|
|
867
|
+
* @property {?onFontActionBefore} [onFontActionBefore]
|
|
868
|
+
* @property {?onDrop} [onDrop]
|
|
869
|
+
* @property {?onPaste} [onPaste]
|
|
870
|
+
* @property {?imageUploadHandler} [imageUploadHandler]
|
|
871
|
+
* @property {?onImageUploadBefore} [onImageUploadBefore]
|
|
872
|
+
* @property {?onImageLoad} [onImageLoad]
|
|
873
|
+
* @property {?onImageAction} [onImageAction]
|
|
874
|
+
* @property {?onImageUploadError} [onImageUploadError]
|
|
875
|
+
* @property {?onImageDeleteBefore} [onImageDeleteBefore]
|
|
876
|
+
* @property {?videoUploadHandler} [videoUploadHandler]
|
|
877
|
+
* @property {?onVideoUploadBefore} [onVideoUploadBefore]
|
|
878
|
+
* @property {?onVideoLoad} [onVideoLoad]
|
|
879
|
+
* @property {?onVideoAction} [onVideoAction]
|
|
880
|
+
* @property {?onVideoUploadError} [onVideoUploadError]
|
|
881
|
+
* @property {?onVideoDeleteBefore} [onVideoDeleteBefore]
|
|
882
|
+
* @property {?audioUploadHandler} [audioUploadHandler]
|
|
883
|
+
* @property {?onAudioUploadBefore} [onAudioUploadBefore]
|
|
884
|
+
* @property {?onAudioUploadError} [onAudioUploadError]
|
|
885
|
+
* @property {?onAudioLoad} [onAudioLoad]
|
|
886
|
+
* @property {?onAudioAction} [onAudioAction]
|
|
887
|
+
* @property {?onAudioDeleteBefore} [onAudioDeleteBefore]
|
|
888
|
+
* @property {?onFileUploadBefore} [onFileUploadBefore]
|
|
889
|
+
* @property {?onFileLoad} [onFileLoad]
|
|
890
|
+
* @property {?onFileAction} [onFileAction]
|
|
891
|
+
* @property {?onFileUploadError} [onFileUploadError]
|
|
892
|
+
* @property {?onFileDeleteBefore} [onFileDeleteBefore]
|
|
893
|
+
* @property {?onExportPDFBefore} [onExportPDFBefore]
|
|
894
|
+
* @property {?onFileManagerAction} [onFileManagerAction]
|
|
895
|
+
* @property {?onEmbedInputBefore} [onEmbedInputBefore]
|
|
896
|
+
* @property {?onEmbedDeleteBefore} [onEmbedDeleteBefore]
|
|
897
|
+
*/
|
|
898
|
+
|
|
899
|
+
export {};
|