suneditor 3.0.0-beta.3 → 3.0.0-beta.30

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 (241) hide show
  1. package/CONTRIBUTING.md +8 -8
  2. package/README.md +44 -49
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +95 -53
  6. package/src/assets/design/color.css +2 -2
  7. package/src/assets/design/size.css +2 -0
  8. package/src/assets/icons/defaultIcons.js +16 -1
  9. package/src/assets/suneditor-contents.css +9 -8
  10. package/src/assets/suneditor.css +29 -26
  11. package/src/core/{section → base}/actives.js +20 -12
  12. package/src/core/base/history.js +4 -4
  13. package/src/core/class/char.js +10 -10
  14. package/src/core/class/component.js +146 -57
  15. package/src/core/class/format.js +94 -2458
  16. package/src/core/class/html.js +187 -129
  17. package/src/core/class/inline.js +1853 -0
  18. package/src/core/class/listFormat.js +582 -0
  19. package/src/core/class/menu.js +14 -3
  20. package/src/core/class/nodeTransform.js +9 -14
  21. package/src/core/class/offset.js +162 -197
  22. package/src/core/class/selection.js +137 -34
  23. package/src/core/class/toolbar.js +73 -52
  24. package/src/core/class/ui.js +11 -11
  25. package/src/core/class/viewer.js +56 -55
  26. package/src/core/config/context.js +122 -0
  27. package/src/core/config/frameContext.js +204 -0
  28. package/src/core/config/options.js +639 -0
  29. package/src/core/editor.js +181 -108
  30. package/src/core/event/actions/index.js +229 -0
  31. package/src/core/event/effects/common.registry.js +60 -0
  32. package/src/core/event/effects/keydown.registry.js +551 -0
  33. package/src/core/event/effects/ruleHelpers.js +145 -0
  34. package/src/core/{base → event}/eventManager.js +119 -201
  35. package/src/core/event/executor.js +21 -0
  36. package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
  37. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
  38. package/src/core/event/handlers/handler_ww_input.js +77 -0
  39. package/src/core/event/handlers/handler_ww_key.js +228 -0
  40. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
  41. package/src/core/event/ports.js +211 -0
  42. package/src/core/event/reducers/keydown.reducer.js +89 -0
  43. package/src/core/event/rules/keydown.rule.arrow.js +54 -0
  44. package/src/core/event/rules/keydown.rule.backspace.js +202 -0
  45. package/src/core/event/rules/keydown.rule.delete.js +126 -0
  46. package/src/core/event/rules/keydown.rule.enter.js +144 -0
  47. package/src/core/event/rules/keydown.rule.tab.js +29 -0
  48. package/src/core/section/constructor.js +79 -388
  49. package/src/core/section/documentType.js +47 -26
  50. package/src/core/util/instanceCheck.js +59 -0
  51. package/src/editorInjector/_classes.js +4 -0
  52. package/src/editorInjector/_core.js +17 -7
  53. package/src/editorInjector/index.js +10 -2
  54. package/src/events.js +6 -0
  55. package/src/helper/clipboard.js +24 -10
  56. package/src/helper/converter.js +17 -12
  57. package/src/helper/dom/domCheck.js +22 -3
  58. package/src/helper/dom/domQuery.js +91 -45
  59. package/src/helper/dom/domUtils.js +93 -19
  60. package/src/helper/dom/index.js +4 -0
  61. package/src/helper/env.js +11 -7
  62. package/src/helper/keyCodeMap.js +4 -3
  63. package/src/langs/ckb.js +1 -1
  64. package/src/langs/cs.js +1 -1
  65. package/src/langs/da.js +1 -1
  66. package/src/langs/de.js +1 -1
  67. package/src/langs/en.js +1 -1
  68. package/src/langs/es.js +1 -1
  69. package/src/langs/fa.js +1 -1
  70. package/src/langs/fr.js +1 -1
  71. package/src/langs/he.js +1 -1
  72. package/src/langs/hu.js +1 -1
  73. package/src/langs/it.js +1 -1
  74. package/src/langs/ja.js +1 -1
  75. package/src/langs/km.js +1 -1
  76. package/src/langs/ko.js +1 -1
  77. package/src/langs/lv.js +1 -1
  78. package/src/langs/nl.js +1 -1
  79. package/src/langs/pl.js +1 -1
  80. package/src/langs/pt_br.js +10 -10
  81. package/src/langs/ro.js +1 -1
  82. package/src/langs/ru.js +1 -1
  83. package/src/langs/se.js +1 -1
  84. package/src/langs/tr.js +1 -1
  85. package/src/langs/uk.js +1 -1
  86. package/src/langs/ur.js +1 -1
  87. package/src/langs/zh_cn.js +1 -1
  88. package/src/modules/ApiManager.js +25 -18
  89. package/src/modules/Browser.js +52 -61
  90. package/src/modules/ColorPicker.js +37 -38
  91. package/src/modules/Controller.js +85 -79
  92. package/src/modules/Figure.js +275 -187
  93. package/src/modules/FileManager.js +86 -92
  94. package/src/modules/HueSlider.js +67 -35
  95. package/src/modules/Modal.js +84 -77
  96. package/src/modules/ModalAnchorEditor.js +62 -79
  97. package/src/modules/SelectMenu.js +89 -86
  98. package/src/plugins/browser/audioGallery.js +9 -5
  99. package/src/plugins/browser/fileBrowser.js +10 -6
  100. package/src/plugins/browser/fileGallery.js +9 -5
  101. package/src/plugins/browser/imageGallery.js +9 -5
  102. package/src/plugins/browser/videoGallery.js +11 -6
  103. package/src/plugins/command/blockquote.js +1 -0
  104. package/src/plugins/command/exportPDF.js +11 -8
  105. package/src/plugins/command/fileUpload.js +41 -29
  106. package/src/plugins/command/list_bulleted.js +2 -1
  107. package/src/plugins/command/list_numbered.js +2 -1
  108. package/src/plugins/dropdown/align.js +8 -2
  109. package/src/plugins/dropdown/backgroundColor.js +19 -11
  110. package/src/plugins/dropdown/font.js +15 -9
  111. package/src/plugins/dropdown/fontColor.js +19 -11
  112. package/src/plugins/dropdown/formatBlock.js +7 -2
  113. package/src/plugins/dropdown/hr.js +7 -3
  114. package/src/plugins/dropdown/layout.js +6 -2
  115. package/src/plugins/dropdown/lineHeight.js +8 -3
  116. package/src/plugins/dropdown/list.js +2 -1
  117. package/src/plugins/dropdown/paragraphStyle.js +15 -11
  118. package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
  119. package/src/plugins/dropdown/template.js +6 -2
  120. package/src/plugins/dropdown/textStyle.js +7 -3
  121. package/src/plugins/field/mention.js +33 -27
  122. package/src/plugins/input/fontSize.js +44 -37
  123. package/src/plugins/input/pageNavigator.js +3 -2
  124. package/src/plugins/modal/audio.js +90 -85
  125. package/src/plugins/modal/drawing.js +58 -66
  126. package/src/plugins/modal/embed.js +193 -180
  127. package/src/plugins/modal/image.js +441 -439
  128. package/src/plugins/modal/link.js +31 -8
  129. package/src/plugins/modal/math.js +23 -22
  130. package/src/plugins/modal/video.js +233 -230
  131. package/src/plugins/popup/anchor.js +24 -18
  132. package/src/suneditor.js +69 -24
  133. package/src/typedef.js +42 -19
  134. package/types/assets/icons/defaultIcons.d.ts +8 -0
  135. package/types/core/class/char.d.ts +1 -1
  136. package/types/core/class/component.d.ts +29 -7
  137. package/types/core/class/format.d.ts +4 -354
  138. package/types/core/class/html.d.ts +13 -4
  139. package/types/core/class/inline.d.ts +263 -0
  140. package/types/core/class/listFormat.d.ts +135 -0
  141. package/types/core/class/menu.d.ts +10 -2
  142. package/types/core/class/offset.d.ts +24 -26
  143. package/types/core/class/selection.d.ts +2 -0
  144. package/types/core/class/toolbar.d.ts +24 -11
  145. package/types/core/class/ui.d.ts +1 -1
  146. package/types/core/class/viewer.d.ts +1 -1
  147. package/types/core/config/context.d.ts +157 -0
  148. package/types/core/config/frameContext.d.ts +367 -0
  149. package/types/core/config/options.d.ts +1119 -0
  150. package/types/core/editor.d.ts +101 -66
  151. package/types/core/event/actions/index.d.ts +47 -0
  152. package/types/core/event/effects/common.registry.d.ts +50 -0
  153. package/types/core/event/effects/keydown.registry.d.ts +73 -0
  154. package/types/core/event/effects/ruleHelpers.d.ts +31 -0
  155. package/types/core/{base → event}/eventManager.d.ts +15 -46
  156. package/types/core/event/executor.d.ts +6 -0
  157. package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
  158. package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
  159. package/types/core/event/ports.d.ts +255 -0
  160. package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
  161. package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
  162. package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
  163. package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
  164. package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
  165. package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
  166. package/types/core/section/constructor.d.ts +101 -631
  167. package/types/core/section/documentType.d.ts +14 -4
  168. package/types/core/util/instanceCheck.d.ts +50 -0
  169. package/types/editorInjector/_classes.d.ts +4 -0
  170. package/types/editorInjector/_core.d.ts +17 -7
  171. package/types/editorInjector/index.d.ts +10 -2
  172. package/types/events.d.ts +1 -0
  173. package/types/helper/clipboard.d.ts +2 -2
  174. package/types/helper/converter.d.ts +6 -9
  175. package/types/helper/dom/domCheck.d.ts +7 -0
  176. package/types/helper/dom/domQuery.d.ts +19 -8
  177. package/types/helper/dom/domUtils.d.ts +24 -2
  178. package/types/helper/dom/index.d.ts +86 -1
  179. package/types/helper/env.d.ts +6 -1
  180. package/types/helper/index.d.ts +7 -1
  181. package/types/helper/keyCodeMap.d.ts +3 -3
  182. package/types/index.d.ts +23 -117
  183. package/types/langs/index.d.ts +2 -2
  184. package/types/modules/ApiManager.d.ts +1 -8
  185. package/types/modules/Browser.d.ts +4 -62
  186. package/types/modules/ColorPicker.d.ts +4 -21
  187. package/types/modules/Controller.d.ts +8 -64
  188. package/types/modules/Figure.d.ts +54 -50
  189. package/types/modules/FileManager.d.ts +1 -13
  190. package/types/modules/HueSlider.d.ts +13 -3
  191. package/types/modules/Modal.d.ts +0 -43
  192. package/types/modules/ModalAnchorEditor.d.ts +0 -73
  193. package/types/modules/SelectMenu.d.ts +0 -85
  194. package/types/modules/index.d.ts +3 -3
  195. package/types/plugins/browser/audioGallery.d.ts +29 -18
  196. package/types/plugins/browser/fileBrowser.d.ts +38 -27
  197. package/types/plugins/browser/fileGallery.d.ts +29 -18
  198. package/types/plugins/browser/imageGallery.d.ts +24 -16
  199. package/types/plugins/browser/videoGallery.d.ts +29 -18
  200. package/types/plugins/command/blockquote.d.ts +1 -0
  201. package/types/plugins/command/exportPDF.d.ts +18 -18
  202. package/types/plugins/command/fileUpload.d.ts +65 -45
  203. package/types/plugins/command/list_bulleted.d.ts +1 -0
  204. package/types/plugins/command/list_numbered.d.ts +1 -0
  205. package/types/plugins/dropdown/align.d.ts +13 -8
  206. package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
  207. package/types/plugins/dropdown/font.d.ts +13 -12
  208. package/types/plugins/dropdown/fontColor.d.ts +30 -19
  209. package/types/plugins/dropdown/formatBlock.d.ts +13 -8
  210. package/types/plugins/dropdown/hr.d.ts +15 -11
  211. package/types/plugins/dropdown/layout.d.ts +15 -11
  212. package/types/plugins/dropdown/lineHeight.d.ts +16 -11
  213. package/types/plugins/dropdown/list.d.ts +1 -0
  214. package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
  215. package/types/plugins/dropdown/table/index.d.ts +582 -0
  216. package/types/plugins/dropdown/table.d.ts +41 -86
  217. package/types/plugins/dropdown/template.d.ts +15 -11
  218. package/types/plugins/dropdown/textStyle.d.ts +19 -11
  219. package/types/plugins/field/mention.d.ts +58 -56
  220. package/types/plugins/index.d.ts +38 -38
  221. package/types/plugins/input/fontSize.d.ts +46 -50
  222. package/types/plugins/modal/audio.d.ts +26 -56
  223. package/types/plugins/modal/drawing.d.ts +0 -85
  224. package/types/plugins/modal/embed.d.ts +15 -79
  225. package/types/plugins/modal/image.d.ts +24 -136
  226. package/types/plugins/modal/link.d.ts +34 -15
  227. package/types/plugins/modal/math.d.ts +0 -16
  228. package/types/plugins/modal/video.d.ts +17 -86
  229. package/types/plugins/popup/anchor.d.ts +1 -8
  230. package/types/suneditor.d.ts +70 -19
  231. package/types/typedef.d.ts +60 -46
  232. package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
  233. package/src/core/section/context.js +0 -102
  234. package/types/core/section/context.d.ts +0 -45
  235. package/types/langs/_Lang.d.ts +0 -194
  236. /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
  237. /package/types/core/{section → base}/actives.d.ts +0 -0
  238. /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
  239. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
  240. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
  241. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
