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/types/events.d.ts
CHANGED
|
@@ -1,68 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
let onload: any;
|
|
3
|
-
let onScroll: any;
|
|
4
|
-
let onMouseDown: any;
|
|
5
|
-
let onClick: any;
|
|
6
|
-
let onInput: any;
|
|
7
|
-
let onMouseLeave: any;
|
|
8
|
-
let onKeyDown: any;
|
|
9
|
-
let onKeyUp: any;
|
|
10
|
-
let onFocus: any;
|
|
11
|
-
let onNativeFocus: any;
|
|
12
|
-
let onBlur: any;
|
|
13
|
-
let onNativeBlur: any;
|
|
14
|
-
let onCopy: any;
|
|
15
|
-
let onCut: any;
|
|
16
|
-
let onChange: any;
|
|
17
|
-
let onShowToolbar: any;
|
|
18
|
-
let onShowController: any;
|
|
19
|
-
let onBeforeShowController: any;
|
|
20
|
-
let onToggleCodeView: any;
|
|
21
|
-
let onToggleFullScreen: any;
|
|
22
|
-
let onResizeEditor: any;
|
|
23
|
-
let onSetToolbarButtons: any;
|
|
24
|
-
let onSave: any;
|
|
25
|
-
let onDrop: any;
|
|
26
|
-
let onPaste: any;
|
|
27
|
-
let imageUploadHandler: any;
|
|
28
|
-
let onImageUploadBefore: any;
|
|
29
|
-
let onImageLoad: any;
|
|
30
|
-
let onImageAction: any;
|
|
31
|
-
let onImageUploadError: any;
|
|
32
|
-
let onImageDeleteBefore: any;
|
|
33
|
-
let videoUploadHandler: any;
|
|
34
|
-
let onVideoUploadBefore: any;
|
|
35
|
-
let onVideoLoad: any;
|
|
36
|
-
let onVideoAction: any;
|
|
37
|
-
let onVideoUploadError: any;
|
|
38
|
-
let onVideoDeleteBefore: any;
|
|
39
|
-
let audioUploadHandler: any;
|
|
40
|
-
let onAudioUploadBefore: any;
|
|
41
|
-
let onAudioUploadError: any;
|
|
42
|
-
let onAudioLoad: any;
|
|
43
|
-
let onAudioAction: any;
|
|
44
|
-
let onAudioDeleteBefore: any;
|
|
45
|
-
let onFileUploadBefore: any;
|
|
46
|
-
let onFileLoad: any;
|
|
47
|
-
let onFileAction: any;
|
|
48
|
-
let onFileUploadError: any;
|
|
49
|
-
let onFileDeleteBefore: any;
|
|
50
|
-
let onExportPDFBefore: any;
|
|
51
|
-
let onFileManagerAction: any;
|
|
52
|
-
let onEmbedInputBefore: any;
|
|
53
|
-
let onEmbedDeleteBefore: any;
|
|
54
|
-
}
|
|
55
|
-
export default _default;
|
|
56
|
-
export type ControllerInstance = import('./modules/Controller').default;
|
|
1
|
+
import type {} from './typedef';
|
|
57
2
|
export type BaseEvent = {
|
|
58
3
|
/**
|
|
59
|
-
* -
|
|
4
|
+
* - Kernel dependencies
|
|
60
5
|
*/
|
|
61
|
-
|
|
6
|
+
$: SunEditor.Deps;
|
|
62
7
|
/**
|
|
63
8
|
* - frame context
|
|
64
9
|
*/
|
|
65
|
-
frameContext:
|
|
10
|
+
frameContext: SunEditor.FrameContext;
|
|
66
11
|
/**
|
|
67
12
|
* - event object
|
|
68
13
|
*/
|
|
@@ -70,13 +15,13 @@ export type BaseEvent = {
|
|
|
70
15
|
};
|
|
71
16
|
export type ClipboardEvent = {
|
|
72
17
|
/**
|
|
73
|
-
* -
|
|
18
|
+
* - Kernel dependencies
|
|
74
19
|
*/
|
|
75
|
-
|
|
20
|
+
$: SunEditor.Deps;
|
|
76
21
|
/**
|
|
77
22
|
* - frame context
|
|
78
23
|
*/
|
|
79
|
-
frameContext:
|
|
24
|
+
frameContext: SunEditor.FrameContext;
|
|
80
25
|
/**
|
|
81
26
|
* - event object
|
|
82
27
|
*/
|
|
@@ -90,11 +35,10 @@ export type ClipboardEvent = {
|
|
|
90
35
|
*/
|
|
91
36
|
maxCharCount: boolean;
|
|
92
37
|
/**
|
|
93
|
-
* - "SE"
|
|
38
|
+
* - `"SE"`|`"MS"`|`""` - source
|
|
94
39
|
*/
|
|
95
40
|
from: string;
|
|
96
41
|
};
|
|
97
|
-
export type ControllerInfo_events = import('./modules/Controller').ControllerInfo;
|
|
98
42
|
export type FileManagementInfo = {
|
|
99
43
|
/**
|
|
100
44
|
* - source URL of the image.
|
|
@@ -265,7 +209,7 @@ export type EmbedInfo = {
|
|
|
265
209
|
*/
|
|
266
210
|
url: string;
|
|
267
211
|
/**
|
|
268
|
-
* - When the input source is stacked in an iframe
|
|
212
|
+
* - When the input source is stacked in an `iframe`, etc., the actual embedded DOM
|
|
269
213
|
*/
|
|
270
214
|
children: HTMLElement | null;
|
|
271
215
|
/**
|
|
@@ -273,3 +217,790 @@ export type EmbedInfo = {
|
|
|
273
217
|
*/
|
|
274
218
|
process: ProcessInfo | null;
|
|
275
219
|
};
|
|
220
|
+
export type EventHandlers = {
|
|
221
|
+
onload?: typeof onload | null;
|
|
222
|
+
onScroll?: typeof onScroll | null;
|
|
223
|
+
onMouseDown?: typeof onMouseDown | null;
|
|
224
|
+
onClick?: typeof onClick | null;
|
|
225
|
+
onBeforeInput?: typeof onBeforeInput | null;
|
|
226
|
+
onInput?: typeof onInput | null;
|
|
227
|
+
onMouseLeave?: typeof onMouseLeave | null;
|
|
228
|
+
onMouseUp?: typeof onMouseUp | null;
|
|
229
|
+
onKeyDown?: typeof onKeyDown | null;
|
|
230
|
+
onKeyUp?: typeof onKeyUp | null;
|
|
231
|
+
onFocus?: typeof onFocus | null;
|
|
232
|
+
onNativeFocus?: typeof onNativeFocus | null;
|
|
233
|
+
onBlur?: typeof onBlur | null;
|
|
234
|
+
onNativeBlur?: typeof onNativeBlur | null;
|
|
235
|
+
onCopy?: typeof onCopy | null;
|
|
236
|
+
onCut?: typeof onCut | null;
|
|
237
|
+
onChange?: typeof onChange | null;
|
|
238
|
+
onShowToolbar?: typeof onShowToolbar | null;
|
|
239
|
+
onShowController?: typeof onShowController | null;
|
|
240
|
+
onBeforeShowController?: typeof onBeforeShowController | null;
|
|
241
|
+
onToggleCodeView?: typeof onToggleCodeView | null;
|
|
242
|
+
onToggleFullScreen?: typeof onToggleFullScreen | null;
|
|
243
|
+
onResizeEditor?: typeof onResizeEditor | null;
|
|
244
|
+
onSetToolbarButtons?: typeof onSetToolbarButtons | null;
|
|
245
|
+
onSave?: typeof onSave | null;
|
|
246
|
+
onResetButtons?: typeof onResetButtons | null;
|
|
247
|
+
onFontActionBefore?: typeof onFontActionBefore | null;
|
|
248
|
+
onDrop?: typeof onDrop | null;
|
|
249
|
+
onPaste?: typeof onPaste | null;
|
|
250
|
+
imageUploadHandler?: typeof imageUploadHandler | null;
|
|
251
|
+
onImageUploadBefore?: typeof onImageUploadBefore | null;
|
|
252
|
+
onImageLoad?: typeof onImageLoad | null;
|
|
253
|
+
onImageAction?: typeof onImageAction | null;
|
|
254
|
+
onImageUploadError?: typeof onImageUploadError | null;
|
|
255
|
+
onImageDeleteBefore?: typeof onImageDeleteBefore | null;
|
|
256
|
+
videoUploadHandler?: typeof videoUploadHandler | null;
|
|
257
|
+
onVideoUploadBefore?: typeof onVideoUploadBefore | null;
|
|
258
|
+
onVideoLoad?: typeof onVideoLoad | null;
|
|
259
|
+
onVideoAction?: typeof onVideoAction | null;
|
|
260
|
+
onVideoUploadError?: typeof onVideoUploadError | null;
|
|
261
|
+
onVideoDeleteBefore?: typeof onVideoDeleteBefore | null;
|
|
262
|
+
audioUploadHandler?: typeof audioUploadHandler | null;
|
|
263
|
+
onAudioUploadBefore?: typeof onAudioUploadBefore | null;
|
|
264
|
+
onAudioUploadError?: typeof onAudioUploadError | null;
|
|
265
|
+
onAudioLoad?: typeof onAudioLoad | null;
|
|
266
|
+
onAudioAction?: typeof onAudioAction | null;
|
|
267
|
+
onAudioDeleteBefore?: typeof onAudioDeleteBefore | null;
|
|
268
|
+
onFileUploadBefore?: typeof onFileUploadBefore | null;
|
|
269
|
+
onFileLoad?: typeof onFileLoad | null;
|
|
270
|
+
onFileAction?: typeof onFileAction | null;
|
|
271
|
+
onFileUploadError?: typeof onFileUploadError | null;
|
|
272
|
+
onFileDeleteBefore?: typeof onFileDeleteBefore | null;
|
|
273
|
+
onExportPDFBefore?: typeof onExportPDFBefore | null;
|
|
274
|
+
onFileManagerAction?: typeof onFileManagerAction | null;
|
|
275
|
+
onEmbedInputBefore?: typeof onEmbedInputBefore | null;
|
|
276
|
+
onEmbedDeleteBefore?: typeof onEmbedDeleteBefore | null;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* @typedef {Object} BaseEvent
|
|
280
|
+
* @property {SunEditor.Deps} $ - Kernel dependencies
|
|
281
|
+
* @property {SunEditor.FrameContext} frameContext - frame context
|
|
282
|
+
* @property {Event} event - event object
|
|
283
|
+
*/
|
|
284
|
+
/**
|
|
285
|
+
* @typedef {Object} ClipboardEvent
|
|
286
|
+
* @property {SunEditor.Deps} $ - Kernel dependencies
|
|
287
|
+
* @property {SunEditor.FrameContext} frameContext - frame context
|
|
288
|
+
* @property {Event} event - event object
|
|
289
|
+
* @property {string} data - drop data
|
|
290
|
+
* @property {boolean} maxCharCount - is max char count
|
|
291
|
+
* @property {string} from - `"SE"`|`"MS"`|`""` - source
|
|
292
|
+
*/
|
|
293
|
+
/**
|
|
294
|
+
* @typedef {Object} FileManagementInfo
|
|
295
|
+
* @property {string} src - source URL of the image.
|
|
296
|
+
* @property {number} index - index of the image.
|
|
297
|
+
* @property {string} name - name of the file.
|
|
298
|
+
* @property {number} size - size of the file in bytes.
|
|
299
|
+
* @property {HTMLElement} element - target element.
|
|
300
|
+
* @property {() => void} delete - delete function.
|
|
301
|
+
* @property {() => void} select - select function.
|
|
302
|
+
*/
|
|
303
|
+
/**
|
|
304
|
+
* @typedef {Object} ProcessInfo
|
|
305
|
+
* @property {string} origin - origin url
|
|
306
|
+
* @property {string} url - url
|
|
307
|
+
* @property {"video"|"iframe"} tag - tag name
|
|
308
|
+
* @property {?HTMLCollection} children - embed children tags
|
|
309
|
+
*/
|
|
310
|
+
/**
|
|
311
|
+
* @typedef {Object} ImageInfo
|
|
312
|
+
* @property {FileList} files - FileList object
|
|
313
|
+
* @property {HTMLImageElement} element - target element
|
|
314
|
+
* @property {string} inputWidth - width value
|
|
315
|
+
* @property {string} inputHeight - height value
|
|
316
|
+
* @property {string} align - align value
|
|
317
|
+
* @property {boolean} isUpdate - new create or update
|
|
318
|
+
* @property {?HTMLElement} anchor - Anchor element, if it exists
|
|
319
|
+
* @property {string} alt - alt text value
|
|
320
|
+
*/
|
|
321
|
+
/**
|
|
322
|
+
* @typedef {Object} VideoInfo
|
|
323
|
+
* @property {FileList} files - FileList object
|
|
324
|
+
* @property {HTMLIFrameElement|HTMLVideoElement} element - target element
|
|
325
|
+
* @property {string} inputWidth - width value
|
|
326
|
+
* @property {string} inputHeight - height value
|
|
327
|
+
* @property {string} align - align value
|
|
328
|
+
* @property {boolean} isUpdate - new create or update
|
|
329
|
+
* @property {string} url - video url
|
|
330
|
+
* @property {?ProcessInfo} process - video process info
|
|
331
|
+
*/
|
|
332
|
+
/**
|
|
333
|
+
* @typedef {Object} AudioInfo
|
|
334
|
+
* @property {HTMLAudioElement} element - target element
|
|
335
|
+
* @property {FileList} files - FileList object
|
|
336
|
+
* @property {boolean} isUpdate - new create or update
|
|
337
|
+
*/
|
|
338
|
+
/**
|
|
339
|
+
* @typedef {Object} FileInfo
|
|
340
|
+
* @property {string} url - file url
|
|
341
|
+
* @property {FileList} files - FileList object
|
|
342
|
+
* @property {Object} uploadHeaders - upload headers
|
|
343
|
+
*/
|
|
344
|
+
/**
|
|
345
|
+
* @typedef {Object} EmbedInfo
|
|
346
|
+
* @property {HTMLElement} element - target element
|
|
347
|
+
* @property {string} inputWidth - width value
|
|
348
|
+
* @property {string} inputHeight - height value
|
|
349
|
+
* @property {string} align - align value
|
|
350
|
+
* @property {boolean} isUpdate - new create or update
|
|
351
|
+
* @property {string} url - embed url
|
|
352
|
+
* @property {?HTMLElement} children - When the input source is stacked in an `iframe`, etc., the actual embedded DOM
|
|
353
|
+
* @property {?ProcessInfo} process - embed process info
|
|
354
|
+
*/
|
|
355
|
+
/**
|
|
356
|
+
* @callback
|
|
357
|
+
* @description Fired when the editor has completed full initialization.
|
|
358
|
+
* This event is deferred via `setTimeout` to ensure all DOM layout calculations are complete,
|
|
359
|
+
* toolbar is visible, `ResizeObserver` is registered, and history stack is initialized.
|
|
360
|
+
* Use this event to safely call editor methods immediately after creation.
|
|
361
|
+
* @param {Object} params
|
|
362
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
363
|
+
*/
|
|
364
|
+
declare function onload(params: { $: SunEditor.Deps }): void;
|
|
365
|
+
/**
|
|
366
|
+
* @callback
|
|
367
|
+
* @description Fired when the editor content area is scrolled.
|
|
368
|
+
* Use this to sync UI elements with scroll position or implement custom scroll behaviors.
|
|
369
|
+
* @param {BaseEvent} params
|
|
370
|
+
*/
|
|
371
|
+
declare function onScroll(params: BaseEvent): void;
|
|
372
|
+
/**
|
|
373
|
+
* @callback
|
|
374
|
+
* @description Fired when the user presses a mouse button down in the editor.
|
|
375
|
+
* Triggered before internal `mousedown` processing.
|
|
376
|
+
* Return `false` to prevent the default editor behavior.
|
|
377
|
+
* @param {BaseEvent} params
|
|
378
|
+
*/
|
|
379
|
+
declare function onMouseDown(params: BaseEvent): void;
|
|
380
|
+
/**
|
|
381
|
+
* @callback
|
|
382
|
+
* @description Fired when the user clicks in the editor.
|
|
383
|
+
* Triggered before component selection and default `line` creation.
|
|
384
|
+
* Return `false` to prevent the default editor behavior.
|
|
385
|
+
* @param {BaseEvent} params
|
|
386
|
+
*/
|
|
387
|
+
declare function onClick(params: BaseEvent): void;
|
|
388
|
+
/**
|
|
389
|
+
* @callback
|
|
390
|
+
* @description Fired before text input is inserted into the editor.
|
|
391
|
+
* Triggered after character count validation.
|
|
392
|
+
* Return `false` to prevent the input from being processed.
|
|
393
|
+
* @param {BaseEvent & {data: string}} params
|
|
394
|
+
*/
|
|
395
|
+
declare function onBeforeInput(
|
|
396
|
+
params: BaseEvent & {
|
|
397
|
+
data: string;
|
|
398
|
+
},
|
|
399
|
+
): void;
|
|
400
|
+
/**
|
|
401
|
+
* @callback
|
|
402
|
+
* @description Fired when text content is input into the editor (typing, composition, paste).
|
|
403
|
+
* Triggered after default `line` creation and selection initialization.
|
|
404
|
+
* Return `false` to prevent history push.
|
|
405
|
+
* @param {BaseEvent & {data: string}} params
|
|
406
|
+
*/
|
|
407
|
+
declare function onInput(
|
|
408
|
+
params: BaseEvent & {
|
|
409
|
+
data: string;
|
|
410
|
+
},
|
|
411
|
+
): void;
|
|
412
|
+
/**
|
|
413
|
+
* @callback
|
|
414
|
+
* @description Fired when the mouse cursor leaves the editor area.
|
|
415
|
+
* Return `false` to prevent the default editor behavior.
|
|
416
|
+
* @param {BaseEvent} params
|
|
417
|
+
*/
|
|
418
|
+
declare function onMouseLeave(params: BaseEvent): void;
|
|
419
|
+
/**
|
|
420
|
+
* @callback
|
|
421
|
+
* @description Fired when the user releases a mouse button in the editor.
|
|
422
|
+
* Triggered after internal selection updates.
|
|
423
|
+
* Return `false` to prevent the default editor behavior.
|
|
424
|
+
* @param {BaseEvent} params
|
|
425
|
+
*/
|
|
426
|
+
declare function onMouseUp(params: BaseEvent): void;
|
|
427
|
+
/**
|
|
428
|
+
* @callback
|
|
429
|
+
* @description Fired when a key is pressed down in the editor.
|
|
430
|
+
* Triggered before shortcut command execution and `keydown` reducers.
|
|
431
|
+
* Return `false` to prevent the default editor behavior including shortcuts, actions, and text input.
|
|
432
|
+
* @param {BaseEvent} params
|
|
433
|
+
*/
|
|
434
|
+
declare function onKeyDown(params: BaseEvent): void;
|
|
435
|
+
/**
|
|
436
|
+
* @callback
|
|
437
|
+
* @description Fired when a key is released in the editor.
|
|
438
|
+
* Triggered after format tag cleanup and zero-width character removal.
|
|
439
|
+
* Return `false` to prevent history push for history-relevant keys.
|
|
440
|
+
* @param {BaseEvent} params
|
|
441
|
+
*/
|
|
442
|
+
declare function onKeyUp(params: BaseEvent): void;
|
|
443
|
+
/**
|
|
444
|
+
* @callback
|
|
445
|
+
* @description Fired when the editor gains focus (managed focus via `editor.focusManager.focus()`).
|
|
446
|
+
* Triggered after toolbar display updates and status flags are set.
|
|
447
|
+
* This is different from `onNativeFocus` which fires on native DOM `focus` events.
|
|
448
|
+
* @param {BaseEvent} params
|
|
449
|
+
*/
|
|
450
|
+
declare function onFocus(params: BaseEvent): void;
|
|
451
|
+
/**
|
|
452
|
+
* @callback
|
|
453
|
+
* @description Fired when the editor receives a native DOM `focus` event.
|
|
454
|
+
* Triggered before managed focus processing.
|
|
455
|
+
* This is the raw browser `focus` event, use `onFocus` for managed focus handling.
|
|
456
|
+
* @param {BaseEvent} params
|
|
457
|
+
*/
|
|
458
|
+
declare function onNativeFocus(params: BaseEvent): void;
|
|
459
|
+
/**
|
|
460
|
+
* @callback
|
|
461
|
+
* @description Fired when the editor loses focus (managed blur via `editor.blur()`).
|
|
462
|
+
* Triggered after balloon toolbar is hidden and status flags are updated.
|
|
463
|
+
* This is different from `onNativeBlur` which fires on native DOM `blur` events.
|
|
464
|
+
* @param {BaseEvent} params
|
|
465
|
+
*/
|
|
466
|
+
declare function onBlur(params: BaseEvent): void;
|
|
467
|
+
/**
|
|
468
|
+
* @callback
|
|
469
|
+
* @description Fired when the editor receives a native DOM `blur` event.
|
|
470
|
+
* Triggered before managed blur processing.
|
|
471
|
+
* This is the raw browser `blur` event, use `onBlur` for managed blur handling.
|
|
472
|
+
* @param {BaseEvent} params
|
|
473
|
+
*/
|
|
474
|
+
declare function onNativeBlur(params: BaseEvent): void;
|
|
475
|
+
/**
|
|
476
|
+
* @callback
|
|
477
|
+
* @description Fired when the user attempts to copy content from the editor.
|
|
478
|
+
* Triggered before copying to clipboard.
|
|
479
|
+
* Return `false` to prevent the copy operation.
|
|
480
|
+
* @param {Object} params
|
|
481
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
482
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
483
|
+
* @param {Event} params.event - event object
|
|
484
|
+
* @param {Event} params.clipboardData - `clipboardData`
|
|
485
|
+
*/
|
|
486
|
+
declare function onCopy(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; event: Event; clipboardData: Event }): void;
|
|
487
|
+
/**
|
|
488
|
+
* @callback
|
|
489
|
+
* @description Fired when the user attempts to cut content from the editor.
|
|
490
|
+
* Triggered before cutting to clipboard.
|
|
491
|
+
* Return `false` to prevent the cut operation and history push.
|
|
492
|
+
* @param {Object} params
|
|
493
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
494
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
495
|
+
* @param {Event} params.event - event object
|
|
496
|
+
* @param {Event} params.clipboardData - `clipboardData`
|
|
497
|
+
*/
|
|
498
|
+
declare function onCut(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; event: Event; clipboardData: Event }): void;
|
|
499
|
+
/**
|
|
500
|
+
* @callback
|
|
501
|
+
* @description Fired when the editor content has changed.
|
|
502
|
+
* Triggered after history stack updates, undo/redo operations, and user edits.
|
|
503
|
+
* Use this to sync external state or validate content.
|
|
504
|
+
* The `data` parameter contains the current HTML content.
|
|
505
|
+
* @param {Object} params
|
|
506
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
507
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
508
|
+
* @param {string} params.data - editor HTML content
|
|
509
|
+
*/
|
|
510
|
+
declare function onChange(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; data: string }): void;
|
|
511
|
+
/**
|
|
512
|
+
* @callback
|
|
513
|
+
* @description Fired when a toolbar becomes visible.
|
|
514
|
+
* Triggered for balloon mode and inline mode toolbars.
|
|
515
|
+
* The `mode` parameter indicates the toolbar type (`balloon` or `inline`).
|
|
516
|
+
* @param {Object} params
|
|
517
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
518
|
+
* @param {HTMLElement} params.toolbar - Toolbar element
|
|
519
|
+
* @param {string} params.mode - Toolbar mode
|
|
520
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
521
|
+
*/
|
|
522
|
+
declare function onShowToolbar(params: { $: SunEditor.Deps; toolbar: HTMLElement; mode: string; frameContext: SunEditor.FrameContext }): void;
|
|
523
|
+
/**
|
|
524
|
+
* @callback
|
|
525
|
+
* @description Fired after a component controller (floating toolbar) is displayed.
|
|
526
|
+
* Triggered when components (images, videos, tables) are selected.
|
|
527
|
+
* The `caller` parameter indicates which plugin triggered the controller.
|
|
528
|
+
* @param {Object} params
|
|
529
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
530
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
531
|
+
* @param {string} params.caller - caller plugin name
|
|
532
|
+
* @param {SunEditor.Module.Controller.Info} params.info - info object
|
|
533
|
+
*/
|
|
534
|
+
declare function onShowController(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; caller: string; info: SunEditor.Module.Controller.Info }): void;
|
|
535
|
+
/**
|
|
536
|
+
* @callback
|
|
537
|
+
* @description Fired before a component controller (floating toolbar) is displayed.
|
|
538
|
+
* Triggered when components (images, videos, tables) are about to be selected.
|
|
539
|
+
* Return `false` to prevent the controller from showing.
|
|
540
|
+
* @param {Object} params
|
|
541
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
542
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
543
|
+
* @param {string} params.caller - caller plugin name
|
|
544
|
+
* @param {SunEditor.Module.Controller.Info} params.info - info object
|
|
545
|
+
*/
|
|
546
|
+
declare function onBeforeShowController(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; caller: string; info: SunEditor.Module.Controller.Info }): void;
|
|
547
|
+
/**
|
|
548
|
+
* @callback
|
|
549
|
+
* @description Fired when the editor switches between WYSIWYG view and code view.
|
|
550
|
+
* The `is` parameter indicates whether code view is now active (`true`) or WYSIWYG view is active (`false`).
|
|
551
|
+
* @param {Object} params
|
|
552
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
553
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
554
|
+
* @param {boolean} params.is - code view status
|
|
555
|
+
*/
|
|
556
|
+
declare function onToggleCodeView(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; is: boolean }): void;
|
|
557
|
+
/**
|
|
558
|
+
* @callback
|
|
559
|
+
* @description Fired when the editor enters or exits fullscreen mode.
|
|
560
|
+
* The `is` parameter indicates whether fullscreen mode is now active (`true`) or normal mode is active (`false`).
|
|
561
|
+
* @param {Object} params
|
|
562
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
563
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
564
|
+
* @param {boolean} params.is - full screen status
|
|
565
|
+
*/
|
|
566
|
+
declare function onToggleFullScreen(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; is: boolean }): void;
|
|
567
|
+
/**
|
|
568
|
+
* @callback
|
|
569
|
+
* @description Fired when the editor's wysiwyg area height changes.
|
|
570
|
+
* Triggered by `ResizeObserver`.
|
|
571
|
+
* Use this to sync external UI elements or implement custom resize behaviors.
|
|
572
|
+
* Parameters include current height, previous height, and the `ResizeObserverEntry`.
|
|
573
|
+
* @param {Object} params
|
|
574
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
575
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
576
|
+
* @param {number} params.height - wysiwyg area frame height
|
|
577
|
+
* @param {boolean} params.prevHeight - wysiwyg area previous height
|
|
578
|
+
* @param {ResizeObserverEntry} params.observerEntry - ResizeObserverEntry
|
|
579
|
+
*/
|
|
580
|
+
declare function onResizeEditor(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; height: number; prevHeight: boolean; observerEntry: ResizeObserverEntry }): void;
|
|
581
|
+
/**
|
|
582
|
+
* @callback
|
|
583
|
+
* @description Fired after toolbar buttons are created and rendered.
|
|
584
|
+
* Triggered during toolbar initialization and `resetToolbarButtons()`.
|
|
585
|
+
* Use this to customize toolbar DOM or add custom elements to the `buttonTray`.
|
|
586
|
+
* @param {Object} params
|
|
587
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
588
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
589
|
+
* @param {HTMLElement} params.buttonTray - button tray element
|
|
590
|
+
*/
|
|
591
|
+
declare function onSetToolbarButtons(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; buttonTray: HTMLElement }): void;
|
|
592
|
+
/**
|
|
593
|
+
* @callback
|
|
594
|
+
* @description Fired when the save command is executed (Ctrl+S or save button).
|
|
595
|
+
* Use this to send editor content to a server or perform custom save logic.
|
|
596
|
+
* Return a Promise resolving to `false` to prevent the save operation from completing.
|
|
597
|
+
* @param {Object} params
|
|
598
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
599
|
+
* @param {SunEditor.FrameContext} params.frameContext - frame context
|
|
600
|
+
* @param {Event} params.data - editor data
|
|
601
|
+
* @returns {PromiseLike<boolean>}
|
|
602
|
+
*/
|
|
603
|
+
declare function onSave(params: { $: SunEditor.Deps; frameContext: SunEditor.FrameContext; data: Event }): PromiseLike<boolean>;
|
|
604
|
+
/**
|
|
605
|
+
* @callback
|
|
606
|
+
* @description Fired when toolbar button states are reset.
|
|
607
|
+
* Triggered during undo/redo operations and history navigation.
|
|
608
|
+
* Use this to update custom toolbar buttons or external UI state.
|
|
609
|
+
* @param {Object} params
|
|
610
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
611
|
+
* @param {string} params.rootKey - frame key
|
|
612
|
+
*/
|
|
613
|
+
declare function onResetButtons(params: { $: SunEditor.Deps; rootKey: string }): void;
|
|
614
|
+
/**
|
|
615
|
+
* @callback
|
|
616
|
+
* @description Fired before a font family change is applied to the selection.
|
|
617
|
+
* Triggered by font dropdown selection.
|
|
618
|
+
* Return a Promise resolving to `false` to cancel the font change operation.
|
|
619
|
+
* @param {Object} params
|
|
620
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
621
|
+
* @param {string} params.value - font value
|
|
622
|
+
* @returns {PromiseLike<boolean | void>}
|
|
623
|
+
*/
|
|
624
|
+
declare function onFontActionBefore(params: { $: SunEditor.Deps; value: string }): PromiseLike<boolean | void>;
|
|
625
|
+
/**
|
|
626
|
+
* @callback
|
|
627
|
+
* @description Fired when the user attempts to drop content into the editor.
|
|
628
|
+
* Triggered after HTML cleaning and character count validation.
|
|
629
|
+
* Return `false` to cancel drop, or return a string to replace the drop data.
|
|
630
|
+
* @param {ClipboardEvent} params
|
|
631
|
+
* @returns {PromiseLike<boolean | string>}
|
|
632
|
+
*/
|
|
633
|
+
declare function onDrop(params: ClipboardEvent): PromiseLike<boolean | string>;
|
|
634
|
+
/**
|
|
635
|
+
* @callback
|
|
636
|
+
* @description Fired when the user attempts to paste content into the editor.
|
|
637
|
+
* Triggered after HTML cleaning and character count validation.
|
|
638
|
+
* Return `false` to cancel paste, or return a string to replace the paste data.
|
|
639
|
+
* @param {ClipboardEvent} params
|
|
640
|
+
* @returns {PromiseLike<boolean | string | void>}
|
|
641
|
+
*/
|
|
642
|
+
declare function onPaste(params: ClipboardEvent): PromiseLike<boolean | string | void>;
|
|
643
|
+
/**
|
|
644
|
+
* @callback
|
|
645
|
+
* @description Custom handler for image upload requests.
|
|
646
|
+
* Fired after the `XMLHttpRequest` is sent but before default response processing.
|
|
647
|
+
* Return a Promise resolving to `true` if you handle the upload response yourself,
|
|
648
|
+
* or `false` to use default processing. The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
|
|
649
|
+
* @param {Object} params
|
|
650
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
651
|
+
* @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
|
|
652
|
+
* @param {ImageInfo} params.info - info object
|
|
653
|
+
* @returns {PromiseLike<boolean | void>}
|
|
654
|
+
*/
|
|
655
|
+
declare function imageUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHttpRequest; info: ImageInfo }): PromiseLike<boolean | void>;
|
|
656
|
+
/**
|
|
657
|
+
* @callback
|
|
658
|
+
* @description Fired before an image is uploaded to the server.
|
|
659
|
+
* Use this to validate, resize, or modify image data before upload.
|
|
660
|
+
* Return `false` to cancel upload, return an `ImageInfo` object to modify the upload data,
|
|
661
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
662
|
+
* @param {Object} params
|
|
663
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
664
|
+
* @param {ImageInfo} params.info - info object
|
|
665
|
+
* @param {(newInfo?: ImageInfo | null) => void} params.handler - handler function
|
|
666
|
+
* @returns {PromiseLike<boolean | ImageInfo | void>}
|
|
667
|
+
*/
|
|
668
|
+
declare function onImageUploadBefore(params: { $: SunEditor.Deps; info: ImageInfo; handler: (newInfo?: ImageInfo | null) => void }): PromiseLike<boolean | ImageInfo | void>;
|
|
669
|
+
/**
|
|
670
|
+
* @callback
|
|
671
|
+
* @description Fired after images are successfully loaded into the editor.
|
|
672
|
+
* Triggered after upload completion or URL-based image insertion.
|
|
673
|
+
* The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded images.
|
|
674
|
+
* @param {Object} params
|
|
675
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
676
|
+
* @param {Array<FileManagementInfo>} params.infoList - info list
|
|
677
|
+
*/
|
|
678
|
+
declare function onImageLoad(params: { $: SunEditor.Deps; infoList: Array<FileManagementInfo> }): void;
|
|
679
|
+
/**
|
|
680
|
+
* @callback
|
|
681
|
+
* @description Fired when an image is created, updated, or deleted in the editor.
|
|
682
|
+
* The `state` parameter indicates the action type (`create`, `update`, or `delete`).
|
|
683
|
+
* Use this to sync image state with external systems or track image modifications.
|
|
684
|
+
* @param {Object} params
|
|
685
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
686
|
+
* @param {FileManagementInfo} params.info - info object
|
|
687
|
+
* @param {HTMLElement | null} params.element - target element
|
|
688
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
689
|
+
* @param {number} params.index - data index
|
|
690
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
691
|
+
* @param {string} params.pluginName - plugin name
|
|
692
|
+
*/
|
|
693
|
+
declare function onImageAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
|
|
694
|
+
/**
|
|
695
|
+
* @callback
|
|
696
|
+
* @description Fired when an image upload fails due to size limits, server errors, or other issues.
|
|
697
|
+
* Return a Promise resolving to a custom error message string to override the default error message,
|
|
698
|
+
* or `undefined` to use the default message.
|
|
699
|
+
* @param {Object} params
|
|
700
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
701
|
+
* @param {string} params.error - error message
|
|
702
|
+
* @param {number} [params.limitSize] - limit size
|
|
703
|
+
* @param {number} [params.uploadSize] - upload size
|
|
704
|
+
* @param {number} [params.currentSize] - current size
|
|
705
|
+
* @param {File} [params.file] - File object
|
|
706
|
+
* @returns {PromiseLike<string | void>}
|
|
707
|
+
*/
|
|
708
|
+
declare function onImageUploadError(params: { $: SunEditor.Deps; error: string; limitSize?: number; uploadSize?: number; currentSize?: number; file?: File }): PromiseLike<string | void>;
|
|
709
|
+
/**
|
|
710
|
+
* @callback
|
|
711
|
+
* @description Fired before an image is deleted from the editor.
|
|
712
|
+
* Use this to confirm deletion, notify server, or perform cleanup.
|
|
713
|
+
* Return a Promise resolving to `false` to prevent the image from being deleted.
|
|
714
|
+
* @param {Object} params
|
|
715
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
716
|
+
* @param {HTMLElement} params.element - target element
|
|
717
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
718
|
+
* @param {string} params.align - align value
|
|
719
|
+
* @param {string} params.alt - alt text value
|
|
720
|
+
* @param {?string} params.url - Anchor url, if it exists
|
|
721
|
+
* @returns {PromiseLike<boolean>}
|
|
722
|
+
*/
|
|
723
|
+
declare function onImageDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; align: string; alt: string; url: string | null }): PromiseLike<boolean>;
|
|
724
|
+
/**
|
|
725
|
+
* @callback
|
|
726
|
+
* @description Custom handler for video upload requests.
|
|
727
|
+
* Fired after the `XMLHttpRequest` is sent but before default response processing.
|
|
728
|
+
* Return a Promise resolving to `true` if you handle the upload response yourself,
|
|
729
|
+
* or `false` to use default processing.
|
|
730
|
+
* The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
|
|
731
|
+
* @param {Object} params
|
|
732
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
733
|
+
* @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
|
|
734
|
+
* @param {VideoInfo} params.info - info object
|
|
735
|
+
* @returns {PromiseLike<boolean>}
|
|
736
|
+
*/
|
|
737
|
+
declare function videoUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHttpRequest; info: VideoInfo }): PromiseLike<boolean>;
|
|
738
|
+
/**
|
|
739
|
+
* @callback
|
|
740
|
+
* @description Fired before a video is uploaded to the server.
|
|
741
|
+
* Use this to validate, transcode, or modify video data before upload.
|
|
742
|
+
* Return `false` to cancel upload, return a `VideoInfo` object to modify the upload data,
|
|
743
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
744
|
+
* @param {Object} params
|
|
745
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
746
|
+
* @param {VideoInfo} params.info - info object
|
|
747
|
+
* @param {(newInfo?: VideoInfo | null) => void} params.handler - handler function
|
|
748
|
+
* @returns {PromiseLike<boolean | VideoInfo | void>}
|
|
749
|
+
*/
|
|
750
|
+
declare function onVideoUploadBefore(params: { $: SunEditor.Deps; info: VideoInfo; handler: (newInfo?: VideoInfo | null) => void }): PromiseLike<boolean | VideoInfo | void>;
|
|
751
|
+
/**
|
|
752
|
+
* @callback
|
|
753
|
+
* @description Fired after videos are successfully loaded into the editor.
|
|
754
|
+
* Triggered after upload completion or URL-based video insertion (iframe/video tag).
|
|
755
|
+
* The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded videos.
|
|
756
|
+
* @param {Object} params
|
|
757
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
758
|
+
* @param {Array<FileManagementInfo>} params.infoList - info list
|
|
759
|
+
*/
|
|
760
|
+
declare function onVideoLoad(params: { $: SunEditor.Deps; infoList: Array<FileManagementInfo> }): void;
|
|
761
|
+
/**
|
|
762
|
+
* @callback
|
|
763
|
+
* @description Fired when a video is created, updated, or deleted in the editor.
|
|
764
|
+
* The `state` parameter indicates the action type (`create`, `update`, or `delete`).
|
|
765
|
+
* Use this to sync video state with external systems or track video modifications.
|
|
766
|
+
* @param {Object} params
|
|
767
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
768
|
+
* @param {FileManagementInfo} params.info - info object
|
|
769
|
+
* @param {HTMLElement | null} params.element - target element
|
|
770
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
771
|
+
* @param {number} params.index - data index
|
|
772
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
773
|
+
* @param {string} params.pluginName - plugin name
|
|
774
|
+
*/
|
|
775
|
+
declare function onVideoAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
|
|
776
|
+
/**
|
|
777
|
+
* @callback
|
|
778
|
+
* @description Fired when a video upload fails due to size limits, server errors, or other issues.
|
|
779
|
+
* Return a Promise resolving to a custom error message string to override the default error message,
|
|
780
|
+
* or `undefined` to use the default message.
|
|
781
|
+
* @param {Object} params
|
|
782
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
783
|
+
* @param {string} params.error - error message
|
|
784
|
+
* @param {number} [params.limitSize] - limit size
|
|
785
|
+
* @param {number} [params.uploadSize] - upload size
|
|
786
|
+
* @param {number} [params.currentSize] - current size
|
|
787
|
+
* @param {File} [params.file] - File object
|
|
788
|
+
* @returns {PromiseLike<string | void>}
|
|
789
|
+
*/
|
|
790
|
+
declare function onVideoUploadError(params: { $: SunEditor.Deps; error: string; limitSize?: number; uploadSize?: number; currentSize?: number; file?: File }): PromiseLike<string | void>;
|
|
791
|
+
/**
|
|
792
|
+
* @callback
|
|
793
|
+
* @description Fired before a video is deleted from the editor.
|
|
794
|
+
* Use this to confirm deletion, notify server, or perform cleanup.
|
|
795
|
+
* Return a Promise resolving to `false` to prevent the video from being deleted.
|
|
796
|
+
* @param {Object} params
|
|
797
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
798
|
+
* @param {HTMLElement} params.element - target element
|
|
799
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
800
|
+
* @param {string} params.align - align value
|
|
801
|
+
* @param {string} params.url - video url
|
|
802
|
+
* @returns {PromiseLike<boolean>}
|
|
803
|
+
*/
|
|
804
|
+
declare function onVideoDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; align: string; url: string }): PromiseLike<boolean>;
|
|
805
|
+
/**
|
|
806
|
+
* @callback
|
|
807
|
+
* @description Custom handler for audio upload requests.
|
|
808
|
+
* Fired after the `XMLHttpRequest` is sent but before default response processing.
|
|
809
|
+
* Return a Promise resolving to `true` if you handle the upload response yourself,
|
|
810
|
+
* or `false` to use default processing.
|
|
811
|
+
* The `xmlHttp` parameter provides access to the `XMLHttpRequest` object.
|
|
812
|
+
* @param {Object} params
|
|
813
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
814
|
+
* @param {XMLHttpRequest} params.xmlHttp - XMLHttpRequest
|
|
815
|
+
* @param {AudioInfo} params.info - info object
|
|
816
|
+
* @returns {PromiseLike<boolean>}
|
|
817
|
+
*/
|
|
818
|
+
declare function audioUploadHandler(params: { $: SunEditor.Deps; xmlHttp: XMLHttpRequest; info: AudioInfo }): PromiseLike<boolean>;
|
|
819
|
+
/**
|
|
820
|
+
* @callback
|
|
821
|
+
* @description Fired before an audio file is uploaded to the server.
|
|
822
|
+
* Use this to validate, transcode, or modify audio data before upload.
|
|
823
|
+
* Return `false` to cancel upload, return an `AudioInfo` object to modify the upload data,
|
|
824
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
825
|
+
* @param {Object} params
|
|
826
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
827
|
+
* @param {AudioInfo} params.info - info object
|
|
828
|
+
* @param {(newInfo?: AudioInfo | null) => void} params.handler - handler function
|
|
829
|
+
* @returns {PromiseLike<boolean | AudioInfo| void>}
|
|
830
|
+
*/
|
|
831
|
+
declare function onAudioUploadBefore(params: { $: SunEditor.Deps; info: AudioInfo; handler: (newInfo?: AudioInfo | null) => void }): PromiseLike<boolean | AudioInfo | void>;
|
|
832
|
+
/**
|
|
833
|
+
* @callback
|
|
834
|
+
* @description Fired when an audio upload fails due to size limits, server errors, or other issues.
|
|
835
|
+
* Return a Promise resolving to a custom error message string to override the default error message,
|
|
836
|
+
* or `undefined` to use the default message.
|
|
837
|
+
* @param {Object} params
|
|
838
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
839
|
+
* @param {string} params.error - error message
|
|
840
|
+
* @param {number} [params.limitSize] - limit size
|
|
841
|
+
* @param {number} [params.uploadSize] - upload size
|
|
842
|
+
* @param {number} [params.currentSize] - current size
|
|
843
|
+
* @param {File} [params.file] - File object
|
|
844
|
+
* @returns {PromiseLike<string | void>}
|
|
845
|
+
*/
|
|
846
|
+
declare function onAudioUploadError(params: { $: SunEditor.Deps; error: string; limitSize?: number; uploadSize?: number; currentSize?: number; file?: File }): PromiseLike<string | void>;
|
|
847
|
+
/**
|
|
848
|
+
* @callback
|
|
849
|
+
* @description Fired after audio files are successfully loaded into the editor.
|
|
850
|
+
* Triggered after upload completion or URL-based audio insertion.
|
|
851
|
+
* The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded audio files.
|
|
852
|
+
* @param {Object} params
|
|
853
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
854
|
+
* @param {Array<FileManagementInfo>} params.infoList - info list
|
|
855
|
+
*/
|
|
856
|
+
declare function onAudioLoad(params: { $: SunEditor.Deps; infoList: Array<FileManagementInfo> }): void;
|
|
857
|
+
/**
|
|
858
|
+
* @callback
|
|
859
|
+
* @description Fired when an audio element is created, updated, or deleted in the editor.
|
|
860
|
+
* The `state` parameter indicates the action type (`create`, `update`, or `delete`).
|
|
861
|
+
* Use this to sync audio state with external systems or track audio modifications.
|
|
862
|
+
* @param {Object} params
|
|
863
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
864
|
+
* @param {FileManagementInfo} params.info - info object
|
|
865
|
+
* @param {HTMLElement | null} params.element - target element
|
|
866
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
867
|
+
* @param {number} params.index - data index
|
|
868
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
869
|
+
* @param {string} params.pluginName - plugin name
|
|
870
|
+
*/
|
|
871
|
+
declare function onAudioAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
|
|
872
|
+
/**
|
|
873
|
+
* @callback
|
|
874
|
+
* @description Fired before an audio element is deleted from the editor.
|
|
875
|
+
* Use this to confirm deletion, notify server, or perform cleanup.
|
|
876
|
+
* Return a Promise resolving to `false` to prevent the audio from being deleted.
|
|
877
|
+
* @param {Object} params
|
|
878
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
879
|
+
* @param {HTMLElement} params.element - target element
|
|
880
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
881
|
+
* @param {string} params.url - audio url
|
|
882
|
+
* @returns {PromiseLike<boolean>}
|
|
883
|
+
*/
|
|
884
|
+
declare function onAudioDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; url: string }): PromiseLike<boolean>;
|
|
885
|
+
/**
|
|
886
|
+
* @callback
|
|
887
|
+
* @description Fired before a file is uploaded to the server (via `fileUpload` plugin).
|
|
888
|
+
* Use this to validate or modify file data before upload.
|
|
889
|
+
* Return `false` to cancel upload, return a `FileInfo` object to modify the upload data,
|
|
890
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
891
|
+
* @param {Object} params
|
|
892
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
893
|
+
* @param {FileInfo} params.info - info object
|
|
894
|
+
* @param {(newInfo?: FileInfo | null) => void} params.handler - handler function
|
|
895
|
+
* @returns {PromiseLike<boolean | FileInfo | void>}
|
|
896
|
+
*/
|
|
897
|
+
declare function onFileUploadBefore(params: { $: SunEditor.Deps; info: FileInfo; handler: (newInfo?: FileInfo | null) => void }): PromiseLike<boolean | FileInfo | void>;
|
|
898
|
+
/**
|
|
899
|
+
* @callback
|
|
900
|
+
* @description Fired after files are successfully uploaded and loaded into the editor.
|
|
901
|
+
* Triggered by the `fileUpload` plugin after upload completion.
|
|
902
|
+
* The `infoList` parameter contains an array of `FileManagementInfo` objects for all loaded files.
|
|
903
|
+
* @param {Object} params
|
|
904
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
905
|
+
* @param {Array<FileManagementInfo>} params.infoList - info list
|
|
906
|
+
*/
|
|
907
|
+
declare function onFileLoad(params: { $: SunEditor.Deps; infoList: Array<FileManagementInfo> }): void;
|
|
908
|
+
/**
|
|
909
|
+
* @callback
|
|
910
|
+
* @description Fired when a file link is created, updated, or deleted in the editor.
|
|
911
|
+
* The `state` parameter indicates the action type (`create`, `update`, or `delete`).
|
|
912
|
+
* Use this to sync file state with external systems or track file modifications.
|
|
913
|
+
* @param {Object} params
|
|
914
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
915
|
+
* @param {FileManagementInfo} params.info - info object
|
|
916
|
+
* @param {HTMLElement | null} params.element - target element
|
|
917
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
918
|
+
* @param {number} params.index - data index
|
|
919
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
920
|
+
* @param {string} params.pluginName - plugin name
|
|
921
|
+
*/
|
|
922
|
+
declare function onFileAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
|
|
923
|
+
/**
|
|
924
|
+
* @callback
|
|
925
|
+
* @description Fired when a file upload fails due to size limits, server errors, or other issues.
|
|
926
|
+
* Return a Promise resolving to a custom error message string to override the default error message,
|
|
927
|
+
* or `undefined` to use the default message.
|
|
928
|
+
* @param {Object} params
|
|
929
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
930
|
+
* @param {string} params.error - error message
|
|
931
|
+
* @param {number} [params.limitSize] - limit size
|
|
932
|
+
* @param {number} [params.uploadSize] - upload size
|
|
933
|
+
* @param {number} [params.currentSize] - current size
|
|
934
|
+
* @param {File} [params.file] - File object
|
|
935
|
+
* @returns {PromiseLike<string | void>}
|
|
936
|
+
*/
|
|
937
|
+
declare function onFileUploadError(params: { $: SunEditor.Deps; error: string; limitSize?: number; uploadSize?: number; currentSize?: number; file?: File }): PromiseLike<string | void>;
|
|
938
|
+
/**
|
|
939
|
+
* @callback
|
|
940
|
+
* @description Fired before a file link is deleted from the editor.
|
|
941
|
+
* Use this to confirm deletion, notify server, or perform cleanup.
|
|
942
|
+
* Return a Promise resolving to `false` to prevent the file link from being deleted.
|
|
943
|
+
* @param {Object} params
|
|
944
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
945
|
+
* @param {HTMLElement} params.element - target element
|
|
946
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
947
|
+
* @param {string} params.url - file url
|
|
948
|
+
* @returns {PromiseLike<boolean>}
|
|
949
|
+
*/
|
|
950
|
+
declare function onFileDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; url: string }): PromiseLike<boolean>;
|
|
951
|
+
/**
|
|
952
|
+
* @callback
|
|
953
|
+
* @description Fired before the editor content is exported to PDF.
|
|
954
|
+
* Use this to modify content, add metadata, or cancel the export.
|
|
955
|
+
* Return a Promise resolving to `false` to prevent the PDF export.
|
|
956
|
+
* @param {Object} params
|
|
957
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
958
|
+
* @param {HTMLElement} params.target - wysiwyg editable element
|
|
959
|
+
* @returns {PromiseLike<boolean>}
|
|
960
|
+
*/
|
|
961
|
+
declare function onExportPDFBefore(params: { $: SunEditor.Deps; target: HTMLElement }): PromiseLike<boolean>;
|
|
962
|
+
/**
|
|
963
|
+
* @callback
|
|
964
|
+
* @description Fired when any media element (image, video, audio, file) is created, updated, or deleted.
|
|
965
|
+
* This is a unified event that triggers for all media types.
|
|
966
|
+
* The `pluginName` parameter indicates which plugin triggered the action (`image`, `video`, `audio`, or `file`).
|
|
967
|
+
* @param {Object} params
|
|
968
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
969
|
+
* @param {FileManagementInfo} params.info - info object
|
|
970
|
+
* @param {HTMLElement | null} params.element - target element
|
|
971
|
+
* @param {"create" | "update" | "delete"} params.state - state
|
|
972
|
+
* @param {number} params.index - data index
|
|
973
|
+
* @param {number} params.remainingFilesCount - remaining files count
|
|
974
|
+
* @param {string} params.pluginName - plugin name
|
|
975
|
+
*/
|
|
976
|
+
declare function onFileManagerAction(params: { $: SunEditor.Deps; info: FileManagementInfo; element: HTMLElement | null; state: 'create' | 'update' | 'delete'; index: number; remainingFilesCount: number; pluginName: string }): void;
|
|
977
|
+
/**
|
|
978
|
+
* @callback
|
|
979
|
+
* @description Fired before an embed URL is processed and inserted into the editor.
|
|
980
|
+
* Use this to validate URLs, add custom embed processors, or modify embed parameters.
|
|
981
|
+
* Return `false` to cancel insertion, return an `EmbedInfo` object to modify the embed data,
|
|
982
|
+
* or call the `handler` parameter to proceed with modified data.
|
|
983
|
+
* @param {EmbedInfo & {$: SunEditor.Deps, handler: (newInfo?: EmbedInfo | null) => void}} params
|
|
984
|
+
* @returns {PromiseLike<boolean | EmbedInfo | void>}
|
|
985
|
+
*/
|
|
986
|
+
declare function onEmbedInputBefore(
|
|
987
|
+
params: EmbedInfo & {
|
|
988
|
+
$: SunEditor.Deps;
|
|
989
|
+
handler: (newInfo?: EmbedInfo | null) => void;
|
|
990
|
+
},
|
|
991
|
+
): PromiseLike<boolean | EmbedInfo | void>;
|
|
992
|
+
/**
|
|
993
|
+
* @callback
|
|
994
|
+
* @description Fired before an embedded element (iframe, custom embed) is deleted from the editor.
|
|
995
|
+
* Use this to confirm deletion or perform cleanup.
|
|
996
|
+
* Return a Promise resolving to `false` to prevent the embed from being deleted.
|
|
997
|
+
* @param {Object} params
|
|
998
|
+
* @param {SunEditor.Deps} params.$ - Kernel dependencies
|
|
999
|
+
* @param {HTMLElement} params.element - target element
|
|
1000
|
+
* @param {HTMLElement} params.container - target's container element (div)
|
|
1001
|
+
* @param {string} params.align - align value
|
|
1002
|
+
* @param {string} params.url - embed url
|
|
1003
|
+
* @returns {PromiseLike<boolean>}
|
|
1004
|
+
*/
|
|
1005
|
+
declare function onEmbedDeleteBefore(params: { $: SunEditor.Deps; element: HTMLElement; container: HTMLElement; align: string; url: string }): PromiseLike<boolean>;
|
|
1006
|
+
export {};
|