suneditor 3.0.0-rc.5 → 3.0.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.
Files changed (118) hide show
  1. package/README.md +3 -2
  2. package/dist/suneditor-contents.min.css +1 -1
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +2 -3
  6. package/src/assets/design/color.css +14 -2
  7. package/src/assets/design/typography.css +5 -0
  8. package/src/assets/icons/defaultIcons.js +22 -4
  9. package/src/assets/suneditor-contents.css +1 -1
  10. package/src/assets/suneditor.css +312 -18
  11. package/src/core/config/eventManager.js +6 -9
  12. package/src/core/editor.js +1 -1
  13. package/src/core/event/actions/index.js +5 -0
  14. package/src/core/event/effects/keydown.registry.js +25 -0
  15. package/src/core/event/eventOrchestrator.js +69 -2
  16. package/src/core/event/handlers/handler_ww_mouse.js +1 -0
  17. package/src/core/event/rules/keydown.rule.backspace.js +9 -1
  18. package/src/core/kernel/coreKernel.js +4 -0
  19. package/src/core/kernel/store.js +2 -0
  20. package/src/core/logic/dom/html.js +110 -11
  21. package/src/core/logic/dom/offset.js +89 -35
  22. package/src/core/logic/dom/selection.js +46 -19
  23. package/src/core/logic/panel/finder.js +982 -0
  24. package/src/core/logic/panel/menu.js +8 -6
  25. package/src/core/logic/panel/toolbar.js +112 -19
  26. package/src/core/logic/panel/viewer.js +214 -43
  27. package/src/core/logic/shell/_commandExecutor.js +7 -1
  28. package/src/core/logic/shell/commandDispatcher.js +1 -1
  29. package/src/core/logic/shell/component.js +5 -7
  30. package/src/core/logic/shell/history.js +24 -0
  31. package/src/core/logic/shell/shortcuts.js +3 -3
  32. package/src/core/logic/shell/ui.js +25 -26
  33. package/src/core/schema/frameContext.js +15 -1
  34. package/src/core/schema/options.js +75 -16
  35. package/src/core/section/constructor.js +61 -20
  36. package/src/core/section/documentType.js +1 -1
  37. package/src/events.js +12 -0
  38. package/src/helper/clipboard.js +1 -1
  39. package/src/helper/dom/domUtils.js +5 -14
  40. package/src/helper/index.js +3 -0
  41. package/src/helper/markdown.js +876 -0
  42. package/src/langs/ckb.js +9 -0
  43. package/src/langs/cs.js +9 -0
  44. package/src/langs/da.js +9 -0
  45. package/src/langs/de.js +9 -0
  46. package/src/langs/en.js +9 -0
  47. package/src/langs/es.js +9 -0
  48. package/src/langs/fa.js +9 -0
  49. package/src/langs/fr.js +9 -0
  50. package/src/langs/he.js +9 -0
  51. package/src/langs/hu.js +9 -0
  52. package/src/langs/it.js +9 -0
  53. package/src/langs/ja.js +9 -0
  54. package/src/langs/km.js +9 -0
  55. package/src/langs/ko.js +9 -0
  56. package/src/langs/lv.js +9 -0
  57. package/src/langs/nl.js +9 -0
  58. package/src/langs/pl.js +9 -0
  59. package/src/langs/pt_br.js +9 -0
  60. package/src/langs/ro.js +9 -0
  61. package/src/langs/ru.js +9 -0
  62. package/src/langs/se.js +9 -0
  63. package/src/langs/tr.js +9 -0
  64. package/src/langs/uk.js +9 -0
  65. package/src/langs/ur.js +9 -0
  66. package/src/langs/zh_cn.js +9 -0
  67. package/src/modules/contract/Controller.js +50 -39
  68. package/src/modules/manager/ApiManager.js +27 -4
  69. package/src/modules/manager/FileManager.js +1 -1
  70. package/src/modules/ui/SelectMenu.js +22 -11
  71. package/src/plugins/command/codeBlock.js +324 -0
  72. package/src/plugins/command/exportPDF.js +15 -3
  73. package/src/plugins/dropdown/blockStyle.js +1 -1
  74. package/src/plugins/dropdown/paragraphStyle.js +1 -2
  75. package/src/plugins/dropdown/table/render/table.html.js +1 -1
  76. package/src/plugins/dropdown/table/services/table.grid.js +16 -8
  77. package/src/plugins/dropdown/table/services/table.style.js +5 -9
  78. package/src/plugins/index.js +3 -0
  79. package/src/plugins/input/fontSize.js +4 -2
  80. package/src/plugins/modal/audio.js +2 -1
  81. package/src/plugins/modal/image/index.js +2 -1
  82. package/src/plugins/modal/math.js +2 -1
  83. package/src/plugins/modal/video/index.js +2 -1
  84. package/src/themes/cobalt.css +13 -4
  85. package/src/themes/cream.css +11 -2
  86. package/src/themes/dark.css +13 -4
  87. package/src/themes/midnight.css +13 -4
  88. package/src/typedef.js +4 -4
  89. package/types/assets/icons/defaultIcons.d.ts +12 -1
  90. package/types/core/config/eventManager.d.ts +6 -8
  91. package/types/core/event/actions/index.d.ts +1 -0
  92. package/types/core/event/effects/keydown.registry.d.ts +2 -0
  93. package/types/core/event/eventOrchestrator.d.ts +2 -1
  94. package/types/core/kernel/coreKernel.d.ts +5 -0
  95. package/types/core/kernel/store.d.ts +5 -0
  96. package/types/core/logic/dom/offset.d.ts +16 -3
  97. package/types/core/logic/dom/selection.d.ts +3 -3
  98. package/types/core/logic/panel/finder.d.ts +83 -0
  99. package/types/core/logic/panel/toolbar.d.ts +14 -1
  100. package/types/core/logic/panel/viewer.d.ts +22 -2
  101. package/types/core/logic/shell/shortcuts.d.ts +1 -1
  102. package/types/core/schema/frameContext.d.ts +22 -0
  103. package/types/core/schema/options.d.ts +153 -31
  104. package/types/events.d.ts +11 -0
  105. package/types/helper/dom/domUtils.d.ts +2 -2
  106. package/types/helper/index.d.ts +5 -0
  107. package/types/helper/markdown.d.ts +27 -0
  108. package/types/langs/_Lang.d.ts +9 -0
  109. package/types/modules/contract/Controller.d.ts +8 -1
  110. package/types/modules/ui/SelectMenu.d.ts +12 -0
  111. package/types/plugins/command/codeBlock.d.ts +53 -0
  112. package/types/plugins/index.d.ts +3 -0
  113. package/types/plugins/input/fontSize.d.ts +6 -2
  114. package/types/plugins/modal/audio.d.ts +4 -2
  115. package/types/plugins/modal/image/index.d.ts +3 -1
  116. package/types/plugins/modal/math.d.ts +3 -1
  117. package/types/plugins/modal/video/index.d.ts +3 -1
  118. package/types/typedef.d.ts +5 -2
