suneditor 3.1.4 → 3.2.0
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/dist/suneditor-contents.min.css +1 -1
- package/dist/suneditor.min.css +28 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +2 -1
- package/src/assets/design/color.css +12 -0
- package/src/assets/design/size.css +9 -2
- package/src/assets/icons/defaultIcons.js +96 -47
- package/src/assets/suneditor-contents.css +3 -2
- package/src/assets/suneditor.css +480 -31
- package/src/core/config/contextProvider.js +2 -1
- package/src/core/config/eventManager.js +41 -2
- package/src/core/config/optionProvider.js +23 -2
- package/src/core/editor.js +32 -14
- package/src/core/event/actions/index.js +76 -9
- package/src/core/event/effects/common.registry.js +2 -1
- package/src/core/event/effects/keydown.registry.js +169 -33
- package/src/core/event/effects/ruleHelpers.js +20 -6
- package/src/core/event/eventOrchestrator.js +136 -23
- package/src/core/event/handlers/handler_toolbar.js +4 -2
- package/src/core/event/handlers/handler_ww_dragDrop.js +10 -0
- package/src/core/event/handlers/handler_ww_input.js +9 -2
- package/src/core/event/handlers/handler_ww_key.js +86 -17
- package/src/core/event/handlers/handler_ww_mouse.js +45 -8
- package/src/core/event/ports.js +23 -5
- package/src/core/event/reducers/keydown.reducer.js +15 -2
- package/src/core/event/rules/keydown.rule.arrow.js +12 -2
- package/src/core/event/rules/keydown.rule.backspace.js +110 -15
- package/src/core/event/rules/keydown.rule.delete.js +62 -7
- package/src/core/event/rules/keydown.rule.enter.js +62 -31
- package/src/core/event/support/defaultLineManager.js +9 -2
- package/src/core/event/support/selectionState.js +13 -3
- package/src/core/kernel/coreKernel.js +1 -0
- package/src/core/logic/dom/char.js +13 -3
- package/src/core/logic/dom/format.js +171 -39
- package/src/core/logic/dom/html.js +350 -72
- package/src/core/logic/dom/inline.js +229 -34
- package/src/core/logic/dom/listFormat.js +111 -20
- package/src/core/logic/dom/nodeTransform.js +36 -11
- package/src/core/logic/dom/offset.js +116 -31
- package/src/core/logic/dom/selection.js +147 -29
- package/src/core/logic/panel/blockHandle.js +785 -0
- package/src/core/logic/panel/blockResolver.js +278 -0
- package/src/core/logic/panel/finder.js +16 -6
- package/src/core/logic/panel/menu.js +119 -18
- package/src/core/logic/panel/toolbar.js +75 -19
- package/src/core/logic/panel/viewer.js +76 -20
- package/src/core/logic/shell/_commandExecutor.js +44 -9
- package/src/core/logic/shell/commandDispatcher.js +46 -4
- package/src/core/logic/shell/component.js +102 -25
- package/src/core/logic/shell/focusManager.js +13 -3
- package/src/core/logic/shell/history.js +21 -6
- package/src/core/logic/shell/pluginManager.js +21 -13
- package/src/core/logic/shell/shortcuts.js +9 -1
- package/src/core/logic/shell/ui.js +139 -37
- package/src/core/schema/frameContext.js +34 -3
- package/src/core/schema/options.js +46 -4
- package/src/core/section/constructor.js +537 -93
- package/src/core/section/documentType.js +35 -6
- package/src/helper/converter.js +24 -7
- package/src/helper/dom/domCheck.js +25 -5
- package/src/helper/dom/domQuery.js +2 -1
- package/src/helper/dom/domUtils.js +17 -4
- package/src/helper/env.js +11 -2
- package/src/helper/keyCodeMap.js +6 -2
- package/src/helper/markdown.js +24 -5
- package/src/helper/msOffice.js +9 -2
- package/src/interfaces/plugins.js +1 -1
- package/src/langs/ckb.js +0 -1
- package/src/langs/cs.js +0 -1
- package/src/langs/da.js +0 -1
- package/src/langs/de.js +0 -1
- package/src/langs/en.js +0 -1
- package/src/langs/es.js +0 -1
- package/src/langs/fa.js +0 -1
- package/src/langs/fr.js +0 -1
- package/src/langs/he.js +0 -1
- package/src/langs/hu.js +0 -1
- package/src/langs/index.js +27 -1
- package/src/langs/it.js +0 -1
- package/src/langs/ja.js +0 -1
- package/src/langs/km.js +0 -1
- package/src/langs/ko.js +0 -1
- package/src/langs/lv.js +0 -1
- package/src/langs/nl.js +0 -1
- package/src/langs/pl.js +0 -1
- package/src/langs/pt_br.js +0 -1
- package/src/langs/ro.js +0 -1
- package/src/langs/ru.js +0 -1
- package/src/langs/se.js +0 -1
- package/src/langs/tr.js +0 -1
- package/src/langs/uk.js +0 -1
- package/src/langs/ur.js +0 -1
- package/src/langs/zh_cn.js +0 -1
- package/src/modules/contract/Browser.js +58 -14
- package/src/modules/contract/ColorPicker.js +12 -4
- package/src/modules/contract/Controller.js +37 -7
- package/src/modules/contract/Figure.js +156 -36
- package/src/modules/contract/HueSlider.js +27 -4
- package/src/modules/contract/Modal.js +50 -10
- package/src/modules/manager/FileManager.js +50 -8
- package/src/modules/ui/CommandMenu.js +597 -0
- package/src/modules/ui/ModalAnchorEditor.js +33 -6
- package/src/modules/ui/SelectMenu.js +481 -36
- package/src/modules/ui/index.js +1 -0
- package/src/plugins/browser/audioGallery.js +2 -1
- package/src/plugins/browser/fileBrowser.js +9 -2
- package/src/plugins/browser/fileGallery.js +2 -1
- package/src/plugins/browser/imageGallery.js +18 -3
- package/src/plugins/browser/videoGallery.js +13 -4
- package/src/plugins/command/blockquote.js +6 -1
- package/src/plugins/command/codeBlock.js +43 -5
- package/src/plugins/command/exportPDF.js +20 -4
- package/src/plugins/command/fileUpload.js +46 -11
- package/src/plugins/command/list_bulleted.js +6 -1
- package/src/plugins/command/list_numbered.js +6 -1
- package/src/plugins/dropdown/align.js +21 -33
- package/src/plugins/dropdown/backgroundColor.js +10 -2
- package/src/plugins/dropdown/blockStyle.js +17 -22
- package/src/plugins/dropdown/font.js +34 -34
- package/src/plugins/dropdown/hr.js +15 -43
- package/src/plugins/dropdown/layout.js +10 -27
- package/src/plugins/dropdown/lineHeight.js +10 -33
- package/src/plugins/dropdown/list.js +19 -25
- package/src/plugins/dropdown/paragraphStyle.js +16 -24
- package/src/plugins/dropdown/table/index.js +72 -17
- package/src/plugins/dropdown/table/render/table.html.js +3 -1
- package/src/plugins/dropdown/table/services/table.cell.js +33 -7
- package/src/plugins/dropdown/table/services/table.clipboard.js +5 -1
- package/src/plugins/dropdown/table/services/table.grid.js +40 -9
- package/src/plugins/dropdown/table/services/table.resize.js +55 -11
- package/src/plugins/dropdown/table/services/table.selection.js +27 -7
- package/src/plugins/dropdown/table/services/table.style.js +120 -20
- package/src/plugins/dropdown/template.js +13 -29
- package/src/plugins/dropdown/textStyle.js +22 -35
- package/src/plugins/field/autocomplete.js +8 -4
- package/src/plugins/field/slashCommand.js +297 -0
- package/src/plugins/index.js +3 -0
- package/src/plugins/input/fontSize.js +37 -8
- package/src/plugins/input/pageNavigator.js +7 -1
- package/src/plugins/modal/audio.js +71 -17
- package/src/plugins/modal/drawing.js +41 -11
- package/src/plugins/modal/embed.js +92 -22
- package/src/plugins/modal/image/index.js +114 -28
- package/src/plugins/modal/image/services/image.size.js +9 -2
- package/src/plugins/modal/image/services/image.upload.js +38 -4
- package/src/plugins/modal/link.js +9 -2
- package/src/plugins/modal/math.js +10 -2
- package/src/plugins/modal/video/index.js +112 -26
- package/src/plugins/modal/video/render/video.html.js +4 -1
- package/src/plugins/modal/video/services/video.size.js +15 -4
- package/src/plugins/modal/video/services/video.upload.js +10 -2
- package/src/plugins/popup/anchor.js +14 -2
- package/src/suneditor.js +8 -2
- package/src/themes/cobalt.css +12 -0
- package/src/themes/cream.css +12 -0
- package/src/themes/dark.css +12 -0
- package/src/themes/midnight.css +12 -0
- package/src/typedef.js +32 -21
- package/types/assets/icons/defaultIcons.d.ts +1 -0
- package/types/core/config/contextProvider.d.ts +7 -1
- package/types/core/config/eventManager.d.ts +37 -4
- package/types/core/config/optionProvider.d.ts +5 -1
- package/types/core/event/actions/index.d.ts +44 -6
- package/types/core/event/effects/keydown.registry.d.ts +37 -7
- package/types/core/event/effects/ruleHelpers.d.ts +6 -1
- package/types/core/event/eventOrchestrator.d.ts +6 -1
- package/types/core/event/handlers/handler_ww_clipboard.d.ts +15 -3
- package/types/core/event/handlers/handler_ww_dragDrop.d.ts +14 -2
- package/types/core/event/handlers/handler_ww_input.d.ts +10 -2
- package/types/core/event/handlers/handler_ww_key.d.ts +10 -2
- package/types/core/event/handlers/handler_ww_mouse.d.ts +25 -5
- package/types/core/event/ports.d.ts +7 -2
- package/types/core/event/rules/keydown.rule.backspace.d.ts +6 -1
- package/types/core/kernel/store.d.ts +4 -1
- package/types/core/logic/dom/format.d.ts +32 -14
- package/types/core/logic/dom/html.d.ts +11 -3
- package/types/core/logic/dom/nodeTransform.d.ts +6 -6
- package/types/core/logic/panel/blockHandle.d.ts +64 -0
- package/types/core/logic/panel/blockResolver.d.ts +50 -0
- package/types/core/logic/panel/menu.d.ts +72 -3
- package/types/core/logic/shell/commandDispatcher.d.ts +8 -0
- package/types/core/logic/shell/component.d.ts +5 -3
- package/types/core/logic/shell/shortcuts.d.ts +10 -1
- package/types/core/logic/shell/ui.d.ts +7 -1
- package/types/core/schema/context.d.ts +7 -1
- package/types/core/schema/frameContext.d.ts +36 -4
- package/types/core/schema/options.d.ts +83 -2
- package/types/core/section/constructor.d.ts +38 -1
- package/types/events.d.ts +208 -32
- package/types/helper/converter.d.ts +4 -2
- package/types/helper/dom/domCheck.d.ts +12 -2
- package/types/helper/dom/domQuery.d.ts +35 -7
- package/types/helper/dom/domUtils.d.ts +4 -1
- package/types/interfaces/plugins.d.ts +2 -2
- package/types/langs/_Lang.d.ts +0 -1
- package/types/modules/contract/ColorPicker.d.ts +2 -2
- package/types/modules/contract/Controller.d.ts +7 -0
- package/types/modules/contract/Figure.d.ts +31 -4
- package/types/modules/ui/CommandMenu.d.ts +262 -0
- package/types/modules/ui/SelectMenu.d.ts +56 -3
- package/types/modules/ui/index.d.ts +1 -0
- package/types/plugins/browser/audioGallery.d.ts +1 -1
- package/types/plugins/browser/fileBrowser.d.ts +1 -1
- package/types/plugins/browser/fileGallery.d.ts +1 -1
- package/types/plugins/browser/imageGallery.d.ts +1 -1
- package/types/plugins/browser/videoGallery.d.ts +1 -1
- package/types/plugins/dropdown/align.d.ts +1 -1
- package/types/plugins/dropdown/blockStyle.d.ts +3 -1
- package/types/plugins/dropdown/table/index.d.ts +4 -1
- package/types/plugins/dropdown/table/services/table.clipboard.d.ts +5 -1
- package/types/plugins/dropdown/table/services/table.grid.d.ts +10 -2
- package/types/plugins/field/autocomplete.d.ts +0 -1
- package/types/plugins/field/slashCommand.d.ts +165 -0
- package/types/plugins/index.d.ts +3 -0
- package/types/plugins/modal/link.d.ts +4 -1
- package/types/typedef.d.ts +48 -23
|
@@ -10,7 +10,11 @@ declare class EventManager {
|
|
|
10
10
|
* @param {import('./optionProvider').default} optionProvider
|
|
11
11
|
* @param {import('../kernel/coreKernel').Deps} $
|
|
12
12
|
*/
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(
|
|
14
|
+
contextProvider: import('./contextProvider').default,
|
|
15
|
+
optionProvider: import('./optionProvider').default,
|
|
16
|
+
$: import('../kernel/coreKernel').Deps,
|
|
17
|
+
);
|
|
14
18
|
/**
|
|
15
19
|
* @description Events object, call by triggerEvent function
|
|
16
20
|
* @type {SunEditor.Event.Handlers}
|
|
@@ -21,6 +25,22 @@ declare class EventManager {
|
|
|
21
25
|
* @type {(eventName: string, ...args: *) => Promise<*>}
|
|
22
26
|
*/
|
|
23
27
|
triggerEvent: (eventName: string, ...args: any) => Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
* @description Bind the EventOrchestrator once it is constructed. Invoked by `coreKernel`
|
|
31
|
+
* immediately after orchestrator creation so the public `applyTagEffect` method below can delegate.
|
|
32
|
+
* @param {import('../event/eventOrchestrator').default} orchestrator
|
|
33
|
+
*/
|
|
34
|
+
_bindOrchestrator(orchestrator: import('../event/eventOrchestrator').default): void;
|
|
35
|
+
/**
|
|
36
|
+
* @description Re-run the toolbar/menu active-state pass against the given selection node (or the
|
|
37
|
+
* current selection if `null`). Thin pass-through to {@link EventOrchestrator#applyTagEffect};
|
|
38
|
+
* exposed on `$.eventManager` so modules/plugins can request an immediate sync after they mutate
|
|
39
|
+
* `commandDispatcher.targets` (e.g. CommandMenu pushing newly-rendered rows).
|
|
40
|
+
* @param {?Node} [selectionNode]
|
|
41
|
+
* @returns {Node | undefined}
|
|
42
|
+
*/
|
|
43
|
+
applyTagEffect(selectionNode?: Node | null): Node | undefined;
|
|
24
44
|
/**
|
|
25
45
|
* @description Register for an event.
|
|
26
46
|
* - Only events registered with this method are unregistered or re-registered when methods such as 'setOptions', 'destroy' are called.
|
|
@@ -30,7 +50,12 @@ declare class EventManager {
|
|
|
30
50
|
* @param {boolean|AddEventListenerOptions} [useCapture] Event useCapture option
|
|
31
51
|
* @return {?SunEditor.Event.Info} Registered event information
|
|
32
52
|
*/
|
|
33
|
-
addEvent(
|
|
53
|
+
addEvent(
|
|
54
|
+
target: any,
|
|
55
|
+
type: string,
|
|
56
|
+
listener: any,
|
|
57
|
+
useCapture?: boolean | AddEventListenerOptions,
|
|
58
|
+
): SunEditor.Event.Info | null;
|
|
34
59
|
/**
|
|
35
60
|
* @description Remove event
|
|
36
61
|
* @param {SunEditor.Event.Info} params event info = this.addEvent()
|
|
@@ -45,7 +70,11 @@ declare class EventManager {
|
|
|
45
70
|
* @param {boolean|AddEventListenerOptions} [useCapture] Use event capture
|
|
46
71
|
* @return {SunEditor.Event.GlobalInfo} Registered event information
|
|
47
72
|
*/
|
|
48
|
-
addGlobalEvent(
|
|
73
|
+
addGlobalEvent(
|
|
74
|
+
type: string,
|
|
75
|
+
listener: any,
|
|
76
|
+
useCapture?: boolean | AddEventListenerOptions,
|
|
77
|
+
): SunEditor.Event.GlobalInfo;
|
|
49
78
|
/**
|
|
50
79
|
* @description Remove events from document.
|
|
51
80
|
* - When created as an Iframe, the event of the document inside the Iframe is also removed.
|
|
@@ -54,7 +83,11 @@ declare class EventManager {
|
|
|
54
83
|
* @param {boolean|AddEventListenerOptions} [useCapture] Use event capture
|
|
55
84
|
* @returns {undefined|null} Success: `null`, Not found: `undefined`
|
|
56
85
|
*/
|
|
57
|
-
removeGlobalEvent(
|
|
86
|
+
removeGlobalEvent(
|
|
87
|
+
type: string | SunEditor.Event.GlobalInfo,
|
|
88
|
+
listener?: any,
|
|
89
|
+
useCapture?: boolean | AddEventListenerOptions,
|
|
90
|
+
): undefined | null;
|
|
58
91
|
/**
|
|
59
92
|
* @internal
|
|
60
93
|
* @description Gives an active effect when the mouse down event is blocked. (Used when "env.isGecko" is `true`)
|
|
@@ -52,7 +52,11 @@ export default class OptionProvider {
|
|
|
52
52
|
* @param {SunEditor.Kernel} kernel
|
|
53
53
|
* @param {import('../section/constructor').ConstructorReturnType} product
|
|
54
54
|
*/
|
|
55
|
-
constructor(
|
|
55
|
+
constructor(
|
|
56
|
+
kernel: SunEditor.Kernel,
|
|
57
|
+
product: import('../section/constructor').ConstructorReturnType,
|
|
58
|
+
options: any,
|
|
59
|
+
);
|
|
56
60
|
/**
|
|
57
61
|
* @return {BaseOptionsMap}
|
|
58
62
|
*/
|
|
@@ -10,29 +10,67 @@ export namespace A {
|
|
|
10
10
|
function historyPush(hard: boolean): Action;
|
|
11
11
|
function documentTypeRefreshHeader(): Action;
|
|
12
12
|
function selectionSetRange(sc: Node, so: number, ec: Node, eo: number): Action;
|
|
13
|
-
function formatRemoveBlock(
|
|
13
|
+
function formatRemoveBlock(
|
|
14
|
+
rangeEl: Element,
|
|
15
|
+
selectedFormats: Element[] | null,
|
|
16
|
+
newBlockElement: Element | null,
|
|
17
|
+
shouldDelete: boolean,
|
|
18
|
+
skipHistory: boolean,
|
|
19
|
+
): Action;
|
|
14
20
|
function domUtilsRemoveItem(item: Node): Action;
|
|
15
21
|
function selectComponentFallback(cmponentInfo: SunEditor.ComponentInfo): Action;
|
|
16
22
|
function delFormatRemoveAndMove(container: Node, formatEl: Element): Action;
|
|
17
23
|
function backspaceFormatMaintain(formatEl: Element): Action;
|
|
18
24
|
function backspaceBrLineStrip(formatEl: Element): Action;
|
|
19
|
-
function backspaceComponentSelect(
|
|
20
|
-
|
|
25
|
+
function backspaceComponentSelect(
|
|
26
|
+
selectionNode: Node,
|
|
27
|
+
range: Range,
|
|
28
|
+
fileComponentInfo: SunEditor.ComponentInfo,
|
|
29
|
+
): Action;
|
|
30
|
+
function backspaceComponentRemove(
|
|
31
|
+
isList: boolean,
|
|
32
|
+
sel: Node,
|
|
33
|
+
formatEl: Element,
|
|
34
|
+
fileComponentInfo: SunEditor.ComponentInfo,
|
|
35
|
+
): Action;
|
|
21
36
|
function backspaceListMergePrev(prev: Element, formatEl: Element, rangeEl: Element): Action;
|
|
22
37
|
function backspaceListRemoveNested(range: Range): Action;
|
|
38
|
+
function backspaceEmptyLineMergePrev(formatEl: Element, prev: Element): Action;
|
|
39
|
+
function backspaceBrLineRowMerge(rowEndBr: Node, rowStartBr: Node): Action;
|
|
23
40
|
function deleteComponentSelect(formatEl: Element, fileComponentInfo: SunEditor.ComponentInfo): Action;
|
|
24
41
|
function deleteComponentSelectNext(formatEl: any, nextEl: Element): Action;
|
|
25
42
|
function deleteListRemoveNested(range: Range, formatEl: Element, rangeEl: Element): Action;
|
|
43
|
+
function deleteEmptyLineMergeNext(formatEl: Element, next: Element): Action;
|
|
44
|
+
function deleteBrLineRowMerge(rowEndBr: Node): Action;
|
|
26
45
|
function tabFormatIndent(range: Range, formatEl: Element, shift: boolean): Action;
|
|
27
46
|
function enterScrollTo(range: Range): Action;
|
|
28
47
|
function enterLineAddDefault(formatEl: Element): Action;
|
|
29
48
|
function enterListAddItem(formatEl: Element, selectionNode: Node): Action;
|
|
30
49
|
function enterFormatExitEmpty(formatEl: Element, rangeEl: Element): Action;
|
|
31
|
-
function enterFormatCleanBrAndZWS(
|
|
50
|
+
function enterFormatCleanBrAndZWS(
|
|
51
|
+
selectionNode: Node,
|
|
52
|
+
selectionFormat: boolean,
|
|
53
|
+
brBlock: Element,
|
|
54
|
+
children: NodeList,
|
|
55
|
+
offset: number,
|
|
56
|
+
): Action;
|
|
32
57
|
function enterFormatInsertBrHtml(brBlock: Element, range: Range, wSelection: Selection, offset: number): Action;
|
|
33
58
|
function enterFormatInsertBrNode(wSelection: Selection): Action;
|
|
34
|
-
function
|
|
35
|
-
function
|
|
59
|
+
function enterBrLineInsert(range: Range): Action;
|
|
60
|
+
function enterBrLineExit(brBlock: Element): Action;
|
|
61
|
+
function enterFormatBreakAtEdge(
|
|
62
|
+
formatEl: Element,
|
|
63
|
+
selectionNode: Node,
|
|
64
|
+
formatStartEdge: boolean,
|
|
65
|
+
formatEndEdge: boolean,
|
|
66
|
+
bidiSwapped?: boolean,
|
|
67
|
+
): Action;
|
|
68
|
+
function enterFormatBreakWithSelection(
|
|
69
|
+
formatEl: Element,
|
|
70
|
+
range: Range,
|
|
71
|
+
formatStartEdge: boolean,
|
|
72
|
+
formatEndEdge: boolean,
|
|
73
|
+
): Action;
|
|
36
74
|
function enterFormatBreakAtCursor(formatEl: Element, range: Range): Action;
|
|
37
75
|
function enterFigcaptionExitInList(formatEl: Element): Action;
|
|
38
76
|
function keydownInputInsertNbsp(): Action;
|
|
@@ -9,13 +9,23 @@ declare const _default: {
|
|
|
9
9
|
/** @action backspaceFormatMaintain */
|
|
10
10
|
'backspace.format.maintain': ({ ctx }: EffectContext_keydown, { formatEl }: any) => void;
|
|
11
11
|
/** @action backspaceComponentSelect */
|
|
12
|
-
'backspace.component.select': (
|
|
12
|
+
'backspace.component.select': (
|
|
13
|
+
{ ports }: EffectContext_keydown,
|
|
14
|
+
{ selectionNode, range, fileComponentInfo }: any,
|
|
15
|
+
) => void;
|
|
13
16
|
/** @action backspaceComponentRemove */
|
|
14
|
-
'backspace.component.remove': (
|
|
17
|
+
'backspace.component.remove': (
|
|
18
|
+
{ ports }: EffectContext_keydown,
|
|
19
|
+
{ isList, sel, formatEl, fileComponentInfo }: any,
|
|
20
|
+
) => void;
|
|
15
21
|
/** @action backspaceListMergePrev */
|
|
16
22
|
'backspace.list.mergePrev': ({ ports }: EffectContext_keydown, { prev, formatEl, rangeEl }: any) => void;
|
|
17
23
|
/** @action backspaceListRemoveNested */
|
|
18
24
|
'backspace.list.removeNested': ({ ports }: EffectContext_keydown, { range }: any) => void;
|
|
25
|
+
/** @action backspaceEmptyLineMergePrev */
|
|
26
|
+
'backspace.emptyLine.mergePrev': ({ ports }: EffectContext_keydown, { formatEl, prev }: any) => void;
|
|
27
|
+
/** @action backspaceBrLineRowMerge */
|
|
28
|
+
'backspace.brline.rowMerge': ({ ports }: EffectContext_keydown, { rowEndBr, rowStartBr }: any) => void;
|
|
19
29
|
/** [delete] */
|
|
20
30
|
/** @action deleteComponentSelect */
|
|
21
31
|
'delete.component.select': ({ ports }: EffectContext_keydown, { formatEl, fileComponentInfo }: any) => void;
|
|
@@ -23,6 +33,10 @@ declare const _default: {
|
|
|
23
33
|
'delete.component.selectNext': ({ ports, ctx }: EffectContext_keydown, { formatEl, nextEl }: any) => void;
|
|
24
34
|
/** @action deleteListRemoveNested */
|
|
25
35
|
'delete.list.removeNested': ({ ports, ctx }: EffectContext_keydown, { range, formatEl, rangeEl }: any) => void;
|
|
36
|
+
/** @action deleteEmptyLineMergeNext — remove an empty line, move caret to the start of the next line */
|
|
37
|
+
'delete.emptyLine.mergeNext': ({ ports }: EffectContext_keydown, { formatEl, next }: any) => void;
|
|
38
|
+
/** @action deleteBrLineRowMerge — remove an empty row inside a brLine (PRE), pull the next row up */
|
|
39
|
+
'delete.brline.rowMerge': ({ ports }: EffectContext_keydown, { rowEndBr }: any) => void;
|
|
26
40
|
/** [tab] */
|
|
27
41
|
/** @action tabFormatIndent */
|
|
28
42
|
'tab.format.indent': ({ ports, ctx }: EffectContext_keydown, { range, formatEl, shift }: any) => boolean;
|
|
@@ -30,21 +44,37 @@ declare const _default: {
|
|
|
30
44
|
/** @action enterScrollTo */
|
|
31
45
|
'enter.scrollTo': ({ ports }: EffectContext_keydown, { range }: any) => void;
|
|
32
46
|
/** @action enterLineAddDefault */
|
|
33
|
-
'enter.line.addDefault': ({ ports
|
|
47
|
+
'enter.line.addDefault': ({ ports }: EffectContext_keydown, { formatEl }: any) => void;
|
|
34
48
|
/** @action enterListAddItem */
|
|
35
49
|
'enter.list.addItem': ({ ports }: EffectContext_keydown, { formatEl, selectionNode }: any) => void;
|
|
36
50
|
/** @action enterFormatExitEmpty */
|
|
37
51
|
'enter.format.exitEmpty': ({ ports, ctx }: EffectContext_keydown, { formatEl, rangeEl }: any) => void;
|
|
38
52
|
/** @action enterFormatCleanBrAndZWS */
|
|
39
|
-
'enter.format.cleanBrAndZWS': (
|
|
53
|
+
'enter.format.cleanBrAndZWS': (
|
|
54
|
+
{ ports }: EffectContext_keydown,
|
|
55
|
+
{ selectionNode, selectionFormat, brBlock, children, offset }: any,
|
|
56
|
+
) => void;
|
|
40
57
|
/** @action enterFormatInsertBrHtml */
|
|
41
|
-
'enter.format.insertBrHtml': (
|
|
58
|
+
'enter.format.insertBrHtml': (
|
|
59
|
+
{ ports }: EffectContext_keydown,
|
|
60
|
+
{ brBlock, range, wSelection, offset }: any,
|
|
61
|
+
) => void;
|
|
62
|
+
/** @action enterBrLineInsert — insert exactly one empty row at the caret inside a normal brLine. */
|
|
63
|
+
'enter.brline.insert': ({ ports }: EffectContext_keydown, { range }: any) => void;
|
|
64
|
+
/** @action enterBrLineExit — consume only the caret's current (last) empty row and add a default line after the brLine. */
|
|
65
|
+
'enter.brline.exit': ({ ports }: EffectContext_keydown, { brBlock }: any) => void;
|
|
42
66
|
/** @action enterFormatInsertBrNode */
|
|
43
67
|
'enter.format.insertBrNode': ({ ports }: EffectContext_keydown, { wSelection }: any) => void;
|
|
44
68
|
/** @action enterFormatBreakAtEdge */
|
|
45
|
-
'enter.format.breakAtEdge': (
|
|
69
|
+
'enter.format.breakAtEdge': (
|
|
70
|
+
{ ports, ctx }: EffectContext_keydown,
|
|
71
|
+
{ formatEl, selectionNode, formatStartEdge, formatEndEdge, bidiSwapped }: any,
|
|
72
|
+
) => void;
|
|
46
73
|
/** @action enterFormatBreakWithSelection */
|
|
47
|
-
'enter.format.breakWithSelection': (
|
|
74
|
+
'enter.format.breakWithSelection': (
|
|
75
|
+
{ ports, ctx }: EffectContext_keydown,
|
|
76
|
+
{ formatEl, range, formatStartEdge, formatEndEdge }: any,
|
|
77
|
+
) => void;
|
|
48
78
|
/** @action enterFormatBreakAtCursor */
|
|
49
79
|
'enter.format.breakAtCursor': ({ ports, ctx }: EffectContext_keydown, { formatEl, range }: any) => void;
|
|
50
80
|
/** @action enterFigcaptionExitInList */
|
|
@@ -45,4 +45,9 @@ export function setDefaultLine(ports: EventPorts, lineTagName: string): void;
|
|
|
45
45
|
* @param {Document} doc - The document object
|
|
46
46
|
* @returns {boolean} true if the detected edge doesn't match the visual position (bidi mismatch)
|
|
47
47
|
*/
|
|
48
|
-
export function isRtlBidiMismatch(
|
|
48
|
+
export function isRtlBidiMismatch(
|
|
49
|
+
range: Range,
|
|
50
|
+
formatEl: HTMLElement,
|
|
51
|
+
detectedEdge: 'front' | 'end',
|
|
52
|
+
doc: Document,
|
|
53
|
+
): boolean;
|
|
@@ -96,7 +96,12 @@ declare class EventOrchestrator extends KernelInjector {
|
|
|
96
96
|
* @param {SunEditor.FrameContext} frameContext The frame context
|
|
97
97
|
* @returns {Promise<boolean>} Resolves to `false` if processing is complete, otherwise allows default behavior
|
|
98
98
|
*/
|
|
99
|
-
_dataTransferAction(
|
|
99
|
+
_dataTransferAction(
|
|
100
|
+
type: 'paste' | 'drop',
|
|
101
|
+
e: Event,
|
|
102
|
+
clipboardData: DataTransfer,
|
|
103
|
+
frameContext: SunEditor.FrameContext,
|
|
104
|
+
): Promise<boolean>;
|
|
100
105
|
/**
|
|
101
106
|
* @internal
|
|
102
107
|
* @description Registers common UI events such as toolbar and menu interactions.
|
|
@@ -6,12 +6,20 @@ import type {} from '../../../typedef';
|
|
|
6
6
|
* @this {EventManagerThis_handler_ww_clipboard}
|
|
7
7
|
* @param {ClipboardEvent} e - Event object
|
|
8
8
|
*/
|
|
9
|
-
export function OnPaste_wysiwyg(
|
|
9
|
+
export function OnPaste_wysiwyg(
|
|
10
|
+
this: import('../eventOrchestrator').default,
|
|
11
|
+
frameContext: any,
|
|
12
|
+
e: ClipboardEvent,
|
|
13
|
+
): true | Promise<boolean>;
|
|
10
14
|
/**
|
|
11
15
|
* @this {EventManagerThis_handler_ww_clipboard}
|
|
12
16
|
* @param {ClipboardEvent} e - Event object
|
|
13
17
|
*/
|
|
14
|
-
export function OnCopy_wysiwyg(
|
|
18
|
+
export function OnCopy_wysiwyg(
|
|
19
|
+
this: import('../eventOrchestrator').default,
|
|
20
|
+
frameContext: any,
|
|
21
|
+
e: ClipboardEvent,
|
|
22
|
+
): Promise<boolean>;
|
|
15
23
|
export class OnCopy_wysiwyg {
|
|
16
24
|
/**
|
|
17
25
|
* @this {EventManagerThis_handler_ww_clipboard}
|
|
@@ -24,7 +32,11 @@ export class OnCopy_wysiwyg {
|
|
|
24
32
|
* @this {EventManagerThis_handler_ww_clipboard}
|
|
25
33
|
* @param {ClipboardEvent} e - Event object
|
|
26
34
|
*/
|
|
27
|
-
export function OnCut_wysiwyg(
|
|
35
|
+
export function OnCut_wysiwyg(
|
|
36
|
+
this: import('../eventOrchestrator').default,
|
|
37
|
+
frameContext: any,
|
|
38
|
+
e: ClipboardEvent,
|
|
39
|
+
): Promise<boolean>;
|
|
28
40
|
export class OnCut_wysiwyg {
|
|
29
41
|
/**
|
|
30
42
|
* @this {EventManagerThis_handler_ww_clipboard}
|
|
@@ -10,7 +10,14 @@ import type {} from '../../../typedef';
|
|
|
10
10
|
* @param {?HTMLElement} _innerToolbar - Inner toolbar element
|
|
11
11
|
* @param {DragEvent} e - Event object
|
|
12
12
|
*/
|
|
13
|
-
export function OnDragOver_wysiwyg(
|
|
13
|
+
export function OnDragOver_wysiwyg(
|
|
14
|
+
this: import('../eventOrchestrator').default,
|
|
15
|
+
fc: SunEditor.FrameContext,
|
|
16
|
+
dragCursor: HTMLElement,
|
|
17
|
+
_iframeTopArea: HTMLElement | null,
|
|
18
|
+
_innerToolbar: HTMLElement | null,
|
|
19
|
+
e: DragEvent,
|
|
20
|
+
): void;
|
|
14
21
|
/**
|
|
15
22
|
* @this {EventManagerThis_handler_ww_dragDrop}
|
|
16
23
|
* @param {HTMLElement} dragCursor - Drag cursor element
|
|
@@ -22,5 +29,10 @@ export function OnDragEnd_wysiwyg(this: import('../eventOrchestrator').default,
|
|
|
22
29
|
* @param {HTMLElement} dragCursor - Drag cursor element
|
|
23
30
|
* @param {DragEvent} e - Event object
|
|
24
31
|
*/
|
|
25
|
-
export function OnDrop_wysiwyg(
|
|
32
|
+
export function OnDrop_wysiwyg(
|
|
33
|
+
this: import('../eventOrchestrator').default,
|
|
34
|
+
fc: SunEditor.FrameContext,
|
|
35
|
+
dragCursor: HTMLElement,
|
|
36
|
+
e: DragEvent,
|
|
37
|
+
): boolean | Promise<boolean>;
|
|
26
38
|
export type EventManagerThis_handler_ww_dragDrop = import('../eventOrchestrator').default;
|
|
@@ -7,7 +7,11 @@ import type {} from '../../../typedef';
|
|
|
7
7
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
8
8
|
* @param {InputEvent} e - Event object
|
|
9
9
|
*/
|
|
10
|
-
export function OnBeforeInput_wysiwyg(
|
|
10
|
+
export function OnBeforeInput_wysiwyg(
|
|
11
|
+
this: import('../eventOrchestrator').default,
|
|
12
|
+
fc: SunEditor.FrameContext,
|
|
13
|
+
e: InputEvent,
|
|
14
|
+
): Promise<boolean>;
|
|
11
15
|
export class OnBeforeInput_wysiwyg {
|
|
12
16
|
/**
|
|
13
17
|
* @typedef {import('../eventOrchestrator').default} EventManagerThis_handler_ww_input
|
|
@@ -25,7 +29,11 @@ export class OnBeforeInput_wysiwyg {
|
|
|
25
29
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
26
30
|
* @param {InputEvent} e - Event object
|
|
27
31
|
*/
|
|
28
|
-
export function OnInput_wysiwyg(
|
|
32
|
+
export function OnInput_wysiwyg(
|
|
33
|
+
this: import('../eventOrchestrator').default,
|
|
34
|
+
fc: SunEditor.FrameContext,
|
|
35
|
+
e: InputEvent,
|
|
36
|
+
): Promise<boolean>;
|
|
29
37
|
export class OnInput_wysiwyg {
|
|
30
38
|
/**
|
|
31
39
|
* @this {EventManagerThis_handler_ww_input}
|
|
@@ -7,7 +7,11 @@ import type {} from '../../../typedef';
|
|
|
7
7
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
8
8
|
* @param {KeyboardEvent} e - Event object
|
|
9
9
|
*/
|
|
10
|
-
export function OnKeyDown_wysiwyg(
|
|
10
|
+
export function OnKeyDown_wysiwyg(
|
|
11
|
+
this: import('../eventOrchestrator').default,
|
|
12
|
+
fc: SunEditor.FrameContext,
|
|
13
|
+
e: KeyboardEvent,
|
|
14
|
+
): Promise<boolean>;
|
|
11
15
|
export class OnKeyDown_wysiwyg {
|
|
12
16
|
/**
|
|
13
17
|
* @typedef {import('../eventOrchestrator').default} EventManagerThis_handler_ww_key_input
|
|
@@ -26,7 +30,11 @@ export class OnKeyDown_wysiwyg {
|
|
|
26
30
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
27
31
|
* @param {KeyboardEvent} e - Event object
|
|
28
32
|
*/
|
|
29
|
-
export function OnKeyUp_wysiwyg(
|
|
33
|
+
export function OnKeyUp_wysiwyg(
|
|
34
|
+
this: import('../eventOrchestrator').default,
|
|
35
|
+
fc: SunEditor.FrameContext,
|
|
36
|
+
e: KeyboardEvent,
|
|
37
|
+
): Promise<void>;
|
|
30
38
|
export class OnKeyUp_wysiwyg {
|
|
31
39
|
/**
|
|
32
40
|
* @this {EventManagerThis_handler_ww_key_input}
|
|
@@ -7,7 +7,11 @@ import type {} from '../../../typedef';
|
|
|
7
7
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
8
8
|
* @param {MouseEvent} e - Event object
|
|
9
9
|
*/
|
|
10
|
-
export function OnMouseDown_wysiwyg(
|
|
10
|
+
export function OnMouseDown_wysiwyg(
|
|
11
|
+
this: import('../eventOrchestrator').default,
|
|
12
|
+
fc: SunEditor.FrameContext,
|
|
13
|
+
e: MouseEvent,
|
|
14
|
+
): Promise<void>;
|
|
11
15
|
export class OnMouseDown_wysiwyg {
|
|
12
16
|
/**
|
|
13
17
|
* @typedef {import('../eventOrchestrator').default} EventManagerThis_handler_ww_mouse
|
|
@@ -25,23 +29,39 @@ export class OnMouseDown_wysiwyg {
|
|
|
25
29
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
26
30
|
* @param {MouseEvent} e - Event object
|
|
27
31
|
*/
|
|
28
|
-
export function OnMouseUp_wysiwyg(
|
|
32
|
+
export function OnMouseUp_wysiwyg(
|
|
33
|
+
this: import('../eventOrchestrator').default,
|
|
34
|
+
fc: SunEditor.FrameContext,
|
|
35
|
+
e: MouseEvent,
|
|
36
|
+
): Promise<void>;
|
|
29
37
|
/**
|
|
30
38
|
* @this {EventManagerThis_handler_ww_mouse}
|
|
31
39
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
32
40
|
* @param {MouseEvent} e - Event object
|
|
33
41
|
*/
|
|
34
|
-
export function OnClick_wysiwyg(
|
|
42
|
+
export function OnClick_wysiwyg(
|
|
43
|
+
this: import('../eventOrchestrator').default,
|
|
44
|
+
fc: SunEditor.FrameContext,
|
|
45
|
+
e: MouseEvent,
|
|
46
|
+
): Promise<boolean>;
|
|
35
47
|
/**
|
|
36
48
|
* @this {EventManagerThis_handler_ww_mouse}
|
|
37
49
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
38
50
|
* @param {MouseEvent} e - Event object
|
|
39
51
|
*/
|
|
40
|
-
export function OnMouseMove_wysiwyg(
|
|
52
|
+
export function OnMouseMove_wysiwyg(
|
|
53
|
+
this: import('../eventOrchestrator').default,
|
|
54
|
+
fc: SunEditor.FrameContext,
|
|
55
|
+
e: MouseEvent,
|
|
56
|
+
): boolean;
|
|
41
57
|
/**
|
|
42
58
|
* @this {EventManagerThis_handler_ww_mouse}
|
|
43
59
|
* @param {SunEditor.FrameContext} fc - Frame context object
|
|
44
60
|
* @param {MouseEvent} e - Event object
|
|
45
61
|
*/
|
|
46
|
-
export function OnMouseLeave_wysiwyg(
|
|
62
|
+
export function OnMouseLeave_wysiwyg(
|
|
63
|
+
this: import('../eventOrchestrator').default,
|
|
64
|
+
fc: SunEditor.FrameContext,
|
|
65
|
+
e: MouseEvent,
|
|
66
|
+
): Promise<void>;
|
|
47
67
|
export type EventManagerThis_handler_ww_mouse = import('../eventOrchestrator').default;
|
|
@@ -33,6 +33,7 @@ import type {} from '../../typedef';
|
|
|
33
33
|
* @property {(...args: Parameters<Format['isEdgeLine']>) => ReturnType<Format['isEdgeLine']>} isEdgeLine
|
|
34
34
|
* @property {(...args: Parameters<Format['removeBlock']>) => ReturnType<Format['removeBlock']>} removeBlock
|
|
35
35
|
* @property {(...args: Parameters<Format['addLine']>) => ReturnType<Format['addLine']>} addLine
|
|
36
|
+
* @property {(...args: Parameters<Format['addLineAfter']>) => ReturnType<Format['addLineAfter']>} addLineAfter
|
|
36
37
|
*/
|
|
37
38
|
/**
|
|
38
39
|
* @typedef {Object} ListFormatPorts
|
|
@@ -111,6 +112,7 @@ export function makePorts(
|
|
|
111
112
|
removeArray: Array<Node> | null;
|
|
112
113
|
};
|
|
113
114
|
addLine: (el: any, nextOrTag: any) => HTMLElement;
|
|
115
|
+
addLineAfter: (el: any) => HTMLElement;
|
|
114
116
|
};
|
|
115
117
|
listFormat: {
|
|
116
118
|
applyNested: (
|
|
@@ -167,7 +169,7 @@ export function makePorts(
|
|
|
167
169
|
setOnShortcutKey: (v: any) => any;
|
|
168
170
|
/**
|
|
169
171
|
* @description Scrolls the editor view to the caret position after pressing `Enter`.
|
|
170
|
-
* @param {Range} range
|
|
172
|
+
* @param {Range} range Pre-Enter snapshot range (fallback only).
|
|
171
173
|
*/
|
|
172
174
|
enterScrollTo(range: Range): void;
|
|
173
175
|
/**
|
|
@@ -204,6 +206,7 @@ export type FormatPorts = {
|
|
|
204
206
|
isEdgeLine: (...args: Parameters<Format['isEdgeLine']>) => ReturnType<Format['isEdgeLine']>;
|
|
205
207
|
removeBlock: (...args: Parameters<Format['removeBlock']>) => ReturnType<Format['removeBlock']>;
|
|
206
208
|
addLine: (...args: Parameters<Format['addLine']>) => ReturnType<Format['addLine']>;
|
|
209
|
+
addLineAfter: (...args: Parameters<Format['addLineAfter']>) => ReturnType<Format['addLineAfter']>;
|
|
207
210
|
};
|
|
208
211
|
export type ListFormatPorts = {
|
|
209
212
|
applyNested: (...args: Parameters<ListFormat['applyNested']>) => ReturnType<ListFormat['applyNested']>;
|
|
@@ -220,7 +223,9 @@ export type HtmlPorts = {
|
|
|
220
223
|
insertNode: (...args: Parameters<Html['insertNode']>) => ReturnType<Html['insertNode']>;
|
|
221
224
|
};
|
|
222
225
|
export type NodeTransformPorts = {
|
|
223
|
-
removeAllParents: (
|
|
226
|
+
removeAllParents: (
|
|
227
|
+
...args: Parameters<NodeTransform['removeAllParents']>
|
|
228
|
+
) => ReturnType<NodeTransform['removeAllParents']>;
|
|
224
229
|
split: (...args: Parameters<NodeTransform['split']>) => ReturnType<NodeTransform['split']>;
|
|
225
230
|
};
|
|
226
231
|
export type CharPorts = {
|
|
@@ -12,7 +12,12 @@ import type {} from '../../../typedef';
|
|
|
12
12
|
* @param {EventKeydownCtx} ctx - Context object
|
|
13
13
|
* @returns {boolean} Return `false` to stop the processing
|
|
14
14
|
*/
|
|
15
|
-
export function reduceBackspaceDown(
|
|
15
|
+
export function reduceBackspaceDown(
|
|
16
|
+
this: void,
|
|
17
|
+
actions: EventActions,
|
|
18
|
+
ports: EventPorts,
|
|
19
|
+
ctx: EventKeydownCtx,
|
|
20
|
+
): boolean;
|
|
16
21
|
export type EventActions = import('../actions').Action[];
|
|
17
22
|
export type EventPorts = import('../ports').EventReducerPorts;
|
|
18
23
|
export type EventKeydownCtx = import('../reducers/keydown.reducer').KeydownReducerCtx;
|
|
@@ -168,7 +168,10 @@ declare class Store {
|
|
|
168
168
|
* @param {(newValue: StoreState[K], oldValue: StoreState[K]) => void} callback
|
|
169
169
|
* @returns {() => void} Unsubscribe function
|
|
170
170
|
*/
|
|
171
|
-
subscribe<K extends keyof StoreState>(
|
|
171
|
+
subscribe<K extends keyof StoreState>(
|
|
172
|
+
path: K,
|
|
173
|
+
callback: (newValue: StoreState[K], oldValue: StoreState[K]) => void,
|
|
174
|
+
): () => void;
|
|
172
175
|
_reset(): void;
|
|
173
176
|
_destroy(): void;
|
|
174
177
|
#private;
|
|
@@ -25,13 +25,13 @@ declare class Format {
|
|
|
25
25
|
/**
|
|
26
26
|
* @description If a parent node that contains an argument node finds a format node (`format.isLine`), it returns that node.
|
|
27
27
|
* @param {Node} node Reference node.
|
|
28
|
-
* @param {?(current:
|
|
28
|
+
* @param {?(current: *) => boolean} [validation] Additional validation function.
|
|
29
29
|
* @returns {HTMLElement|null}
|
|
30
30
|
* @example
|
|
31
31
|
* const line = editor.$.format.getLine(editor.$.selection.getNode());
|
|
32
32
|
* const lineWithFilter = editor.$.format.getLine(node, (el) => el.nodeName !== 'LI');
|
|
33
33
|
*/
|
|
34
|
-
getLine(node: Node, validation?: ((current:
|
|
34
|
+
getLine(node: Node, validation?: ((current: any) => boolean) | null): HTMLElement | null;
|
|
35
35
|
/**
|
|
36
36
|
* @description Replace the br-line tag of the current selection.
|
|
37
37
|
* @param {Node} element BR-Line element (PRE..)
|
|
@@ -42,30 +42,48 @@ declare class Format {
|
|
|
42
42
|
/**
|
|
43
43
|
* @description If a parent node that contains an argument node finds a `brLine` (`format.isBrLine`), it returns that node.
|
|
44
44
|
* @param {Node} element Reference node.
|
|
45
|
-
* @param {?(current:
|
|
45
|
+
* @param {?(current: *) => boolean} [validation] Additional validation function.
|
|
46
46
|
* @returns {HTMLBRElement|null}
|
|
47
47
|
* @example
|
|
48
48
|
* const brLine = editor.$.format.getBrLine(editor.$.selection.getNode());
|
|
49
49
|
*/
|
|
50
|
-
getBrLine(element: Node, validation?: ((current:
|
|
50
|
+
getBrLine(element: Node, validation?: ((current: any) => boolean) | null): HTMLBRElement | null;
|
|
51
51
|
/**
|
|
52
|
-
* @description
|
|
53
|
-
* -
|
|
54
|
-
* -
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
52
|
+
* @description Insert a new line as the next sibling of `element`.
|
|
53
|
+
* - Selection-aware — tag/attributes default to the **currently selected line**, not
|
|
54
|
+
* - `element`'s tag. Use {@link addLineAfter} when the decision must depend only on
|
|
55
|
+
* - `element` (e.g., Enter exiting a heading).
|
|
56
|
+
*
|
|
57
|
+
* - Tag resolution: brLine context → bare `<br>`; else `lineNode` override → current
|
|
58
|
+
* - line clone → `defaultLine`. Attribute copy excludes only `id` (vs `addLineAfter`
|
|
59
|
+
* - which respects `lineAttrReset`). Inside a table cell, inserts within the cell.
|
|
60
|
+
*
|
|
61
|
+
* @param {Node} element Reference element — new line is inserted right after it
|
|
62
|
+
* @param {?(string|Node)} [lineNode] Override: string tag name, or Node whose tag
|
|
63
|
+
* and attributes (except `id`) are copied
|
|
64
|
+
* @returns {HTMLElement} The new line, or a `<br>` in brLine context
|
|
58
65
|
*/
|
|
59
66
|
addLine(element: Node, lineNode?: (string | Node) | null): HTMLElement;
|
|
67
|
+
/**
|
|
68
|
+
* @description Insert a new line after the given block element.
|
|
69
|
+
* Selection-independent — determines tag/attributes from the element itself.
|
|
70
|
+
* - Heading (H1-H6), HR → new default line
|
|
71
|
+
* - LI → new LI with copied attributes
|
|
72
|
+
* - PRE / brLine → new default line (exit brLine)
|
|
73
|
+
* - Normal line → same tag with copied attributes
|
|
74
|
+
* @param {HTMLElement} element The block element to insert after
|
|
75
|
+
* @returns {HTMLElement|null} The newly created element
|
|
76
|
+
*/
|
|
77
|
+
addLineAfter(element: HTMLElement): HTMLElement | null;
|
|
60
78
|
/**
|
|
61
79
|
* @description If a parent node that contains an argument node finds a format node (`format.isBlock`), it returns that node.
|
|
62
80
|
* @param {Node} element Reference node.
|
|
63
|
-
* @param {?(current:
|
|
81
|
+
* @param {?(current: *) => boolean} [validation] Additional validation function.
|
|
64
82
|
* @returns {HTMLElement|null}
|
|
65
83
|
* @example
|
|
66
84
|
* const block = editor.$.format.getBlock(editor.$.selection.getNode());
|
|
67
85
|
*/
|
|
68
|
-
getBlock(element: Node, validation?: ((current:
|
|
86
|
+
getBlock(element: Node, validation?: ((current: any) => boolean) | null): HTMLElement | null;
|
|
69
87
|
/**
|
|
70
88
|
* @description Appended all selected `line` element to the argument element(`block`) and insert
|
|
71
89
|
* @param {Node} blockElement Element of wrap the arguments (BLOCKQUOTE...)
|
|
@@ -218,12 +236,12 @@ declare class Format {
|
|
|
218
236
|
isClosureBrLine(element: Node | string): element is HTMLElement;
|
|
219
237
|
/**
|
|
220
238
|
* @description Returns a `line` array from selected range.
|
|
221
|
-
* @param {?(current:
|
|
239
|
+
* @param {?(current: *) => boolean} [validation] The validation function. (Replaces the default validation `format.isLine(current)`)
|
|
222
240
|
* @returns {Array<HTMLElement>}
|
|
223
241
|
* @example
|
|
224
242
|
* const selectedLines = editor.$.format.getLines();
|
|
225
243
|
*/
|
|
226
|
-
getLines(validation?: ((current:
|
|
244
|
+
getLines(validation?: ((current: any) => boolean) | null): Array<HTMLElement>;
|
|
227
245
|
/**
|
|
228
246
|
* @description Get lines and components from the selected range. (P, DIV, H[1-6], OL, UL, TABLE..)
|
|
229
247
|
* - If some of the component are included in the selection, get the entire that component.
|
|
@@ -17,7 +17,7 @@ declare class HTML {
|
|
|
17
17
|
* @param {Object} params - Filtering parameters.
|
|
18
18
|
* @param {string} [params.tagWhitelist] - Allowed tags, specified as a string with tags separated by `'|'`. (e.g. `"div|p|span"`).
|
|
19
19
|
* @param {string} [params.tagBlacklist] - Disallowed tags, specified as a string with tags separated by `'|'`. (e.g. `"script|iframe"`).
|
|
20
|
-
* @param {(node:
|
|
20
|
+
* @param {(node: *) => Node | string | null} [params.validate] - Function to validate and modify individual nodes.
|
|
21
21
|
* - Return `null` to remove the node.
|
|
22
22
|
* - Return a `Node` to replace the current node.
|
|
23
23
|
* - Return a `string` to replace the node's `outerHTML`.
|
|
@@ -54,7 +54,7 @@ declare class HTML {
|
|
|
54
54
|
}: {
|
|
55
55
|
tagWhitelist?: string;
|
|
56
56
|
tagBlacklist?: string;
|
|
57
|
-
validate?: (node:
|
|
57
|
+
validate?: (node: any) => Node | string | null;
|
|
58
58
|
validateAll?: boolean;
|
|
59
59
|
},
|
|
60
60
|
): string;
|
|
@@ -185,7 +185,15 @@ declare class HTML {
|
|
|
185
185
|
* const html = editor.$.html.get();
|
|
186
186
|
* const htmlWithFrame = editor.$.html.get({ withFrame: true });
|
|
187
187
|
*/
|
|
188
|
-
get({
|
|
188
|
+
get({
|
|
189
|
+
withFrame,
|
|
190
|
+
includeFullPage,
|
|
191
|
+
rootKey,
|
|
192
|
+
}?: {
|
|
193
|
+
withFrame?: boolean;
|
|
194
|
+
includeFullPage?: boolean;
|
|
195
|
+
rootKey?: number | Array<number>;
|
|
196
|
+
}): string | any;
|
|
189
197
|
/**
|
|
190
198
|
* @description Sets the HTML string to the editor content
|
|
191
199
|
* @param {string} html HTML string
|