suneditor 3.0.0-beta.3 → 3.0.0-beta.30
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/CONTRIBUTING.md +8 -8
- package/README.md +44 -49
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +95 -53
- package/src/assets/design/color.css +2 -2
- package/src/assets/design/size.css +2 -0
- package/src/assets/icons/defaultIcons.js +16 -1
- package/src/assets/suneditor-contents.css +9 -8
- package/src/assets/suneditor.css +29 -26
- package/src/core/{section → base}/actives.js +20 -12
- package/src/core/base/history.js +4 -4
- package/src/core/class/char.js +10 -10
- package/src/core/class/component.js +146 -57
- package/src/core/class/format.js +94 -2458
- package/src/core/class/html.js +187 -129
- package/src/core/class/inline.js +1853 -0
- package/src/core/class/listFormat.js +582 -0
- package/src/core/class/menu.js +14 -3
- package/src/core/class/nodeTransform.js +9 -14
- package/src/core/class/offset.js +162 -197
- package/src/core/class/selection.js +137 -34
- package/src/core/class/toolbar.js +73 -52
- package/src/core/class/ui.js +11 -11
- package/src/core/class/viewer.js +56 -55
- package/src/core/config/context.js +122 -0
- package/src/core/config/frameContext.js +204 -0
- package/src/core/config/options.js +639 -0
- package/src/core/editor.js +181 -108
- package/src/core/event/actions/index.js +229 -0
- package/src/core/event/effects/common.registry.js +60 -0
- package/src/core/event/effects/keydown.registry.js +551 -0
- package/src/core/event/effects/ruleHelpers.js +145 -0
- package/src/core/{base → event}/eventManager.js +119 -201
- package/src/core/event/executor.js +21 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
- package/src/core/event/handlers/handler_ww_input.js +77 -0
- package/src/core/event/handlers/handler_ww_key.js +228 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
- package/src/core/event/ports.js +211 -0
- package/src/core/event/reducers/keydown.reducer.js +89 -0
- package/src/core/event/rules/keydown.rule.arrow.js +54 -0
- package/src/core/event/rules/keydown.rule.backspace.js +202 -0
- package/src/core/event/rules/keydown.rule.delete.js +126 -0
- package/src/core/event/rules/keydown.rule.enter.js +144 -0
- package/src/core/event/rules/keydown.rule.tab.js +29 -0
- package/src/core/section/constructor.js +79 -388
- package/src/core/section/documentType.js +47 -26
- package/src/core/util/instanceCheck.js +59 -0
- package/src/editorInjector/_classes.js +4 -0
- package/src/editorInjector/_core.js +17 -7
- package/src/editorInjector/index.js +10 -2
- package/src/events.js +6 -0
- package/src/helper/clipboard.js +24 -10
- package/src/helper/converter.js +17 -12
- package/src/helper/dom/domCheck.js +22 -3
- package/src/helper/dom/domQuery.js +91 -45
- package/src/helper/dom/domUtils.js +93 -19
- package/src/helper/dom/index.js +4 -0
- package/src/helper/env.js +11 -7
- package/src/helper/keyCodeMap.js +4 -3
- package/src/langs/ckb.js +1 -1
- package/src/langs/cs.js +1 -1
- package/src/langs/da.js +1 -1
- package/src/langs/de.js +1 -1
- package/src/langs/en.js +1 -1
- package/src/langs/es.js +1 -1
- package/src/langs/fa.js +1 -1
- package/src/langs/fr.js +1 -1
- package/src/langs/he.js +1 -1
- package/src/langs/hu.js +1 -1
- package/src/langs/it.js +1 -1
- package/src/langs/ja.js +1 -1
- package/src/langs/km.js +1 -1
- package/src/langs/ko.js +1 -1
- package/src/langs/lv.js +1 -1
- package/src/langs/nl.js +1 -1
- package/src/langs/pl.js +1 -1
- package/src/langs/pt_br.js +10 -10
- package/src/langs/ro.js +1 -1
- package/src/langs/ru.js +1 -1
- package/src/langs/se.js +1 -1
- package/src/langs/tr.js +1 -1
- package/src/langs/uk.js +1 -1
- package/src/langs/ur.js +1 -1
- package/src/langs/zh_cn.js +1 -1
- package/src/modules/ApiManager.js +25 -18
- package/src/modules/Browser.js +52 -61
- package/src/modules/ColorPicker.js +37 -38
- package/src/modules/Controller.js +85 -79
- package/src/modules/Figure.js +275 -187
- package/src/modules/FileManager.js +86 -92
- package/src/modules/HueSlider.js +67 -35
- package/src/modules/Modal.js +84 -77
- package/src/modules/ModalAnchorEditor.js +62 -79
- package/src/modules/SelectMenu.js +89 -86
- package/src/plugins/browser/audioGallery.js +9 -5
- package/src/plugins/browser/fileBrowser.js +10 -6
- package/src/plugins/browser/fileGallery.js +9 -5
- package/src/plugins/browser/imageGallery.js +9 -5
- package/src/plugins/browser/videoGallery.js +11 -6
- package/src/plugins/command/blockquote.js +1 -0
- package/src/plugins/command/exportPDF.js +11 -8
- package/src/plugins/command/fileUpload.js +41 -29
- package/src/plugins/command/list_bulleted.js +2 -1
- package/src/plugins/command/list_numbered.js +2 -1
- package/src/plugins/dropdown/align.js +8 -2
- package/src/plugins/dropdown/backgroundColor.js +19 -11
- package/src/plugins/dropdown/font.js +15 -9
- package/src/plugins/dropdown/fontColor.js +19 -11
- package/src/plugins/dropdown/formatBlock.js +7 -2
- package/src/plugins/dropdown/hr.js +7 -3
- package/src/plugins/dropdown/layout.js +6 -2
- package/src/plugins/dropdown/lineHeight.js +8 -3
- package/src/plugins/dropdown/list.js +2 -1
- package/src/plugins/dropdown/paragraphStyle.js +15 -11
- package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
- package/src/plugins/dropdown/template.js +6 -2
- package/src/plugins/dropdown/textStyle.js +7 -3
- package/src/plugins/field/mention.js +33 -27
- package/src/plugins/input/fontSize.js +44 -37
- package/src/plugins/input/pageNavigator.js +3 -2
- package/src/plugins/modal/audio.js +90 -85
- package/src/plugins/modal/drawing.js +58 -66
- package/src/plugins/modal/embed.js +193 -180
- package/src/plugins/modal/image.js +441 -439
- package/src/plugins/modal/link.js +31 -8
- package/src/plugins/modal/math.js +23 -22
- package/src/plugins/modal/video.js +233 -230
- package/src/plugins/popup/anchor.js +24 -18
- package/src/suneditor.js +69 -24
- package/src/typedef.js +42 -19
- package/types/assets/icons/defaultIcons.d.ts +8 -0
- package/types/core/class/char.d.ts +1 -1
- package/types/core/class/component.d.ts +29 -7
- package/types/core/class/format.d.ts +4 -354
- package/types/core/class/html.d.ts +13 -4
- package/types/core/class/inline.d.ts +263 -0
- package/types/core/class/listFormat.d.ts +135 -0
- package/types/core/class/menu.d.ts +10 -2
- package/types/core/class/offset.d.ts +24 -26
- package/types/core/class/selection.d.ts +2 -0
- package/types/core/class/toolbar.d.ts +24 -11
- package/types/core/class/ui.d.ts +1 -1
- package/types/core/class/viewer.d.ts +1 -1
- package/types/core/config/context.d.ts +157 -0
- package/types/core/config/frameContext.d.ts +367 -0
- package/types/core/config/options.d.ts +1119 -0
- package/types/core/editor.d.ts +101 -66
- package/types/core/event/actions/index.d.ts +47 -0
- package/types/core/event/effects/common.registry.d.ts +50 -0
- package/types/core/event/effects/keydown.registry.d.ts +73 -0
- package/types/core/event/effects/ruleHelpers.d.ts +31 -0
- package/types/core/{base → event}/eventManager.d.ts +15 -46
- package/types/core/event/executor.d.ts +6 -0
- package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
- package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
- package/types/core/event/ports.d.ts +255 -0
- package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
- package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
- package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
- package/types/core/section/constructor.d.ts +101 -631
- package/types/core/section/documentType.d.ts +14 -4
- package/types/core/util/instanceCheck.d.ts +50 -0
- package/types/editorInjector/_classes.d.ts +4 -0
- package/types/editorInjector/_core.d.ts +17 -7
- package/types/editorInjector/index.d.ts +10 -2
- package/types/events.d.ts +1 -0
- package/types/helper/clipboard.d.ts +2 -2
- package/types/helper/converter.d.ts +6 -9
- package/types/helper/dom/domCheck.d.ts +7 -0
- package/types/helper/dom/domQuery.d.ts +19 -8
- package/types/helper/dom/domUtils.d.ts +24 -2
- package/types/helper/dom/index.d.ts +86 -1
- package/types/helper/env.d.ts +6 -1
- package/types/helper/index.d.ts +7 -1
- package/types/helper/keyCodeMap.d.ts +3 -3
- package/types/index.d.ts +23 -117
- package/types/langs/index.d.ts +2 -2
- package/types/modules/ApiManager.d.ts +1 -8
- package/types/modules/Browser.d.ts +4 -62
- package/types/modules/ColorPicker.d.ts +4 -21
- package/types/modules/Controller.d.ts +8 -64
- package/types/modules/Figure.d.ts +54 -50
- package/types/modules/FileManager.d.ts +1 -13
- package/types/modules/HueSlider.d.ts +13 -3
- package/types/modules/Modal.d.ts +0 -43
- package/types/modules/ModalAnchorEditor.d.ts +0 -73
- package/types/modules/SelectMenu.d.ts +0 -85
- package/types/modules/index.d.ts +3 -3
- package/types/plugins/browser/audioGallery.d.ts +29 -18
- package/types/plugins/browser/fileBrowser.d.ts +38 -27
- package/types/plugins/browser/fileGallery.d.ts +29 -18
- package/types/plugins/browser/imageGallery.d.ts +24 -16
- package/types/plugins/browser/videoGallery.d.ts +29 -18
- package/types/plugins/command/blockquote.d.ts +1 -0
- package/types/plugins/command/exportPDF.d.ts +18 -18
- package/types/plugins/command/fileUpload.d.ts +65 -45
- package/types/plugins/command/list_bulleted.d.ts +1 -0
- package/types/plugins/command/list_numbered.d.ts +1 -0
- package/types/plugins/dropdown/align.d.ts +13 -8
- package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
- package/types/plugins/dropdown/font.d.ts +13 -12
- package/types/plugins/dropdown/fontColor.d.ts +30 -19
- package/types/plugins/dropdown/formatBlock.d.ts +13 -8
- package/types/plugins/dropdown/hr.d.ts +15 -11
- package/types/plugins/dropdown/layout.d.ts +15 -11
- package/types/plugins/dropdown/lineHeight.d.ts +16 -11
- package/types/plugins/dropdown/list.d.ts +1 -0
- package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
- package/types/plugins/dropdown/table/index.d.ts +582 -0
- package/types/plugins/dropdown/table.d.ts +41 -86
- package/types/plugins/dropdown/template.d.ts +15 -11
- package/types/plugins/dropdown/textStyle.d.ts +19 -11
- package/types/plugins/field/mention.d.ts +58 -56
- package/types/plugins/index.d.ts +38 -38
- package/types/plugins/input/fontSize.d.ts +46 -50
- package/types/plugins/modal/audio.d.ts +26 -56
- package/types/plugins/modal/drawing.d.ts +0 -85
- package/types/plugins/modal/embed.d.ts +15 -79
- package/types/plugins/modal/image.d.ts +24 -136
- package/types/plugins/modal/link.d.ts +34 -15
- package/types/plugins/modal/math.d.ts +0 -16
- package/types/plugins/modal/video.d.ts +17 -86
- package/types/plugins/popup/anchor.d.ts +1 -8
- package/types/suneditor.d.ts +70 -19
- package/types/typedef.d.ts +60 -46
- package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
- package/src/core/section/context.js +0 -102
- package/types/core/section/context.d.ts +0 -45
- package/types/langs/_Lang.d.ts +0 -194
- /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
- /package/types/core/{section → base}/actives.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* @this {EventManagerThis_handler_ww_key_input}
|
|
4
|
-
* @param {__se__FrameContext} fc - Frame context object
|
|
5
|
-
* @param {InputEvent} e - Event object
|
|
2
|
+
* @typedef {Omit<import('../eventManager').default & Partial<__se__EditorInjector>, 'eventManager'>} EventManagerThis_handler_ww_key_input
|
|
6
3
|
*/
|
|
7
|
-
export function OnInput_wysiwyg(this: Omit<import('../eventManager').default & Partial<import('../../../editorInjector').default>, 'eventManager'>, fc: __se__FrameContext, e: InputEvent): Promise<boolean>;
|
|
8
4
|
/**
|
|
9
5
|
* @private
|
|
10
6
|
* @this {EventManagerThis_handler_ww_key_input}
|
|
@@ -13,6 +9,9 @@ export function OnInput_wysiwyg(this: Omit<import('../eventManager').default & P
|
|
|
13
9
|
*/
|
|
14
10
|
export function OnKeyDown_wysiwyg(this: Omit<import('../eventManager').default & Partial<import('../../../editorInjector').default>, 'eventManager'>, fc: __se__FrameContext, e: KeyboardEvent): Promise<boolean>;
|
|
15
11
|
export class OnKeyDown_wysiwyg {
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Omit<import('../eventManager').default & Partial<__se__EditorInjector>, 'eventManager'>} EventManagerThis_handler_ww_key_input
|
|
14
|
+
*/
|
|
16
15
|
/**
|
|
17
16
|
* @private
|
|
18
17
|
* @this {EventManagerThis_handler_ww_key_input}
|
|
@@ -22,7 +21,6 @@ export class OnKeyDown_wysiwyg {
|
|
|
22
21
|
private constructor();
|
|
23
22
|
isComposing: boolean;
|
|
24
23
|
_onShortcutKey: boolean;
|
|
25
|
-
_formatAttrsTemp: NamedNodeMap;
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
26
|
* @private
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./eventManager').EventManagerThis} EventManagerInstanceType
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('../class/selection').default} Selection
|
|
6
|
+
* @typedef {import('../class/format').default} Format
|
|
7
|
+
* @typedef {import('../class/listFormat').default} ListFormat
|
|
8
|
+
* @typedef {import('../class/component').default} Component
|
|
9
|
+
* @typedef {import('../class/html').default} Html
|
|
10
|
+
* @typedef {import('../class/nodeTransform').default} NodeTransform
|
|
11
|
+
* @typedef {import('../class/char').default} Char
|
|
12
|
+
* @typedef {import('../class/menu').default} Menu
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Object} SelectionPorts
|
|
16
|
+
* @property {(...args: Parameters<Selection['getRange']>) => ReturnType<Selection['getRange']>} getRange
|
|
17
|
+
* @property {(...args: Parameters<Selection['getNode']>) => ReturnType<Selection['getNode']>} getNode
|
|
18
|
+
* @property {(...args: Parameters<Selection['setRange']>) => ReturnType<Selection['setRange']>} setRange
|
|
19
|
+
* @property {(...args: Parameters<Selection['get']>) => ReturnType<Selection['get']>} get
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Object} FormatPorts
|
|
23
|
+
* @property {(...args: Parameters<Format['isLine']>) => ReturnType<Format['isLine']>} isLine
|
|
24
|
+
* @property {(...args: Parameters<Format['getLine']>) => ReturnType<Format['getLine']>} getLine
|
|
25
|
+
* @property {(...args: Parameters<Format['getLines']>) => ReturnType<Format['getLines']>} getLines
|
|
26
|
+
* @property {(...args: Parameters<Format['getBrLine']>) => ReturnType<Format['getBrLine']>} getBrLine
|
|
27
|
+
* @property {(...args: Parameters<Format['getBlock']>) => ReturnType<Format['getBlock']>} getBlock
|
|
28
|
+
* @property {(...args: Parameters<Format['isNormalLine']>) => ReturnType<Format['isNormalLine']>} isNormalLine
|
|
29
|
+
* @property {(...args: Parameters<Format['isBrLine']>) => ReturnType<Format['isBrLine']>} isBrLine
|
|
30
|
+
* @property {(...args: Parameters<Format['isClosureBrLine']>) => ReturnType<Format['isClosureBrLine']>} isClosureBrLine
|
|
31
|
+
* @property {(...args: Parameters<Format['isClosureBlock']>) => ReturnType<Format['isClosureBlock']>} isClosureBlock
|
|
32
|
+
* @property {(...args: Parameters<Format['isEdgeLine']>) => ReturnType<Format['isEdgeLine']>} isEdgeLine
|
|
33
|
+
* @property {(...args: Parameters<Format['removeBlock']>) => ReturnType<Format['removeBlock']>} removeBlock
|
|
34
|
+
* @property {(...args: Parameters<Format['addLine']>) => ReturnType<Format['addLine']>} addLine
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* @typedef {Object} ListFormatPorts
|
|
38
|
+
* @property {(...args: Parameters<ListFormat['applyNested']>) => ReturnType<ListFormat['applyNested']>} applyNested
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} ComponentPorts
|
|
42
|
+
* @property {(...args: Parameters<Component['deselect']>) => ReturnType<Component['deselect']>} deselect
|
|
43
|
+
* @property {(...args: Parameters<Component['is']>) => ReturnType<Component['is']>} is
|
|
44
|
+
* @property {(...args: Parameters<Component['get']>) => ReturnType<Component['get']>} get
|
|
45
|
+
* @property {(...args: Parameters<Component['select']>) => ReturnType<Component['select']>} select
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {Object} HtmlPorts
|
|
49
|
+
* @property {(...args: Parameters<Html['remove']>) => ReturnType<Html['remove']>} remove
|
|
50
|
+
* @property {(...args: Parameters<Html['insert']>) => ReturnType<Html['insert']>} insert
|
|
51
|
+
* @property {(...args: Parameters<Html['insertNode']>) => ReturnType<Html['insertNode']>} insertNode
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {Object} NodeTransformPorts
|
|
55
|
+
* @property {(...args: Parameters<NodeTransform['removeAllParents']>) => ReturnType<NodeTransform['removeAllParents']>} removeAllParents
|
|
56
|
+
* @property {(...args: Parameters<NodeTransform['split']>) => ReturnType<NodeTransform['split']>} split
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {Object} CharPorts
|
|
60
|
+
* @property {(...args: Parameters<Char['check']>) => ReturnType<Char['check']>} check
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {Object} MenuPorts
|
|
64
|
+
* @property {(...args: Parameters<Menu['dropdownOff']>) => ReturnType<Menu['dropdownOff']>} dropdownOff
|
|
65
|
+
*/
|
|
66
|
+
/**
|
|
67
|
+
* @description Create ports for event reducers
|
|
68
|
+
* @param {EventManagerInstanceType} inst - EventManager instance
|
|
69
|
+
* @param {Object} param1 - Additional parameters
|
|
70
|
+
* @param {*} param1._styleNodes - Style nodes reference object
|
|
71
|
+
*/
|
|
72
|
+
export function makePorts(
|
|
73
|
+
inst: EventManagerInstanceType,
|
|
74
|
+
{
|
|
75
|
+
_styleNodes
|
|
76
|
+
}: {
|
|
77
|
+
_styleNodes: any;
|
|
78
|
+
}
|
|
79
|
+
): {
|
|
80
|
+
editor: {
|
|
81
|
+
_nativeFocus: () => void;
|
|
82
|
+
blur: () => void;
|
|
83
|
+
};
|
|
84
|
+
selection: {
|
|
85
|
+
getRange: () => Range;
|
|
86
|
+
getNode: () => HTMLElement | Text;
|
|
87
|
+
setRange: (se: any, so: any, ec: any, eo: any) => Range;
|
|
88
|
+
get: () => globalThis.Selection;
|
|
89
|
+
};
|
|
90
|
+
format: {
|
|
91
|
+
isLine: (n: any) => n is HTMLElement;
|
|
92
|
+
getLine: (n: any, p: any) => HTMLElement;
|
|
93
|
+
getLines: (v: any) => HTMLElement[];
|
|
94
|
+
getBrLine: (n: any, p: any) => HTMLBRElement;
|
|
95
|
+
getBlock: (n: any, p: any) => HTMLElement;
|
|
96
|
+
isNormalLine: (n: any) => n is HTMLElement;
|
|
97
|
+
isBrLine: (n: any) => n is HTMLElement;
|
|
98
|
+
isClosureBrLine: (n: any) => n is HTMLElement;
|
|
99
|
+
isClosureBlock: (n: any) => n is HTMLElement;
|
|
100
|
+
isEdgeLine: (node: any, offset: any, dir: any) => node is HTMLElement;
|
|
101
|
+
removeBlock: (
|
|
102
|
+
n: any,
|
|
103
|
+
p: any
|
|
104
|
+
) => {
|
|
105
|
+
cc: Node;
|
|
106
|
+
sc: Node;
|
|
107
|
+
so: number;
|
|
108
|
+
ec: Node;
|
|
109
|
+
eo: number;
|
|
110
|
+
removeArray: Array<Node> | null;
|
|
111
|
+
};
|
|
112
|
+
addLine: (el: any, nextOrTag: any) => HTMLElement;
|
|
113
|
+
};
|
|
114
|
+
listFormat: {
|
|
115
|
+
applyNested: (
|
|
116
|
+
cells: any,
|
|
117
|
+
shift: any
|
|
118
|
+
) => {
|
|
119
|
+
sc: Node;
|
|
120
|
+
so: number;
|
|
121
|
+
ec: Node;
|
|
122
|
+
eo: number;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
component: {
|
|
126
|
+
deselect: () => void;
|
|
127
|
+
is: (n: any) => boolean;
|
|
128
|
+
get: (n: any) => __se__ComponentInfo;
|
|
129
|
+
select: (t: any, p: any) => boolean;
|
|
130
|
+
};
|
|
131
|
+
html: {
|
|
132
|
+
remove: () => {
|
|
133
|
+
container: Node;
|
|
134
|
+
offset: number;
|
|
135
|
+
commonCon?: Node | null;
|
|
136
|
+
prevContainer?: Node | null;
|
|
137
|
+
};
|
|
138
|
+
insert: (h: any, p: any) => HTMLElement;
|
|
139
|
+
insertNode: (n: any, p: any) => any;
|
|
140
|
+
};
|
|
141
|
+
history: {
|
|
142
|
+
push: (hard: any) => void;
|
|
143
|
+
};
|
|
144
|
+
nodeTransform: {
|
|
145
|
+
removeAllParents: (
|
|
146
|
+
s: any,
|
|
147
|
+
n: any,
|
|
148
|
+
p: any
|
|
149
|
+
) => {
|
|
150
|
+
sc: Node | null;
|
|
151
|
+
ec: Node | null;
|
|
152
|
+
};
|
|
153
|
+
split: (n: any, o: any, d: any) => HTMLElement;
|
|
154
|
+
};
|
|
155
|
+
char: {
|
|
156
|
+
check: (content: any) => boolean;
|
|
157
|
+
};
|
|
158
|
+
menu: {
|
|
159
|
+
dropdownOff: () => void;
|
|
160
|
+
};
|
|
161
|
+
setDefaultLine: (tag: any) => any;
|
|
162
|
+
hideToolbar: () => void;
|
|
163
|
+
hideToolbar_sub: () => void;
|
|
164
|
+
styleNodeCache: () => Node[];
|
|
165
|
+
formatAttrsTempCache: (attrs: any) => any;
|
|
166
|
+
setOnShortcutKey: (v: any) => any;
|
|
167
|
+
/**
|
|
168
|
+
* @description Scrolls the editor view to the caret position after pressing Enter. (Ignored on mobile devices)
|
|
169
|
+
* @param {Range} range Range object
|
|
170
|
+
*/
|
|
171
|
+
enterScrollTo(range: Range): void;
|
|
172
|
+
/**
|
|
173
|
+
* @description Prevents the default behavior of the Enter key and refocuses the editor.
|
|
174
|
+
* @param {Event} e The keyboard event
|
|
175
|
+
*/
|
|
176
|
+
enterPrevent(e: Event): void;
|
|
177
|
+
};
|
|
178
|
+
export type EventManagerInstanceType = import('./eventManager').EventManagerThis;
|
|
179
|
+
export type Selection = import('../class/selection').default;
|
|
180
|
+
export type Format = import('../class/format').default;
|
|
181
|
+
export type ListFormat = import('../class/listFormat').default;
|
|
182
|
+
export type Component = import('../class/component').default;
|
|
183
|
+
export type Html = import('../class/html').default;
|
|
184
|
+
export type NodeTransform = import('../class/nodeTransform').default;
|
|
185
|
+
export type Char = import('../class/char').default;
|
|
186
|
+
export type Menu = import('../class/menu').default;
|
|
187
|
+
export type SelectionPorts = {
|
|
188
|
+
getRange: (...args: Parameters<Selection['getRange']>) => ReturnType<Selection['getRange']>;
|
|
189
|
+
getNode: (...args: Parameters<Selection['getNode']>) => ReturnType<Selection['getNode']>;
|
|
190
|
+
setRange: (...args: Parameters<Selection['setRange']>) => ReturnType<Selection['setRange']>;
|
|
191
|
+
get: (...args: Parameters<Selection['get']>) => ReturnType<Selection['get']>;
|
|
192
|
+
};
|
|
193
|
+
export type FormatPorts = {
|
|
194
|
+
isLine: (...args: Parameters<Format['isLine']>) => ReturnType<Format['isLine']>;
|
|
195
|
+
getLine: (...args: Parameters<Format['getLine']>) => ReturnType<Format['getLine']>;
|
|
196
|
+
getLines: (...args: Parameters<Format['getLines']>) => ReturnType<Format['getLines']>;
|
|
197
|
+
getBrLine: (...args: Parameters<Format['getBrLine']>) => ReturnType<Format['getBrLine']>;
|
|
198
|
+
getBlock: (...args: Parameters<Format['getBlock']>) => ReturnType<Format['getBlock']>;
|
|
199
|
+
isNormalLine: (...args: Parameters<Format['isNormalLine']>) => ReturnType<Format['isNormalLine']>;
|
|
200
|
+
isBrLine: (...args: Parameters<Format['isBrLine']>) => ReturnType<Format['isBrLine']>;
|
|
201
|
+
isClosureBrLine: (...args: Parameters<Format['isClosureBrLine']>) => ReturnType<Format['isClosureBrLine']>;
|
|
202
|
+
isClosureBlock: (...args: Parameters<Format['isClosureBlock']>) => ReturnType<Format['isClosureBlock']>;
|
|
203
|
+
isEdgeLine: (...args: Parameters<Format['isEdgeLine']>) => ReturnType<Format['isEdgeLine']>;
|
|
204
|
+
removeBlock: (...args: Parameters<Format['removeBlock']>) => ReturnType<Format['removeBlock']>;
|
|
205
|
+
addLine: (...args: Parameters<Format['addLine']>) => ReturnType<Format['addLine']>;
|
|
206
|
+
};
|
|
207
|
+
export type ListFormatPorts = {
|
|
208
|
+
applyNested: (...args: Parameters<ListFormat['applyNested']>) => ReturnType<ListFormat['applyNested']>;
|
|
209
|
+
};
|
|
210
|
+
export type ComponentPorts = {
|
|
211
|
+
deselect: (...args: Parameters<Component['deselect']>) => ReturnType<Component['deselect']>;
|
|
212
|
+
is: (...args: Parameters<Component['is']>) => ReturnType<Component['is']>;
|
|
213
|
+
get: (...args: Parameters<Component['get']>) => ReturnType<Component['get']>;
|
|
214
|
+
select: (...args: Parameters<Component['select']>) => ReturnType<Component['select']>;
|
|
215
|
+
};
|
|
216
|
+
export type HtmlPorts = {
|
|
217
|
+
remove: (...args: Parameters<Html['remove']>) => ReturnType<Html['remove']>;
|
|
218
|
+
insert: (...args: Parameters<Html['insert']>) => ReturnType<Html['insert']>;
|
|
219
|
+
insertNode: (...args: Parameters<Html['insertNode']>) => ReturnType<Html['insertNode']>;
|
|
220
|
+
};
|
|
221
|
+
export type NodeTransformPorts = {
|
|
222
|
+
removeAllParents: (...args: Parameters<NodeTransform['removeAllParents']>) => ReturnType<NodeTransform['removeAllParents']>;
|
|
223
|
+
split: (...args: Parameters<NodeTransform['split']>) => ReturnType<NodeTransform['split']>;
|
|
224
|
+
};
|
|
225
|
+
export type CharPorts = {
|
|
226
|
+
check: (...args: Parameters<Char['check']>) => ReturnType<Char['check']>;
|
|
227
|
+
};
|
|
228
|
+
export type MenuPorts = {
|
|
229
|
+
dropdownOff: (...args: Parameters<Menu['dropdownOff']>) => ReturnType<Menu['dropdownOff']>;
|
|
230
|
+
};
|
|
231
|
+
export type EventReducerPorts = {
|
|
232
|
+
editor: {
|
|
233
|
+
_nativeFocus: () => void;
|
|
234
|
+
blur: () => void;
|
|
235
|
+
};
|
|
236
|
+
selection: SelectionPorts;
|
|
237
|
+
format: FormatPorts;
|
|
238
|
+
listFormat: ListFormatPorts;
|
|
239
|
+
component: ComponentPorts;
|
|
240
|
+
html: HtmlPorts;
|
|
241
|
+
history: {
|
|
242
|
+
push: (hard: boolean) => void;
|
|
243
|
+
};
|
|
244
|
+
nodeTransform: NodeTransformPorts;
|
|
245
|
+
char: CharPorts;
|
|
246
|
+
menu: MenuPorts;
|
|
247
|
+
setDefaultLine: (tag: string) => void;
|
|
248
|
+
hideToolbar: () => void;
|
|
249
|
+
hideToolbar_sub: () => void;
|
|
250
|
+
styleNodeCache: () => void;
|
|
251
|
+
formatAttrsTempCache: (attrs: { [x: string]: any }) => void;
|
|
252
|
+
setOnShortcutKey: (v: boolean) => void;
|
|
253
|
+
enterPrevent: (e: Event) => void;
|
|
254
|
+
enterScrollTo: (range: Range) => void;
|
|
255
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} KeydownReducerCtx - Keydown Reducer Context object
|
|
3
|
+
* @property {KeyboardEvent} ctx.e - The keyboard event
|
|
4
|
+
* @property {__se__FrameContext} ctx.fc - Frame context object
|
|
5
|
+
* @property {__se__EditorStatus} ctx.status - Editor status object
|
|
6
|
+
* @property {__se__BaseOptions} ctx.options - Options object
|
|
7
|
+
* @property {__se__FrameOptions} ctx.frameOptions - Frame options object
|
|
8
|
+
* @property {Range} ctx.range - Current selection range
|
|
9
|
+
* @property {HTMLElement|Text} ctx.selectionNode - Current selection node
|
|
10
|
+
* @property {HTMLElement} ctx.formatEl - Current format element
|
|
11
|
+
* @property {string} ctx.keyCode - Key code
|
|
12
|
+
* @property {boolean} ctx.ctrl - Whether the ctrl key is pressed
|
|
13
|
+
* @property {boolean} ctx.alt - Whether the alt key is pressed
|
|
14
|
+
* @property {boolean} ctx.shift - Whether the shift key is pressed
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @description Keydown event reducer
|
|
18
|
+
* @param {__se__EventPorts} ports - Ports for interacting with editor
|
|
19
|
+
* @param {KeydownReducerCtx} ctx - Context object
|
|
20
|
+
* @returns {Promise<__se__EventActions>} Action list
|
|
21
|
+
*/
|
|
22
|
+
export function reduceKeydown(ports: __se__EventPorts, ctx: KeydownReducerCtx): Promise<__se__EventActions>;
|
|
23
|
+
/**
|
|
24
|
+
* - Keydown Reducer Context object
|
|
25
|
+
*/
|
|
26
|
+
export type KeydownReducerCtx = {
|
|
27
|
+
/**
|
|
28
|
+
* - The keyboard event
|
|
29
|
+
*/
|
|
30
|
+
e: KeyboardEvent;
|
|
31
|
+
/**
|
|
32
|
+
* - Frame context object
|
|
33
|
+
*/
|
|
34
|
+
fc: __se__FrameContext;
|
|
35
|
+
/**
|
|
36
|
+
* - Editor status object
|
|
37
|
+
*/
|
|
38
|
+
status: __se__EditorStatus;
|
|
39
|
+
/**
|
|
40
|
+
* - Options object
|
|
41
|
+
*/
|
|
42
|
+
options: __se__BaseOptions;
|
|
43
|
+
/**
|
|
44
|
+
* - Frame options object
|
|
45
|
+
*/
|
|
46
|
+
frameOptions: __se__FrameOptions;
|
|
47
|
+
/**
|
|
48
|
+
* - Current selection range
|
|
49
|
+
*/
|
|
50
|
+
range: Range;
|
|
51
|
+
/**
|
|
52
|
+
* - Current selection node
|
|
53
|
+
*/
|
|
54
|
+
selectionNode: HTMLElement | Text;
|
|
55
|
+
/**
|
|
56
|
+
* - Current format element
|
|
57
|
+
*/
|
|
58
|
+
formatEl: HTMLElement;
|
|
59
|
+
/**
|
|
60
|
+
* - Key code
|
|
61
|
+
*/
|
|
62
|
+
keyCode: string;
|
|
63
|
+
/**
|
|
64
|
+
* - Whether the ctrl key is pressed
|
|
65
|
+
*/
|
|
66
|
+
ctrl: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* - Whether the alt key is pressed
|
|
69
|
+
*/
|
|
70
|
+
alt: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* - Whether the shift key is pressed
|
|
73
|
+
*/
|
|
74
|
+
shift: boolean;
|
|
75
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @this {void}
|
|
3
|
+
* @description Arrow key down rule
|
|
4
|
+
* @param {__se__EventActions} actions - Action list
|
|
5
|
+
* @param {__se__EventPorts} ports - Ports for interacting with editor
|
|
6
|
+
* @param {__se__EventKeydownCtx} ctx - Context object
|
|
7
|
+
*/
|
|
8
|
+
export function reduceArrowDown(this: void, actions: __se__EventActions, ports: __se__EventPorts, ctx: __se__EventKeydownCtx): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @this {void}
|
|
3
|
+
* @description Backspace key down rule
|
|
4
|
+
* @param {__se__EventActions} actions - Action list
|
|
5
|
+
* @param {__se__EventPorts} ports - Ports for interacting with editor
|
|
6
|
+
* @param {__se__EventKeydownCtx} ctx - Context object
|
|
7
|
+
* @returns {boolean} Return false to stop the processing
|
|
8
|
+
*/
|
|
9
|
+
export function reduceBackspaceDown(this: void, actions: __se__EventActions, ports: __se__EventPorts, ctx: __se__EventKeydownCtx): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @this {void}
|
|
3
|
+
* @description Delete key down rule
|
|
4
|
+
* @param {__se__EventActions} actions - Action list
|
|
5
|
+
* @param {__se__EventPorts} ports - Ports for interacting with editor
|
|
6
|
+
* @param {__se__EventKeydownCtx} ctx - Context object
|
|
7
|
+
* @returns {boolean} Return false to stop the processing
|
|
8
|
+
*/
|
|
9
|
+
export function reduceDeleteDown(this: void, actions: __se__EventActions, ports: __se__EventPorts, ctx: __se__EventKeydownCtx): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @this {void}
|
|
3
|
+
* @description Enter key down rule
|
|
4
|
+
* @param {__se__EventActions} actions - Action list
|
|
5
|
+
* @param {__se__EventPorts} ports - Ports for interacting with editor
|
|
6
|
+
* @param {__se__EventKeydownCtx} ctx - Context object
|
|
7
|
+
* @returns {boolean} Return false to stop the processing
|
|
8
|
+
*/
|
|
9
|
+
export function reduceEnterDown(this: void, actions: __se__EventActions, ports: __se__EventPorts, ctx: __se__EventKeydownCtx): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @this {void}
|
|
3
|
+
* @description Tab key down rule
|
|
4
|
+
* @param {__se__EventActions} actions - Action list
|
|
5
|
+
* @param {__se__EventPorts} _ports - Ports for interacting with editor
|
|
6
|
+
* @param {__se__EventKeydownCtx} ctx - Context object
|
|
7
|
+
* @returns {boolean} Return false to stop the processing
|
|
8
|
+
*/
|
|
9
|
+
export function reduceTabDown(this: void, actions: __se__EventActions, _ports: __se__EventPorts, ctx: __se__EventKeydownCtx): boolean;
|