@@ -38,15 +38,19 @@
38
38
  --se-edit-outline: #424242;
39
39
 
40
40
  /** --------------------------- layout - [colors] ----------- */
41
- /* main shell and typography */
42
- --se-main-font-family: Helvetica Neue;
43
41
  --se-main-out-color: #2c2c2c;
44
42
  --se-main-color: #e4e4e4;
45
43
  --se-main-color-lighter: #cfcfcf;
46
44
  --se-main-background-color: #212121;
47
- --se-code-view-color: #111111;
45
+ --se-code-view-color: #e4e4e4;
48
46
  --se-main-font-color: #e4e4e4;
49
- --se-code-view-background-color: #dadada;
47
+ --se-code-view-background-color: #1a1a1a;
48
+ --se-code-view-line-color: #999;
49
+ --se-code-view-line-background-color: #252525;
50
+ --se-markdown-view-color: #e4e4e4;
51
+ --se-markdown-view-background-color: #1a1a1a;
52
+ --se-markdown-view-line-color: #999;
53
+ --se-markdown-view-line-background-color: #252525;
50
54
  --se-main-divider-color: #3d4350;
51
55
  --se-main-border-color: #444;
52
56
  --se-main-outline-color: #383838;
@@ -54,6 +58,11 @@
54
58
  --se-statusbar-font-color: #a1a1a1;
55
59
  --se-overlay-background-color: rgba(0, 0, 0, 0.6);
56
60
 
61
+ /* finder */
62
+ --se-find-match-color: rgba(255, 213, 0, 0.3);
63
+ --se-find-current-color: rgba(255, 150, 50, 0.55);
64
+ --se-find-no-match-color: rgba(255, 80, 80, 0.2);
65
+
57
66
  /* hover states */
58
67
  --se-hover-color: #2f3f44;
59
68
  --se-hover-dark-color: #4b6b72;
package/src/typedef.js CHANGED
@@ -195,7 +195,7 @@
195
195
  * @typedef {Object} SunEditor.Event.Info