@@ -7,13 +7,14 @@ import { dom, unicode, numbers, env, converter } from '../../helper';
7
7
  import { _DragHandle } from '../../modules';
8
8
 
9
9
  // event handlers
10
- import { ButtonsHandler, OnClick_menuTray, OnClick_toolbar } from './eventHandlers/handler_toolbar';
11
- import { OnMouseDown_wysiwyg, OnMouseUp_wysiwyg, OnClick_wysiwyg, OnMouseMove_wysiwyg, OnMouseLeave_wysiwyg } from './eventHandlers/handler_ww_mouse';
12
- import { OnInput_wysiwyg, OnKeyDown_wysiwyg, OnKeyUp_wysiwyg } from './eventHandlers/handler_ww_key_input';
13
- import { OnPaste_wysiwyg, OnCopy_wysiwyg, OnCut_wysiwyg } from './eventHandlers/handler_ww_clipboard';
14
- import { OnDragOver_wysiwyg, OnDragEnd_wysiwyg, OnDrop_wysiwyg } from './eventHandlers/handler_ww_dragDrop';
10
+ import { ButtonsHandler, OnClick_menuTray, OnClick_toolbar } from './handlers/handler_toolbar';
11
+ import { OnMouseDown_wysiwyg, OnMouseUp_wysiwyg, OnClick_wysiwyg, OnMouseMove_wysiwyg, OnMouseLeave_wysiwyg } from './handlers/handler_ww_mouse';
12
+ import { OnBeforeInput_wysiwyg, OnInput_wysiwyg } from './handlers/handler_ww_input';
13
+ import { OnKeyDown_wysiwyg, OnKeyUp_wysiwyg } from './handlers/handler_ww_key';
14
+ import { OnPaste_wysiwyg, OnCopy_wysiwyg, OnCut_wysiwyg } from './handlers/handler_ww_clipboard';
15
+ import { OnDragOver_wysiwyg, OnDragEnd_wysiwyg, OnDrop_wysiwyg } from './handlers/handler_ww_dragDrop';
15
16
 
