suneditor 3.2.1 → 3.2.3
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.min.css +2 -2
- package/dist/suneditor.min.js +1 -1
- package/package.json +1 -1
- package/src/assets/suneditor.css +8 -1
- package/src/core/editor.js +2 -0
- package/src/core/event/actions/index.js +21 -0
- package/src/core/event/effects/keydown.registry.js +77 -0
- package/src/core/event/eventOrchestrator.js +13 -0
- package/src/core/event/handlers/handler_ww_input.js +12 -5
- package/src/core/event/handlers/handler_ww_key.js +5 -3
- package/src/core/event/ports.js +12 -2
- package/src/core/event/reducers/keydown.reducer.js +19 -9
- package/src/core/event/rules/keydown.rule.backspace.js +14 -0
- package/src/core/event/rules/keydown.rule.delete.js +29 -0
- package/src/core/event/rules/keydown.rule.enter.js +7 -0
- package/src/core/kernel/store.js +2 -0
- package/src/core/logic/dom/html.js +13 -1
- package/src/core/logic/panel/blockHandle.js +94 -29
- package/src/core/logic/shell/ui.js +3 -2
- package/src/core/schema/options.js +4 -2
- package/src/core/section/constructor.js +16 -1
- package/src/helper/converter.js +3 -2
- package/src/helper/env.js +51 -0
- package/src/helper/markdown.js +3 -1
- package/src/modules/contract/Browser.js +2 -2
- package/src/modules/ui/CommandMenu.js +1 -1
- package/src/plugins/dropdown/table/index.js +3 -2
- package/src/plugins/field/slashCommand.js +17 -1
- package/types/core/event/actions/index.d.ts +3 -0
- package/types/core/event/effects/keydown.registry.d.ts +6 -0
- package/types/core/event/eventOrchestrator.d.ts +7 -0
- package/types/core/event/handlers/handler_ww_key.d.ts +1 -0
- package/types/core/event/ports.d.ts +4 -2
- package/types/core/event/reducers/keydown.reducer.d.ts +15 -5
- package/types/core/kernel/store.d.ts +5 -0
- package/types/core/schema/options.d.ts +7 -4
- package/types/helper/env.d.ts +10 -0
- package/types/helper/index.d.ts +1 -0
- package/types/plugins/field/slashCommand.d.ts +34 -2
package/types/helper/env.d.ts
CHANGED
|
@@ -19,6 +19,15 @@ export function getPageStyle(doc: Document | null): string;
|
|
|
19
19
|
* @returns {string} If not found, return the first found value.
|
|
20
20
|
*/
|
|
21
21
|
export function getIncludePath(nameArray: Array<string>, extension: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* @description Runtime probe: does this environment actually deliver input events for edits?
|
|
24
|
+
* Some managed/corporate environments (keyboard-hooking security SW, DLP, VDI) silently drop `beforeinput`
|
|
25
|
+
* **and** `input` at runtime even though the browser statically supports them — static feature-detection
|
|
26
|
+
* (`window.InputEvent`) cannot see that. This synthetically triggers an edit (`execCommand('insertText')`)
|
|
27
|
+
* on an offscreen contenteditable and observes whether an input-family event fires **synchronously**.
|
|
28
|
+
* @returns {boolean} `true` if an input-family event fired (environment delivers edits), else `false`.
|
|
29
|
+
*/
|
|
30
|
+
export function canUseBeforeInput(): boolean;
|
|
22
31
|
/** @type {SunEditor.GlobalWindow} */
|
|
23
32
|
export const _w: SunEditor.GlobalWindow;
|
|
24
33
|
/** @type {Document} */
|
|
@@ -127,6 +136,7 @@ declare namespace env {
|
|
|
127
136
|
export { isAndroid };
|
|
128
137
|
export { isMobile };
|
|
129
138
|
export { isTouchDevice };
|
|
139
|
+
export { canUseBeforeInput };
|
|
130
140
|
export { cmdIcon };
|
|
131
141
|
export { shiftIcon };
|
|
132
142
|
export { DPI };
|
package/types/helper/index.d.ts
CHANGED
|
@@ -75,7 +75,23 @@ export type SlashCommandPluginOptions = {
|
|
|
75
75
|
* title: 'Heading 1',
|
|
76
76
|
* icon: 'h1',
|
|
77
77
|
* keywords: ['header', 'title'],
|
|
78
|
-
*
|
|
78
|
+
* // A line-level tag (H1-H6, P): `setLine` CHANGES the current line's tag → `<h1>…</h1>`.
|
|
79
|
+
* // Do NOT use `applyBlock` here — it WRAPS (`<h1><p>…</p></h1>`) and traps Enter inside.
|
|
80
|
+
* action: ($) => $.format.setLine(document.createElement('H1')),
|
|
81
|
+
* },
|
|
82
|
+
* {
|
|
83
|
+
* key: 'code',
|
|
84
|
+
* title: 'Code block',
|
|
85
|
+
* keywords: ['pre'],
|
|
86
|
+
* // A br-line block (PRE): `setBrLine` converts the line to a `<br>`-separated code block.
|
|
87
|
+
* action: ($) => $.format.setBrLine(document.createElement('PRE')),
|
|
88
|
+
* },
|
|
89
|
+
* {
|
|
90
|
+
* key: 'quote',
|
|
91
|
+
* title: 'Quote',
|
|
92
|
+
* keywords: ['blockquote'],
|
|
93
|
+
* // A container block (BLOCKQUOTE, DIV…): `applyBlock` WRAPS the selected lines → `<blockquote>…</blockquote>`.
|
|
94
|
+
* action: ($) => $.format.applyBlock(document.createElement('BLOCKQUOTE')),
|
|
79
95
|
* },
|
|
80
96
|
* 'bold',
|
|
81
97
|
* 'image',
|
|
@@ -130,7 +146,23 @@ export type SlashCommandPluginOptions = {
|
|
|
130
146
|
* title: 'Heading 1',
|
|
131
147
|
* icon: 'h1',
|
|
132
148
|
* keywords: ['header', 'title'],
|
|
133
|
-
*
|
|
149
|
+
* // A line-level tag (H1-H6, P): `setLine` CHANGES the current line's tag → `<h1>…</h1>`.
|
|
150
|
+
* // Do NOT use `applyBlock` here — it WRAPS (`<h1><p>…</p></h1>`) and traps Enter inside.
|
|
151
|
+
* action: ($) => $.format.setLine(document.createElement('H1')),
|
|
152
|
+
* },
|
|
153
|
+
* {
|
|
154
|
+
* key: 'code',
|
|
155
|
+
* title: 'Code block',
|
|
156
|
+
* keywords: ['pre'],
|
|
157
|
+
* // A br-line block (PRE): `setBrLine` converts the line to a `<br>`-separated code block.
|
|
158
|
+
* action: ($) => $.format.setBrLine(document.createElement('PRE')),
|
|
159
|
+
* },
|
|
160
|
+
* {
|
|
161
|
+
* key: 'quote',
|
|
162
|
+
* title: 'Quote',
|
|
163
|
+
* keywords: ['blockquote'],
|
|
164
|
+
* // A container block (BLOCKQUOTE, DIV…): `applyBlock` WRAPS the selected lines → `<blockquote>…</blockquote>`.
|
|
165
|
+
* action: ($) => $.format.applyBlock(document.createElement('BLOCKQUOTE')),
|
|
134
166
|
* },
|
|
135
167
|
* 'bold',
|
|
136
168
|
* 'image',
|