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.
@@ -54,9 +54,18 @@ export type SlashCommandPluginOptions = {
54
54
  */
55
55
  delayTime?: number;
56
56
  /**
57
- * - Maximum number of items shown in the dropdown.
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=10] - Maximum number of items shown in the dropdown.
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';