suneditor 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/dist/suneditor.min.css +2 -2
- package/dist/suneditor.min.js +1 -1
- package/package.json +1 -1
- package/src/assets/suneditor.css +5101 -5105
- package/src/core/config/eventManager.js +24 -1
- package/src/core/logic/dom/format.js +1 -1
- package/src/core/logic/dom/html.js +31 -0
- package/src/core/logic/panel/blockHandle.js +61 -24
- package/src/core/logic/panel/blockResolver.js +41 -4
- package/src/core/logic/shell/pluginManager.js +15 -2
- package/src/core/logic/shell/ui.js +32 -27
- package/src/core/schema/options.js +16 -0
- package/src/core/section/constructor.js +12 -8
- package/src/modules/contract/Figure.js +5 -2
- package/src/modules/ui/CommandMenu.js +47 -5
- package/src/modules/ui/SelectMenu.js +97 -36
- package/src/plugins/dropdown/table/index.js +25 -8
- package/src/plugins/dropdown/table/shared/table.constants.js +2 -0
- package/src/plugins/field/slashCommand.js +59 -12
- package/types/core/logic/panel/blockHandle.d.ts +3 -16
- package/types/core/logic/shell/ui.d.ts +14 -5
- package/types/core/schema/options.d.ts +25 -0
- package/types/modules/ui/CommandMenu.d.ts +11 -0
- package/types/modules/ui/SelectMenu.d.ts +13 -7
- package/types/plugins/dropdown/table/index.d.ts +11 -0
- package/types/plugins/dropdown/table/shared/table.constants.d.ts +1 -0
- package/types/plugins/field/slashCommand.d.ts +43 -2
|
@@ -54,9 +54,18 @@ export type SlashCommandPluginOptions = {
|
|
|
54
54
|
*/
|
|
55
55
|
delayTime?: number;
|
|
56
56
|
/**
|
|
57
|
-
* - Maximum number of items
|
|
57
|
+
* - Maximum number of items kept after filtering. `0` (default) keeps every match
|
|
58
|
+
* - the list scrolls within `maxHeight`, so a cap only hides matches the user can no longer reach.
|
|
58
59
|
*/
|
|
59
60
|
limitSize?: number;
|
|
61
|
+
/**
|
|
62
|
+
* - Max height of the menu list. Any CSS length; the list scrolls past it.
|
|
63
|
+
*/
|
|
64
|
+
maxHeight?: string;
|
|
65
|
+
/**
|
|
66
|
+
* - Min width of the menu.
|
|
67
|
+
*/
|
|
68
|
+
minWidth?: string;
|
|
60
69
|
/**
|
|
61
70
|
* - Message shown when no items match the query. If unset, the menu closes on no match.
|
|
62
71
|
*/
|
|
@@ -93,6 +102,15 @@ export type SlashCommandPluginOptions = {
|
|
|
93
102
|
* // A container block (BLOCKQUOTE, DIV…): `applyBlock` WRAPS the selected lines → `<blockquote>…</blockquote>`.
|
|
94
103
|
* action: ($) => $.format.applyBlock(document.createElement('BLOCKQUOTE')),
|
|
95
104
|
* },
|
|
105
|
+
* {
|
|
106
|
+
* key: 'table',
|
|
107
|
+
* title: 'Table',
|
|
108
|
+
* icon: 'table',
|
|
109
|
+
* // A plugin-name entry (`'table'`) opens that plugin's own UI — for table, the size picker,
|
|
110
|
+
* // which is driven by the pointer. A custom item skips it and inserts straight away, which
|
|
111
|
+
* // keeps the whole gesture on the keyboard: type the trigger, press Enter, done.
|
|
112
|
+
* action: ($) => $.plugins.table.insert(3, 3),
|
|
113
|
+
* },
|
|
96
114
|
* 'bold',
|
|
97
115
|
* 'image',
|
|
98
116
|
* 'blockStyle',
|
|
@@ -131,7 +149,10 @@ export type SlashCommandPluginOptions = {
|
|
|
131
149
|
* (plugin names, built-in commands like `'bold'`); objects are custom items with their own `action`.
|
|
132
150
|
* Required.
|
|
133
151
|
* @property {number} [delayTime=120] - Debounce delay (ms) before the input is inspected for the trigger.
|
|
134
|
-
* @property {number} [limitSize=
|
|
152
|
+
* @property {number} [limitSize=0] - Maximum number of items kept after filtering. `0` (default) keeps every match
|
|
153
|
+
* - the list scrolls within `maxHeight`, so a cap only hides matches the user can no longer reach.
|
|
154
|
+
* @property {string} [maxHeight='320px'] - Max height of the menu list. Any CSS length; the list scrolls past it.
|
|
155
|
+
* @property {string} [minWidth='200px'] - Min width of the menu.
|
|
135
156
|
* @property {string} [emptyMessage] - Message shown when no items match the query. If unset, the menu closes on no match.
|
|
136
157
|
* @property {function(SlashCommandItem, { icons: Object }): string} [renderItem] - Custom item HTML renderer.
|
|
137
158
|
* Applied only to custom item objects; plugin-name entries always render with the canonical BlockHandle row.
|
|
@@ -164,6 +185,15 @@ export type SlashCommandPluginOptions = {
|
|
|
164
185
|
* // A container block (BLOCKQUOTE, DIV…): `applyBlock` WRAPS the selected lines → `<blockquote>…</blockquote>`.
|
|
165
186
|
* action: ($) => $.format.applyBlock(document.createElement('BLOCKQUOTE')),
|
|
166
187
|
* },
|
|
188
|
+
* {
|
|
189
|
+
* key: 'table',
|
|
190
|
+
* title: 'Table',
|
|
191
|
+
* icon: 'table',
|
|
192
|
+
* // A plugin-name entry (`'table'`) opens that plugin's own UI — for table, the size picker,
|
|
193
|
+
* // which is driven by the pointer. A custom item skips it and inserts straight away, which
|
|
194
|
+
* // keeps the whole gesture on the keyboard: type the trigger, press Enter, done.
|
|
195
|
+
* action: ($) => $.plugins.table.insert(3, 3),
|
|
196
|
+
* },
|
|
167
197
|
* 'bold',
|
|
168
198
|
* 'image',
|
|
169
199
|
* 'blockStyle',
|
|
@@ -191,6 +221,17 @@ declare class SlashCommand extends PluginField {
|
|
|
191
221
|
controller: Controller;
|
|
192
222
|
onInput(params: SunEditor.HookParams.InputWithData): void;
|
|
193
223
|
onKeyDown(params: SunEditor.HookParams.KeyEvent): void | boolean;
|
|
224
|
+
/**
|
|
225
|
+
* @description Open the command menu programmatically, with no trigger character typed and the full tem list shown.
|
|
226
|
+
* - Intended for host UI that wants the same menu without the `/` shortcut — e.g. the
|
|
227
|
+
* - block handle's plus button:
|
|
228
|
+
* ```js
|
|
229
|
+
* blockHandle: { onPlusClick: ($, { block }) => $.plugins.slashCommand.open(block) }
|
|
230
|
+
* ```
|
|
231
|
+
* @param {Node} anchorNode - Node the menu anchors to (typically the line the caret sits on).
|
|
232
|
+
* @returns {boolean} `true` if the menu was opened
|
|
233
|
+
*/
|
|
234
|
+
open(anchorNode: Node): boolean;
|
|
194
235
|
#private;
|
|
195
236
|
}
|
|
196
237
|
import { PluginField } from '../../interfaces';
|