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
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type {} from '../../typedef';
|
|
2
|
+
export default SlashCommand;
|
|
3
|
+
export type SlashCommandItem = {
|
|
4
|
+
/**
|
|
5
|
+
* - Unique identifier for the item.
|
|
6
|
+
*/
|
|
7
|
+
key: string;
|
|
8
|
+
/**
|
|
9
|
+
* - Display label.
|
|
10
|
+
*/
|
|
11
|
+
title: string;
|
|
12
|
+
/**
|
|
13
|
+
* - Icon key from `$.icons` (e.g. `'h1'`) or a raw HTML string (e.g. `'<svg>...</svg>'`).
|
|
14
|
+
*/
|
|
15
|
+
icon?: string;
|
|
16
|
+
/**
|
|
17
|
+
* - Extra search terms used in addition to the title.
|
|
18
|
+
*/
|
|
19
|
+
keywords?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* - Invoked when the item is selected.
|
|
22
|
+
* The trigger string (e.g. `/hea`) is already removed from the editor and the caret restored to that position before `action` runs.
|
|
23
|
+
* The action owns its history entry — calling an L3 wrapper (`$.html.*`, `$.format.*`, `$.inline.apply`) auto-pushes; otherwise call `$.history.push(false)` manually.
|
|
24
|
+
*/
|
|
25
|
+
action: (arg0: SunEditor.Deps, arg1: SlashCommandActionContext) => void | Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
export type SlashCommandActionContext = {
|
|
28
|
+
/**
|
|
29
|
+
* - The configured trigger character (e.g. `'/'`).
|
|
30
|
+
*/
|
|
31
|
+
triggerChar: string;
|
|
32
|
+
/**
|
|
33
|
+
* - The text the user typed after the trigger (e.g. `'hea'`).
|
|
34
|
+
*/
|
|
35
|
+
query: string;
|
|
36
|
+
/**
|
|
37
|
+
* - The selected item.
|
|
38
|
+
*/
|
|
39
|
+
item: SlashCommandItem;
|
|
40
|
+
};
|
|
41
|
+
export type SlashCommandPluginOptions = {
|
|
42
|
+
/**
|
|
43
|
+
* - Character that opens the command menu. Single character recommended.
|
|
44
|
+
*/
|
|
45
|
+
triggerChar?: string;
|
|
46
|
+
/**
|
|
47
|
+
* - Menu entries. Strings resolve via `ResolveButton`
|
|
48
|
+
* (plugin names, built-in commands like `'bold'`); objects are custom items with their own `action`.
|
|
49
|
+
* Required.
|
|
50
|
+
*/
|
|
51
|
+
items: Array<SlashCommandItem | string>;
|
|
52
|
+
/**
|
|
53
|
+
* - Debounce delay (ms) before the input is inspected for the trigger.
|
|
54
|
+
*/
|
|
55
|
+
delayTime?: number;
|
|
56
|
+
/**
|
|
57
|
+
* - Maximum number of items shown in the dropdown.
|
|
58
|
+
*/
|
|
59
|
+
limitSize?: number;
|
|
60
|
+
/**
|
|
61
|
+
* - Message shown when no items match the query. If unset, the menu closes on no match.
|
|
62
|
+
*/
|
|
63
|
+
emptyMessage?: string;
|
|
64
|
+
/**
|
|
65
|
+
* - Custom item HTML renderer.
|
|
66
|
+
* Applied only to custom item objects; plugin-name entries always render with the canonical BlockHandle row.
|
|
67
|
+
* ```js
|
|
68
|
+
* SUNEDITOR.create('#editor', {
|
|
69
|
+
* plugins: [slashCommand],
|
|
70
|
+
* slashCommand: {
|
|
71
|
+
* triggerChar: '/',
|
|
72
|
+
* items: [
|
|
73
|
+
* {
|
|
74
|
+
* key: 'h1',
|
|
75
|
+
* title: 'Heading 1',
|
|
76
|
+
* icon: 'h1',
|
|
77
|
+
* keywords: ['header', 'title'],
|
|
78
|
+
* action: ($) => $.format.applyBlock(document.createElement('H1')),
|
|
79
|
+
* },
|
|
80
|
+
* 'bold',
|
|
81
|
+
* 'image',
|
|
82
|
+
* 'blockStyle',
|
|
83
|
+
* ],
|
|
84
|
+
* },
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
renderItem?: (
|
|
89
|
+
arg0: SlashCommandItem,
|
|
90
|
+
arg1: {
|
|
91
|
+
icons: any;
|
|
92
|
+
},
|
|
93
|
+
) => string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* @typedef {Object} SlashCommandItem
|
|
97
|
+
* @property {string} key - Unique identifier for the item.
|
|
98
|
+
* @property {string} title - Display label.
|
|
99
|
+
* @property {string} [icon] - Icon key from `$.icons` (e.g. `'h1'`) or a raw HTML string (e.g. `'<svg>...</svg>'`).
|
|
100
|
+
* @property {string[]} [keywords] - Extra search terms used in addition to the title.
|
|
101
|
+
* @property {function(SunEditor.Deps, SlashCommandActionContext): void | Promise<void>} action - Invoked when the item is selected.
|
|
102
|
+
* The trigger string (e.g. `/hea`) is already removed from the editor and the caret restored to that position before `action` runs.
|
|
103
|
+
* The action owns its history entry — calling an L3 wrapper (`$.html.*`, `$.format.*`, `$.inline.apply`) auto-pushes; otherwise call `$.history.push(false)` manually.
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* @typedef {Object} SlashCommandActionContext
|
|
107
|
+
* @property {string} triggerChar - The configured trigger character (e.g. `'/'`).
|
|
108
|
+
* @property {string} query - The text the user typed after the trigger (e.g. `'hea'`).
|
|
109
|
+
* @property {SlashCommandItem} item - The selected item.
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* @typedef {Object} SlashCommandPluginOptions
|
|
113
|
+
* @property {string} [triggerChar='/'] - Character that opens the command menu. Single character recommended.
|
|
114
|
+
* @property {Array<SlashCommandItem | string>} items - Menu entries. Strings resolve via `ResolveButton`
|
|
115
|
+
* (plugin names, built-in commands like `'bold'`); objects are custom items with their own `action`.
|
|
116
|
+
* Required.
|
|
117
|
+
* @property {number} [delayTime=120] - Debounce delay (ms) before the input is inspected for the trigger.
|
|
118
|
+
* @property {number} [limitSize=10] - Maximum number of items shown in the dropdown.
|
|
119
|
+
* @property {string} [emptyMessage] - Message shown when no items match the query. If unset, the menu closes on no match.
|
|
120
|
+
* @property {function(SlashCommandItem, { icons: Object }): string} [renderItem] - Custom item HTML renderer.
|
|
121
|
+
* Applied only to custom item objects; plugin-name entries always render with the canonical BlockHandle row.
|
|
122
|
+
* ```js
|
|
123
|
+
* SUNEDITOR.create('#editor', {
|
|
124
|
+
* plugins: [slashCommand],
|
|
125
|
+
* slashCommand: {
|
|
126
|
+
* triggerChar: '/',
|
|
127
|
+
* items: [
|
|
128
|
+
* {
|
|
129
|
+
* key: 'h1',
|
|
130
|
+
* title: 'Heading 1',
|
|
131
|
+
* icon: 'h1',
|
|
132
|
+
* keywords: ['header', 'title'],
|
|
133
|
+
* action: ($) => $.format.applyBlock(document.createElement('H1')),
|
|
134
|
+
* },
|
|
135
|
+
* 'bold',
|
|
136
|
+
* 'image',
|
|
137
|
+
* 'blockStyle',
|
|
138
|
+
* ],
|
|
139
|
+
* },
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
/**
|
|
144
|
+
* @class
|
|
145
|
+
* @description Slash Command plugin
|
|
146
|
+
* - Notion / Tiptap style "/" command menu. Triggered by the configured character (default `'/'`).
|
|
147
|
+
* - Menu rendering + dispatch is delegated to {@link CommandMenu}, which is also used by BlockHandle's
|
|
148
|
+
* action menu — both menus share the exact same row HTML and dispatch behavior.
|
|
149
|
+
* - SlashCommand-specific concerns kept here: input watching, debounce, trigger detection,
|
|
150
|
+
* trigger text deletion before dispatch, empty-state row.
|
|
151
|
+
*/
|
|
152
|
+
declare class SlashCommand extends PluginField {
|
|
153
|
+
/**
|
|
154
|
+
* @constructor
|
|
155
|
+
* @param {SunEditor.Kernel} kernel
|
|
156
|
+
* @param {SlashCommandPluginOptions} pluginOptions
|
|
157
|
+
*/
|
|
158
|
+
constructor(kernel: SunEditor.Kernel, pluginOptions: SlashCommandPluginOptions);
|
|
159
|
+
controller: Controller;
|
|
160
|
+
onInput(params: SunEditor.HookParams.InputWithData): void;
|
|
161
|
+
onKeyDown(params: SunEditor.HookParams.KeyEvent): void | boolean;
|
|
162
|
+
#private;
|
|
163
|
+
}
|
|
164
|
+
import { PluginField } from '../../interfaces';
|
|
165
|
+
import { Controller } from '../../modules/contract';
|
package/types/plugins/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare namespace _default {
|
|
|
7
7
|
export { list_bulleted };
|
|
8
8
|
export { list_numbered };
|
|
9
9
|
export { autocomplete };
|
|
10
|
+
export { slashCommand };
|
|
10
11
|
export { align };
|
|
11
12
|
export { font };
|
|
12
13
|
export { fontColor };
|
|
@@ -62,6 +63,7 @@ import table from './dropdown/table';
|
|
|
62
63
|
import template from './dropdown/template';
|
|
63
64
|
import textStyle from './dropdown/textStyle';
|
|
64
65
|
import autocomplete from './field/autocomplete';
|
|
66
|
+
import slashCommand from './field/slashCommand';
|
|
65
67
|
import fontSize from './input/fontSize';
|
|
66
68
|
import pageNavigator from './input/pageNavigator';
|
|
67
69
|
import audio from './modal/audio';
|
|
@@ -103,6 +105,7 @@ export {
|
|
|
103
105
|
math,
|
|
104
106
|
pageNavigator,
|
|
105
107
|
paragraphStyle,
|
|
108
|
+
slashCommand,
|
|
106
109
|
table,
|
|
107
110
|
template,
|
|
108
111
|
textStyle,
|
|
@@ -36,7 +36,10 @@ export type LinkOptions = {
|
|
|
36
36
|
*/
|
|
37
37
|
acceptedFormats?: string;
|
|
38
38
|
};
|
|
39
|
-
export type LinkPluginOptions = Omit<
|
|
39
|
+
export type LinkPluginOptions = Omit<
|
|
40
|
+
LinkOptions & import('../../modules/ui/ModalAnchorEditor').ModalAnchorEditorParams,
|
|
41
|
+
''
|
|
42
|
+
>;
|
|
40
43
|
/**
|
|
41
44
|
* @typedef {Object} LinkOptions
|
|
42
45
|
* @property {string} [uploadUrl] - The URL endpoint for file uploads.
|
package/types/typedef.d.ts
CHANGED
|
@@ -17,6 +17,20 @@ declare global {
|
|
|
17
17
|
type EventWysiwyg = HTMLElement & Window;
|
|
18
18
|
type WysiwygFrame = HTMLElement & HTMLIFrameElement;
|
|
19
19
|
type GlobalWindow = Window & typeof globalThis;
|
|
20
|
+
type ComponentLauncher = {
|
|
21
|
+
/**
|
|
22
|
+
* - Delete hook (invoked by the selected-component keydown handler).
|
|
23
|
+
*/
|
|
24
|
+
componentDestroy?: (target: any) => void | Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* - Optional select hook.
|
|
27
|
+
*/
|
|
28
|
+
componentSelect?: (target: any) => boolean | void;
|
|
29
|
+
/**
|
|
30
|
+
* - Optional deselect hook.
|
|
31
|
+
*/
|
|
32
|
+
componentDeselect?: (target: any) => void;
|
|
33
|
+
};
|
|
20
34
|
type ComponentInfo = {
|
|
21
35
|
/**
|
|
22
36
|
* - The target element associated with the component.
|
|
@@ -53,9 +67,9 @@ declare global {
|
|
|
53
67
|
*/
|
|
54
68
|
isFile: boolean;
|
|
55
69
|
/**
|
|
56
|
-
* -
|
|
70
|
+
* - Hook object for non-plugin components (e.g. `pageBreak`), if applicable.
|
|
57
71
|
*/
|
|
58
|
-
launcher:
|
|
72
|
+
launcher: SunEditor.ComponentLauncher | null;
|
|
59
73
|
/**
|
|
60
74
|
* - Whether the component is an input component (e.g., table).
|
|
61
75
|
*/
|
|
@@ -117,35 +131,35 @@ declare global {
|
|
|
117
131
|
type Init = typeof import('./hooks/base').Core.Init;
|
|
118
132
|
}
|
|
119
133
|
namespace Component {
|
|
120
|
-
type Select =
|
|
121
|
-
type Deselect =
|
|
122
|
-
type Edit =
|
|
123
|
-
type Destroy =
|
|
124
|
-
type Copy =
|
|
134
|
+
type Select = import('./interfaces/contracts').EditorComponent['componentSelect'];
|
|
135
|
+
type Deselect = import('./interfaces/contracts').EditorComponent['componentDeselect'];
|
|
136
|
+
type Edit = import('./interfaces/contracts').EditorComponent['componentEdit'];
|
|
137
|
+
type Destroy = import('./interfaces/contracts').EditorComponent['componentDestroy'];
|
|
138
|
+
type Copy = import('./interfaces/contracts').EditorComponent['componentCopy'];
|
|
125
139
|
}
|
|
126
140
|
namespace Modal {
|
|
127
|
-
type Action =
|
|
128
|
-
type On =
|
|
129
|
-
type Init =
|
|
130
|
-
type Off =
|
|
131
|
-
type Resize =
|
|
141
|
+
type Action = import('./interfaces/contracts').ModuleModal['modalAction'];
|
|
142
|
+
type On = import('./interfaces/contracts').ModuleModal['modalOn'];
|
|
143
|
+
type Init = import('./interfaces/contracts').ModuleModal['modalInit'];
|
|
144
|
+
type Off = import('./interfaces/contracts').ModuleModal['modalOff'];
|
|
145
|
+
type Resize = import('./interfaces/contracts').ModuleModal['modalResize'];
|
|
132
146
|
}
|
|
133
147
|
namespace Controller {
|
|
134
|
-
type Action =
|
|
135
|
-
type On =
|
|
136
|
-
type Close =
|
|
148
|
+
type Action = import('./interfaces/contracts').ModuleController['controllerAction'];
|
|
149
|
+
type On = import('./interfaces/contracts').ModuleController['controllerOn'];
|
|
150
|
+
type Close = import('./interfaces/contracts').ModuleController['controllerClose'];
|
|
137
151
|
}
|
|
138
152
|
namespace Browser {
|
|
139
|
-
type Init =
|
|
153
|
+
type Init = import('./interfaces/contracts').ModuleBrowser['browserInit'];
|
|
140
154
|
}
|
|
141
155
|
namespace ColorPicker {
|
|
142
|
-
type Action =
|
|
143
|
-
type HueSliderOpen =
|
|
144
|
-
type HueSliderClose =
|
|
156
|
+
type Action = import('./interfaces/contracts').ModuleColorPicker['colorPickerAction'];
|
|
157
|
+
type HueSliderOpen = import('./interfaces/contracts').ModuleColorPicker['colorPickerHueSliderOpen'];
|
|
158
|
+
type HueSliderClose = import('./interfaces/contracts').ModuleColorPicker['colorPickerHueSliderClose'];
|
|
145
159
|
}
|
|
146
160
|
namespace HueSlider {
|
|
147
|
-
type Action =
|
|
148
|
-
type CancelAction =
|
|
161
|
+
type Action = import('./interfaces/contracts').ModuleHueSlider['hueSliderAction'];
|
|
162
|
+
type CancelAction = import('./interfaces/contracts').ModuleHueSlider['hueSliderCancelAction'];
|
|
149
163
|
}
|
|
150
164
|
}
|
|
151
165
|
export namespace HookParams {
|
|
@@ -261,7 +275,13 @@ declare global {
|
|
|
261
275
|
* - `"#fix"`: RTL direction fix
|
|
262
276
|
* - `"%100"|"%50"`: Responsive breakpoint (percentage)
|
|
263
277
|
*/
|
|
264
|
-
type ButtonSpecial =
|
|
278
|
+
type ButtonSpecial =
|
|
279
|
+
| '|'
|
|
280
|
+
| '/'
|
|
281
|
+
| `-${'left' | 'right' | 'center'}`
|
|
282
|
+
| '#fix'
|
|
283
|
+
| `:${string}-${string}`
|
|
284
|
+
| `%${number}`;
|
|
265
285
|
/**
|
|
266
286
|
* Plugin buttons available in the toolbar
|
|
267
287
|
*/
|
|
@@ -307,6 +327,7 @@ declare global {
|
|
|
307
327
|
| 'list_bulleted'
|
|
308
328
|
| 'list_numbered'
|
|
309
329
|
| 'autocomplete'
|
|
330
|
+
| 'slashCommand'
|
|
310
331
|
| 'align'
|
|
311
332
|
| 'font'
|
|
312
333
|
| 'fontColor'
|
|
@@ -339,7 +360,11 @@ declare global {
|
|
|
339
360
|
* Button list configuration for the toolbar
|
|
340
361
|
* Supports nested arrays, special controls, and responsive breakpoint configurations
|
|
341
362
|
*/
|
|
342
|
-
type ButtonItem =
|
|
363
|
+
type ButtonItem =
|
|
364
|
+
| SunEditor.UI.ButtonCommand
|
|
365
|
+
| SunEditor.UI.ButtonPlugin
|
|
366
|
+
| SunEditor.UI.ButtonSpecial
|
|
367
|
+
| string;
|
|
343
368
|
/**
|
|
344
369
|
* ///
|
|
345
370
|
* ---[ End of auto-generated button types ]---
|