196
196
  * @property {*} target Target element
197
197
  * @property {string} type Event type
198
- * @property {EventListenerOrEventListenerObject} listener Event listener
198
+ * @property {*} listener Event listener
199
199
  * @property {boolean|AddEventListenerOptions} [useCapture] Event useCapture option
200
200
  */
201
201
 
@@ -203,7 +203,7 @@
203
203
  * EventManager global event information
204
204
  * @typedef {Object} SunEditor.Event.GlobalInfo
205
205
  * @property {string} type Event type
206
- * @property {(...args: *) => *} listener Event listener
206
+ * @property {*} listener Event listener
207
207
  * @property {boolean|AddEventListenerOptions} [useCapture] Use event capture
208
208
  */
209
209
 
@@ -265,10 +265,10 @@
265
265
  * ---[ Auto-generated by scripts/check/gen-button-types.cjs - DO NOT EDIT MANUALLY ]---
266
266
  *
267
267
  * Default command buttons available in the toolbar
268
- * @typedef {"bold"|"underline"|"italic"|"strike"|"subscript"|"superscript"|"removeFormat"|"copyFormat"|"indent"|"outdent"|"fullScreen"|"showBlocks"|"codeView"|"undo"|"redo"|"preview"|"print"|"copy"|"dir"|"dir_ltr"|"dir_rtl"|"save"|"newDocument"|"selectAll"|"pageBreak"|"pageUp"|"pageDown"|"pageNavigator"} SunEditor.UI.ButtonCommand
268
+ * @typedef {"bold"|"underline"|"italic"|"strike"|"subscript"|"superscript"|"removeFormat"|"copyFormat"|"indent"|"outdent"|"fullScreen"|"showBlocks"|"codeView"|"markdownView"|"undo"|"redo"|"preview"|"print"|"copy"|"dir"|"dir_ltr"|"dir_rtl"|"finder"|"save"|"newDocument"|"selectAll"|"pageBreak"|"pageUp"|"pageDown"|"pageNavigator"} SunEditor.UI.ButtonCommand
269
269
  *
270
270
  * Plugin buttons available in the toolbar
271
- * @typedef {"blockquote"|"exportPDF"|"fileUpload"|"list_bulleted"|"list_numbered"|"mention"|"align"|"font"|"fontColor"|"backgroundColor"|"list"|"table"|"blockStyle"|"hr"|"layout"|"lineHeight"|"template"|"paragraphStyle"|"textStyle"|"link"|"image"|"video"|"audio"|"embed"|"math"|"drawing"|"imageGallery"|"videoGallery"|"audioGallery"|"fileGallery"|"fileBrowser"|"fontSize"|"pageNavigator"|"anchor"} SunEditor.UI.ButtonPlugin
271
+ * @typedef {"blockquote"|"codeBlock"|"exportPDF"|"fileUpload"|"list_bulleted"|"list_numbered"|"mention"|"align"|"font"|"fontColor"|"backgroundColor"|"list"|"table"|"blockStyle"|"hr"|"layout"|"lineHeight"|"template"|"paragraphStyle"|"textStyle"|"link"|"image"|"video"|"audio"|"embed"|"math"|"drawing"|"imageGallery"|"videoGallery"|"audioGallery"|"fileGallery"|"fileBrowser"|"fontSize"|"pageNavigator"|"anchor"} SunEditor.UI.ButtonPlugin
272
272
  *
273
273
  * Single button item in the toolbar (includes special controls and custom strings)
274
274
  * @typedef {SunEditor.UI.ButtonCommand|SunEditor.UI.ButtonPlugin|SunEditor.UI.ButtonSpecial|string} SunEditor.UI.ButtonItem