16
- const { _w, ON_OVER_COMPONENT, isMobile } = env;
17
+ const { _w, ON_OVER_COMPONENT, isMobile, isTouchDevice } = env;
17
18
 
18
19
  /**
19
20
  * @typedef {Omit<EventManager & Partial<__se__EditorInjector>, 'eventManager'>} EventManagerThis
@@ -35,12 +36,20 @@ function EventManager(editor) {
35
36
  */
36
37
  this.isComposing = false;
37
38
 
39
+ /**
40
+ * @description An array of parent containers that can be scrolled (in descending order)
41
+ * @type {Array<Element>}
42
+ */
43
+ this.scrollparents = [];
44
+
38
45
  /** @type {Array<*>} */
39
46
  this._events = [];
40
47
  /** @type {RegExp} */
41
48
  this._onButtonsCheck = new RegExp(`^(${Object.keys(editor.options.get('_defaultStyleTagMap')).join('|')})$`, 'i');
42
49
  /** @type {boolean} */
43
50
  this._onShortcutKey = false;
51
+ /** @type {boolean} */
52
+ this._handledInBefore = false;
44
53
  /** @type {number} */
45
54
  this._balloonDelay = null;
46
55
  /** @type {ResizeObserver} */
@@ -59,8 +68,6 @@ function EventManager(editor) {
59
68
  this.__close_move = null;
60
69
  /** @type {__se__GlobalEventInfo|null} */
61
70
  this.__geckoActiveEvent = null;
62
- /** @type {Array<Element>} */
63
- this.__scrollparents = [];
64
71
  /** @type {Array<Node>} */
65
72
  this.__cacheStyleNodes = [];
66
73
  /** @type {__se__GlobalEventInfo|null} */
@@ -157,10 +164,10 @@ EventManager.prototype = {
157
164
  * @return {__se__GlobalEventInfo} Registered event information
158
165
  */
159
166
  addGlobalEvent(type, listener, useCapture) {
160
- if (this.editor.frameOptions.get('iframe')) {
161
- this.editor.frameContext.get('_ww').addEventListener(type, listener, useCapture);
167
+ if (this.frameOptions.get('iframe')) {
168
+ this.frameContext.get('_ww').addEventListener(type, listener, useCapture);
162
169
  }
163
- this._w.addEventListener(type, listener, useCapture);
170
+ _w.addEventListener(type, listener, useCapture);
164
171
  return {
165
172
  type,
166
173
  listener,
@@ -185,10 +192,10 @@ EventManager.prototype = {
185
192
  useCapture = type.useCapture;
186
193
  type = type.type;
187
194
  }
188
- if (this.editor.frameOptions.get('iframe')) {
189
- this.editor.frameContext.get('_ww').removeEventListener(type, listener, useCapture);
195
+ if (this.frameOptions.get('iframe')) {
196
+ this.frameContext.get('_ww').removeEventListener(type, listener, useCapture);
190
197
  }
191
- this._w.removeEventListener(type, listener, useCapture);
198
+ _w.removeEventListener(type, listener, useCapture);
192
199
 
193
200
  return null;
194
201
  },
@@ -201,7 +208,7 @@ EventManager.prototype = {
201
208
  * @returns {Node|undefined} selectionNode
202
209
  */
203
210
  applyTagEffect(selectionNode) {
204
- selectionNode = selectionNode || this.selection.getNode();
211
+ selectionNode ||= this.selection.getNode();
205
212
  if (selectionNode === this.editor.effectNode) return;
206
213
  this.editor.effectNode = selectionNode;
207
214
 
@@ -216,6 +223,7 @@ EventManager.prototype = {
216
223
  const styleTags = this.options.get('_textStyleTags');
217
224
  const styleNodes = [];
218
225
 
226
+ const ignoreCommands = [];
219
227
  const activeCommands = this.editor.activeCommands;
220
228
  const cLen = activeCommands.length;
221
229
  let nodeName = '';
@@ -223,6 +231,7 @@ EventManager.prototype = {
223
231
  if (this.component.is(selectionNode) && !this.component.__selectionSelected) {
224
232
  const component = this.component.get(selectionNode);
225
233
  if (!component) return;
234
+ this.editor.effectNode = null;
226
235
  this.component.select(component.target, component.pluginName);
227
236
  return;
228
237
  }
@@ -231,7 +240,7 @@ EventManager.prototype = {
231
240
  selectionNode = selectionNode.firstChild;
232
241
  }
233
242
 
234
- const fc = this.editor.frameContext;
243
+ const fc = this.frameContext;
235
244
  const notReadonly = !fc.get('isReadOnly');
236
245
  for (let element = selectionNode; !dom.check.isWysiwygFrame(element); element = element.parentElement) {
237
246
  if (!element) break;
@@ -251,9 +260,14 @@ EventManager.prototype = {
251
260
  name = activeCommands[c];
252
261
  if (
253
262
  !commandMapNodes.includes(name) &&
263
+ !ignoreCommands.includes(name) &&
254
264
  commandTargets.get(name) &&
255
265
  commandTargets.get(name).filter((e) => {
256
- return plugins[name]?.active(element, e);
266
+ const r = plugins[name]?.active(element, e);
267
+ if (r === undefined) {
268
+ ignoreCommands.push(name);
269
+ }
270
+ return r;
257
271
  }).length > 0
258
272
  ) {
259
273
  commandMapNodes.push(name);
@@ -310,7 +324,7 @@ EventManager.prototype = {
310
324
  this.status.currentNodesMap = commandMapNodes;
311
325
 
312
326
  /** Displays the current node structure to statusbar */
313
- if (this.editor.frameOptions.get('statusbar_showPathLabel') && fc.get('navigation')) {
327
+ if (this.frameOptions.get('statusbar_showPathLabel') && fc.get('navigation')) {
314
328
  fc.get('navigation').textContent = this.options.get('_rtl') ? this.status.currentNodes.reverse().join(' < ') : this.status.currentNodes.join(' > ');
315
329
  }
316
330
 
@@ -407,7 +421,7 @@ EventManager.prototype = {
407
421
  * @description Hide the toolbar.
408
422
  */
409
423
  _hideToolbar() {
410
- if (!this.editor._notHideToolbar && !this.editor.frameContext.get('isFullScreen')) {
424
+ if (!this.editor._notHideToolbar && !this.frameContext.get('isFullScreen')) {
411
425
  this.toolbar.hide();
412
426
  }
413
427
  },
@@ -434,93 +448,6 @@ EventManager.prototype = {
434
448
  return dom.check.isElement(node) && node.getAttribute('data-se-non-focus') === 'true';
435
449
  },
436
450
 
437
- /**
438
- * @private
439
- * @this {EventManagerThis}
440
- * @description Determines if the "range" is within an uneditable node.
441
- * @param {Range} range The range object
442
- * @param {boolean} isFront Whether to check the start or end of the range
443
- * @returns {Node|null} The uneditable node if found, otherwise null
444
- */
445
- _isUneditableNode(range, isFront) {
446
- const container = isFront ? range.startContainer : range.endContainer;
447
- const offset = isFront ? range.startOffset : range.endOffset;
448
- const siblingKey = isFront ? 'previousSibling' : 'nextSibling';
449
- const isElement = container.nodeType === 1;
450
-
451
- let siblingNode;
452
- if (isElement) {
453
- siblingNode = /** @type {HTMLElement} */ (this._isUneditableNode_getSibling(container.childNodes[offset], siblingKey, container));
454
- return siblingNode && siblingNode.nodeType === 1 && siblingNode.getAttribute('contenteditable') === 'false' ? siblingNode : null;
455
- } else {
456
- siblingNode = /** @type {HTMLElement} */ (this._isUneditableNode_getSibling(container, siblingKey, container));
457
- return dom.check.isEdgePoint(container, offset, isFront ? 'front' : 'end') && siblingNode && siblingNode.nodeType === 1 && siblingNode.getAttribute('contenteditable') === 'false' ? siblingNode : null;
458
- }
459
- },
460
-
461
- /**
462
- * @private
463
- * @this {EventManagerThis}
464
- * @description Retrieves the sibling node of a selected node if it is uneditable.
465
- * - Used only in `_isUneditableNode`.
466
- * @param {Node} selectNode The selected node
467
- * @param {string} siblingKey The key to access the sibling (`previousSibling` or `nextSibling`)
468
- * @param {Node} container The parent container node
469
- * @returns {Node|null} The sibling node if found, otherwise null
470
- */
471
- _isUneditableNode_getSibling(selectNode, siblingKey, container) {
472
- if (!selectNode) return null;
473
- let siblingNode = selectNode[siblingKey];
474
-
475
- if (!siblingNode) {
476
- siblingNode = this.format.getLine(container);
477
- siblingNode = siblingNode ? siblingNode[siblingKey] : null;
478
- if (siblingNode && !this.component.is(siblingNode)) siblingNode = siblingKey === 'previousSibling' ? siblingNode.firstChild : siblingNode.lastChild;
479
- else return null;
480
- }
481
-
482
- return siblingNode;
483
- },
484
-
485
- /**
486
- * @private
487
- * @this {EventManagerThis}
488
- * @description Deletes specific elements such as tables in "Firefox" and media elements (image, video, audio) in "Chrome".
489
- * - Handles deletion logic based on selection range and node types.
490
- * @returns {boolean} Returns `true` if an element was deleted and focus was adjusted, otherwise `false`.
491
- */
492
- _hardDelete() {
493
- const range = this.selection.getRange();
494
- const sc = range.startContainer;
495
- const ec = range.endContainer;
496
-
497
- // table
498
- const sCell = this.format.getBlock(sc);
499
- const eCell = this.format.getBlock(ec);
500
- const sIsCell = dom.check.isTableCell(sCell);
501
- const eIsCell = dom.check.isTableCell(eCell);
502
- if (((sIsCell && !sCell.previousElementSibling && !sCell.parentElement.previousElementSibling) || (eIsCell && !eCell.nextElementSibling && !eCell.parentElement.nextElementSibling)) && sCell !== eCell) {
503
- const ancestor = dom.query.getParentElement(range.commonAncestorContainer, dom.check.isFigure)?.parentElement || range.commonAncestorContainer;
504
- if (!sIsCell) {
505
- dom.utils.removeItem(dom.query.getParentElement(eCell, (current) => ancestor === current.parentNode));
506
- } else if (!eIsCell) {
507
- dom.utils.removeItem(dom.query.getParentElement(sCell, (current) => ancestor === current.parentNode));
508
- } else {
509
- dom.utils.removeItem(dom.query.getParentElement(sCell, (current) => ancestor === current.parentNode));
510
- this.editor._nativeFocus();
511
- return true;
512
- }
513
- }
514
-
515
- // component
516
- const sComp = sc.nodeType === 1 ? dom.query.getParentElement(sc, '.se-component') : null;
517
- const eComp = ec.nodeType === 1 ? dom.query.getParentElement(ec, '.se-component') : null;
518
- if (sComp) dom.utils.removeItem(sComp);
519
- if (eComp) dom.utils.removeItem(eComp);
520
-
521
- return false;
522
- },
523
-
524
451
  /**
525
452
  * @private
526
453
  * @this {EventManagerThis}
@@ -534,6 +461,7 @@ EventManager.prototype = {
534
461
  const range = this.selection.getRange();
535
462
  const commonCon = /** @type {HTMLElement} */ (range.commonAncestorContainer);
536
463
  const startCon = range.startContainer;
464
+ const endOffset = range.endOffset;
537
465
  const rangeEl = this.format.getBlock(commonCon, null);
538
466
 
539
467
  /** @type {Node} */
@@ -547,7 +475,7 @@ EventManager.prototype = {
547
475
 
548
476
  rangeEl.innerHTML = format.outerHTML;
549
477
  format = rangeEl.firstChild;
550
- focusNode = dom.query.getEdgeChildNodes(format, null).sc;
478
+ focusNode = format.childNodes[endOffset] || dom.query.getEdgeChildNodes(format, null).sc;
551
479
 
552
480
  if (!focusNode) {
553
481
  focusNode = dom.utils.createTextNode(unicode.zeroWidthSpace);
@@ -561,6 +489,8 @@ EventManager.prototype = {
561
489
 
562
490
  if (commonCon.nodeType === 3 && this.component.is(commonCon.parentElement)) {
563
491
  const compInfo = this.component.get(commonCon.parentElement);
492
+ if (!compInfo) return;
493
+
564
494
  const container = compInfo.container;
565
495
 
566
496
  if (commonCon.parentElement === container) {
@@ -596,7 +526,6 @@ EventManager.prototype = {
596
526
  return;
597
527
  }
598
528
 
599
- /* eslint-disable @typescript-eslint/no-unused-vars */
600
529
  try {
601
530
  if (commonCon.nodeType === 3) {
602
531
  format = dom.utils.createElement(formatName || this.options.get('defaultLine'));
@@ -611,14 +540,12 @@ EventManager.prototype = {
611
540
  focusNode.parentNode.insertBefore(zeroWidth, focusNode);
612
541
  focusNode = zeroWidth;
613
542
  }
614
- } catch (e) {
543
+ } catch {
615
544
  this.editor.execCommand('formatBlock', false, formatName || this.options.get('defaultLine'));
616
- this.selection.removeRange();
617
- this.selection._init();
618
545
  this.editor.effectNode = null;
546
+ this.selection._init();
619
547
  return;
620
548
  }
621
- /* eslint-disable @typescript-eslint/no-unused-vars */
622
549
 
623
550
  if (format) {
624
551
  if (dom.check.isBreak(format.nextSibling)) dom.utils.removeItem(format.nextSibling);
@@ -703,7 +630,7 @@ EventManager.prototype = {
703
630
  const autoLinkify = this.options.get('autoLinkify');
704
631
  if (autoLinkify) {
705
632
  const domParser = new DOMParser().parseFromString(cleanData, 'text/html');
706
- dom.query.getListChildNodes(domParser.body, converter.textToAnchor);
633
+ dom.query.getListChildNodes(domParser.body, converter.textToAnchor, null);
707
634
  cleanData = domParser.body.innerHTML;
708
635
  }
709
636
  }
@@ -712,7 +639,7 @@ EventManager.prototype = {
712
639
  cleanData = this.html.clean(cleanData, { forceFormat: false, whitelist: null, blacklist: null });
713
640
  }
714
641
 
715
- const maxCharCount = this.char.test(this.editor.frameOptions.get('charCounter_type') === 'byte-html' ? cleanData : plainText, false);
642
+ const maxCharCount = this.char.test(this.frameOptions.get('charCounter_type') === 'byte-html' ? cleanData : plainText, false);
716
643
  // user event - paste
717
644
  if (type === 'paste') {
718
645
  const value = await this.triggerEvent('onPaste', { frameContext, event: e, data: cleanData, maxCharCount, from });
@@ -755,7 +682,7 @@ EventManager.prototype = {
755
682
  }
756
683
 
757
684
  // document type
758
- if (frameContext.has('documentType-use-header')) {
685
+ if (frameContext.has('documentType_use_header')) {
759
686
  frameContext.get('documentType').reHeader();
760
687
  }
761
688
  return false;
@@ -777,12 +704,12 @@ EventManager.prototype = {
777
704
  this.addEvent(this.context.get('menuTray'), 'click', OnClick_menuTray.bind(this), true);
778
705
 
779
706
  /** toolbar event */
780
- this.addEvent(this.context.get('toolbar.main'), 'mousedown', buttonsHandler, false);
781
- this.addEvent(this.context.get('toolbar.main'), 'click', toolbarHandler, false);
707
+ this.addEvent(this.context.get('toolbar_main'), 'mousedown', buttonsHandler, false);
708
+ this.addEvent(this.context.get('toolbar_main'), 'click', toolbarHandler, false);
782
709
  // subToolbar
783
710
  if (this.options.has('_subMode')) {
784
- this.addEvent(this.context.get('toolbar.sub.main'), 'mousedown', buttonsHandler, false);
785
- this.addEvent(this.context.get('toolbar.sub.main'), 'click', toolbarHandler, false);
711
+ this.addEvent(this.context.get('toolbar_sub_main'), 'mousedown', buttonsHandler, false);
712
+ this.addEvent(this.context.get('toolbar_sub_main'), 'click', toolbarHandler, false);
786
713
  }
787
714
 
788
715
  /** set response toolbar */
@@ -818,12 +745,12 @@ EventManager.prototype = {
818
745
  );
819
746
  }
820
747
 
821
- /** window event */
748
+ /** global event */
822
749
  this.addEvent(_w, 'resize', OnResize_window.bind(this), false);
750
+ this.addEvent(_w.visualViewport, 'resize', OnResize_viewport.bind(this), false);
823
751
  this.addEvent(_w, 'scroll', OnScroll_window.bind(this), false);
824
- if (env.isMobile) {
825
- this.addEvent(_w.visualViewport, 'resize', OnChange_viewport.bind(this), false);
826
- this.addEvent(_w.visualViewport, 'scroll', OnChange_viewport.bind(this), false);
752
+ if (isTouchDevice) {
753
+ this.addEvent(_w.visualViewport, 'scroll', OnMobileScroll_viewport.bind(this), false);
827
754
  }
828
755
  },
829
756
 
@@ -848,6 +775,7 @@ EventManager.prototype = {
848
775
  this.addEvent(eventWysiwyg, 'mousedown', OnMouseDown_wysiwyg.bind(this, fc), false);
849
776
  this.addEvent(eventWysiwyg, 'mouseup', OnMouseUp_wysiwyg.bind(this, fc), false);
850
777
  this.addEvent(eventWysiwyg, 'click', OnClick_wysiwyg.bind(this, fc), false);
778
+ this.addEvent(eventWysiwyg, 'beforeinput', OnBeforeInput_wysiwyg.bind(this, fc), false);
851
779
  this.addEvent(eventWysiwyg, 'input', OnInput_wysiwyg.bind(this, fc), false);
852
780
  this.addEvent(eventWysiwyg, 'keydown', OnKeyDown_wysiwyg.bind(this, fc), false);
853
781
  this.addEvent(eventWysiwyg, 'keyup', OnKeyUp_wysiwyg.bind(this, fc), false);
@@ -857,7 +785,7 @@ EventManager.prototype = {
857
785
  this.addEvent(
858
786
  eventWysiwyg,
859
787
  'dragover',
860
- OnDragOver_wysiwyg.bind(this, fc, dragCursor, isIframe ? this.editor.frameContext.get('topArea') : null, !this.options.get('toolbar_container') && !this.editor.isBalloon && !this.editor.isInline),
788
+ OnDragOver_wysiwyg.bind(this, fc, dragCursor, isIframe ? this.frameContext.get('topArea') : null, !this.options.get('toolbar_container') && !this.editor.isBalloon && !this.editor.isInline),
861
789
  false
862
790
  );
863
791
  this.addEvent(eventWysiwyg, 'dragend', OnDragEnd_wysiwyg.bind(this, dragCursor), false);
@@ -880,20 +808,11 @@ EventManager.prototype = {
880
808
  );
881
809
 
882
810
  /** line breaker */
883
- const lineBreakEventName = isMobile ? 'touchstart' : 'mousedown';
884
- // this.addEvent(
885
- // [fc.get('lineBreaker_t'), fc.get('lineBreaker_b')],
886
- // lineBreakEventName,
887
- // (e) => {
888
- // e.preventDefault();
889
- // },
890
- // false
891
- // );
892
- this.addEvent(fc.get('lineBreaker_t'), lineBreakEventName, DisplayLineBreak.bind(this, 't'), false);
893
- this.addEvent(fc.get('lineBreaker_b'), lineBreakEventName, DisplayLineBreak.bind(this, 'b'), false);
811
+ this.addEvent(fc.get('lineBreaker_t'), 'pointerdown', DisplayLineBreak.bind(this, 't'), false);
812
+ this.addEvent(fc.get('lineBreaker_b'), 'pointerdown', DisplayLineBreak.bind(this, 'b'), false);
894
813
 
895
814
  /** Events are registered mobile. */
896
- if (isMobile) {
815
+ if (isTouchDevice) {
897
816
  this.addEvent(eventWysiwyg, 'touchstart', wwMouseMove, {
898
817
  passive: true,
899
818
  capture: false
@@ -903,7 +822,7 @@ EventManager.prototype = {
903
822
  /** code view area auto line */
904
823
  if (!this.options.get('hasCodeMirror')) {
905
824
  const codeNumbers = fc.get('codeNumbers');
906
- const cvAuthHeight = this.viewer._codeViewAutoHeight.bind(this.viewer, fc.get('code'), codeNumbers, this.editor.frameOptions.get('height') === 'auto');
825
+ const cvAuthHeight = this.viewer._codeViewAutoHeight.bind(this.viewer, fc.get('code'), codeNumbers, this.frameOptions.get('height') === 'auto');
907
826
 
908
827
  this.addEvent(codeArea, 'keydown', cvAuthHeight, false);
909
828
  this.addEvent(codeArea, 'keyup', cvAuthHeight, false);
@@ -916,10 +835,10 @@ EventManager.prototype = {
916
835
  if (fc.has('statusbar')) this.__addStatusbarEvent(fc, fc.get('options'));
917
836
 
918
837
  const OnScrollAbs = OnScroll_Abs.bind(this);
919
- let scrollParent = fc.get('originElement');
920
- while ((scrollParent = dom.query.getScrollParent(scrollParent.parentElement))) {
921
- this.__scrollparents.push(scrollParent);
922
- this.addEvent(scrollParent, 'scroll', OnScrollAbs, false);
838
+ const scrollParents = dom.query.getScrollParents(fc.get('originElement'));
839
+ for (const parent of scrollParents) {
840
+ this.scrollparents.push(parent);
841
+ this.addEvent(parent, 'scroll', OnScrollAbs, false);
923
842
  }
924
843
 
925
844
  /** focus temp (mobile) */
@@ -978,21 +897,21 @@ EventManager.prototype = {
978
897
  * @this {EventManagerThis}
979
898
  * @description Adjusts the position of the editor's toolbar, controllers, and other floating elements based on scroll position.
980
899
  * - Ensures UI elements maintain their intended relative positions when scrolling.
981
- * @param {Element} eventWysiwyg The wysiwyg event object containing scroll data
900
+ * @param {*} eventWysiwyg The wysiwyg event object containing scroll data (Window or element)
982
901
  */
983
902
  _moveContainer(eventWysiwyg) {
984
- const y = eventWysiwyg.scrollTop || 0;
985
- const x = eventWysiwyg.scrollLeft || 0;
903
+ const y = eventWysiwyg.scrollTop || eventWysiwyg.scrollY || 0;
904
+ const x = eventWysiwyg.scrollLeft || eventWysiwyg.scrollX || 0;
986
905
 
987
906
  if (this.editor.isBalloon) {
988
- this.context.get('toolbar.main').style.top = this.toolbar._balloonOffset.top - y + 'px';
989
- this.context.get('toolbar.main').style.left = this.toolbar._balloonOffset.left - x + 'px';
907
+ this.context.get('toolbar_main').style.top = this.toolbar._balloonOffset.top - y + 'px';
908
+ this.context.get('toolbar_main').style.left = this.toolbar._balloonOffset.left - x + 'px';
990
909
  } else if (this.editor.isSubBalloon) {
991
- this.context.get('toolbar.sub.main').style.top = this.subToolbar._balloonOffset.top - y + 'px';
992
- this.context.get('toolbar.sub.main').style.left = this.subToolbar._balloonOffset.left - x + 'px';
910
+ this.context.get('toolbar_sub_main').style.top = this.subToolbar._balloonOffset.top - y + 'px';
911
+ this.context.get('toolbar_sub_main').style.left = this.subToolbar._balloonOffset.left - x + 'px';
993
912
  }
994
913
 
995
- if (this.editor._controllerTargetContext !== this.editor.frameContext.get('topArea')) {
914
+ if (this.editor._controllerTargetContext !== this.frameContext.get('topArea')) {
996
915
  this.ui._offCurrentController();
997
916
  }
998
917
 
@@ -1031,8 +950,12 @@ EventManager.prototype = {
1031
950
  * - Repositions open controllers if necessary.
1032
951
  */
1033
952
  _scrollContainer() {
953
+ if (this.menu.currentDropdownActiveButton && this.menu.currentDropdown) {
954
+ this.menu._resetMenuPosition(this.menu.currentDropdownActiveButton, this.menu.currentDropdown);
955
+ }
956
+
1034
957
  const openCont = this.editor.opendControllers;
1035
- if (!openCont.length) return;
958
+ if (openCont.length === 0) return;
1036
959
 
1037
960
  this.__rePositionController(openCont);
1038
961
  },
@@ -1064,7 +987,7 @@ EventManager.prototype = {
1064
987
  if (this.options.get('_subMode')) this.subToolbar.resetResponsiveToolbar();
1065
988
  }
1066
989
 
1067
- const toolbar = this.context.get('toolbar.main');
990
+ const toolbar = this.context.get('toolbar_main');
1068
991
  const isToolbarHidden = toolbar.style.display === 'none' || (this.editor.isInline && !this.toolbar._inlineToolbarAttr.isShow);
1069
992
  if (toolbar.offsetWidth === 0 && !isToolbarHidden) return;
1070
993
 
@@ -1074,12 +997,12 @@ EventManager.prototype = {
1074
997
  }
1075
998
 
1076
999
  if (this.menu.currentDropdownActiveButton && this.menu.currentDropdown) {
1077
- this.menu._setMenuPosition(this.menu.currentDropdownActiveButton, this.menu.currentDropdown);
1000
+ this.menu._resetMenuPosition(this.menu.currentDropdownActiveButton, this.menu.currentDropdown);
1078
1001
  }
1079
1002
 
1080
1003
  if (this.viewer._resetFullScreenHeight()) return;
1081
1004
 
1082
- const fc = this.editor.frameContext;
1005
+ const fc = this.frameContext;
1083
1006
  if (fc.get('isCodeView') && this.editor.isInline) {
1084
1007
  this.toolbar._showInline();
1085
1008
  return;
@@ -1088,7 +1011,7 @@ EventManager.prototype = {
1088
1011
  this.editor._iframeAutoHeight(fc);
1089
1012
 
1090
1013
  if (this.toolbar._sticky) {
1091
- this.context.get('toolbar.main').style.width = fc.get('topArea').offsetWidth - 2 + 'px';
1014
+ this.context.get('toolbar_main').style.width = fc.get('topArea').offsetWidth - 2 + 'px';
1092
1015
  this.toolbar._resetSticky();
1093
1016
  }
1094
1017
  },
@@ -1174,7 +1097,7 @@ EventManager.prototype = {
1174
1097
  const figure = dom.query.getParentElement(target, dom.check.isFigure);
1175
1098
  let info = this.component.get(target);
1176
1099
  if (info || figure) {
1177
- if (!info) info = this.component.get(figure);
1100
+ info ||= this.component.get(figure);
1178
1101
  if (info && !dom.utils.hasClass(info.container, 'se-component-selected')) {
1179
1102
  this.ui._offCurrentController();
1180
1103
  _DragHandle.set('__overInfo', ON_OVER_COMPONENT);
@@ -1198,30 +1121,6 @@ EventManager.prototype = {
1198
1121
  this.__inputPlugin = null;
1199
1122
  },
1200
1123
 
1201
- /**
1202
- * @private
1203
- * @this {EventManagerThis}
1204
- * @description Prevents the default behavior of the Enter key and refocuses the editor.
1205
- * @param {Event} e The keyboard event
1206
- */
1207
- __enterPrevent(e) {
1208
- e.preventDefault();
1209
- if (!isMobile) return;
1210
-
1211
- this.__focusTemp.focus();
1212
- this.editor.frameContext.get('wysiwyg').focus();
1213
- },
1214
-
1215
- /**
1216
- * @private
1217
- * @description Scrolls the editor view to the caret position after pressing Enter. (Ignored on mobile devices)
1218
- * @this {EventManagerThis}
1219
- * @param {*} range Range object
1220
- */
1221
- __enterScrollTo(range) {
1222
- if (!env.isMobile) this.editor.selection.scrollTo(range);
1223
- },
1224
-
1225
1124
  /**
1226
1125
  * @private
1227
1126
  * @description Focus Event Postprocessing
@@ -1256,13 +1155,23 @@ EventManager.prototype = {
1256
1155
  this._callPluginEvent('onBlur', { frameContext, event });
1257
1156
  },
1258
1157
 
1158
+ /**
1159
+ * @private
1160
+ * @description Records the current viewport size.
1161
+ * @this {EventManagerThis}
1162
+ */
1163
+ __setViewportSize() {
1164
+ this.status.currentViewportHeight = numbers.get(_w.visualViewport.height, 0);
1165
+ // dom.utils.setRootCssVar('--se-var-viewport-height', `${this.status.currentViewportHeight}px`);
1166
+ },
1167
+
1259
1168
  constructor: EventManager
1260
1169
  };
1261
1170
 
1262
1171
  /**
1263
1172
  * @this {EventManagerThis}
1264
1173
  * @param {__se__FrameContext} frameContext - frame context object
1265
- * @param {Element} eventWysiwyg - wysiwyg event object
1174
+ * @param {Element|Window} eventWysiwyg - wysiwyg event object
1266
1175
  * @param {Event} e - Event object
1267
1176
  */
1268
1177
  function OnScroll_wysiwyg(frameContext, eventWysiwyg, e) {
@@ -1273,7 +1182,7 @@ function OnScroll_wysiwyg(frameContext, eventWysiwyg, e) {
1273
1182
  this._callPluginEvent('onScroll', { frameContext, event: e });
1274
1183
 
1275
1184
  // document type page
1276
- if (frameContext.has('documentType-use-page')) {
1185
+ if (frameContext.has('documentType_use_page')) {
1277
1186
  frameContext.get('documentType').scrollPage();
1278
1187
  }
1279
1188
 
@@ -1300,7 +1209,7 @@ function OnFocus_wysiwyg(frameContext, e) {
1300
1209
 
1301
1210
  if (this._inputFocus) {
1302
1211
  if (this.editor.isInline) {
1303
- this._w.setTimeout(() => {
1212
+ _w.setTimeout(() => {
1304
1213
  this.toolbar._showInline();
1305
1214
  }, 0);
1306
1215
  }
@@ -1310,7 +1219,6 @@ function OnFocus_wysiwyg(frameContext, e) {
1310
1219
  if ((this.status.rootKey === rootKey && this.editor._preventBlur) || this.editor._preventFocus) return;
1311
1220
  this.editor._preventFocus = true;
1312
1221
 
1313
- const onSelected = this.editor.status.onSelected || this.editor.opendModal;
1314
1222
  this.ui._offCurrentController();
1315
1223
 
1316
1224
  dom.utils.removeClass(this.editor.commandTargets.get('codeView'), 'active');
@@ -1319,11 +1227,7 @@ function OnFocus_wysiwyg(frameContext, e) {
1319
1227
  this.editor.changeFrameContext(rootKey);
1320
1228
  this.history.resetButtons(rootKey, null);
1321
1229
 
1322
- if (!onSelected) {
1323
- this.applyTagEffect();
1324
- }
1325
-
1326
- this._w.setTimeout(() => {
1230
+ _w.setTimeout(() => {
1327
1231
  this.__postFocusEvent(frameContext, e);
1328
1232
  }, 0);
1329
1233
  }
@@ -1374,7 +1278,7 @@ function OnMouseDown_statusbar(e) {
1374
1278
  * @param {MouseEvent} e - Event object
1375
1279
  */
1376
1280
  function __resizeEditor(e) {
1377
- const fc = this.editor.frameContext;
1281
+ const fc = this.frameContext;
1378
1282
  const resizeInterval = fc.get('wrapper').offsetHeight + (e.clientY - this._resizeClientY);
1379
1283
  const h = resizeInterval < fc.get('_minHeight') ? fc.get('_minHeight') : resizeInterval;
1380
1284
  fc.get('wysiwygFrame').style.height = fc.get('code').style.height = h + 'px';
@@ -1387,8 +1291,8 @@ function __resizeEditor(e) {
1387
1291
  */
1388
1292
  function __closeMove() {
1389
1293
  this.ui.disableBackWrapper();
1390
- if (this.__resize_editor) this.__resize_editor = this.removeGlobalEvent(this.__resize_editor);
1391
- if (this.__close_move) this.__close_move = this.removeGlobalEvent(this.__close_move);
1294
+ this.__resize_editor &&= this.removeGlobalEvent(this.__resize_editor);
1295
+ this.__close_move &&= this.removeGlobalEvent(this.__close_move);
1392
1296
  }
1393
1297
 
1394
1298
  /**
@@ -1406,7 +1310,7 @@ function DisplayLineBreak(dir, e) {
1406
1310
  const format = dom.utils.createElement(isList ? 'BR' : dom.check.isTableCell(component.parentElement) ? 'DIV' : this.options.get('defaultLine'));
1407
1311
  if (!isList) format.innerHTML = '<br>';
1408
1312
 
1409
- if (this.editor.frameOptions.get('charCounter_type') === 'byte-html' && !this.char.check(format.outerHTML)) return;
1313
+ if (this.frameOptions.get('charCounter_type') === 'byte-html' && !this.char.check(format.outerHTML)) return;
1410
1314
 
1411
1315
  component.parentNode.insertBefore(format, dir === 't' ? component : component.nextSibling);
1412
1316
  this.component.deselect();
@@ -1424,9 +1328,9 @@ function DisplayLineBreak(dir, e) {
1424
1328
  * @this {EventManagerThis}
1425
1329
  */
1426
1330
  function OnResize_window() {
1427
- if (isMobile) {
1428
- this._scrollContainer();
1429
- } else {
1331
+ this.status.initViewportHeight = _w.visualViewport.height;
1332
+
1333
+ if (!isMobile) {
1430
1334
  this.ui._offCurrentController();
1431
1335
  }
1432
1336
 
@@ -1436,6 +1340,19 @@ function OnResize_window() {
1436
1340
  this._resetFrameStatus();
1437
1341
  }
1438
1342
 
1343
+ /**
1344
+ * @this {EventManagerThis}
1345
+ */
1346
+ function OnResize_viewport() {
1347
+ if (isMobile && this.options.get('toolbar_sticky') > -1) {
1348
+ this.toolbar._resetSticky();
1349
+ this.editor.menu._restoreMenuPosition();
1350
+ }
1351
+
1352
+ this._scrollContainer();
1353
+ this.__setViewportSize();
1354
+ }
1355
+
1439
1356
  /**
1440
1357
  * @this {EventManagerThis}
1441
1358
  */
@@ -1444,24 +1361,24 @@ function OnScroll_window() {
1444
1361
  this.toolbar._resetSticky();
1445
1362
  }
1446
1363
 
1447
- if (this.editor.isBalloon && this.context.get('toolbar.main').style.display === 'block') {
1364
+ if (this.editor.isBalloon && this.context.get('toolbar_main').style.display === 'block') {
1448
1365
  this.toolbar._setBalloonOffset(this.toolbar._balloonOffset.position === 'top');
1449
- } else if (this.editor.isSubBalloon && this.context.get('toolbar.sub.main').style.display === 'block') {
1366
+ } else if (this.editor.isSubBalloon && this.context.get('toolbar_sub_main').style.display === 'block') {
1450
1367
  this.subToolbar._setBalloonOffset(this.subToolbar._balloonOffset.position === 'top');
1451
1368
  }
1452
1369
 
1453
1370
  this._scrollContainer();
1454
1371
 
1455
1372
  // document type page
1456
- if (this.editor.frameContext.has('documentType-use-page')) {
1457
- this.editor.frameContext.get('documentType').scrollWindow();
1373
+ if (this.frameContext.has('documentType_use_page')) {
1374
+ this.frameContext.get('documentType').scrollWindow();
1458
1375
  }
1459
1376
  }
1460
1377
 
1461
1378
  /**
1462
1379
  * @this {EventManagerThis}
1463
1380
  */
1464
- function OnChange_viewport() {
1381
+ function OnMobileScroll_viewport() {
1465
1382
  if (this.options.get('toolbar_sticky') > -1) {
1466
1383
  this.toolbar._resetSticky();
1467
1384
  this.editor.menu._restoreMenuPosition();
@@ -1487,7 +1404,7 @@ function OnSelectionchange_document(_wd) {
1487
1404
  this.applyTagEffect();
1488
1405
 
1489
1406
  // document type
1490
- if (root.has('documentType-use-header')) {
1407
+ if (root.has('documentType_use_header')) {
1491
1408
  const el = dom.query.getParentElement(this.selection.selectionNode, this.format.isLine.bind(this.format));
1492
1409
  root.get('documentType').on(el);
1493
1410
  }
@@ -1499,6 +1416,7 @@ function OnSelectionchange_document(_wd) {
1499
1416
  * @this {EventManagerThis}
1500
1417
  */
1501
1418
  function OnScroll_Abs() {
1419
+ this.menu.dropdownOff();
1502
1420
  this._scrollContainer();
1503
1421
  }
1504
1422