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
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import type {} from '../typedef';
|
|
2
|
+
export namespace Event {
|
|
3
|
+
/**
|
|
4
|
+
* Executes the method that is called whenever the cursor position changes.
|
|
5
|
+
* @description Executes the method that is called whenever the cursor position changes.
|
|
6
|
+
* @param {?HTMLElement} element - Node element where the cursor is currently located
|
|
7
|
+
* @param {?HTMLElement} target - The plugin's toolbar button element
|
|
8
|
+
* @returns {boolean|void} - Whether the plugin is active
|
|
9
|
+
* - If it returns `undefined`, it will no longer be called in this scope.
|
|
10
|
+
*/
|
|
11
|
+
function Active(element: HTMLElement | null, target: HTMLElement | null): boolean | void;
|
|
12
|
+
/**
|
|
13
|
+
* Executes the event function of `focus`.
|
|
14
|
+
* @param {SunEditor.HookParams.FocusBlur} params - Event parameters
|
|
15
|
+
* @returns {void}
|
|
16
|
+
*/
|
|
17
|
+
function OnFocus(params: SunEditor.HookParams.FocusBlur): void;
|
|
18
|
+
/**
|
|
19
|
+
* Executes the event function of `blur`.
|
|
20
|
+
* @param {SunEditor.HookParams.FocusBlur} params - Event parameters
|
|
21
|
+
* @returns {void}
|
|
22
|
+
*/
|
|
23
|
+
function OnBlur(params: SunEditor.HookParams.FocusBlur): void;
|
|
24
|
+
/**
|
|
25
|
+
* Executes the event function of `mousemove`.
|
|
26
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
29
|
+
function OnMouseMove(params: SunEditor.HookParams.MouseEvent): void;
|
|
30
|
+
/**
|
|
31
|
+
* Executes the event function of `scroll`.
|
|
32
|
+
* @param {SunEditor.HookParams.Scroll} params - Event parameters
|
|
33
|
+
* @returns {void}
|
|
34
|
+
*/
|
|
35
|
+
function OnScroll(params: SunEditor.HookParams.Scroll): void;
|
|
36
|
+
/**
|
|
37
|
+
* Executes the event function of `keydown` (sync).
|
|
38
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
39
|
+
* @param {SunEditor.HookParams.KeyEvent} params - Key event information
|
|
40
|
+
* @returns {void|boolean} - Return `false` to prevent the editor's `keydown` processing (shortcuts, actions)
|
|
41
|
+
*/
|
|
42
|
+
function OnKeyDown(params: SunEditor.HookParams.KeyEvent): void | boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Executes the event function of `keydown` (async).
|
|
45
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
46
|
+
* @param {SunEditor.HookParams.KeyEvent} params - Key event information
|
|
47
|
+
* @returns {Promise<void|boolean>} - Return `false` to prevent the editor's `keydown` processing (shortcuts, actions)
|
|
48
|
+
*/
|
|
49
|
+
function OnKeyDownAsync(params: SunEditor.HookParams.KeyEvent): Promise<void | boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Executes the event function of `keyup` (sync).
|
|
52
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
53
|
+
* @param {SunEditor.HookParams.KeyEvent} params - Key event information
|
|
54
|
+
* @returns {void|boolean} - Return `false` to prevent adding to history
|
|
55
|
+
*/
|
|
56
|
+
function OnKeyUp(params: SunEditor.HookParams.KeyEvent): void | boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Executes the event function of `keyup` (async).
|
|
59
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
60
|
+
* @param {SunEditor.HookParams.KeyEvent} params - Key event information
|
|
61
|
+
* @returns {Promise<void|boolean>} - Return `false` to prevent adding to history
|
|
62
|
+
*/
|
|
63
|
+
function OnKeyUpAsync(params: SunEditor.HookParams.KeyEvent): Promise<void | boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Executes the event function of `mousedown` (sync).
|
|
66
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
67
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
68
|
+
* @returns {void|boolean} - Return `false` to prevent the editor's `mousedown` processing
|
|
69
|
+
*/
|
|
70
|
+
function OnMouseDown(params: SunEditor.HookParams.MouseEvent): void | boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Executes the event function of `mousedown` (async).
|
|
73
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
74
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
75
|
+
* @returns {Promise<void|boolean>} - Return `false` to prevent the editor's `mousedown` processing
|
|
76
|
+
*/
|
|
77
|
+
function OnMouseDownAsync(params: SunEditor.HookParams.MouseEvent): Promise<void | boolean>;
|
|
78
|
+
/**
|
|
79
|
+
* Executes the event function of `click` (sync).
|
|
80
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
81
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
82
|
+
* @returns {void|boolean} - Return `false` to prevent the editor's `click` processing (component selection)
|
|
83
|
+
*/
|
|
84
|
+
function OnClick(params: SunEditor.HookParams.MouseEvent): void | boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Executes the event function of `click` (async).
|
|
87
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
88
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
89
|
+
* @returns {Promise<void|boolean>} - Return `false` to prevent the editor's `click` processing (component selection)
|
|
90
|
+
*/
|
|
91
|
+
function OnClickAsync(params: SunEditor.HookParams.MouseEvent): Promise<void | boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Executes the event function of `paste` (sync).
|
|
94
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
95
|
+
* Returning `false` will stop event propagation and cancel the paste.
|
|
96
|
+
* @param {SunEditor.HookParams.Paste} params - Paste event information
|
|
97
|
+
* @returns {void|boolean}
|
|
98
|
+
*/
|
|
99
|
+
function OnPaste(params: SunEditor.HookParams.Paste): void | boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Executes the event function of `paste` (async).
|
|
102
|
+
* Called sequentially on all plugins. Returning a boolean stops the loop.
|
|
103
|
+
* Returning `false` will stop event propagation and cancel the paste.
|
|
104
|
+
* @param {SunEditor.HookParams.Paste} params - Paste event information
|
|
105
|
+
* @returns {Promise<void|boolean>}
|
|
106
|
+
*/
|
|
107
|
+
function OnPasteAsync(params: SunEditor.HookParams.Paste): Promise<void | boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Executes the event function of `beforeinput` (sync).
|
|
110
|
+
* Called after validation but before the input is processed.
|
|
111
|
+
* @param {SunEditor.HookParams.InputWithData} params - Event parameters
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
function OnBeforeInput(params: SunEditor.HookParams.InputWithData): void;
|
|
115
|
+
/**
|
|
116
|
+
* Executes the event function of `beforeinput` (async).
|
|
117
|
+
* Called after validation but before the input is processed.
|
|
118
|
+
* @param {SunEditor.HookParams.InputWithData} params - Event parameters
|
|
119
|
+
* @returns {Promise<void>}
|
|
120
|
+
*/
|
|
121
|
+
function OnBeforeInputAsync(params: SunEditor.HookParams.InputWithData): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Executes the event function of `input` (sync).
|
|
124
|
+
* Called after the input has been processed.
|
|
125
|
+
* @param {SunEditor.HookParams.InputWithData} params - Event parameters
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
128
|
+
function OnInput(params: SunEditor.HookParams.InputWithData): void;
|
|
129
|
+
/**
|
|
130
|
+
* Executes the event function of `input` (async).
|
|
131
|
+
* Called after the input has been processed.
|
|
132
|
+
* @param {SunEditor.HookParams.InputWithData} params - Event parameters
|
|
133
|
+
* @returns {Promise<void>}
|
|
134
|
+
*/
|
|
135
|
+
function OnInputAsync(params: SunEditor.HookParams.InputWithData): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Executes the event function of `mouseup` (sync).
|
|
138
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
139
|
+
* @returns {void}
|
|
140
|
+
*/
|
|
141
|
+
function OnMouseUp(params: SunEditor.HookParams.MouseEvent): void;
|
|
142
|
+
/**
|
|
143
|
+
* Executes the event function of `mouseup` (async).
|
|
144
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
145
|
+
* @returns {Promise<void>}
|
|
146
|
+
*/
|
|
147
|
+
function OnMouseUpAsync(params: SunEditor.HookParams.MouseEvent): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Executes the event function of `mouseleave` (sync).
|
|
150
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
151
|
+
* @returns {void}
|
|
152
|
+
*/
|
|
153
|
+
function OnMouseLeave(params: SunEditor.HookParams.MouseEvent): void;
|
|
154
|
+
/**
|
|
155
|
+
* Executes the event function of `mouseleave` (async).
|
|
156
|
+
* @param {SunEditor.HookParams.MouseEvent} params - Mouse event information
|
|
157
|
+
* @returns {Promise<void>}
|
|
158
|
+
*/
|
|
159
|
+
function OnMouseLeaveAsync(params: SunEditor.HookParams.MouseEvent): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Executes when files are pasted or dropped into the editor (sync).
|
|
162
|
+
* This event is called for each file. The paste/drop process is automatically stopped after processing all files.
|
|
163
|
+
* @param {SunEditor.HookParams.FilePasteDrop} params - File paste/drop event information
|
|
164
|
+
* @returns {void}
|
|
165
|
+
*/
|
|
166
|
+
function OnFilePasteAndDrop(params: SunEditor.HookParams.FilePasteDrop): void;
|
|
167
|
+
/**
|
|
168
|
+
* Executes when files are pasted or dropped into the editor (async).
|
|
169
|
+
* This event is called for each file. The paste/drop process is automatically stopped after processing all files.
|
|
170
|
+
* @param {SunEditor.HookParams.FilePasteDrop} params - File paste/drop event information
|
|
171
|
+
* @returns {Promise<void>}
|
|
172
|
+
*/
|
|
173
|
+
function OnFilePasteAndDropAsync(params: SunEditor.HookParams.FilePasteDrop): Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
export namespace Component {
|
|
176
|
+
/**
|
|
177
|
+
* Executes the method that is called when a component of a plugin is selected.
|
|
178
|
+
* @param {HTMLElement} target - Target component element
|
|
179
|
+
* @returns {void|boolean} - If return `true`, Special components that are not wrapping as `figure`
|
|
180
|
+
*/
|
|
181
|
+
function Select(target: HTMLElement): void | boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Called when a container is deselected.
|
|
184
|
+
* @param {HTMLElement} target Target element
|
|
185
|
+
* @returns {void}
|
|
186
|
+
*/
|
|
187
|
+
function Deselect(target: HTMLElement): void;
|
|
188
|
+
/**
|
|
189
|
+
* Executes the method that is called when a component is being edited.
|
|
190
|
+
* @param {HTMLElement} target - Target element
|
|
191
|
+
* @returns {void}
|
|
192
|
+
*/
|
|
193
|
+
function Edit(target: HTMLElement): void;
|
|
194
|
+
/**
|
|
195
|
+
* Method to delete a component of a plugin, called by the `FileManager`, `Controller` module.
|
|
196
|
+
* @param {HTMLElement} target - Target element
|
|
197
|
+
* @returns {Promise<void>}
|
|
198
|
+
*/
|
|
199
|
+
function Destroy(target: HTMLElement): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Executes the method that is called when a component copy is requested.
|
|
202
|
+
* @param {SunEditor.HookParams.CopyComponent} params - Copy component event information
|
|
203
|
+
* @returns {boolean | void} - If return `false`, the copy will be canceled
|
|
204
|
+
*/
|
|
205
|
+
function Copy(params: SunEditor.HookParams.CopyComponent): boolean | void;
|
|
206
|
+
}
|
|
207
|
+
export namespace Core {
|
|
208
|
+
/**
|
|
209
|
+
* This method is used to validate and preserve the format of the component within the editor.
|
|
210
|
+
* - It ensures that the structure and attributes of the element are maintained and secure.
|
|
211
|
+
* - The method checks if the element is already wrapped in a valid container and updates its attributes if necessary.
|
|
212
|
+
* - If the element isn't properly contained, a new container is created to retain the format.
|
|
213
|
+
* @returns {{query: string, method: (element: HTMLElement) => void}} The format retention object containing the query and method to process the element.
|
|
214
|
+
* - query: The selector query to identify the relevant elements.
|
|
215
|
+
* - method: The function to execute on the element to validate and preserve its format.
|
|
216
|
+
*/
|
|
217
|
+
function RetainFormat(): {
|
|
218
|
+
query: string;
|
|
219
|
+
method: (element: HTMLElement) => void;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Executes methods called by shortcut keys.
|
|
223
|
+
* @param {SunEditor.HookParams.Shortcut} params - Information of the `shortcut` plugin
|
|
224
|
+
* @returns {void}
|
|
225
|
+
*/
|
|
226
|
+
function Shortcut(params: SunEditor.HookParams.Shortcut): void;
|
|
227
|
+
/**
|
|
228
|
+
* Executes the method called when the rtl, ltr mode changes. (`editor.ui.setDir`)
|
|
229
|
+
* @param {string} dir - Direction (`rtl` or `ltr`)
|
|
230
|
+
* @returns {void}
|
|
231
|
+
*/
|
|
232
|
+
function SetDir(dir: string): void;
|
|
233
|
+
/**
|
|
234
|
+
* Executes when the editor or plugin is initialized.
|
|
235
|
+
* Called during editor initialization and when `resetOptions` is called.
|
|
236
|
+
* @returns {void}
|
|
237
|
+
*/
|
|
238
|
+
function Init(): void;
|
|
239
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type {} from '../typedef';
|
|
2
|
+
export type FilePasteDrop = {
|
|
3
|
+
file: File;
|
|
4
|
+
event: ClipboardEvent | DragEvent;
|
|
5
|
+
frameContext: SunEditor.FrameContext;
|
|
6
|
+
};
|
|
7
|
+
export type FocusBlurEvent = {
|
|
8
|
+
frameContext: SunEditor.FrameContext;
|
|
9
|
+
event: FocusEvent;
|
|
10
|
+
};
|
|
11
|
+
export type ScrollEvent = {
|
|
12
|
+
frameContext: SunEditor.FrameContext;
|
|
13
|
+
event: Event;
|
|
14
|
+
};
|
|
15
|
+
export type InputEventWithData = {
|
|
16
|
+
frameContext: SunEditor.FrameContext;
|
|
17
|
+
event: InputEvent;
|
|
18
|
+
data: string;
|
|
19
|
+
};
|
|
20
|
+
export type Paste = {
|
|
21
|
+
frameContext: SunEditor.FrameContext;
|
|
22
|
+
event: ClipboardEvent;
|
|
23
|
+
data: string;
|
|
24
|
+
doc: Document;
|
|
25
|
+
};
|
|
26
|
+
export type Mouse = {
|
|
27
|
+
frameContext: SunEditor.FrameContext;
|
|
28
|
+
event: MouseEvent;
|
|
29
|
+
};
|
|
30
|
+
export type Keyboard = {
|
|
31
|
+
frameContext: SunEditor.FrameContext;
|
|
32
|
+
event: KeyboardEvent;
|
|
33
|
+
};
|
|
34
|
+
export type ToolbarInputKeyDown = {
|
|
35
|
+
target: HTMLElement;
|
|
36
|
+
event: KeyboardEvent;
|
|
37
|
+
};
|
|
38
|
+
export type ToolbarInputChange = {
|
|
39
|
+
target: HTMLElement;
|
|
40
|
+
value: string;
|
|
41
|
+
event: FocusEvent | MouseEvent;
|
|
42
|
+
};
|
|
43
|
+
export type CopyComponent = {
|
|
44
|
+
event: ClipboardEvent;
|
|
45
|
+
cloneContainer: HTMLElement;
|
|
46
|
+
info: SunEditor.ComponentInfo;
|
|
47
|
+
};
|
|
48
|
+
export type MouseEventInfo = {
|
|
49
|
+
frameContext: SunEditor.FrameContext;
|
|
50
|
+
event: MouseEvent;
|
|
51
|
+
};
|
|
52
|
+
export type KeyEventInfo = {
|
|
53
|
+
frameContext: SunEditor.FrameContext;
|
|
54
|
+
event: KeyboardEvent;
|
|
55
|
+
range: Range;
|
|
56
|
+
line: HTMLElement;
|
|
57
|
+
};
|
|
58
|
+
export type ShortcutInfo = {
|
|
59
|
+
range: Range;
|
|
60
|
+
line: HTMLElement;
|
|
61
|
+
info: import('../core/logic/shell/shortcuts').ShortcutInfo;
|
|
62
|
+
event: KeyboardEvent;
|
|
63
|
+
keyCode: string;
|
|
64
|
+
$: SunEditor.Deps;
|
|
65
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,120 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Automatically generated by
|
|
2
|
+
* @file Automatically generated by "<Root>/scripts/ts-build/format-index.cjs"
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export
|
|
24
|
-
export * from './core/class/selection';
|
|
25
|
-
export * from './core/class/shortcuts';
|
|
26
|
-
export * from './core/class/toolbar';
|
|
27
|
-
export * from './core/class/ui';
|
|
28
|
-
export * from './core/class/viewer';
|
|
29
|
-
export * from './core/section/actives';
|
|
30
|
-
export * from './core/section/constructor';
|
|
31
|
-
export * from './core/section/context';
|
|
32
|
-
export * from './core/section/documentType';
|
|
33
|
-
export * from './editorInjector/_classes';
|
|
34
|
-
export * from './editorInjector/_core';
|
|
35
|
-
export * from './editorInjector/index';
|
|
36
|
-
export * from './helper/clipboard';
|
|
37
|
-
export * from './helper/converter';
|
|
38
|
-
export * from './helper/env';
|
|
39
|
-
export * from './helper/index';
|
|
40
|
-
export * from './helper/keyCodeMap';
|
|
41
|
-
export * from './helper/numbers';
|
|
42
|
-
export * from './helper/unicode';
|
|
43
|
-
export * from './helper/dom/domCheck';
|
|
44
|
-
export * from './helper/dom/domQuery';
|
|
45
|
-
export * from './helper/dom/domUtils';
|
|
46
|
-
export * from './helper/dom/index';
|
|
47
|
-
export * from './langs/_Lang';
|
|
48
|
-
export * from './langs/ckb';
|
|
49
|
-
export * from './langs/cs';
|
|
50
|
-
export * from './langs/da';
|
|
51
|
-
export * from './langs/de';
|
|
52
|
-
export * from './langs/en';
|
|
53
|
-
export * from './langs/es';
|
|
54
|
-
export * from './langs/fa';
|
|
55
|
-
export * from './langs/fr';
|
|
56
|
-
export * from './langs/he';
|
|
57
|
-
export * from './langs/hu';
|
|
58
|
-
export * from './langs/index';
|
|
59
|
-
export * from './langs/it';
|
|
60
|
-
export * from './langs/ja';
|
|
61
|
-
export * from './langs/km';
|
|
62
|
-
export * from './langs/ko';
|
|
63
|
-
export * from './langs/lv';
|
|
64
|
-
export * from './langs/nl';
|
|
65
|
-
export * from './langs/pl';
|
|
66
|
-
export * from './langs/pt_br';
|
|
67
|
-
export * from './langs/ro';
|
|
68
|
-
export * from './langs/ru';
|
|
69
|
-
export * from './langs/se';
|
|
70
|
-
export * from './langs/tr';
|
|
71
|
-
export * from './langs/uk';
|
|
72
|
-
export * from './langs/ur';
|
|
73
|
-
export * from './langs/zh_cn';
|
|
74
|
-
export * from './modules/ApiManager';
|
|
75
|
-
export * from './modules/Browser';
|
|
76
|
-
export * from './modules/ColorPicker';
|
|
77
|
-
export * from './modules/Controller';
|
|
78
|
-
export * from './modules/Figure';
|
|
79
|
-
export * from './modules/FileManager';
|
|
80
|
-
export * from './modules/HueSlider';
|
|
81
|
-
export * from './modules/Modal';
|
|
82
|
-
export * from './modules/ModalAnchorEditor';
|
|
83
|
-
export * from './modules/SelectMenu';
|
|
84
|
-
export * from './modules/_DragHandle';
|
|
85
|
-
export * from './modules/index';
|
|
86
|
-
export * from './plugins/index';
|
|
87
|
-
export * from './plugins/browser/audioGallery';
|
|
88
|
-
export * from './plugins/browser/fileBrowser';
|
|
89
|
-
export * from './plugins/browser/fileGallery';
|
|
90
|
-
export * from './plugins/browser/imageGallery';
|
|
91
|
-
export * from './plugins/browser/videoGallery';
|
|
92
|
-
export * from './plugins/command/blockquote';
|
|
93
|
-
export * from './plugins/command/exportPDF';
|
|
94
|
-
export * from './plugins/command/fileUpload';
|
|
95
|
-
export * from './plugins/command/list_bulleted';
|
|
96
|
-
export * from './plugins/command/list_numbered';
|
|
97
|
-
export * from './plugins/dropdown/align';
|
|
98
|
-
export * from './plugins/dropdown/backgroundColor';
|
|
99
|
-
export * from './plugins/dropdown/font';
|
|
100
|
-
export * from './plugins/dropdown/fontColor';
|
|
101
|
-
export * from './plugins/dropdown/formatBlock';
|
|
102
|
-
export * from './plugins/dropdown/hr';
|
|
103
|
-
export * from './plugins/dropdown/layout';
|
|
104
|
-
export * from './plugins/dropdown/lineHeight';
|
|
105
|
-
export * from './plugins/dropdown/list';
|
|
106
|
-
export * from './plugins/dropdown/paragraphStyle';
|
|
107
|
-
export * from './plugins/dropdown/table';
|
|
108
|
-
export * from './plugins/dropdown/template';
|
|
109
|
-
export * from './plugins/dropdown/textStyle';
|
|
110
|
-
export * from './plugins/field/mention';
|
|
111
|
-
export * from './plugins/input/fontSize';
|
|
112
|
-
export * from './plugins/input/pageNavigator';
|
|
113
|
-
export * from './plugins/modal/audio';
|
|
114
|
-
export * from './plugins/modal/drawing';
|
|
115
|
-
export * from './plugins/modal/embed';
|
|
116
|
-
export * from './plugins/modal/image';
|
|
117
|
-
export * from './plugins/modal/link';
|
|
118
|
-
export * from './plugins/modal/math';
|
|
119
|
-
export * from './plugins/modal/video';
|
|
120
|
-
export * from './plugins/popup/anchor';
|
|
5
|
+
// Re-export default exports as named exports
|
|
6
|
+
export { default as helper } from './helper';
|
|
7
|
+
export { default as langs } from './langs';
|
|
8
|
+
export { default as plugins } from './plugins';
|
|
9
|
+
|
|
10
|
+
// Re-export modules (no default export in these)
|
|
11
|
+
import * as interfaces from './interfaces';
|
|
12
|
+
import * as moduleContract from './modules/contract';
|
|
13
|
+
import * as moduleManager from './modules/manager';
|
|
14
|
+
import * as moduleUI from './modules/ui';
|
|
15
|
+
export { interfaces };
|
|
16
|
+
export namespace modules {
|
|
17
|
+
export { moduleContract as contract };
|
|
18
|
+
export { moduleManager as manager };
|
|
19
|
+
export { moduleUI as ui };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Main default export
|
|
23
|
+
export { default } from './suneditor';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type {} from '../typedef';
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Contract interfaces for SunEditor plugins.
|
|
4
|
+
* These interfaces define callback methods that modules and editor core call on plugin instances.
|
|
5
|
+
* Use `@implements` to get type hints for these hooks in your plugin.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Modal plugin hook methods interface.
|
|
9
|
+
* `modalAction` is required, other methods are optional.
|
|
10
|
+
* @interface
|
|
11
|
+
*/
|
|
12
|
+
export interface ModuleModal {
|
|
13
|
+
/**
|
|
14
|
+
* @abstract
|
|
15
|
+
* This function is called when a form within a modal window is `submit`.
|
|
16
|
+
* @returns {Promise<boolean>}
|
|
17
|
+
* - `true`: modal and loading are closed
|
|
18
|
+
* - `false`: only loading is closed
|
|
19
|
+
* - `undefined`: only modal is closed
|
|
20
|
+
*/
|
|
21
|
+
modalAction(): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* @optional
|
|
24
|
+
* Executes the method that is called when a plugin's modal is opened.
|
|
25
|
+
* @param {boolean} isUpdate - Indicates whether the modal is for editing an existing component (`true`) or registering a new one (`false`).
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
28
|
+
modalOn?(isUpdate: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* @optional
|
|
31
|
+
* This function is called before the modal window is opened, but before it is closed.
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
modalInit?(): void;
|
|
35
|
+
/**
|
|
36
|
+
* @optional
|
|
37
|
+
* Modal off callback.
|
|
38
|
+
* @param {boolean} isUpdate - Indicates whether the modal is for editing an existing component (`true`) or registering a new one (`false`).
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*/
|
|
41
|
+
modalOff?(isUpdate: boolean): void;
|
|
42
|
+
/**
|
|
43
|
+
* @optional
|
|
44
|
+
* Modal resize callback (optional).
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
modalResize?(): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Controller plugin hook methods interface.
|
|
51
|
+
* `controllerAction` is required, other methods are optional.
|
|
52
|
+
* @interface
|
|
53
|
+
*/
|
|
54
|
+
export interface ModuleController {
|
|
55
|
+
/**
|
|
56
|
+
* @abstract
|
|
57
|
+
* Executes the method that is called when a button is clicked in the `controller`.
|
|
58
|
+
* @param {HTMLButtonElement} target Action button element
|
|
59
|
+
* @returns {void}
|
|
60
|
+
*/
|
|
61
|
+
controllerAction(target: HTMLButtonElement): void;
|
|
62
|
+
/**
|
|
63
|
+
* @optional
|
|
64
|
+
* This function is called after the `controller` is opened.
|
|
65
|
+
* @param {HTMLFormElement} form Controller form element
|
|
66
|
+
* @param {Node|Range} target Controller target element
|
|
67
|
+
* @returns {void}
|
|
68
|
+
*/
|
|
69
|
+
controllerOn?(form: HTMLFormElement, target: Node | Range): void;
|
|
70
|
+
/**
|
|
71
|
+
* @optional
|
|
72
|
+
* This function is called before the `controller` is closed.
|
|
73
|
+
* @returns {void}
|
|
74
|
+
*/
|
|
75
|
+
controllerClose?(): void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Browser plugin hook methods interface.
|
|
79
|
+
* All methods are optional - implement only what you need.
|
|
80
|
+
* @interface
|
|
81
|
+
*/
|
|
82
|
+
export interface ModuleBrowser {
|
|
83
|
+
/**
|
|
84
|
+
* @optional
|
|
85
|
+
* Executes the method that is called when a `Browser` module's is opened.
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
88
|
+
browserInit?(): void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* ColorPicker plugin hook methods interface.
|
|
92
|
+
* All methods are optional - implement only what you need.
|
|
93
|
+
* @interface
|
|
94
|
+
*/
|
|
95
|
+
export interface ModuleColorPicker {
|
|
96
|
+
/**
|
|
97
|
+
* @optional
|
|
98
|
+
* Executes the method called when a button of `ColorPicker` module is clicked.
|
|
99
|
+
* - This plugin is by applying the `ColorPicker` module globally to the `dropdown` menu, the default `action` method is not called.
|
|
100
|
+
* @param {SunEditor.Module.HueSlider.Color} color - Selected color information
|
|
101
|
+
* @returns {void}
|
|
102
|
+
*/
|
|
103
|
+
colorPickerAction?(color: SunEditor.Module.HueSlider.Color): void;
|
|
104
|
+
/**
|
|
105
|
+
* @optional
|
|
106
|
+
* Executes the method called when the `HueSlider` module is opened.
|
|
107
|
+
* @returns {void}
|
|
108
|
+
*/
|
|
109
|
+
colorPickerHueSliderOpen?(): void;
|
|
110
|
+
/**
|
|
111
|
+
* @optional
|
|
112
|
+
* Executes the method called when the `HueSlider` module is closed.
|
|
113
|
+
* @returns {void}
|
|
114
|
+
*/
|
|
115
|
+
colorPickerHueSliderClose?(): void;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* HueSlider plugin hook methods interface.
|
|
119
|
+
* All methods are optional - implement only what you need.
|
|
120
|
+
* @interface
|
|
121
|
+
*/
|
|
122
|
+
export interface ModuleHueSlider {
|
|
123
|
+
/**
|
|
124
|
+
* @abstract
|
|
125
|
+
* This method is called when the color is selected in the hue slider.
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
128
|
+
hueSliderAction(): void;
|
|
129
|
+
/**
|
|
130
|
+
* @optional
|
|
131
|
+
* This method is called when the hue slider is closed.
|
|
132
|
+
* @returns {void}
|
|
133
|
+
*/
|
|
134
|
+
hueSliderCancelAction?(): void;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Component plugin hook methods interface.
|
|
138
|
+
* `componentSelect` is required, other methods are optional.
|
|
139
|
+
*
|
|
140
|
+
* **`inst._element` Requirement:**
|
|
141
|
+
* Plugins with `static component` method must define a public `_element` property
|
|
142
|
+
* that references the currently controlled DOM element.
|
|
143
|
+
* - Used to detect clicks on the target element and prevent accidental `controller` closure.
|
|
144
|
+
*
|
|
145
|
+
* @interface
|
|
146
|
+
*/
|
|
147
|
+
export interface EditorComponent {
|
|
148
|
+
/**
|
|
149
|
+
* @abstract
|
|
150
|
+
* Executes the method that is called when a component of a plugin is selected.
|
|
151
|
+
* @param {HTMLElement} target - Target component element
|
|
152
|
+
* @returns {void|boolean} - If return `true`, Special components that are not wrapping as `figure`
|
|
153
|
+
*/
|
|
154
|
+
componentSelect(target: HTMLElement): void | boolean;
|
|
155
|
+
/**
|
|
156
|
+
* @optional
|
|
157
|
+
* Called when a container is deselected.
|
|
158
|
+
* @param {HTMLElement} target - Target element
|
|
159
|
+
* @returns {void}
|
|
160
|
+
*/
|
|
161
|
+
componentDeselect?(target: HTMLElement): void;
|
|
162
|
+
/**
|
|
163
|
+
* @optional
|
|
164
|
+
* Executes the method that is called when a component is being edited.
|
|
165
|
+
* @param {HTMLElement} target - Target element
|
|
166
|
+
* @returns {void}
|
|
167
|
+
*/
|
|
168
|
+
componentEdit?(target: HTMLElement): void;
|
|
169
|
+
/**
|
|
170
|
+
* @optional
|
|
171
|
+
* Method to delete a component of a plugin, called by the `FileManager`, `Controller` module.
|
|
172
|
+
* @param {HTMLElement} target - Target element
|
|
173
|
+
* @returns {Promise<void>}
|
|
174
|
+
*/
|
|
175
|
+
componentDestroy?(target: HTMLElement): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* @optional
|
|
178
|
+
* Executes the method that is called when a component copy is requested.
|
|
179
|
+
* @param {SunEditor.HookParams.CopyComponent} params - Copy component event information
|
|
180
|
+
* @returns {boolean|void} - If return `false`, the copy will be canceled
|
|
181
|
+
*/
|
|
182
|
+
componentCopy?(params: SunEditor.HookParams.CopyComponent): boolean | void;
|
|
183
|
+
}
|