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,219 @@
|
|
|
1
|
+
import type {} from '../../typedef';
|
|
2
|
+
export default CoreKernel;
|
|
3
|
+
export type ProductType = import('../section/constructor').ConstructorReturnType;
|
|
4
|
+
export type Deps = {
|
|
5
|
+
/**
|
|
6
|
+
* - Editor facade (public API)
|
|
7
|
+
*/
|
|
8
|
+
facade: SunEditor.Instance;
|
|
9
|
+
/**
|
|
10
|
+
* - L1: Central state store
|
|
11
|
+
*/
|
|
12
|
+
store: SunEditor.Store;
|
|
13
|
+
/**
|
|
14
|
+
* - L2: Context provider
|
|
15
|
+
*/
|
|
16
|
+
contextProvider: import('../config/contextProvider').default;
|
|
17
|
+
/**
|
|
18
|
+
* - L2: Option provider
|
|
19
|
+
*/
|
|
20
|
+
optionProvider: import('../config/optionProvider').default;
|
|
21
|
+
/**
|
|
22
|
+
* - L2: Instance type checker
|
|
23
|
+
*/
|
|
24
|
+
instanceCheck: import('../config/instanceCheck').default;
|
|
25
|
+
/**
|
|
26
|
+
* - L2: Event manager (public API)
|
|
27
|
+
*/
|
|
28
|
+
eventManager: import('../config/eventManager').default;
|
|
29
|
+
/**
|
|
30
|
+
* - Frame root elements map
|
|
31
|
+
*/
|
|
32
|
+
frameRoots: Map<string, SunEditor.FrameContext>;
|
|
33
|
+
/**
|
|
34
|
+
* - Editor context
|
|
35
|
+
*/
|
|
36
|
+
context: SunEditor.Context;
|
|
37
|
+
/**
|
|
38
|
+
* - Editor options
|
|
39
|
+
*/
|
|
40
|
+
options: SunEditor.Options;
|
|
41
|
+
/**
|
|
42
|
+
* - Icon set
|
|
43
|
+
*/
|
|
44
|
+
icons: any;
|
|
45
|
+
/**
|
|
46
|
+
* - Language strings
|
|
47
|
+
*/
|
|
48
|
+
lang: any;
|
|
49
|
+
/**
|
|
50
|
+
* - Current frame context
|
|
51
|
+
*/
|
|
52
|
+
frameContext: SunEditor.FrameContext;
|
|
53
|
+
/**
|
|
54
|
+
* - Current frame options
|
|
55
|
+
*/
|
|
56
|
+
frameOptions: SunEditor.FrameOptions;
|
|
57
|
+
/**
|
|
58
|
+
* - L3: Offset calculator
|
|
59
|
+
*/
|
|
60
|
+
offset: import('../logic/dom/offset').default;
|
|
61
|
+
/**
|
|
62
|
+
* - L3: Selection handler
|
|
63
|
+
*/
|
|
64
|
+
selection: import('../logic/dom/selection').default;
|
|
65
|
+
/**
|
|
66
|
+
* - L3: Block formatting
|
|
67
|
+
*/
|
|
68
|
+
format: import('../logic/dom/format').default;
|
|
69
|
+
/**
|
|
70
|
+
* - L3: Inline styling
|
|
71
|
+
*/
|
|
72
|
+
inline: import('../logic/dom/inline').default;
|
|
73
|
+
/**
|
|
74
|
+
* - L3: List operations
|
|
75
|
+
*/
|
|
76
|
+
listFormat: import('../logic/dom/listFormat').default;
|
|
77
|
+
/**
|
|
78
|
+
* - L3: HTML processing
|
|
79
|
+
*/
|
|
80
|
+
html: import('../logic/dom/html').default;
|
|
81
|
+
/**
|
|
82
|
+
* - L3: Node transformation
|
|
83
|
+
*/
|
|
84
|
+
nodeTransform: import('../logic/dom/nodeTransform').default;
|
|
85
|
+
/**
|
|
86
|
+
* - L3: Character counting
|
|
87
|
+
*/
|
|
88
|
+
char: import('../logic/dom/char').default;
|
|
89
|
+
/**
|
|
90
|
+
* - L3: Component lifecycle
|
|
91
|
+
*/
|
|
92
|
+
component: import('../logic/shell/component').default;
|
|
93
|
+
/**
|
|
94
|
+
* - L3: Focus management
|
|
95
|
+
*/
|
|
96
|
+
focusManager: import('../logic/shell/focusManager').default;
|
|
97
|
+
/**
|
|
98
|
+
* - L3: Plugin registry
|
|
99
|
+
*/
|
|
100
|
+
pluginManager: import('../logic/shell/pluginManager').default;
|
|
101
|
+
/**
|
|
102
|
+
* - Plugin instances map
|
|
103
|
+
*/
|
|
104
|
+
plugins: {
|
|
105
|
+
[x: string]: any;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* - L3: UI state management
|
|
109
|
+
*/
|
|
110
|
+
ui: import('../logic/shell/ui').default;
|
|
111
|
+
/**
|
|
112
|
+
* - L3: Command routing
|
|
113
|
+
*/
|
|
114
|
+
commandDispatcher: import('../logic/shell/commandDispatcher').default;
|
|
115
|
+
/**
|
|
116
|
+
* - L3: Undo/Redo stack
|
|
117
|
+
*/
|
|
118
|
+
history: ReturnType<typeof History>;
|
|
119
|
+
/**
|
|
120
|
+
* - L3: Shortcut mapping
|
|
121
|
+
*/
|
|
122
|
+
shortcuts: import('../logic/shell/shortcuts').default;
|
|
123
|
+
/**
|
|
124
|
+
* - L3: Toolbar renderer
|
|
125
|
+
*/
|
|
126
|
+
toolbar: import('../logic/panel/toolbar').default;
|
|
127
|
+
/**
|
|
128
|
+
* - L3: Sub-toolbar renderer
|
|
129
|
+
*/
|
|
130
|
+
subToolbar: import('../logic/panel/toolbar').default;
|
|
131
|
+
/**
|
|
132
|
+
* - L3: Menu renderer
|
|
133
|
+
*/
|
|
134
|
+
menu: import('../logic/panel/menu').default;
|
|
135
|
+
/**
|
|
136
|
+
* - L3: View mode handler
|
|
137
|
+
*/
|
|
138
|
+
viewer: import('../logic/panel/viewer').default;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* @typedef {import('../section/constructor').ConstructorReturnType} ProductType
|
|
142
|
+
*/
|
|
143
|
+
/**
|
|
144
|
+
* @typedef {Object} Deps
|
|
145
|
+
* @property {SunEditor.Instance} facade - Editor facade (public API)
|
|
146
|
+
* @property {SunEditor.Store} store - L1: Central state store
|
|
147
|
+
*
|
|
148
|
+
* @property {import('../config/contextProvider').default} contextProvider - L2: Context provider
|
|
149
|
+
* @property {import('../config/optionProvider').default} optionProvider - L2: Option provider
|
|
150
|
+
* @property {import('../config/instanceCheck').default} instanceCheck - L2: Instance type checker
|
|
151
|
+
* @property {import('../config/eventManager').default} eventManager - L2: Event manager (public API)
|
|
152
|
+
*
|
|
153
|
+
* @property {Map<string, SunEditor.FrameContext>} frameRoots - Frame root elements map
|
|
154
|
+
* @property {SunEditor.Context} context - Editor context
|
|
155
|
+
* @property {SunEditor.Options} options - Editor options
|
|
156
|
+
* @property {Object} icons - Icon set
|
|
157
|
+
* @property {Object} lang - Language strings
|
|
158
|
+
* @property {SunEditor.FrameContext} frameContext - Current frame context
|
|
159
|
+
* @property {SunEditor.FrameOptions} frameOptions - Current frame options
|
|
160
|
+
*
|
|
161
|
+
* @property {import('../logic/dom/offset').default} offset - L3: Offset calculator
|
|
162
|
+
* @property {import('../logic/dom/selection').default} selection - L3: Selection handler
|
|
163
|
+
* @property {import('../logic/dom/format').default} format - L3: Block formatting
|
|
164
|
+
* @property {import('../logic/dom/inline').default} inline - L3: Inline styling
|
|
165
|
+
* @property {import('../logic/dom/listFormat').default} listFormat - L3: List operations
|
|
166
|
+
* @property {import('../logic/dom/html').default} html - L3: HTML processing
|
|
167
|
+
* @property {import('../logic/dom/nodeTransform').default} nodeTransform - L3: Node transformation
|
|
168
|
+
* @property {import('../logic/dom/char').default} char - L3: Character counting
|
|
169
|
+
*
|
|
170
|
+
* @property {import('../logic/shell/component').default} component - L3: Component lifecycle
|
|
171
|
+
* @property {import('../logic/shell/focusManager').default} focusManager - L3: Focus management
|
|
172
|
+
* @property {import('../logic/shell/pluginManager').default} pluginManager - L3: Plugin registry
|
|
173
|
+
* @property {Object<string, Object>} plugins - Plugin instances map
|
|
174
|
+
* @property {import('../logic/shell/ui').default} ui - L3: UI state management
|
|
175
|
+
* @property {import('../logic/shell/commandDispatcher').default} commandDispatcher - L3: Command routing
|
|
176
|
+
* @property {ReturnType<import('../logic/shell/history').default>} history - L3: Undo/Redo stack
|
|
177
|
+
* @property {import('../logic/shell/shortcuts').default} shortcuts - L3: Shortcut mapping
|
|
178
|
+
*
|
|
179
|
+
* @property {import('../logic/panel/toolbar').default} toolbar - L3: Toolbar renderer
|
|
180
|
+
* @property {import('../logic/panel/toolbar').default} subToolbar - L3: Sub-toolbar renderer
|
|
181
|
+
* @property {import('../logic/panel/menu').default} menu - L3: Menu renderer
|
|
182
|
+
* @property {import('../logic/panel/viewer').default} viewer - L3: View mode handler
|
|
183
|
+
*/
|
|
184
|
+
/**
|
|
185
|
+
* @description Core dependency container for the editor.
|
|
186
|
+
* - Stores and retrieves config/logic/plugin instances.
|
|
187
|
+
* - Orchestrates dependency injection across layers.
|
|
188
|
+
* - Initialization order: L1 Store -> L2 Config (`$` Phase 1) -> L3 Logic (`$` Phase 2) -> L4 Event.
|
|
189
|
+
*/
|
|
190
|
+
declare class CoreKernel {
|
|
191
|
+
/**
|
|
192
|
+
* @param {SunEditor.Instance} facade - Editor instance (Public API)
|
|
193
|
+
* @param {Object} config - Initial configuration
|
|
194
|
+
* @param {ProductType} config.product - The initial product object.
|
|
195
|
+
* @param {SunEditor.InitOptions} config.options - The initial options.
|
|
196
|
+
*/
|
|
197
|
+
constructor(
|
|
198
|
+
facade: SunEditor.Instance,
|
|
199
|
+
config: {
|
|
200
|
+
product: ProductType;
|
|
201
|
+
options: SunEditor.InitOptions;
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
/** @type {Deps} */
|
|
205
|
+
$: Deps;
|
|
206
|
+
store: Store;
|
|
207
|
+
_eventOrchestrator: EventOrchestrator;
|
|
208
|
+
/**
|
|
209
|
+
* @description Destroy the kernel and release all resources.
|
|
210
|
+
* Teardown order (reverse of init): plugins -> logic -> event -> config -> store
|
|
211
|
+
* Uses error aggregation to ensure all modules are cleaned up even if some fail.
|
|
212
|
+
*/
|
|
213
|
+
_destroy(): void;
|
|
214
|
+
facade: any;
|
|
215
|
+
#private;
|
|
216
|
+
}
|
|
217
|
+
import EventOrchestrator from '../event/eventOrchestrator';
|
|
218
|
+
import History from '../logic/shell/history';
|
|
219
|
+
import Store from './store';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type {} from '../../typedef';
|
|
2
|
+
export default KernelInjector;
|
|
3
|
+
/**
|
|
4
|
+
* @description Base class for kernel consumers (plugins, modules).
|
|
5
|
+
* - Provides cached access to kernel dependencies via `$` object.
|
|
6
|
+
* - Dependencies are built once in `CoreKernel` and shared across all consumers.
|
|
7
|
+
* - Eliminates circular references by routing through the kernel.
|
|
8
|
+
*/
|
|
9
|
+
declare class KernelInjector {
|
|
10
|
+
/**
|
|
11
|
+
* @param {SunEditor.Kernel} kernel
|
|
12
|
+
*/
|
|
13
|
+
constructor(kernel: SunEditor.Kernel);
|
|
14
|
+
/** @type {SunEditor.Deps} */
|
|
15
|
+
$: SunEditor.Deps;
|
|
16
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type {} from '../../typedef';
|
|
2
|
+
export default Store;
|
|
3
|
+
export type StoreState = {
|
|
4
|
+
/**
|
|
5
|
+
* - Current root frame key.
|
|
6
|
+
*/
|
|
7
|
+
rootKey: any;
|
|
8
|
+
/**
|
|
9
|
+
* - Whether the editor has focus.
|
|
10
|
+
*/
|
|
11
|
+
hasFocus: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* - Tab character space count.
|
|
14
|
+
*/
|
|
15
|
+
tabSize: number;
|
|
16
|
+
/**
|
|
17
|
+
* - `block` indent margin size (px).
|
|
18
|
+
*/
|
|
19
|
+
indentSize: number;
|
|
20
|
+
/**
|
|
21
|
+
* - Code view indent space count.
|
|
22
|
+
*/
|
|
23
|
+
codeIndentSize: number;
|
|
24
|
+
/**
|
|
25
|
+
* - Selection path tag names (for navigation bar).
|
|
26
|
+
*/
|
|
27
|
+
currentNodes: Array<string>;
|
|
28
|
+
/**
|
|
29
|
+
* - Active command/style names from selection path.
|
|
30
|
+
*/
|
|
31
|
+
currentNodesMap: Array<string>;
|
|
32
|
+
/**
|
|
33
|
+
* - Viewport height at initialization.
|
|
34
|
+
*/
|
|
35
|
+
initViewportHeight: number;
|
|
36
|
+
/**
|
|
37
|
+
* - Current visual viewport height.
|
|
38
|
+
*/
|
|
39
|
+
currentViewportHeight: number;
|
|
40
|
+
/**
|
|
41
|
+
* - Whether a controller or component is currently active, used to manage `blur`/`focus` behavior.
|
|
42
|
+
*/
|
|
43
|
+
controlActive: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* - Whether the frame content is scrollable (derived from `height`/`maxHeight` options).
|
|
46
|
+
*/
|
|
47
|
+
isScrollable: (fc: SunEditor.FrameContext) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* - Last selection node processed by `selectionState.update()` (cache for dedup).
|
|
50
|
+
*/
|
|
51
|
+
_lastSelectionNode: Node | null;
|
|
52
|
+
/**
|
|
53
|
+
* - Cached selection range.
|
|
54
|
+
*/
|
|
55
|
+
_range: Range | null;
|
|
56
|
+
/**
|
|
57
|
+
* - Whether `mousedown` is pressed.
|
|
58
|
+
*/
|
|
59
|
+
_mousedown: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* - Suppress `blur` event handling.
|
|
62
|
+
*/
|
|
63
|
+
_preventBlur: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* - Suppress `focus` event handling.
|
|
66
|
+
*/
|
|
67
|
+
_preventFocus: boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* - Toolbar display mode flags (immutable after init).
|
|
71
|
+
*/
|
|
72
|
+
export type StoreMode = {
|
|
73
|
+
/**
|
|
74
|
+
* - Whether the toolbar is in classic (top-fixed) mode.
|
|
75
|
+
*/
|
|
76
|
+
isClassic: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* - Whether the toolbar is in `inline` mode (appears above the editor on focus).
|
|
79
|
+
*/
|
|
80
|
+
isInline: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* - Whether the toolbar is in `balloon` mode (appears on text selection).
|
|
83
|
+
*/
|
|
84
|
+
isBalloon: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* - Whether the toolbar is in `balloon-always` mode (always visible as floating).
|
|
87
|
+
*/
|
|
88
|
+
isBalloonAlways: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* - Whether the sub-toolbar is in `balloon` mode.
|
|
91
|
+
*/
|
|
92
|
+
isSubBalloon: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* - Whether the sub-toolbar is in `balloon-always` mode.
|
|
95
|
+
*/
|
|
96
|
+
isSubBalloonAlways: boolean;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* @typedef {Object} StoreState
|
|
100
|
+
* @property {*} rootKey - Current root frame key.
|
|
101
|
+
* @property {boolean} hasFocus - Whether the editor has focus.
|
|
102
|
+
* @property {number} tabSize - Tab character space count.
|
|
103
|
+
* @property {number} indentSize - `block` indent margin size (px).
|
|
104
|
+
* @property {number} codeIndentSize - Code view indent space count.
|
|
105
|
+
* @property {Array<string>} currentNodes - Selection path tag names (for navigation bar).
|
|
106
|
+
* @property {Array<string>} currentNodesMap - Active command/style names from selection path.
|
|
107
|
+
* @property {number} initViewportHeight - Viewport height at initialization.
|
|
108
|
+
* @property {number} currentViewportHeight - Current visual viewport height.
|
|
109
|
+
* @property {boolean} controlActive - Whether a controller or component is currently active, used to manage `blur`/`focus` behavior.
|
|
110
|
+
* @property {(fc: SunEditor.FrameContext) => boolean} isScrollable - Whether the frame content is scrollable (derived from `height`/`maxHeight` options).
|
|
111
|
+
* @property {?Node} _lastSelectionNode - Last selection node processed by `selectionState.update()` (cache for dedup).
|
|
112
|
+
* @property {?Range} _range - Cached selection range.
|
|
113
|
+
* @property {boolean} _mousedown - Whether `mousedown` is pressed.
|
|
114
|
+
* @property {boolean} _preventBlur - Suppress `blur` event handling.
|
|
115
|
+
* @property {boolean} _preventFocus - Suppress `focus` event handling.
|
|
116
|
+
*/
|
|
117
|
+
/**
|
|
118
|
+
* @typedef {Object} StoreMode - Toolbar display mode flags (immutable after init).
|
|
119
|
+
* @property {boolean} isClassic - Whether the toolbar is in classic (top-fixed) mode.
|
|
120
|
+
* @property {boolean} isInline - Whether the toolbar is in `inline` mode (appears above the editor on focus).
|
|
121
|
+
* @property {boolean} isBalloon - Whether the toolbar is in `balloon` mode (appears on text selection).
|
|
122
|
+
* @property {boolean} isBalloonAlways - Whether the toolbar is in `balloon-always` mode (always visible as floating).
|
|
123
|
+
* @property {boolean} isSubBalloon - Whether the sub-toolbar is in `balloon` mode.
|
|
124
|
+
* @property {boolean} isSubBalloonAlways - Whether the sub-toolbar is in `balloon-always` mode.
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* @description Central runtime state management for the editor.
|
|
128
|
+
* - Does not store DOM references (kept in `frameContext`).
|
|
129
|
+
* - Does not store configuration values (kept in `options`).
|
|
130
|
+
* - Only manages runtime state.
|
|
131
|
+
*/
|
|
132
|
+
declare class Store {
|
|
133
|
+
/**
|
|
134
|
+
* @param {import('../section/constructor').ConstructorReturnType} product - Constructor product
|
|
135
|
+
*/
|
|
136
|
+
constructor(product: import('../section/constructor').ConstructorReturnType);
|
|
137
|
+
/**
|
|
138
|
+
* @internal
|
|
139
|
+
* @description If `true`, initialize all indexes of image, video information
|
|
140
|
+
* @type {boolean}
|
|
141
|
+
*/
|
|
142
|
+
_editorInitFinished: boolean;
|
|
143
|
+
/** @type {StoreMode} */
|
|
144
|
+
mode: StoreMode;
|
|
145
|
+
/**
|
|
146
|
+
* @description Get state value (supports underscore notation)
|
|
147
|
+
* @template {keyof StoreState} K
|
|
148
|
+
* @param {K} key
|
|
149
|
+
* @returns {StoreState[K]}
|
|
150
|
+
*/
|
|
151
|
+
get<K extends keyof StoreState>(key: K): StoreState[K];
|
|
152
|
+
/**
|
|
153
|
+
* @description Set state value and notify subscribers
|
|
154
|
+
* @template {keyof StoreState} K
|
|
155
|
+
* @param {K} key
|
|
156
|
+
* @param {StoreState[K]} value - Value to set
|
|
157
|
+
*/
|
|
158
|
+
set<K extends keyof StoreState>(key: K, value: StoreState[K]): void;
|
|
159
|
+
/**
|
|
160
|
+
* @description Subscribe to state changes
|
|
161
|
+
* @template {keyof StoreState} K
|
|
162
|
+
* @param {K} path - Path to subscribe
|
|
163
|
+
* @param {(newValue: StoreState[K], oldValue: StoreState[K]) => void} callback
|
|
164
|
+
* @returns {() => void} Unsubscribe function
|
|
165
|
+
*/
|
|
166
|
+
subscribe<K extends keyof StoreState>(path: K, callback: (newValue: StoreState[K], oldValue: StoreState[K]) => void): () => void;
|
|
167
|
+
_reset(): void;
|
|
168
|
+
_destroy(): void;
|
|
169
|
+
#private;
|
|
170
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {} from '../../../typedef';
|
|
2
|
+
export default Char;
|
|
3
|
+
/**
|
|
4
|
+
* @description character count, character limit, etc. management class
|
|
5
|
+
*/
|
|
6
|
+
declare class Char {
|
|
7
|
+
/**
|
|
8
|
+
* @constructor
|
|
9
|
+
* @param {SunEditor.Kernel} kernel
|
|
10
|
+
*/
|
|
11
|
+
constructor(kernel: SunEditor.Kernel);
|
|
12
|
+
/**
|
|
13
|
+
* @description Returns false if char count is greater than "frameOptions.get('charCounter_max')" when "html" is added to the current editor.
|
|
14
|
+
* @param {Node|string} html Element node or String.
|
|
15
|
+
* @returns {boolean}
|
|
16
|
+
*/
|
|
17
|
+
check(html: Node | string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @description Get the [content]'s number of characters or binary data size. (frameOptions.get('charCounter_type'))
|
|
20
|
+
* - If [content] is undefined, get the current editor's number of characters or binary data size.
|
|
21
|
+
* @param {string} [content] Content to count. (defalut: this.#frameContext.get('wysiwyg'))
|
|
22
|
+
* @returns {number}
|
|
23
|
+
*/
|
|
24
|
+
getLength(content?: string): number;
|
|
25
|
+
/**
|
|
26
|
+
* @descriptionGets Get the length in bytes of a string.
|
|
27
|
+
* @param {string} text String text
|
|
28
|
+
* @returns {number}
|
|
29
|
+
*/
|
|
30
|
+
getByteLength(text: string): number;
|
|
31
|
+
/**
|
|
32
|
+
* @description Set the char count to charCounter element textContent.
|
|
33
|
+
* @param {?SunEditor.FrameContext} [fc] Frame context
|
|
34
|
+
*/
|
|
35
|
+
display(fc?: SunEditor.FrameContext | null): void;
|
|
36
|
+
/**
|
|
37
|
+
* @description Returns false if char count is greater than "frameOptions.get('charCounter_max')" when "inputText" is added to the current editor.
|
|
38
|
+
* - If the current number of characters is greater than "charCounter_max", the excess characters are removed.
|
|
39
|
+
* And call the char.display()
|
|
40
|
+
* @param {string} inputText Text added.
|
|
41
|
+
* @param {boolean} _fromInputEvent Whether the test is triggered from an input event.
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
test(inputText: string, _fromInputEvent: boolean): boolean;
|
|
45
|
+
#private;
|
|
46
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type {} from '../../../typedef';
|
|
2
|
+
export default Format;
|
|
3
|
+
/**
|
|
4
|
+
* @description Classes related to editor formats such as `line` and `block`.
|
|
5
|
+
*/
|
|
6
|
+
declare class Format {
|
|
7
|
+
/**
|
|
8
|
+
* @constructor
|
|
9
|
+
* @param {SunEditor.Kernel} kernel
|
|
10
|
+
*/
|
|
11
|
+
constructor(kernel: SunEditor.Kernel);
|
|
12
|
+
/**
|
|
13
|
+
* @description Replace the line tag of the current selection.
|
|
14
|
+
* @param {Node} element Line element (P, DIV..)
|
|
15
|
+
* @example
|
|
16
|
+
* // Replace the format tag of selected lines with H1
|
|
17
|
+
* const h1 = document.createElement('h1');
|
|
18
|
+
* editor.format.setLine(h1);
|
|
19
|
+
*
|
|
20
|
+
* // Replace the format tag of selected lines with DIV
|
|
21
|
+
* const div = document.createElement('div');
|
|
22
|
+
* editor.format.setLine(div);
|
|
23
|
+
*/
|
|
24
|
+
setLine(element: Node): void;
|
|
25
|
+
/**
|
|
26
|
+
* @description If a parent node that contains an argument node finds a format node (`format.isLine`), it returns that node.
|
|
27
|
+
* @param {Node} node Reference node.
|
|
28
|
+
* @param {?(current: Node) => boolean} [validation] Additional validation function.
|
|
29
|
+
* @returns {HTMLElement|null}
|
|
30
|
+
*/
|
|
31
|
+
getLine(node: Node, validation?: ((current: Node) => boolean) | null): HTMLElement | null;
|
|
32
|
+
/**
|
|
33
|
+
* @description Replace the br-line tag of the current selection.
|
|
34
|
+
* @param {Node} element BR-Line element (PRE..)
|
|
35
|
+
*/
|
|
36
|
+
setBrLine(element: Node): void;
|
|
37
|
+
/**
|
|
38
|
+
* @description If a parent node that contains an argument node finds a `brLine` (`format.isBrLine`), it returns that node.
|
|
39
|
+
* @param {Node} element Reference node.
|
|
40
|
+
* @param {?(current: Node) => boolean} [validation] Additional validation function.
|
|
41
|
+
* @returns {HTMLBRElement|null}
|
|
42
|
+
*/
|
|
43
|
+
getBrLine(element: Node, validation?: ((current: Node) => boolean) | null): HTMLBRElement | null;
|
|
44
|
+
/**
|
|
45
|
+
* @description Append `line` element to sibling node of argument element.
|
|
46
|
+
* - If the `lineNode` argument value is present, the tag of that argument value is inserted,
|
|
47
|
+
* - If not, the currently selected format tag is inserted.
|
|
48
|
+
* @param {Node} element Insert as siblings of that element
|
|
49
|
+
* @param {?(string|Node)} [lineNode] Node name or node obejct to be inserted
|
|
50
|
+
* @returns {HTMLElement}
|
|
51
|
+
*/
|
|
52
|
+
addLine(element: Node, lineNode?: (string | Node) | null): HTMLElement;
|
|
53
|
+
/**
|
|
54
|
+
* @description If a parent node that contains an argument node finds a format node (`format.isBlock`), it returns that node.
|
|
55
|
+
* @param {Node} element Reference node.
|
|
56
|
+
* @param {?(current: Node) => boolean} [validation] Additional validation function.
|
|
57
|
+
* @returns {HTMLElement|null}
|
|
58
|
+
*/
|
|
59
|
+
getBlock(element: Node, validation?: ((current: Node) => boolean) | null): HTMLElement | null;
|
|
60
|
+
/**
|
|
61
|
+
* @description Appended all selected `line` element to the argument element(`block`) and insert
|
|
62
|
+
* @param {Node} blockElement Element of wrap the arguments (BLOCKQUOTE...)
|
|
63
|
+
* @example
|
|
64
|
+
* // Wrap selected lines in a blockquote
|
|
65
|
+
* const blockquote = document.createElement('blockquote');
|
|
66
|
+
* editor.format.applyBlock(blockquote);
|
|
67
|
+
*/
|
|
68
|
+
applyBlock(blockElement: Node): void;
|
|
69
|
+
/**
|
|
70
|
+
* @description The elements of the `selectedFormats` array are detached from the `blockElement` element. (`LI` tags are converted to `P` tags)
|
|
71
|
+
* - When `selectedFormats` is `null`, all elements are detached and return {cc: parentNode, sc: nextSibling, ec: previousSibling, removeArray: [Array of removed elements]}.
|
|
72
|
+
* @param {Node} blockElement `block` element (PRE, BLOCKQUOTE, OL, UL...)
|
|
73
|
+
* @param {Object} [options] Options
|
|
74
|
+
* @param {Array<Node>} [options.selectedFormats=null] Array of `line` elements (P, DIV, LI...) to remove.
|
|
75
|
+
* - If `null`, Applies to all elements and return {cc: parentNode, sc: nextSibling, ec: previousSibling}
|
|
76
|
+
* @param {Node} [options.newBlockElement=null] The node(`blockElement`) to replace the currently wrapped node.
|
|
77
|
+
* @param {boolean} [options.shouldDelete=false] If `true`, deleted without detached.
|
|
78
|
+
* @param {boolean} [options.skipHistory=false] When `true`, it does not update the history stack and the selection object and return `EdgeNodes` (dom-query-GetEdgeChildNodes)
|
|
79
|
+
* @returns {{cc: Node, sc: Node, so: number, ec: Node, eo: number, removeArray: ?Array<Node>}} Node information after deletion
|
|
80
|
+
* - cc: Common parent container node
|
|
81
|
+
* - sc: Start container node
|
|
82
|
+
* - so: Start offset
|
|
83
|
+
* - ec: End container node
|
|
84
|
+
* - eo: End offset
|
|
85
|
+
* - removeArray: Array of removed elements
|
|
86
|
+
* @example
|
|
87
|
+
* // Remove all list items from a list
|
|
88
|
+
* const listElement = editor.selection.getNode().closest('ul');
|
|
89
|
+
* editor.format.removeBlock(listElement);
|
|
90
|
+
*
|
|
91
|
+
* // Remove specific list items only
|
|
92
|
+
* const selectedItems = [liElement1, liElement2];
|
|
93
|
+
* editor.format.removeBlock(listElement, { selectedFormats: selectedItems });
|
|
94
|
+
*
|
|
95
|
+
* // Replace blockquote with div
|
|
96
|
+
* const blockquote = editor.selection.getNode().closest('blockquote');
|
|
97
|
+
* const newDiv = document.createElement('div');
|
|
98
|
+
* editor.format.removeBlock(blockquote, { newBlockElement: newDiv });
|
|
99
|
+
*/
|
|
100
|
+
removeBlock(
|
|
101
|
+
blockElement: Node,
|
|
102
|
+
{
|
|
103
|
+
selectedFormats,
|
|
104
|
+
newBlockElement,
|
|
105
|
+
shouldDelete,
|
|
106
|
+
skipHistory,
|
|
107
|
+
}?: {
|
|
108
|
+
selectedFormats?: Array<Node>;
|
|
109
|
+
newBlockElement?: Node;
|
|
110
|
+
shouldDelete?: boolean;
|
|
111
|
+
skipHistory?: boolean;
|
|
112
|
+
},
|
|
113
|
+
): {
|
|
114
|
+
cc: Node;
|
|
115
|
+
sc: Node;
|
|
116
|
+
so: number;
|
|
117
|
+
ec: Node;
|
|
118
|
+
eo: number;
|
|
119
|
+
removeArray: Array<Node> | null;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* @description Indent more the selected lines.
|
|
123
|
+
* - margin size : `store.get('indentSize')`
|
|
124
|
+
*/
|
|
125
|
+
indent(): void;
|
|
126
|
+
/**
|
|
127
|
+
* @description Indent less the selected lines.
|
|
128
|
+
* - margin size - `store.get('indentSize')`
|
|
129
|
+
*/
|
|
130
|
+
outdent(): void;
|
|
131
|
+
/**
|
|
132
|
+
* @description Check if the container and offset values are the edges of the `line`
|
|
133
|
+
* @param {Node} node The node of the selection object. (range.startContainer..)
|
|
134
|
+
* @param {number} offset The offset of the selection object. (selection.getRange().startOffset...)
|
|
135
|
+
* @param {"front"|"end"} dir Select check point - `front`: Front edge, `end`: End edge, `undefined`: Both edge.
|
|
136
|
+
* @returns {node is HTMLElement}
|
|
137
|
+
*/
|
|
138
|
+
isEdgeLine(node: Node, offset: number, dir: 'front' | 'end'): node is HTMLElement;
|
|
139
|
+
/**
|
|
140
|
+
* @description It is judged whether it is a node related to the text style.
|
|
141
|
+
* @param {Node|string} element The node to check
|
|
142
|
+
* @returns {element is HTMLElement}
|
|
143
|
+
*/
|
|
144
|
+
isTextStyleNode(element: Node | string): element is HTMLElement;
|
|
145
|
+
/**
|
|
146
|
+
* @description It is judged whether it is the `line` element.
|
|
147
|
+
* - (P, DIV, H[1-6], PRE, LI | class=`__se__format__line_xxx`)
|
|
148
|
+
* - `line` element also contain `brLine` element
|
|
149
|
+
* @param {Node|string} element The node to check
|
|
150
|
+
* @returns {element is HTMLElement}
|
|
151
|
+
*/
|
|
152
|
+
isLine(element: Node | string): element is HTMLElement;
|
|
153
|
+
/**
|
|
154
|
+
* @description It is judged whether it is the only `line` element.
|
|
155
|
+
* @param {Node|string} element The node to check
|
|
156
|
+
* @returns {element is HTMLElement}
|
|
157
|
+
*/
|
|
158
|
+
isNormalLine(element: Node | string): element is HTMLElement;
|
|
159
|
+
/**
|
|
160
|
+
* @description It is judged whether it is the `brLine` element.
|
|
161
|
+
* - (PRE | class=`__se__format__br_line_xxx`)
|
|
162
|
+
* - `brLine` elements is included in the `line` element.
|
|
163
|
+
* - `brLine` elements's line break is `BR` tag.
|
|
164
|
+
* ※ Entering the Enter key in the space on the last line ends `brLine` and appends `line`.
|
|
165
|
+
* @param {Node|string} element The node to check
|
|
166
|
+
* @returns {element is HTMLElement}
|
|
167
|
+
*/
|
|
168
|
+
isBrLine(element: Node | string): element is HTMLElement;
|
|
169
|
+
/**
|
|
170
|
+
* @description It is judged whether it is the `block` element.
|
|
171
|
+
* - (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class=`__se__format__block_xxx`)
|
|
172
|
+
* - `block` is wrap the `line` and `component`
|
|
173
|
+
* @param {Node|string} element The node to check
|
|
174
|
+
* @returns {element is HTMLElement}
|
|
175
|
+
*/
|
|
176
|
+
isBlock(element: Node | string): element is HTMLElement;
|
|
177
|
+
/**
|
|
178
|
+
* @description It is judged whether it is the `closureBlock` element.
|
|
179
|
+
* - (TH, TD | class=`__se__format__block_closure_xxx`)
|
|
180
|
+
* - `closureBlock` elements is included in the `block`.
|
|
181
|
+
* - `closureBlock` element is wrap the `line` and `component`
|
|
182
|
+
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
183
|
+
* - ※ Use it only in special cases. ([ex] format of table cells)
|
|
184
|
+
* @param {Node|string} element The node to check
|
|
185
|
+
* @returns {element is HTMLElement}
|
|
186
|
+
*/
|
|
187
|
+
isClosureBlock(element: Node | string): element is HTMLElement;
|
|
188
|
+
/**
|
|
189
|
+
* @description It is judged whether it is the `closureBrLine` element.
|
|
190
|
+
* - (class=`__se__format__br_line__closure_xxx`)
|
|
191
|
+
* - `closureBrLine` elements is included in the `brLine`.
|
|
192
|
+
* - `closureBrLine` elements's line break is `BR` tag.
|
|
193
|
+
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
194
|
+
* - ※ Use it only in special cases. ([ex] format of table cells)
|
|
195
|
+
* @param {Node|string} element The node to check
|
|
196
|
+
* @returns {element is HTMLElement}
|
|
197
|
+
*/
|
|
198
|
+
isClosureBrLine(element: Node | string): element is HTMLElement;
|
|
199
|
+
/**
|
|
200
|
+
* @description Returns a `line` array from selected range.
|
|
201
|
+
* @param {?(current: Node) => boolean} [validation] The validation function. (Replaces the default validation `format.isLine(current)`)
|
|
202
|
+
* @returns {Array<HTMLElement>}
|
|
203
|
+
*/
|
|
204
|
+
getLines(validation?: ((current: Node) => boolean) | null): Array<HTMLElement>;
|
|
205
|
+
/**
|
|
206
|
+
* @description Get lines and components from the selected range. (P, DIV, H[1-6], OL, UL, TABLE..)
|
|
207
|
+
* - If some of the component are included in the selection, get the entire that component.
|
|
208
|
+
* @param {boolean} removeDuplicate If `true`, if there is a parent and child tag among the selected elements, the child tag is excluded.
|
|
209
|
+
* @returns {Array<HTMLElement>}
|
|
210
|
+
*/
|
|
211
|
+
getLinesAndComponents(removeDuplicate: boolean): Array<HTMLElement>;
|
|
212
|
+
/**
|
|
213
|
+
* @internal
|
|
214
|
+
* @description Nodes without text
|
|
215
|
+
* @param {Node|string} element Element to check
|
|
216
|
+
* @returns {boolean}
|
|
217
|
+
*/
|
|
218
|
+
_isNotTextNode(element: Node | string): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* @internal
|
|
221
|
+
* @description A function that distinguishes areas where `selection` should not be placed
|
|
222
|
+
* @param {Node} element Element
|
|
223
|
+
* @returns {boolean}
|
|
224
|
+
*/
|
|
225
|
+
_isExcludeSelectionElement(element: Node): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* @internal
|
|
228
|
+
* @description Reset the line break format.
|
|
229
|
+
* @param {"line"|"br"} breakFormat `options.get('defaultLineBreakFormat')`
|
|
230
|
+
* @returns {boolean}
|
|
231
|
+
*/
|
|
232
|
+
__resetBrLineBreak(breakFormat: 'line' | 'br'): boolean;
|
|
233
|
+
#private;
|
|
234
|
+
}
|