@@ -13,7 +13,9 @@ declare namespace _default {
13
13
  export let outdent: string;
14
14
  export let expansion: string;
15
15
  export let reduction: string;
16
+ export let code_block: string;
16
17
  export let code_view: string;
18
+ export let markdown_view: string;
17
19
  export let preview: string;
18
20
  export let print: string;
19
21
  export let template: string;
@@ -119,12 +121,20 @@ declare namespace _default {
119
121
  export let cut: string;
120
122
  export let PDF: string;
121
123
  export let format_paint: string;
122
- export let find_replace: string;
123
124
  export let drawing: string;
124
125
  export let eraser: string;
125
126
  export let search: string;
126
127
  export let selection_search: string;
127
128
  export let embed: string;
129
+ export let finder: string;
130
+ export let regex: string;
131
+ export let match_case: string;
132
+ export let whole_word: string;
133
+ export let swap_vert: string;
134
+ export let arrow_down_small: string;
135
+ export let arrow_up_small: string;
136
+ export let replaceText: string;
137
+ export let relaceTextAll: string;
128
138
  export let menu_arrow_down: string;
129
139
  export let menu_arrow_up: string;
130
140
  export let menu_arrow_right: string;
@@ -147,6 +157,7 @@ declare namespace _default {
147
157
  export let more_plus: string;
148
158
  export let more_horizontal: string;
149
159
  export let more_vertical: string;
160
+ export let more_flag: string;
150
161
  export let as_inline: string;
151
162
  export let as_block: string;
152
163
  export let page_break: string;
@@ -21,18 +21,16 @@ declare class EventManager {
21
21
  * @type {(eventName: string, ...args: *) => Promise<*>}
22
22
  */
23
23
  triggerEvent: (eventName: string, ...args: any) => Promise<any>;
24
- /** @type {HTMLInputElement} */
25
- __focusTemp: HTMLInputElement;
26
24
  /**
27
25
  * @description Register for an event.
28
26
  * - Only events registered with this method are unregistered or re-registered when methods such as 'setOptions', 'destroy' are called.
29
27
  * @param {*} target Target element
30
28
  * @param {string} type Event type
31
- * @param {EventListenerOrEventListenerObject} listener Event handler
29
+ * @param {*} listener Event handler
32
30
  * @param {boolean|AddEventListenerOptions} [useCapture] Event useCapture option
33
31
  * @return {?SunEditor.Event.Info} Registered event information
34
32
  */
35
- addEvent(target: any, type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean | AddEventListenerOptions): SunEditor.Event.Info | null;
33
+ addEvent(target: any, type: string, listener: any, useCapture?: boolean | AddEventListenerOptions): SunEditor.Event.Info | null;
36
34
  /**
37
35
  * @description Remove event
38
36
  * @param {SunEditor.Event.Info} params event info = this.addEvent()
@@ -43,20 +41,20 @@ declare class EventManager {
43
41
  * @description Add an event to document.
44
42
  * - When created as an Iframe, the same event is added to the document in the Iframe.
45
43
  * @param {string} type Event type
46
- * @param {(...args: *) => *} listener Event listener
44
+ * @param {*} listener Event listener
47
45
  * @param {boolean|AddEventListenerOptions} [useCapture] Use event capture
48
46
  * @return {SunEditor.Event.GlobalInfo} Registered event information
49
47
  */
50
- addGlobalEvent(type: string, listener: (...args: any) => any, useCapture?: boolean | AddEventListenerOptions): SunEditor.Event.GlobalInfo;
48
+ addGlobalEvent(type: string, listener: any, useCapture?: boolean | AddEventListenerOptions): SunEditor.Event.GlobalInfo;
51
49
  /**
52
50
  * @description Remove events from document.
53
51
  * - When created as an Iframe, the event of the document inside the Iframe is also removed.
54
52
  * @param {string|SunEditor.Event.GlobalInfo} type Event type or (Event info = this.addGlobalEvent())
55
- * @param {(...args: *) => *} [listener] Event listener
53
+ * @param {*} [listener] Event listener
56
54
  * @param {boolean|AddEventListenerOptions} [useCapture] Use event capture
57
55
  * @returns {undefined|null} Success: `null`, Not found: `undefined`
58
56
  */
59
- removeGlobalEvent(type: string | SunEditor.Event.GlobalInfo, listener?: (...args: any) => any, useCapture?: boolean | AddEventListenerOptions): undefined | null;
57
+ removeGlobalEvent(type: string | SunEditor.Event.GlobalInfo, listener?: any, useCapture?: boolean | AddEventListenerOptions): undefined | null;
60
58
  /**
61
59
  * @internal
62
60
  * @description Gives an active effect when the mouse down event is blocked. (Used when "env.isGecko" is `true`)
@@ -15,6 +15,7 @@ export namespace A {
15
15
  function selectComponentFallback(cmponentInfo: SunEditor.ComponentInfo): Action;
16
16
  function delFormatRemoveAndMove(container: Node, formatEl: Element): Action;
17
17
  function backspaceFormatMaintain(formatEl: Element): Action;
18
+ function backspaceBrLineStrip(formatEl: Element): Action;
18
19
  function backspaceComponentSelect(selectionNode: Node, range: Range, fileComponentInfo: SunEditor.ComponentInfo): Action;
19
20
  function backspaceComponentRemove(isList: boolean, sel: Node, formatEl: Element, fileComponentInfo: SunEditor.ComponentInfo): Action;
20
21
  function backspaceListMergePrev(prev: Element, formatEl: Element, rangeEl: Element): Action;
@@ -4,6 +4,8 @@ declare const _default: {
4
4
  /** @action delFormatRemoveAndMove */
5
5
  'del.format.removeAndMove': ({ ports }: EffectContext_keydown, { container, formatEl }: any) => void;
6
6
  /** [backspace] */
7
+ /** @action backspaceBrLineStrip — extract first line from brLine (PRE) */
8
+ 'backspace.brline.strip': ({ ctx, ports }: EffectContext_keydown, { formatEl }: any) => void;
7
9
  /** @action backspaceFormatMaintain */
8
10
  'backspace.format.maintain': ({ ctx }: EffectContext_keydown, { formatEl }: any) => void;
9
11
  /** @action backspaceComponentSelect */
@@ -51,6 +51,8 @@ declare class EventOrchestrator extends KernelInjector {
51
51
  __eventDoc: Document;
52
52
  /** @type {string} */
53
53
  __secopy: string;
54
+ /** @type {HTMLInputElement} */
55
+ __focusTemp: HTMLInputElement;
54
56
  /**
55
57
  * @description Activates the corresponding button with the tags information of the current cursor position,
56
58
  * - such as `bold`, `underline`, etc., and executes the `active` method of the plugins.
@@ -122,7 +124,6 @@ declare class EventOrchestrator extends KernelInjector {
122
124
  * - Disconnects observers and clears stored event references.
123
125
  */
124
126
  _removeAllEvents(): void;
125
- __focusTemp: any;
126
127
  /**
127
128
  * @internal
128
129
  * @description Synchronizes the selection state by resetting it on `mouseup`.
@@ -136,6 +136,10 @@ export type Deps = {
136
136
  * - L3: View mode handler
137
137
  */
138
138
  viewer: import('../logic/panel/viewer').default;
139
+ /**
140
+ * - L3: Finder handler
141
+ */
142
+ finder: import('../logic/panel/finder').default;
139
143
  };
140
144
  /**
141
145
  * @typedef {import('../section/constructor').ConstructorReturnType} ProductType
@@ -180,6 +184,7 @@ export type Deps = {
180
184
  * @property {import('../logic/panel/toolbar').default} subToolbar - L3: Sub-toolbar renderer
181
185
  * @property {import('../logic/panel/menu').default} menu - L3: Menu renderer
182
186
  * @property {import('../logic/panel/viewer').default} viewer - L3: View mode handler
187
+ * @property {import('../logic/panel/finder').default} finder - L3: Finder handler
183
188
  */
184
189
  /**
185
190
  * @description Core dependency container for the editor.
@@ -94,6 +94,10 @@ export type StoreMode = {
94
94
  * - Whether the sub-toolbar is in `balloon-always` mode.
95
95
  */
96
96
  isSubBalloonAlways: boolean;
97
+ /**
98
+ * - Whether the toolbar is placed at the bottom of the editor (`classic:bottom`, `inline:bottom`).
99
+ */
100
+ isBottom: boolean;
97
101
  };
98
102
  /**
99
103
  * @typedef {Object} StoreState
@@ -122,6 +126,7 @@ export type StoreMode = {
122
126
  * @property {boolean} isBalloonAlways - Whether the toolbar is in `balloon-always` mode (always visible as floating).
123
127
  * @property {boolean} isSubBalloon - Whether the sub-toolbar is in `balloon` mode.
124
128
  * @property {boolean} isSubBalloonAlways - Whether the sub-toolbar is in `balloon-always` mode.
129
+ * @property {boolean} isBottom - Whether the toolbar is placed at the bottom of the editor (`classic:bottom`, `inline:bottom`).
125
130
  */
126
131
  /**
127
132
  * @description Central runtime state management for the editor.
@@ -279,22 +279,34 @@ declare class Offset {
279
279
  * @param {HTMLElement} e_container Element's root container
280
280
  * @param {HTMLElement} target Target element to position against
281
281
  * @param {HTMLElement} t_container Target's root container
282
+ * @param {Object} [opts] Options
283
+ * @param {boolean} [opts.preferUp=false] Open upward by default (for bottom toolbar)
282
284
  */
283
- setRelPosition(element: HTMLElement, e_container: HTMLElement, target: HTMLElement, t_container: HTMLElement): void;
285
+ setRelPosition(
286
+ element: HTMLElement,
287
+ e_container: HTMLElement,
288
+ target: HTMLElement,
289
+ t_container: HTMLElement,
290
+ {
291
+ preferUp,
292
+ }?: {
293
+ preferUp?: boolean;
294
+ },
295
+ ): void;
284
296
  /**
285
297
  * @description Sets the absolute position of an element
286
298
  * @param {HTMLElement} element Element to position
287
299
  * @param {HTMLElement} target Target element
288
300
  * @param {Object} params Position parameters
289
301
  * @param {boolean} [params.isWWTarget=false] Whether the target is within the editor's WYSIWYG area
290
- * @param {{left:number, top:number}} [params.addOffset={left:0, top:0}] Additional offset
302
+ * @param {{left:number, right:number, top:number}} [params.addOffset={left:0, right:0, top:0}] Additional offset
291
303
  * @param {"bottom"|"top"} [params.position="bottom"] Position ('bottom'|'top')
292
304
  * @param {*} params.inst Instance object of caller
293
305
  * @param {HTMLElement} [params.sibling=null] The sibling controller element
294
306
  * @returns {{position: "top" | "bottom"} | undefined} Success -> {position: current position}
295
307
  * @example
296
308
  * const result = editor.$.offset.setAbsPosition(controller, targetElement, {
297
- * position: 'bottom', inst: this, addOffset: { left: 0, top: 0 }
309
+ * position: 'bottom', inst: this, addOffset: { left: 0, right: 0, top: 0 }
298
310
  * });
299
311
  */
300
312
  setAbsPosition(
@@ -304,6 +316,7 @@ declare class Offset {
304
316
  isWWTarget?: boolean;
305
317
  addOffset?: {
306
318
  left: number;
319
+ right: number;
307
320
  top: number;
308
321
  };
309
322
  position?: 'bottom' | 'top';
@@ -127,7 +127,7 @@ declare class Selection_ {
127
127
  /**
128
128
  * @description Scroll to the corresponding selection or range position.
129
129
  * @param {Selection|Range|Node} ref selection or range object
130
- * @param {Object<string, *>} [scrollOption] option of scrollTo
130
+ * @param {ScrollIntoViewOptions & {noFocus?: boolean}} [scrollOption] Scroll options. Extends `ScrollIntoViewOptions` (`behavior`, `block`, `inline`) with `noFocus` to prevent focus change.
131
131
  * @example
132
132
  * // Scroll to current selection smoothly
133
133
  * editor.selection.scrollTo(editor.selection.get());
@@ -144,8 +144,8 @@ declare class Selection_ {
144
144
  */
145
145
  scrollTo(
146
146
  ref: Selection | Range | Node,
147
- scrollOption?: {
148
- [x: string]: any;
147
+ scrollOption?: ScrollIntoViewOptions & {
148
+ noFocus?: boolean;
149
149
  },
150
150
  ): void;
151
151
  /**
@@ -0,0 +1,83 @@
1
+ import type {} from '../../../typedef';
2
+ export default Finder;
3
+ /**
4
+ * @description Find/Replace feature
5
+ */
6
+ declare class Finder {
7
+ /** @description Inject ::highlight() styles at runtime (avoids PostCSS parse errors). */
8
+ static #highlightStyleInjected: boolean;
9
+ static #injectHighlightStyles(): void;
10
+ /**
11
+ * @constructor
12
+ * @param {SunEditor.Kernel} kernel
13
+ */
14
+ constructor(kernel: SunEditor.Kernel);
15
+ /**
16
+ * @description Whether the panel is open.
17
+ * @returns {boolean}
18
+ */
19
+ get isOpen(): boolean;
20
+ /**
21
+ * @description Opens the finder. With panel: shows UI. Without panel: activates search state only.
22
+ * @param {boolean} [replaceMode=true] Whether to show replace row
23
+ */
24
+ open(replaceMode?: boolean): void;
25
+ /**
26
+ * @description Closes the finder and clears highlights.
27
+ */
28
+ close(): void;
29
+ /**
30
+ * @description Navigate to next match (public for shortcut binding).
31
+ */
32
+ findNext(): void;
33
+ /**
34
+ * @description Navigate to previous match (public for shortcut binding).
35
+ */
36
+ findPrev(): void;
37
+ /**
38
+ * @description Search for a term in the editor content (headless API).
39
+ * @param {string} term Search term
40
+ * @param {Object} [options] Search options
41
+ * @param {boolean} [options.matchCase=false] Case-sensitive search
42
+ * @param {boolean} [options.wholeWord=false] Whole word search
43
+ * @param {boolean} [options.regex=false] Regex search
44
+ * @returns {number} Number of matches found
45
+ */
46
+ search(
47
+ term: string,
48
+ {
49
+ matchCase,
50
+ wholeWord,
51
+ regex,
52
+ }?: {
53
+ matchCase?: boolean;
54
+ wholeWord?: boolean;
55
+ regex?: boolean;
56
+ },
57
+ ): number;
58
+ /**
59
+ * @description Replace the current match (headless API).
60
+ * @param {string} replaceText Replacement text
61
+ */
62
+ replace(replaceText: string): void;
63
+ /**
64
+ * @description Replace all matches (headless API).
65
+ * @param {string} replaceText Replacement text
66
+ */
67
+ replaceAll(replaceText: string): void;
68
+ /**
69
+ * @description Current match count and index.
70
+ * @returns {{ current: number, total: number }}
71
+ */
72
+ get matchInfo(): {
73
+ current: number;
74
+ total: number;
75
+ };
76
+ /**
77
+ * @description Re-run search with current term (debounced 300ms). Called on wysiwyg content change.
78
+ */
79
+ refresh(): void;
80
+ /** @internal */
81
+ _destroy(): void;
82
+ #private;
83
+ }
@@ -40,7 +40,6 @@ declare class Toolbar {
40
40
  */
41
41
  keyName: any;
42
42
  currentMoreLayerActiveButton: HTMLButtonElement;
43
- isSticky: boolean;
44
43
  isBalloonMode: boolean;
45
44
  isInlineMode: boolean;
46
45
  isBalloonAlwaysMode: boolean;
@@ -53,6 +52,20 @@ declare class Toolbar {
53
52
  top: number;
54
53
  left: number;
55
54
  };
55
+ isBottomMode: boolean;
56
+ /**
57
+ * @description Whether the toolbar is currently in a sticky (fixed) state.
58
+ * For CSS sticky mode, computed from the element's viewport position.
59
+ * For JS sticky mode (toolbar_container), uses a manual flag.
60
+ * @type {boolean}
61
+ */
62
+ get isSticky(): boolean;
63
+ /**
64
+ * @description Whether the toolbar uses native CSS `position: sticky`.
65
+ * - When `false`, the JS-based sticky fallback (`position: fixed`) is active.
66
+ * @type {boolean}
67
+ */
68
+ get isCSSSticky(): boolean;
56
69
  /**
57
70
  * @description Disables all toolbar buttons.
58
71
  */
@@ -14,6 +14,11 @@ declare class Viewer {
14
14
  * @param {boolean} [value] `true`/`false`, If `undefined` toggle the `codeView` mode.
15
15
  */
16
16
  codeView(value?: boolean): void;
17
+ /**
18
+ * @description Changes to markdown view or wysiwyg view
19
+ * @param {boolean} [value] `true`/`false`, If `undefined` toggle the `markdownView` mode.
20
+ */
21
+ markdownView(value?: boolean): void;
17
22
  /**
18
23
  * @description Changes to full screen or default screen
19
24
  * @param {boolean} [value] `true`/`false`, If `undefined` toggle the `fullScreen` mode.
@@ -67,11 +72,11 @@ declare class Viewer {
67
72
  * @internal
68
73
  * @description Adjusts the height of the code view area.
69
74
  * - Ensures the code block `auto`-resizes based on its content.
70
- * @param {HTMLElement} code - Code area
75
+ * @param {HTMLTextAreaElement} code - Code area
71
76
  * @param {HTMLTextAreaElement} codeNumbers - Code numbers area
72
77
  * @param {boolean} isAuto - `auto` height option
73
78
  */
74
- _codeViewAutoHeight(code: HTMLElement, codeNumbers: HTMLTextAreaElement, isAuto: boolean): void;
79
+ _codeViewAutoHeight(code: HTMLTextAreaElement, codeNumbers: HTMLTextAreaElement, isAuto: boolean): void;
75
80
  /**
76
81
  * @internal
77
82
  * @this {HTMLElement} Code numbers area
@@ -80,6 +85,21 @@ declare class Viewer {
80
85
  * @param {HTMLTextAreaElement} codeNumbers - Code numbers textarea
81
86
  */
82
87
  _scrollLineNumbers(this: HTMLElement, codeNumbers: HTMLTextAreaElement): void;
88
+ /**
89
+ * @internal
90
+ * @description Adjusts the height of the markdown view area.
91
+ * @param {HTMLTextAreaElement} md - Markdown area
92
+ * @param {HTMLTextAreaElement} mdNumbers - Markdown numbers area
93
+ * @param {boolean} isAuto - `auto` height option
94
+ */
95
+ _markdownViewAutoHeight(md: HTMLTextAreaElement, mdNumbers: HTMLTextAreaElement, isAuto: boolean): void;
96
+ /**
97
+ * @internal
98
+ * @this {HTMLElement} Markdown numbers area
99
+ * @description Synchronizes scrolling of line numbers with the markdown editor.
100
+ * @param {HTMLTextAreaElement} mdNumbers - Markdown numbers textarea
101
+ */
102
+ _scrollMarkdownLineNumbers(this: HTMLElement, mdNumbers: HTMLTextAreaElement): void;
83
103
  /**
84
104
  * @internal
85
105
  * @description Destroy the Viewer instance and release memory
@@ -121,7 +121,7 @@ declare class Shortcuts {
121
121
  * @description Registers custom shortcut keys (keys starting with `_`) into the shortcut map.
122
122
  * Called during initialization and when toolbar is reset.
123
123
  */
124
- _registerCustomShortcuts(): void;
124
+ _registerShortcuts(): void;
125
125
  /**
126
126
  * @internal
127
127
  * @description Destroy the Shortcuts instance and release memory
@@ -29,6 +29,9 @@ import type {} from '../../typedef';
29
29
  * @property {HTMLElement} codeWrapper - Wrapper element for the code-view mode.
30
30
  * @property {HTMLElement & HTMLTextAreaElement} code - Code view editing element (a <textarea> or <pre>).
31
31
  * @property {HTMLTextAreaElement} codeNumbers - Element displaying line numbers in code view mode.
32
+ * @property {HTMLElement} markdownWrapper - Wrapper element for the markdown-view mode.
33
+ * @property {HTMLTextAreaElement} markdown - Markdown view editing element (a <textarea>).
34
+ * @property {HTMLTextAreaElement} markdownNumbers - Element displaying line numbers in markdown view mode.
32
35
  * @property {HTMLElement} placeholder - Placeholder element shown when the editor is empty.
33
36
  * @property {HTMLElement} statusbar - Editor status bar element (for resizing, info, etc.).
34
37
  * @property {HTMLElement} navigation - Navigation element (e.g., for outline or bookmarks).
@@ -46,6 +49,7 @@ import type {} from '../../typedef';
46
49
  *
47
50
  * === State Flags ===
48
51
  * @property {boolean} isCodeView - Whether the editor is currently in code view mode.
52
+ * @property {boolean} isMarkdownView - Whether the editor is currently in markdown view mode.
49
53
  * @property {boolean} isFullScreen - Whether the editor is currently in fullscreen mode.
50
54
  * @property {boolean} isReadOnly - Whether the editor is set to readonly mode.
51
55
  * @property {boolean} isDisabled - Whether the editor is currently disabled.
@@ -97,6 +101,8 @@ export function CreateFrameContext(
97
101
  wwFrame: HTMLElement,
98
102
  codeWrapper: HTMLElement,
99
103
  codeFrame: HTMLElement,
104
+ markdownWrapper: any,
105
+ markdownFrame: any,
100
106
  statusbar: HTMLElement | null,
101
107
  documentTypeInner: {
102
108
  inner: HTMLElement;
@@ -177,6 +183,18 @@ export type FrameContextStore = {
177
183
  * - Element displaying line numbers in code view mode.
178
184
  */
179
185
  codeNumbers: HTMLTextAreaElement;
186
+ /**
187
+ * - Wrapper element for the markdown-view mode.
188
+ */
189
+ markdownWrapper: HTMLElement;
190
+ /**
191
+ * - Markdown view editing element (a <textarea>).
192
+ */
193
+ markdown: HTMLTextAreaElement;
194
+ /**
195
+ * - Element displaying line numbers in markdown view mode.
196
+ */
197
+ markdownNumbers: HTMLTextAreaElement;
180
198
  /**
181
199
  * - Placeholder element shown when the editor is empty.
182
200
  */
@@ -238,6 +256,10 @@ export type FrameContextStore = {
238
256
  * - Whether the editor is currently in code view mode.
239
257
  */
240
258
  isCodeView: boolean;
259
+ /**
260
+ * - Whether the editor is currently in markdown view mode.
261
+ */
262
+ isMarkdownView: boolean;
241
263
  /**
242
264
  * - Whether the editor is currently in fullscreen mode.
243
265
  */