suneditor 3.1.3 → 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 +357 -87
- 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 +61 -19
- package/src/core/section/constructor.js +537 -103
- 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 +68 -23
- package/src/modules/contract/ColorPicker.js +12 -4
- package/src/modules/contract/Controller.js +37 -7
- package/src/modules/contract/Figure.js +159 -36
- package/src/modules/contract/HueSlider.js +27 -4
- package/src/modules/contract/Modal.js +62 -11
- package/src/modules/manager/FileManager.js +50 -8
- package/src/modules/ui/CommandMenu.js +597 -0
- package/src/modules/ui/ModalAnchorEditor.js +41 -9
- package/src/modules/ui/SelectMenu.js +481 -36
- package/src/modules/ui/index.js +1 -0
- package/src/plugins/browser/audioGallery.js +8 -1
- package/src/plugins/browser/fileBrowser.js +15 -2
- package/src/plugins/browser/fileGallery.js +8 -1
- package/src/plugins/browser/imageGallery.js +24 -3
- package/src/plugins/browser/videoGallery.js +19 -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 +132 -22
- package/src/plugins/modal/image/index.js +115 -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 +110 -37
- 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/Browser.d.ts +7 -7
- 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/ModalAnchorEditor.d.ts +6 -1
- 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 +17 -1
- package/types/plugins/browser/fileBrowser.d.ts +17 -1
- package/types/plugins/browser/fileGallery.d.ts +17 -1
- package/types/plugins/browser/imageGallery.d.ts +17 -1
- package/types/plugins/browser/videoGallery.d.ts +17 -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/embed.d.ts +34 -0
- package/types/plugins/modal/link.d.ts +4 -1
- package/types/typedef.d.ts +48 -23
|
@@ -25,6 +25,8 @@ export namespace DEFAULTS {
|
|
|
25
25
|
};
|
|
26
26
|
let CONTENT_STYLES: string;
|
|
27
27
|
let TAG_STYLES: {
|
|
28
|
+
'@text': string;
|
|
29
|
+
'@line': string;
|
|
28
30
|
'table|th|td': string;
|
|
29
31
|
'table|td': string;
|
|
30
32
|
tr: string;
|
|
@@ -36,8 +38,6 @@ export namespace DEFAULTS {
|
|
|
36
38
|
'img|video|iframe': string;
|
|
37
39
|
hr: string;
|
|
38
40
|
};
|
|
39
|
-
let SPAN_STYLES: string;
|
|
40
|
-
let LINE_STYLES: string;
|
|
41
41
|
let RETAIN_STYLE_MODE: string[];
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -54,7 +54,9 @@ export namespace DEFAULTS {
|
|
|
54
54
|
*
|
|
55
55
|
* === Content & Editing ===
|
|
56
56
|
* @property {string} [value=""] - Initial value for the editor.
|
|
57
|
-
* @property {string} [placeholder=""] - Placeholder text.
|
|
57
|
+
* @property {string} [placeholder=""] - Placeholder text shown when the whole editor is empty.
|
|
58
|
+
* @property {string} [placeholder_line=""] - per-line placeholder shown on the focused
|
|
59
|
+
* line when that line is empty. Takes priority over `placeholder` while a line is focused.
|
|
58
60
|
* @property {Object<string, string>} [editableFrameAttributes={spellcheck: "false"}] - Attributes for the editable frame[.sun-editor-editable].
|
|
59
61
|
* ```js
|
|
60
62
|
* { editableFrameAttributes: { spellcheck: 'true', autocomplete: 'on' } }
|
|
@@ -65,6 +67,13 @@ export namespace DEFAULTS {
|
|
|
65
67
|
* @property {string|number} [width="100%"] - Width for the editor.
|
|
66
68
|
* @property {string|number} [minWidth=""] - Min width for the editor.
|
|
67
69
|
* @property {string|number} [maxWidth=""] - Max width for the editor.
|
|
70
|
+
* @property {string} [innerWidth=""] - Optional max-width for the editor body (`.se-wrapper`).
|
|
71
|
+
* - **CSS length** (`"740px"`, `"60ch"`): editor body's content is clamped to this width and centered horizontally; scroll container stays full width (scrollbar at the outer edge, wheel/touch active over the whole area).
|
|
72
|
+
* - **`"auto"`** or **empty string** (default): no constraint — natural full-width layout with default content padding.
|
|
73
|
+
* - In `blockHandle` mode, the gutter handle tracks the centered text band.
|
|
74
|
+
* ```js
|
|
75
|
+
* { innerWidth: '740px' }
|
|
76
|
+
* ```
|
|
68
77
|
* @property {string|number} [height="auto"] - Height for the editor.
|
|
69
78
|
* @property {string|number} [minHeight=""] - Min height for the editor.
|
|
70
79
|
* @property {string|number} [maxHeight=""] - Max height for the editor.
|
|
@@ -233,6 +242,22 @@ export namespace DEFAULTS {
|
|
|
233
242
|
* === Modes & Themes ===
|
|
234
243
|
* @property {boolean} [v2Migration=false] - Enables migration mode for SunEditor v2.
|
|
235
244
|
* @property {"classic"|"inline"|"balloon"|"balloon-always"|"classic:bottom"|"inline:bottom"} [mode="classic"] - Toolbar mode: `classic`, `inline`, `balloon`, `balloon-always`. Append `:bottom` to place toolbar at the bottom (e.g. `classic:bottom`, `inline:bottom`).
|
|
245
|
+
* @property {Object} [blockHandle] - Block handle configuration. When provided, a per-line block handle UI is shown. Works independently of `mode`.
|
|
246
|
+
* @property {Array<string | { title: string, icon?: string, action: (deps: SunEditor.Deps, ctx: { block: HTMLElement }) => void }>} [blockHandle.menu] - Menu entries.
|
|
247
|
+
* - **String entries** — resolved via `ResolveButton`. Accepts the same values as toolbar `buttonList`:
|
|
248
|
+
* - **Block format keys**: `p`, `h1`-`h6`, `heading` (H1-H6 submenu), `ul`, `ol`, `list` (UL/OL submenu), `blockquote`, `pre`.
|
|
249
|
+
* - **Plugin names**: Any registered plugin name (e.g. `blockStyle`, `align`, `image`, `link`). Dropdown plugins display their items as a submenu. Modal plugins open the modal on click.
|
|
250
|
+
* - **Built-in commands**: `bold`, `italic`, `underline`, `strike`, `undo`, `redo`, etc.
|
|
251
|
+
* - **Custom item objects** — `{ title, icon?, action }`. `icon` is an icon key from `$.icons` or a raw `<svg>` HTML string; `action` is invoked with `($, { block })`.
|
|
252
|
+
* - Defaults to `['p', 'heading', 'list', 'blockquote', 'pre']`.
|
|
253
|
+
* ```js
|
|
254
|
+
* blockHandle: {
|
|
255
|
+
* menu: [
|
|
256
|
+
* 'p', 'heading', 'blockStyle',
|
|
257
|
+
* { title: 'Duplicate', icon: 'copy', action: ($, { block }) => block.after(block.cloneNode(true)) },
|
|
258
|
+
* ],
|
|
259
|
+
* }
|
|
260
|
+
* ```
|
|
236
261
|
* @property {string} [type=""] - Editor type. Use `"document"` for a document-style layout, with optional sub-types after `:`.
|
|
237
262
|
* ```js
|
|
238
263
|
* // type
|
|
@@ -263,7 +288,7 @@ export namespace DEFAULTS {
|
|
|
263
288
|
* - `classFilter`: Filters disallowed CSS class names (`allowedClassName`)
|
|
264
289
|
* - `textStyleTagFilter`: Filters text style tags (b, i, u, span, etc.)
|
|
265
290
|
* - `attrFilter`: Filters disallowed HTML attributes (`attributeWhitelist`/`attributeBlacklist`)
|
|
266
|
-
* - `styleFilter`: Filters disallowed inline styles (`
|
|
291
|
+
* - `styleFilter`: Filters disallowed inline styles (per-tag from `tagStyles`)
|
|
267
292
|
* ```js
|
|
268
293
|
* // disable only attribute and style filters
|
|
269
294
|
* {
|
|
@@ -339,19 +364,23 @@ export namespace DEFAULTS {
|
|
|
339
364
|
* ```js
|
|
340
365
|
* { allUsedStyles: 'color|background-color|text-shadow' }
|
|
341
366
|
* ```
|
|
342
|
-
* @property {Object<string, string>} [tagStyles={}] - Specifies allowed styles
|
|
367
|
+
* @property {Object<string, string>} [tagStyles={}] - Specifies allowed CSS styles per HTML tag.
|
|
368
|
+
* - Key is a tag name, multiple tags joined with `|`, or a category sentinel (`@text`, `@line`).
|
|
369
|
+
* - Value is a pipe-delimited list of allowed style names.
|
|
370
|
+
* - Resolution order when filtering an element: explicit tag entry → `@line` (for formatLine elements) → `@text` (for textStyleTags).
|
|
371
|
+
* - An explicit tag entry **replaces** the category default — include category styles in the value if you want both.
|
|
372
|
+
* - Merged with {@link DEFAULTS.TAG_STYLES}; user-supplied keys win.
|
|
343
373
|
* ```js
|
|
344
374
|
* {
|
|
345
375
|
* tagStyles: {
|
|
346
|
-
* '
|
|
347
|
-
*
|
|
376
|
+
* '@text': 'color|font-size|background-color', // default for span, b, i, em, ...
|
|
377
|
+
* '@line': 'text-align|margin|line-height', // default for p, h1-h6, div, li, ...
|
|
378
|
+
* 'table|td': 'border|color|background-color', // per-tag whitelist
|
|
379
|
+
* div: 'color', // explicit override; ignores `@line` default
|
|
380
|
+
* hr: 'border-top',
|
|
348
381
|
* }
|
|
349
382
|
* }
|
|
350
383
|
* ```
|
|
351
|
-
* @property {string} [spanStyles=CONSTANTS.SPAN_STYLES] - Specifies allowed styles for the `span` tag.
|
|
352
|
-
* - The default follows {@link DEFAULTS.SPAN_STYLES}
|
|
353
|
-
* @property {string} [lineStyles=CONSTANTS.LINE_STYLES] - Specifies allowed styles for the `line` element (p..).
|
|
354
|
-
* - The default follows {@link DEFAULTS.LINE_STYLES}
|
|
355
384
|
* @property {Array<string>} [fontSizeUnits=CONSTANTS.SIZE_UNITS] - Allowed font size units.
|
|
356
385
|
* - The default follows {@link DEFAULTS.SIZE_UNITS}
|
|
357
386
|
* @property {"repeat"|"always"|"none"} [retainStyleMode="repeat"] - Determines how inline elements (e.g. `<span>`, `<strong>`) are handled when deleting text.
|
|
@@ -412,6 +441,15 @@ export namespace DEFAULTS {
|
|
|
412
441
|
* @property {boolean} [syncTabIndent=true] - Synchronizes tab indent with spaces.
|
|
413
442
|
* @property {boolean} [tabDisable=false] - Disables tab key input.
|
|
414
443
|
* @property {string} [toolbar_width="auto"] - Toolbar width.
|
|
444
|
+
* @property {string} [toolbar_innerWidth=""] - Center the toolbar's button row (`.se-btn-tray`) horizontally.
|
|
445
|
+
* - **CSS length** (e.g. `"500px"`, `"740px"`, `"60ch"`): toolbar background spans full width while the button row is capped at that width and centered. If buttons fit, the row stays on a single line; if they exceed the cap, they wrap inside it.
|
|
446
|
+
* - **`"auto"`**: no cap — the row is sized to its content and simply centered.
|
|
447
|
+
* - **Empty string** (default): no constraint.
|
|
448
|
+
* - **Note on `responsiveButtonList`**: thresholds compare against the toolbar's full width, not the band. When this option is set, calibrate `responsiveButtonList` keys around the toolbar size you actually want each button set to kick in at.
|
|
449
|
+
* ```js
|
|
450
|
+
* { toolbar_innerWidth: '740px' }
|
|
451
|
+
* { toolbar_innerWidth: 'auto' }
|
|
452
|
+
* ```
|
|
415
453
|
* @property {?HTMLElement} [toolbar_container] - Container element for the toolbar.
|
|
416
454
|
* @property {number|{top: number, offset: number}} [toolbar_sticky=0] - Enables sticky toolbar.
|
|
417
455
|
* - `number`: Sets the sticky top position (px). Use `-1` to disable sticky.
|
|
@@ -546,6 +584,7 @@ export namespace DEFAULTS {
|
|
|
546
584
|
* @property {import('../../plugins/modal/link.js').LinkPluginOptions} [link]
|
|
547
585
|
* @property {import('../../plugins/modal/math.js').MathPluginOptions} [math]
|
|
548
586
|
* @property {import('../../plugins/dropdown/paragraphStyle.js').ParagraphStylePluginOptions} [paragraphStyle]
|
|
587
|
+
* @property {import('../../plugins/field/slashCommand.js').SlashCommandPluginOptions} [slashCommand]
|
|
549
588
|
* @property {import('../../plugins/dropdown/table/index.js').TablePluginOptions} [table]
|
|
550
589
|
* @property {import('../../plugins/dropdown/template.js').TemplatePluginOptions} [template]
|
|
551
590
|
* @property {import('../../plugins/dropdown/textStyle.js').TextStylePluginOptions} [textStyle]
|
|
@@ -570,8 +609,6 @@ export namespace DEFAULTS {
|
|
|
570
609
|
* @property {string[]} [_reverseCommandArray] - Internal key shortcut matcher for reverse commands.
|
|
571
610
|
* @property {string} [_subMode] - Sub toolbar mode (e.g., `balloon`).
|
|
572
611
|
* @property {string[]} [_textStyleTags] - Tag names used for text styling, plus span/li.
|
|
573
|
-
* @property {RegExp} [_textStylesRegExp] - Regex to match inline styles (e.g., fontSize, color).
|
|
574
|
-
* @property {RegExp} [_lineStylesRegExp] - Regex to match line styles (e.g., text-align, padding).
|
|
575
612
|
* @property {Object<string, string>} [_defaultStyleTagMap] - Mapping HTML tag => standard tag.
|
|
576
613
|
* @property {Object<string, string>} [_styleCommandMap] - Mapping HTML tag => command (e.g., bold, underline).
|
|
577
614
|
* @property {Object<string, string>} [_defaultTagCommand] - Mapping command => preferred tag.
|
|
@@ -624,9 +661,14 @@ export type EditorFrameOptions = {
|
|
|
624
661
|
*/
|
|
625
662
|
value?: string;
|
|
626
663
|
/**
|
|
627
|
-
* - Placeholder text.
|
|
664
|
+
* - Placeholder text shown when the whole editor is empty.
|
|
628
665
|
*/
|
|
629
666
|
placeholder?: string;
|
|
667
|
+
/**
|
|
668
|
+
* - per-line placeholder shown on the focused
|
|
669
|
+
* line when that line is empty. Takes priority over `placeholder` while a line is focused.
|
|
670
|
+
*/
|
|
671
|
+
placeholder_line?: string;
|
|
630
672
|
/**
|
|
631
673
|
* - Attributes for the editable frame[.sun-editor-editable].
|
|
632
674
|
* ```js
|
|
@@ -651,6 +693,16 @@ export type EditorFrameOptions = {
|
|
|
651
693
|
* - Max width for the editor.
|
|
652
694
|
*/
|
|
653
695
|
maxWidth?: string | number;
|
|
696
|
+
/**
|
|
697
|
+
* - Optional max-width for the editor body (`.se-wrapper`).
|
|
698
|
+
* - **CSS length** (`"740px"`, `"60ch"`): editor body's content is clamped to this width and centered horizontally; scroll container stays full width (scrollbar at the outer edge, wheel/touch active over the whole area).
|
|
699
|
+
* - **`"auto"`** or **empty string** (default): no constraint — natural full-width layout with default content padding.
|
|
700
|
+
* - In `blockHandle` mode, the gutter handle tracks the centered text band.
|
|
701
|
+
* ```js
|
|
702
|
+
* { innerWidth: '740px' }
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
innerWidth?: string;
|
|
654
706
|
/**
|
|
655
707
|
* - Height for the editor.
|
|
656
708
|
*/
|
|
@@ -939,6 +991,24 @@ export type EditorBaseOptions = {
|
|
|
939
991
|
* - Toolbar mode: `classic`, `inline`, `balloon`, `balloon-always`. Append `:bottom` to place toolbar at the bottom (e.g. `classic:bottom`, `inline:bottom`).
|
|
940
992
|
*/
|
|
941
993
|
mode?: 'classic' | 'inline' | 'balloon' | 'balloon-always' | 'classic:bottom' | 'inline:bottom';
|
|
994
|
+
/**
|
|
995
|
+
* - Block handle configuration. When provided, a per-line block handle UI is shown. Works independently of `mode`.
|
|
996
|
+
*/
|
|
997
|
+
blockHandle?: {
|
|
998
|
+
menu?: Array<
|
|
999
|
+
| string
|
|
1000
|
+
| {
|
|
1001
|
+
title: string;
|
|
1002
|
+
icon?: string;
|
|
1003
|
+
action: (
|
|
1004
|
+
deps: SunEditor.Deps,
|
|
1005
|
+
ctx: {
|
|
1006
|
+
block: HTMLElement;
|
|
1007
|
+
},
|
|
1008
|
+
) => void;
|
|
1009
|
+
}
|
|
1010
|
+
>;
|
|
1011
|
+
};
|
|
942
1012
|
/**
|
|
943
1013
|
* - Editor type. Use `"document"` for a document-style layout, with optional sub-types after `:`.
|
|
944
1014
|
* ```js
|
|
@@ -985,7 +1055,7 @@ export type EditorBaseOptions = {
|
|
|
985
1055
|
* - `classFilter`: Filters disallowed CSS class names (`allowedClassName`)
|
|
986
1056
|
* - `textStyleTagFilter`: Filters text style tags (b, i, u, span, etc.)
|
|
987
1057
|
* - `attrFilter`: Filters disallowed HTML attributes (`attributeWhitelist`/`attributeBlacklist`)
|
|
988
|
-
* - `styleFilter`: Filters disallowed inline styles (`
|
|
1058
|
+
* - `styleFilter`: Filters disallowed inline styles (per-tag from `tagStyles`)
|
|
989
1059
|
* ```js
|
|
990
1060
|
* // disable only attribute and style filters
|
|
991
1061
|
* {
|
|
@@ -1106,12 +1176,20 @@ export type EditorBaseOptions = {
|
|
|
1106
1176
|
*/
|
|
1107
1177
|
allUsedStyles?: string;
|
|
1108
1178
|
/**
|
|
1109
|
-
* - Specifies allowed styles
|
|
1179
|
+
* - Specifies allowed CSS styles per HTML tag.
|
|
1180
|
+
* - Key is a tag name, multiple tags joined with `|`, or a category sentinel (`@text`, `@line`).
|
|
1181
|
+
* - Value is a pipe-delimited list of allowed style names.
|
|
1182
|
+
* - Resolution order when filtering an element: explicit tag entry → `@line` (for formatLine elements) → `@text` (for textStyleTags).
|
|
1183
|
+
* - An explicit tag entry **replaces** the category default — include category styles in the value if you want both.
|
|
1184
|
+
* - Merged with {@link DEFAULTS.TAG_STYLES}; user-supplied keys win.
|
|
1110
1185
|
* ```js
|
|
1111
1186
|
* {
|
|
1112
1187
|
* tagStyles: {
|
|
1113
|
-
* '
|
|
1114
|
-
*
|
|
1188
|
+
* '@text': 'color|font-size|background-color', // default for span, b, i, em, ...
|
|
1189
|
+
* '@line': 'text-align|margin|line-height', // default for p, h1-h6, div, li, ...
|
|
1190
|
+
* 'table|td': 'border|color|background-color', // per-tag whitelist
|
|
1191
|
+
* div: 'color', // explicit override; ignores `@line` default
|
|
1192
|
+
* hr: 'border-top',
|
|
1115
1193
|
* }
|
|
1116
1194
|
* }
|
|
1117
1195
|
* ```
|
|
@@ -1119,16 +1197,6 @@ export type EditorBaseOptions = {
|
|
|
1119
1197
|
tagStyles?: {
|
|
1120
1198
|
[x: string]: string;
|
|
1121
1199
|
};
|
|
1122
|
-
/**
|
|
1123
|
-
* - Specifies allowed styles for the `span` tag.
|
|
1124
|
-
* - The default follows {@link DEFAULTS.SPAN_STYLES}
|
|
1125
|
-
*/
|
|
1126
|
-
spanStyles?: string;
|
|
1127
|
-
/**
|
|
1128
|
-
* - Specifies allowed styles for the `line` element (p..).
|
|
1129
|
-
* - The default follows {@link DEFAULTS.LINE_STYLES}
|
|
1130
|
-
*/
|
|
1131
|
-
lineStyles?: string;
|
|
1132
1200
|
/**
|
|
1133
1201
|
* - Allowed font size units.
|
|
1134
1202
|
* - The default follows {@link DEFAULTS.SIZE_UNITS}
|
|
@@ -1231,6 +1299,18 @@ export type EditorBaseOptions = {
|
|
|
1231
1299
|
* - Toolbar width.
|
|
1232
1300
|
*/
|
|
1233
1301
|
toolbar_width?: string;
|
|
1302
|
+
/**
|
|
1303
|
+
* - Center the toolbar's button row (`.se-btn-tray`) horizontally.
|
|
1304
|
+
* - **CSS length** (e.g. `"500px"`, `"740px"`, `"60ch"`): toolbar background spans full width while the button row is capped at that width and centered. If buttons fit, the row stays on a single line; if they exceed the cap, they wrap inside it.
|
|
1305
|
+
* - **`"auto"`**: no cap — the row is sized to its content and simply centered.
|
|
1306
|
+
* - **Empty string** (default): no constraint.
|
|
1307
|
+
* - **Note on `responsiveButtonList`**: thresholds compare against the toolbar's full width, not the band. When this option is set, calibrate `responsiveButtonList` keys around the toolbar size you actually want each button set to kick in at.
|
|
1308
|
+
* ```js
|
|
1309
|
+
* { toolbar_innerWidth: '740px' }
|
|
1310
|
+
* { toolbar_innerWidth: 'auto' }
|
|
1311
|
+
* ```
|
|
1312
|
+
*/
|
|
1313
|
+
toolbar_innerWidth?: string;
|
|
1234
1314
|
/**
|
|
1235
1315
|
* - Container element for the toolbar.
|
|
1236
1316
|
*/
|
|
@@ -1450,6 +1530,7 @@ export type EditorBaseOptions = {
|
|
|
1450
1530
|
link?: import('../../plugins/modal/link.js').LinkPluginOptions;
|
|
1451
1531
|
math?: import('../../plugins/modal/math.js').MathPluginOptions;
|
|
1452
1532
|
paragraphStyle?: import('../../plugins/dropdown/paragraphStyle.js').ParagraphStylePluginOptions;
|
|
1533
|
+
slashCommand?: import('../../plugins/field/slashCommand.js').SlashCommandPluginOptions;
|
|
1453
1534
|
table?: import('../../plugins/dropdown/table/index.js').TablePluginOptions;
|
|
1454
1535
|
template?: import('../../plugins/dropdown/template.js').TemplatePluginOptions;
|
|
1455
1536
|
textStyle?: import('../../plugins/dropdown/textStyle.js').TextStylePluginOptions;
|
|
@@ -1501,14 +1582,6 @@ export type InternalBaseOptions = {
|
|
|
1501
1582
|
* - Tag names used for text styling, plus span/li.
|
|
1502
1583
|
*/
|
|
1503
1584
|
_textStyleTags?: string[];
|
|
1504
|
-
/**
|
|
1505
|
-
* - Regex to match inline styles (e.g., fontSize, color).
|
|
1506
|
-
*/
|
|
1507
|
-
_textStylesRegExp?: RegExp;
|
|
1508
|
-
/**
|
|
1509
|
-
* - Regex to match line styles (e.g., text-align, padding).
|
|
1510
|
-
*/
|
|
1511
|
-
_lineStylesRegExp?: RegExp;
|
|
1512
1585
|
/**
|
|
1513
1586
|
* - Mapping HTML tag => standard tag.
|
|
1514
1587
|
*/
|
|
@@ -1602,7 +1675,7 @@ export type StrictModeOptions = {
|
|
|
1602
1675
|
*/
|
|
1603
1676
|
attrFilter: boolean;
|
|
1604
1677
|
/**
|
|
1605
|
-
* - Filters disallowed inline styles (`
|
|
1678
|
+
* - Filters disallowed inline styles (per-tag from `tagStyles`)
|
|
1606
1679
|
*/
|
|
1607
1680
|
styleFilter: boolean;
|
|
1608
1681
|
};
|
|
@@ -8,7 +8,14 @@ import type {} from '../../typedef';
|
|
|
8
8
|
* @param {Array} rc `_reverseCommandArray` option
|
|
9
9
|
* @param {Set} reverseKeys Reverse key array
|
|
10
10
|
*/
|
|
11
|
-
export function CreateShortcuts(
|
|
11
|
+
export function CreateShortcuts(
|
|
12
|
+
command: string,
|
|
13
|
+
button: Element | null,
|
|
14
|
+
values: Array<string>,
|
|
15
|
+
keyMap: Map<string, any>,
|
|
16
|
+
rc: any[],
|
|
17
|
+
reverseKeys: Set<any>,
|
|
18
|
+
): void;
|
|
12
19
|
/**
|
|
13
20
|
* @typedef {Object} InitOptionsReturnType
|
|
14
21
|
* @property {Map<string, *>} o - Processed base options (`Map` containing {@link AllBaseOptions_constructor} keys)
|
|
@@ -55,6 +62,36 @@ export function CreateStatusbar(
|
|
|
55
62
|
wordWrapper: HTMLElement;
|
|
56
63
|
wordCounter: HTMLElement;
|
|
57
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* @description Resolves a button key to its toolbar metadata.
|
|
67
|
+
* Checks plugins first, then falls back to the default button list.
|
|
68
|
+
* Same resolution logic as `CreateToolBar`.
|
|
69
|
+
* @param {string} key Button name
|
|
70
|
+
* @param {?Object<string, *>} plugins Plugin instances
|
|
71
|
+
* @param {SunEditor.Options} options Options map
|
|
72
|
+
* @param {Object<string, string>} icons Icons
|
|
73
|
+
* @param {Object<string, string>} lang Language object
|
|
74
|
+
* @returns {{className: string, title: string, command: string, type: string, icon: string}|null}
|
|
75
|
+
*/
|
|
76
|
+
export function ResolveButton(
|
|
77
|
+
key: string,
|
|
78
|
+
plugins: {
|
|
79
|
+
[x: string]: any;
|
|
80
|
+
} | null,
|
|
81
|
+
options: SunEditor.Options,
|
|
82
|
+
icons: {
|
|
83
|
+
[x: string]: string;
|
|
84
|
+
},
|
|
85
|
+
lang: {
|
|
86
|
+
[x: string]: string;
|
|
87
|
+
},
|
|
88
|
+
): {
|
|
89
|
+
className: string;
|
|
90
|
+
title: string;
|
|
91
|
+
command: string;
|
|
92
|
+
type: string;
|
|
93
|
+
icon: string;
|
|
94
|
+
} | null;
|
|
58
95
|
/**
|
|
59
96
|
* @description Update a button state, attributes, and icons
|
|
60
97
|
* @param {?HTMLElement} element Button element
|