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,529 @@
|
|
|
1
|
+
import type {} from '../../typedef';
|
|
2
|
+
export default Figure;
|
|
3
|
+
/**
|
|
4
|
+
* Figure information object
|
|
5
|
+
*/
|
|
6
|
+
export type FigureInfo = {
|
|
7
|
+
/**
|
|
8
|
+
* - Target element (`img`, `iframe`, `video`, `audio`, `table`, etc.)
|
|
9
|
+
*/
|
|
10
|
+
target: HTMLElement;
|
|
11
|
+
/**
|
|
12
|
+
* - Container element (`div.se-component`|`span.se-component.se-inline-component`)
|
|
13
|
+
*/
|
|
14
|
+
container: HTMLElement;
|
|
15
|
+
/**
|
|
16
|
+
* - Cover element (`FIGURE`|`null`)
|
|
17
|
+
*/
|
|
18
|
+
cover: HTMLElement | null;
|
|
19
|
+
/**
|
|
20
|
+
* - Inline cover element (`span.se-inline-component`)
|
|
21
|
+
*/
|
|
22
|
+
inlineCover: HTMLElement | null;
|
|
23
|
+
/**
|
|
24
|
+
* - Caption element (`FIGCAPTION`)
|
|
25
|
+
*/
|
|
26
|
+
caption: HTMLElement | null;
|
|
27
|
+
/**
|
|
28
|
+
* - Whether to rotate vertically
|
|
29
|
+
*/
|
|
30
|
+
isVertical: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Figure target information object (for resize/align operations)
|
|
34
|
+
*/
|
|
35
|
+
export type FigureTargetInfo = {
|
|
36
|
+
/**
|
|
37
|
+
* - Container element (`div.se-component`|`span.se-component.se-inline-component`)
|
|
38
|
+
*/
|
|
39
|
+
container: HTMLElement;
|
|
40
|
+
/**
|
|
41
|
+
* - Cover element (`FIGURE`|`null`)
|
|
42
|
+
*/
|
|
43
|
+
cover?: HTMLElement | null;
|
|
44
|
+
/**
|
|
45
|
+
* - Caption element (`FIGCAPTION`)
|
|
46
|
+
*/
|
|
47
|
+
caption?: HTMLElement | null;
|
|
48
|
+
/**
|
|
49
|
+
* - Alignment of the element.
|
|
50
|
+
*/
|
|
51
|
+
align?: string;
|
|
52
|
+
/**
|
|
53
|
+
* - The aspect ratio of the element.
|
|
54
|
+
*/
|
|
55
|
+
ratio?: {
|
|
56
|
+
w: number;
|
|
57
|
+
h: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* - Whether to rotate vertically
|
|
61
|
+
*/
|
|
62
|
+
isVertical: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* - Width of the element.
|
|
65
|
+
*/
|
|
66
|
+
w?: string | number;
|
|
67
|
+
/**
|
|
68
|
+
* - Height of the element.
|
|
69
|
+
*/
|
|
70
|
+
h?: string | number;
|
|
71
|
+
/**
|
|
72
|
+
* - Top position.
|
|
73
|
+
*/
|
|
74
|
+
t?: number;
|
|
75
|
+
/**
|
|
76
|
+
* - Left position.
|
|
77
|
+
*/
|
|
78
|
+
l?: number;
|
|
79
|
+
/**
|
|
80
|
+
* - Width, can be a number or `auto`.
|
|
81
|
+
*/
|
|
82
|
+
width: string | number;
|
|
83
|
+
/**
|
|
84
|
+
* - Height, can be a number or `auto`.
|
|
85
|
+
*/
|
|
86
|
+
height: string | number;
|
|
87
|
+
/**
|
|
88
|
+
* - Original width from `naturalWidth` or `offsetWidth`.
|
|
89
|
+
*/
|
|
90
|
+
originWidth?: number;
|
|
91
|
+
/**
|
|
92
|
+
* - Original height from `naturalHeight` or `offsetHeight`.
|
|
93
|
+
*/
|
|
94
|
+
originHeight?: number;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Figure control button type
|
|
98
|
+
*/
|
|
99
|
+
export type FigureControlButton = 'mirror_h' | 'mirror_v' | 'rotate_l' | 'rotate_r' | 'caption' | 'revert' | 'edit' | 'copy' | 'remove' | 'as' | 'align' | 'onalign' | 'onresize';
|
|
100
|
+
/**
|
|
101
|
+
* Figure control resize value type (auto, or percentage numbers)
|
|
102
|
+
*/
|
|
103
|
+
export type FigureControlResize = `resize_auto,${number}` | `resize_auto,${number},${number}` | `resize_auto,${number},${number},${number}` | `resize_auto,${number},${number},${number},${number}`;
|
|
104
|
+
/**
|
|
105
|
+
* Figure control custom action object
|
|
106
|
+
*/
|
|
107
|
+
export type ControlCustomAction = {
|
|
108
|
+
action: (element: Node, value: string, target: Node) => void;
|
|
109
|
+
command: string;
|
|
110
|
+
value: string;
|
|
111
|
+
title: string;
|
|
112
|
+
icon: string;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Figure controls configuration
|
|
116
|
+
* 2D array of control buttons for the figure component toolbar
|
|
117
|
+
*
|
|
118
|
+
* **Available control buttons**:
|
|
119
|
+
* - `"mirror_h"`: Mirror horizontally
|
|
120
|
+
* - `"mirror_v"`: Mirror vertically
|
|
121
|
+
* - `"rotate_l"`: Rotate left (-90°)
|
|
122
|
+
* - `"rotate_r"`: Rotate right (90°)
|
|
123
|
+
* - `"caption"`: Toggle caption (`FIGCAPTION`)
|
|
124
|
+
* - `"revert"`: Revert to original size
|
|
125
|
+
* - `"edit"`: Open edit modal
|
|
126
|
+
* - `"copy"`: Copy component
|
|
127
|
+
* - `"remove"`: Remove component
|
|
128
|
+
* - `"as"`: Format type (`block`/`inline`) - requires `useFormatType` option
|
|
129
|
+
* - `"align"`: Alignment (`none`/`left`/`center`/`right`)
|
|
130
|
+
* - `"onalign"`: Alignment button (opens alignment menu)
|
|
131
|
+
* - `"onresize"`: Resize button (opens resize menu)
|
|
132
|
+
* - `"resize_auto,50,75,100"`: Auto-resize with percentage values (e.g., `"resize_auto,100,75,50"`)
|
|
133
|
+
* - Custom action object with action, command, value, title, icon
|
|
134
|
+
*/
|
|
135
|
+
export type FigureControls = Array<Array<FigureControlButton | FigureControlResize | ControlCustomAction | string>>;
|
|
136
|
+
export type FigureParams = {
|
|
137
|
+
/**
|
|
138
|
+
* Size unit
|
|
139
|
+
*/
|
|
140
|
+
sizeUnit?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Auto ratio `{ current: '00%', default: '00%' }`
|
|
143
|
+
*/
|
|
144
|
+
autoRatio?: {
|
|
145
|
+
current: string;
|
|
146
|
+
default: string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Figure information object
|
|
151
|
+
* @typedef {Object} FigureInfo
|
|
152
|
+
* @property {HTMLElement} target - Target element (`img`, `iframe`, `video`, `audio`, `table`, etc.)
|
|
153
|
+
* @property {HTMLElement} container - Container element (`div.se-component`|`span.se-component.se-inline-component`)
|
|
154
|
+
* @property {?HTMLElement} cover - Cover element (`FIGURE`|`null`)
|
|
155
|
+
* @property {?HTMLElement} inlineCover - Inline cover element (`span.se-inline-component`)
|
|
156
|
+
* @property {?HTMLElement} caption - Caption element (`FIGCAPTION`)
|
|
157
|
+
* @property {boolean} isVertical - Whether to rotate vertically
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
* Figure target information object (for resize/align operations)
|
|
161
|
+
* @typedef {Object} FigureTargetInfo
|
|
162
|
+
* @property {HTMLElement} container - Container element (`div.se-component`|`span.se-component.se-inline-component`)
|
|
163
|
+
* @property {?HTMLElement} [cover] - Cover element (`FIGURE`|`null`)
|
|
164
|
+
* @property {?HTMLElement} [caption] - Caption element (`FIGCAPTION`)
|
|
165
|
+
* @property {string} [align] - Alignment of the element.
|
|
166
|
+
* @property {{w:number, h:number}} [ratio] - The aspect ratio of the element.
|
|
167
|
+
* @property {boolean} isVertical - Whether to rotate vertically
|
|
168
|
+
* @property {string|number} [w] - Width of the element.
|
|
169
|
+
* @property {string|number} [h] - Height of the element.
|
|
170
|
+
* @property {number} [t] - Top position.
|
|
171
|
+
* @property {number} [l] - Left position.
|
|
172
|
+
* @property {string|number} width - Width, can be a number or `auto`.
|
|
173
|
+
* @property {string|number} height - Height, can be a number or `auto`.
|
|
174
|
+
* @property {number} [originWidth] - Original width from `naturalWidth` or `offsetWidth`.
|
|
175
|
+
* @property {number} [originHeight] - Original height from `naturalHeight` or `offsetHeight`.
|
|
176
|
+
*/
|
|
177
|
+
/**
|
|
178
|
+
* Figure control button type
|
|
179
|
+
* @typedef {"mirror_h" | "mirror_v" | "rotate_l" | "rotate_r" | "caption" | "revert" | "edit" | "copy" | "remove" | "as" | "align" | "onalign" | "onresize"} FigureControlButton
|
|
180
|
+
*/
|
|
181
|
+
/**
|
|
182
|
+
* Figure control resize value type (auto, or percentage numbers)
|
|
183
|
+
* @typedef {`resize_auto,${number}` | `resize_auto,${number},${number}` | `resize_auto,${number},${number},${number}` | `resize_auto,${number},${number},${number},${number}`} FigureControlResize
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* Figure control custom action object
|
|
187
|
+
* @typedef {{
|
|
188
|
+
* action: (element: Node, value: string, target: Node) => void,
|
|
189
|
+
* command: string,
|
|
190
|
+
* value: string,
|
|
191
|
+
* title: string,
|
|
192
|
+
* icon: string
|
|
193
|
+
* }} ControlCustomAction
|
|
194
|
+
*/
|
|
195
|
+
/**
|
|
196
|
+
* Figure controls configuration
|
|
197
|
+
* 2D array of control buttons for the figure component toolbar
|
|
198
|
+
*
|
|
199
|
+
* **Available control buttons**:
|
|
200
|
+
* - `"mirror_h"`: Mirror horizontally
|
|
201
|
+
* - `"mirror_v"`: Mirror vertically
|
|
202
|
+
* - `"rotate_l"`: Rotate left (-90°)
|
|
203
|
+
* - `"rotate_r"`: Rotate right (90°)
|
|
204
|
+
* - `"caption"`: Toggle caption (`FIGCAPTION`)
|
|
205
|
+
* - `"revert"`: Revert to original size
|
|
206
|
+
* - `"edit"`: Open edit modal
|
|
207
|
+
* - `"copy"`: Copy component
|
|
208
|
+
* - `"remove"`: Remove component
|
|
209
|
+
* - `"as"`: Format type (`block`/`inline`) - requires `useFormatType` option
|
|
210
|
+
* - `"align"`: Alignment (`none`/`left`/`center`/`right`)
|
|
211
|
+
* - `"onalign"`: Alignment button (opens alignment menu)
|
|
212
|
+
* - `"onresize"`: Resize button (opens resize menu)
|
|
213
|
+
* - `"resize_auto,50,75,100"`: Auto-resize with percentage values (e.g., `"resize_auto,100,75,50"`)
|
|
214
|
+
* - Custom action object with action, command, value, title, icon
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* // Basic controls
|
|
218
|
+
* [['mirror_h', 'mirror_v', 'align', 'caption', 'edit', 'copy', 'remove']]
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* // Multi-row controls with resize options
|
|
222
|
+
* [
|
|
223
|
+
* ['as', 'resize_auto,100,75,50', 'rotate_l', 'rotate_r', 'mirror_h', 'mirror_v'],
|
|
224
|
+
* ['edit', 'align', 'caption', 'revert', 'copy', 'remove']
|
|
225
|
+
* ]
|
|
226
|
+
*
|
|
227
|
+
* @typedef {Array<Array<FigureControlButton | FigureControlResize | ControlCustomAction | string>>} FigureControls
|
|
228
|
+
*/
|
|
229
|
+
/**
|
|
230
|
+
* @typedef {Object} FigureParams
|
|
231
|
+
* @property {string} [sizeUnit="px"] Size unit
|
|
232
|
+
* @property {{ current: string, default: string }} [autoRatio=null] Auto ratio `{ current: '00%', default: '00%' }`
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* @class
|
|
236
|
+
* @description Figure module class for handling resizable/alignable components (images, videos, iframes, etc.)
|
|
237
|
+
* @see EditorComponent for `inst._element` requirement
|
|
238
|
+
*/
|
|
239
|
+
declare class Figure {
|
|
240
|
+
/**
|
|
241
|
+
* @description Create a container for the resizing component and insert the element.
|
|
242
|
+
* @param {Node} element Target element
|
|
243
|
+
* @param {string} [className] Class name of container (fixed: `se-component`)
|
|
244
|
+
* @returns {FigureInfo} {target, container, cover, inlineCover, caption}
|
|
245
|
+
*/
|
|
246
|
+
static CreateContainer(element: Node, className?: string): FigureInfo;
|
|
247
|
+
/**
|
|
248
|
+
* @description Create a container for the inline resizing component and insert the element.
|
|
249
|
+
* @param {Node} element Target element
|
|
250
|
+
* @param {string} [className] Class name of container (fixed: `se-component` `se-inline-component`)
|
|
251
|
+
* @returns {FigureInfo} {target, container, cover, inlineCover, caption}
|
|
252
|
+
*/
|
|
253
|
+
static CreateInlineContainer(element: Node, className?: string): FigureInfo;
|
|
254
|
+
/**
|
|
255
|
+
* @description Return HTML string of caption(`FIGCAPTION`) element
|
|
256
|
+
* @param {Node} cover Cover element(`FIGURE`). `CreateContainer().cover`
|
|
257
|
+
* @returns {HTMLElement} caption element
|
|
258
|
+
*/
|
|
259
|
+
static CreateCaption(cover: Node, text: any): HTMLElement;
|
|
260
|
+
/**
|
|
261
|
+
* @description Get the element's container(`.se-component`) info.
|
|
262
|
+
* @param {Node} element Target element
|
|
263
|
+
* @returns {FigureInfo} {target, container, cover, inlineCover, caption}
|
|
264
|
+
*/
|
|
265
|
+
static GetContainer(element: Node): FigureInfo;
|
|
266
|
+
/**
|
|
267
|
+
* @description Ratio calculation
|
|
268
|
+
* @param {string|number} w Width size
|
|
269
|
+
* @param {string|number} h Height size
|
|
270
|
+
* @param {?string} [defaultSizeUnit="px"] Default size unit (default: `"px"`)
|
|
271
|
+
* @return {{w: number, h: number}}
|
|
272
|
+
*/
|
|
273
|
+
static GetRatio(
|
|
274
|
+
w: string | number,
|
|
275
|
+
h: string | number,
|
|
276
|
+
defaultSizeUnit?: string | null,
|
|
277
|
+
): {
|
|
278
|
+
w: number;
|
|
279
|
+
h: number;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* @description Ratio calculation
|
|
283
|
+
* @param {string|number} w Width size
|
|
284
|
+
* @param {string|number} h Height size
|
|
285
|
+
* @param {string} defaultSizeUnit Default size unit (default: `"px"`)
|
|
286
|
+
* @param {?{w: number, h: number}} [ratio] Ratio size (Figure.GetRatio)
|
|
287
|
+
* @return {{w: string|number, h: string|number}}
|
|
288
|
+
*/
|
|
289
|
+
static CalcRatio(
|
|
290
|
+
w: string | number,
|
|
291
|
+
h: string | number,
|
|
292
|
+
defaultSizeUnit: string,
|
|
293
|
+
ratio?: {
|
|
294
|
+
w: number;
|
|
295
|
+
h: number;
|
|
296
|
+
} | null,
|
|
297
|
+
): {
|
|
298
|
+
w: string | number;
|
|
299
|
+
h: string | number;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* @description It is judged whether it is the component[`img`, `iframe`, `video`, `audio`, `table`] cover(class=`"se-component"`) and `table`, `hr`
|
|
303
|
+
* @param {Node} element Target element
|
|
304
|
+
* @returns {boolean}
|
|
305
|
+
*/
|
|
306
|
+
static is(element: Node): boolean;
|
|
307
|
+
/**
|
|
308
|
+
* @constructor
|
|
309
|
+
* @param {*} inst The instance object that called the constructor.
|
|
310
|
+
* @param {SunEditor.Deps} $ Kernel dependencies
|
|
311
|
+
* @param {FigureControls} controls Controller button array
|
|
312
|
+
* @param {FigureParams} params Figure options
|
|
313
|
+
*/
|
|
314
|
+
constructor(inst: any, $: SunEditor.Deps, controls: FigureControls, params: FigureParams);
|
|
315
|
+
kind: any;
|
|
316
|
+
_alignIcons: {
|
|
317
|
+
none: any;
|
|
318
|
+
left: any;
|
|
319
|
+
right: any;
|
|
320
|
+
center: any;
|
|
321
|
+
};
|
|
322
|
+
/** @type {Object<string, *>} */
|
|
323
|
+
_action: {
|
|
324
|
+
[x: string]: any;
|
|
325
|
+
};
|
|
326
|
+
controller: Controller;
|
|
327
|
+
alignButton: Element;
|
|
328
|
+
selectMenu_align: SelectMenu;
|
|
329
|
+
asButton: Element;
|
|
330
|
+
selectMenu_as: SelectMenu;
|
|
331
|
+
resizeButton: Element;
|
|
332
|
+
selectMenu_resize: SelectMenu;
|
|
333
|
+
inst: any;
|
|
334
|
+
sizeUnit: string;
|
|
335
|
+
autoRatio: {
|
|
336
|
+
current: string;
|
|
337
|
+
default: string;
|
|
338
|
+
};
|
|
339
|
+
isVertical: boolean;
|
|
340
|
+
percentageButtons: any[] | NodeListOf<Element>;
|
|
341
|
+
captionButton: Element;
|
|
342
|
+
align: string;
|
|
343
|
+
as: string;
|
|
344
|
+
/** @type {{left?: number, top?: number}} */
|
|
345
|
+
__offset: {
|
|
346
|
+
left?: number;
|
|
347
|
+
top?: number;
|
|
348
|
+
};
|
|
349
|
+
_element: HTMLElement;
|
|
350
|
+
_cover: HTMLElement;
|
|
351
|
+
_inlineCover: HTMLElement;
|
|
352
|
+
_container: HTMLElement;
|
|
353
|
+
_caption: HTMLElement;
|
|
354
|
+
_resizeClientX: number;
|
|
355
|
+
_resizeClientY: number;
|
|
356
|
+
_resize_direction: string;
|
|
357
|
+
__containerResizingOff: any;
|
|
358
|
+
__containerResizing: any;
|
|
359
|
+
__onContainerEvent: any;
|
|
360
|
+
__offContainerEvent: any;
|
|
361
|
+
/**
|
|
362
|
+
* @description Close the figure's controller
|
|
363
|
+
*/
|
|
364
|
+
close(): void;
|
|
365
|
+
/**
|
|
366
|
+
* @description Open the figure's controller
|
|
367
|
+
* @param {Node} targetNode Target element
|
|
368
|
+
* @param {Object} params params
|
|
369
|
+
* @param {boolean} [params.nonResizing=false] Do not display the resizing button
|
|
370
|
+
* @param {boolean} [params.nonSizeInfo=false] Do not display the size information
|
|
371
|
+
* @param {boolean} [params.nonBorder=false] Do not display the selected style line
|
|
372
|
+
* @param {boolean} [params.figureTarget=false] If `true`, the target is a figure element
|
|
373
|
+
* @param {boolean} [params.infoOnly=false] If `true`, returns only the figure target info without opening the controller
|
|
374
|
+
* @returns {FigureTargetInfo|undefined} figure target info
|
|
375
|
+
*/
|
|
376
|
+
open(
|
|
377
|
+
targetNode: Node,
|
|
378
|
+
{
|
|
379
|
+
nonResizing,
|
|
380
|
+
nonSizeInfo,
|
|
381
|
+
nonBorder,
|
|
382
|
+
figureTarget,
|
|
383
|
+
infoOnly,
|
|
384
|
+
}: {
|
|
385
|
+
nonResizing?: boolean;
|
|
386
|
+
nonSizeInfo?: boolean;
|
|
387
|
+
nonBorder?: boolean;
|
|
388
|
+
figureTarget?: boolean;
|
|
389
|
+
infoOnly?: boolean;
|
|
390
|
+
},
|
|
391
|
+
): FigureTargetInfo | undefined;
|
|
392
|
+
/**
|
|
393
|
+
* @description Hide the controller
|
|
394
|
+
*/
|
|
395
|
+
controllerHide(): void;
|
|
396
|
+
/**
|
|
397
|
+
* @description Hide the controller
|
|
398
|
+
*/
|
|
399
|
+
controllerShow(): void;
|
|
400
|
+
/**
|
|
401
|
+
* @description Open the figure's controller
|
|
402
|
+
* @param {Node} target Target element
|
|
403
|
+
* @param {Object} [params={}] params
|
|
404
|
+
* @param {boolean} [params.isWWTarget] If the controller is in the WYSIWYG area, set it to `true`.
|
|
405
|
+
* @param {() => void} [params.initMethod] Method to be called when the controller is closed.
|
|
406
|
+
* @param {boolean} [params.disabled] If `true`, the controller is disabled.
|
|
407
|
+
* @param {{left: number, top: number}} [params.addOffset] Additional offset values
|
|
408
|
+
*/
|
|
409
|
+
controllerOpen(
|
|
410
|
+
target: Node,
|
|
411
|
+
params?: {
|
|
412
|
+
isWWTarget?: boolean;
|
|
413
|
+
initMethod?: () => void;
|
|
414
|
+
disabled?: boolean;
|
|
415
|
+
addOffset?: {
|
|
416
|
+
left: number;
|
|
417
|
+
top: number;
|
|
418
|
+
};
|
|
419
|
+
},
|
|
420
|
+
): void;
|
|
421
|
+
/**
|
|
422
|
+
* @description Set the element's container size
|
|
423
|
+
* @param {string|number} w Width size
|
|
424
|
+
* @param {string|number} h Height size
|
|
425
|
+
*/
|
|
426
|
+
setFigureSize(w: string | number, h: string | number): void;
|
|
427
|
+
/**
|
|
428
|
+
* @description Set the element's container size from plugins input value
|
|
429
|
+
* @param {string|number} w Width size
|
|
430
|
+
* @param {string|number} h Height size
|
|
431
|
+
*/
|
|
432
|
+
setSize(w: string | number, h: string | number): void;
|
|
433
|
+
/**
|
|
434
|
+
* @description Gets the Figure size
|
|
435
|
+
* @param {?Node} [targetNode] Target element, default is the current element
|
|
436
|
+
* @returns {{w: string, h: string, dw: string, dh: string}}
|
|
437
|
+
*/
|
|
438
|
+
getSize(targetNode?: Node | null): {
|
|
439
|
+
w: string;
|
|
440
|
+
h: string;
|
|
441
|
+
dw: string;
|
|
442
|
+
dh: string;
|
|
443
|
+
};
|
|
444
|
+
/**
|
|
445
|
+
* @description Align the container.
|
|
446
|
+
* @param {?Node} targetNode Target element
|
|
447
|
+
* @param {string} align `"none"`|`"left"`|`"center"`|`"right"`
|
|
448
|
+
*/
|
|
449
|
+
setAlign(targetNode: Node | null, align: string): void;
|
|
450
|
+
/**
|
|
451
|
+
* @description As style[block, inline] the component
|
|
452
|
+
* @param {?Node} targetNode Target element
|
|
453
|
+
* @param {"block"|"inline"} formatStyle Format style
|
|
454
|
+
* @returns {HTMLElement} New target element after conversion
|
|
455
|
+
*/
|
|
456
|
+
convertAsFormat(targetNode: Node | null, formatStyle: 'block' | 'inline'): HTMLElement;
|
|
457
|
+
controllerAction(target: HTMLButtonElement): void;
|
|
458
|
+
/**
|
|
459
|
+
* @description Inspect the figure component format and change it to the correct format.
|
|
460
|
+
* @param {Node} container - The container element of the figure component.
|
|
461
|
+
* @param {Node} originEl - The original element of the figure component.
|
|
462
|
+
* @param {Node} anchorCover - The anchor cover element of the figure component.
|
|
463
|
+
* @param {import('../manager/FileManager').default} [fileManagerInst=null] - FileManager module instance, if used.
|
|
464
|
+
*/
|
|
465
|
+
retainFigureFormat(container: Node, originEl: Node, anchorCover: Node, fileManagerInst?: import('../manager/FileManager').default): void;
|
|
466
|
+
/**
|
|
467
|
+
* @description Initialize the transform style (rotation) of the element.
|
|
468
|
+
* @param {?Node} [node] Target element, default is the current element
|
|
469
|
+
*/
|
|
470
|
+
deleteTransform(node?: Node | null): void;
|
|
471
|
+
/**
|
|
472
|
+
* @description Set the transform style (rotation) of the element.
|
|
473
|
+
* @param {Node} node Target element
|
|
474
|
+
* @param {?string|number} width Element's width size
|
|
475
|
+
* @param {?string|number} height Element's height size
|
|
476
|
+
* @param {?number} deg rotate value
|
|
477
|
+
*/
|
|
478
|
+
setTransform(node: Node, width: (string | number) | null, height: (string | number) | null, deg: number | null): void;
|
|
479
|
+
/**
|
|
480
|
+
* @internal
|
|
481
|
+
* @description Displays or hides the resize handles of the figure component.
|
|
482
|
+
* @param {boolean} display Whether to display resize handles.
|
|
483
|
+
*/
|
|
484
|
+
_displayResizeHandles(display: boolean): void;
|
|
485
|
+
/**
|
|
486
|
+
* @internal
|
|
487
|
+
* @description Applies rotation transformation to the target element.
|
|
488
|
+
* @param {HTMLElement} element Target element.
|
|
489
|
+
* @param {number} r Rotation degree.
|
|
490
|
+
* @param {number} x X-axis rotation value.
|
|
491
|
+
* @param {number} y Y-axis rotation value.
|
|
492
|
+
*/
|
|
493
|
+
_setRotate(element: HTMLElement, r: number, x: number, y: number): void;
|
|
494
|
+
/**
|
|
495
|
+
* @internal
|
|
496
|
+
* @description Applies size adjustments to the figure element.
|
|
497
|
+
* @param {string|number} w Width value.
|
|
498
|
+
* @param {string|number} h Height value.
|
|
499
|
+
* @param {string} direction Resize direction.
|
|
500
|
+
*/
|
|
501
|
+
_applySize(w: string | number, h: string | number, direction: string): void;
|
|
502
|
+
/**
|
|
503
|
+
* @internal
|
|
504
|
+
* @description Sets padding-bottom for cover elements based on width and height.
|
|
505
|
+
* @param {string} w Width value.
|
|
506
|
+
* @param {string} h Height value.
|
|
507
|
+
*/
|
|
508
|
+
__setCoverPaddingBottom(w: string, h: string): void;
|
|
509
|
+
/**
|
|
510
|
+
* @internal
|
|
511
|
+
* @description Sets the figure element to its auto size.
|
|
512
|
+
*/
|
|
513
|
+
_setAutoSize(): void;
|
|
514
|
+
/**
|
|
515
|
+
* @internal
|
|
516
|
+
* @description Sets the figure element's size in percentage.
|
|
517
|
+
* @param {string|number} w Width percentage.
|
|
518
|
+
* @param {string|number} h Height percentage.
|
|
519
|
+
*/
|
|
520
|
+
_setPercentSize(w: string | number, h: string | number): void;
|
|
521
|
+
/**
|
|
522
|
+
* @internal
|
|
523
|
+
* @description Reverts the figure element to its previously saved size.
|
|
524
|
+
*/
|
|
525
|
+
_setRevert(): void;
|
|
526
|
+
#private;
|
|
527
|
+
}
|
|
528
|
+
import SelectMenu from '../ui/SelectMenu';
|
|
529
|
+
import Controller from './Controller';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type {} from '../../typedef';
|
|
1
2
|
export default HueSlider;
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* HueSlider color information object
|
|
5
|
+
*/
|
|
3
6
|
export type HueSliderColor = {
|
|
4
7
|
/**
|
|
5
8
|
* - HEX color
|
|
@@ -31,23 +34,36 @@ export type HueSliderColor = {
|
|
|
31
34
|
l: number;
|
|
32
35
|
};
|
|
33
36
|
export type HueSliderParams = {
|
|
34
|
-
/**
|
|
35
|
-
* The form element to attach the hue slider.
|
|
36
|
-
*/
|
|
37
|
-
form?: Node;
|
|
38
37
|
/**
|
|
39
38
|
* Whether to create a new form element.
|
|
40
39
|
*/
|
|
41
40
|
isNewForm?: boolean;
|
|
42
41
|
/**
|
|
43
|
-
*
|
|
42
|
+
* Parent elements for controller positioning.
|
|
44
43
|
*/
|
|
45
|
-
|
|
44
|
+
parents?: Array<HTMLElement>;
|
|
45
|
+
/**
|
|
46
|
+
* Controller options (excluding 'parents')
|
|
47
|
+
*/
|
|
48
|
+
controllerOptions?: import('./Controller').ControllerParams;
|
|
46
49
|
};
|
|
47
50
|
/**
|
|
48
|
-
* @
|
|
51
|
+
* @returns {{slider: HTMLElement, offscreenCanvas: HTMLCanvasElement, offscreenCtx: CanvasRenderingContext2D, wheel: HTMLCanvasElement, wheelCtx: CanvasRenderingContext2D, wheelPointer: HTMLElement, gradientBar: HTMLCanvasElement, gradientPointer: HTMLElement, fanalColorHex: HTMLElement, fanalColorBackground: HTMLElement}}
|
|
49
52
|
*/
|
|
53
|
+
export function CreateSliderCtx(): {
|
|
54
|
+
slider: HTMLElement;
|
|
55
|
+
offscreenCanvas: HTMLCanvasElement;
|
|
56
|
+
offscreenCtx: CanvasRenderingContext2D;
|
|
57
|
+
wheel: HTMLCanvasElement;
|
|
58
|
+
wheelCtx: CanvasRenderingContext2D;
|
|
59
|
+
wheelPointer: HTMLElement;
|
|
60
|
+
gradientBar: HTMLCanvasElement;
|
|
61
|
+
gradientPointer: HTMLElement;
|
|
62
|
+
fanalColorHex: HTMLElement;
|
|
63
|
+
fanalColorBackground: HTMLElement;
|
|
64
|
+
};
|
|
50
65
|
/**
|
|
66
|
+
* HueSlider color information object
|
|
51
67
|
* @typedef {Object} HueSliderColor
|
|
52
68
|
* @property {string} hex - HEX color
|
|
53
69
|
* @property {number} r - Red color value
|
|
@@ -59,28 +75,26 @@ export type HueSliderParams = {
|
|
|
59
75
|
*/
|
|
60
76
|
/**
|
|
61
77
|
* @typedef {Object} HueSliderParams
|
|
62
|
-
* @property {Node} [form] The form element to attach the hue slider.
|
|
63
78
|
* @property {boolean} [isNewForm] Whether to create a new form element.
|
|
64
|
-
* @property {
|
|
79
|
+
* @property {Array<HTMLElement>} [parents] Parent elements for controller positioning.
|
|
80
|
+
* @property {import('./Controller').ControllerParams} [controllerOptions] Controller options (excluding 'parents')
|
|
65
81
|
*/
|
|
66
82
|
/**
|
|
67
83
|
* @class
|
|
68
84
|
* @description Create a Hue slider. (only create one at a time)
|
|
69
|
-
* - When you call the
|
|
85
|
+
* - When you call the `.attach()` method, the hue slider is appended to the form element.
|
|
70
86
|
* It must be called every time it is used.
|
|
71
87
|
*/
|
|
72
88
|
declare class HueSlider {
|
|
73
89
|
/**
|
|
74
90
|
* @constructor
|
|
75
|
-
* @param {
|
|
91
|
+
* @param {import('./ColorPicker').default} inst The instance object that called the constructor.
|
|
92
|
+
* @param {SunEditor.Deps} $ Kernel dependencies
|
|
76
93
|
* @param {HueSliderParams} [params={}] Hue slider options
|
|
77
94
|
* @param {string} [className=""] The class name of the hue slider.
|
|
78
95
|
*/
|
|
79
|
-
constructor(inst:
|
|
80
|
-
|
|
81
|
-
eventManager: any;
|
|
82
|
-
inst: any;
|
|
83
|
-
form: Node;
|
|
96
|
+
constructor(inst: import('./ColorPicker').default, $: SunEditor.Deps, params?: HueSliderParams, className?: string);
|
|
97
|
+
inst: import('./ColorPicker').default;
|
|
84
98
|
ctx: {
|
|
85
99
|
wheelX: number;
|
|
86
100
|
wheelY: number;
|
|
@@ -100,10 +114,10 @@ declare class HueSlider {
|
|
|
100
114
|
};
|
|
101
115
|
isOpen: boolean;
|
|
102
116
|
controlle: any;
|
|
103
|
-
|
|
104
|
-
__globalMouseMove: any;
|
|
105
|
-
__globalMouseUp: any;
|
|
117
|
+
circle: Element;
|
|
106
118
|
controller: Controller;
|
|
119
|
+
controllerAction(target: HTMLButtonElement): void;
|
|
120
|
+
controllerClose(): void;
|
|
107
121
|
/**
|
|
108
122
|
* @description Get the current color information.
|
|
109
123
|
* @returns {HueSliderColor} color information
|
|
@@ -115,22 +129,19 @@ declare class HueSlider {
|
|
|
115
129
|
*/
|
|
116
130
|
open(target: Node): void;
|
|
117
131
|
/**
|
|
118
|
-
* @description
|
|
119
|
-
|
|
120
|
-
off(): void;
|
|
121
|
-
/**
|
|
122
|
-
* @description Close the hue slider. (include off method)
|
|
123
|
-
* - Call the instance's hueSliderCancelAction method.
|
|
132
|
+
* @description Close the hue slider.
|
|
133
|
+
* - Call the instance's `hueSliderCancelAction` method.
|
|
124
134
|
*/
|
|
125
135
|
close(): void;
|
|
126
136
|
/**
|
|
127
137
|
* @description Attach the hue slider to the form element.
|
|
128
|
-
* @param {?Node
|
|
138
|
+
* @param {?Node} [form] The element to attach the hue slider.
|
|
129
139
|
*/
|
|
130
|
-
attach(form?:
|
|
140
|
+
attach(form?: Node | null): void;
|
|
131
141
|
/**
|
|
132
142
|
* @description Initialize the hue slider information.
|
|
133
143
|
*/
|
|
134
144
|
init(): void;
|
|
145
|
+
#private;
|
|
135
146
|
}
|
|
136
147
|
import Controller from './Controller';
|