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.
- package/CONTRIBUTING.md +8 -8
- package/README.md +44 -49
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +95 -53
- package/src/assets/design/color.css +2 -2
- package/src/assets/design/size.css +2 -0
- package/src/assets/icons/defaultIcons.js +16 -1
- package/src/assets/suneditor-contents.css +9 -8
- package/src/assets/suneditor.css +29 -26
- package/src/core/{section → base}/actives.js +20 -12
- package/src/core/base/history.js +4 -4
- package/src/core/class/char.js +10 -10
- package/src/core/class/component.js +146 -57
- package/src/core/class/format.js +94 -2458
- package/src/core/class/html.js +187 -129
- package/src/core/class/inline.js +1853 -0
- package/src/core/class/listFormat.js +582 -0
- package/src/core/class/menu.js +14 -3
- package/src/core/class/nodeTransform.js +9 -14
- package/src/core/class/offset.js +162 -197
- package/src/core/class/selection.js +137 -34
- package/src/core/class/toolbar.js +73 -52
- package/src/core/class/ui.js +11 -11
- package/src/core/class/viewer.js +56 -55
- package/src/core/config/context.js +122 -0
- package/src/core/config/frameContext.js +204 -0
- package/src/core/config/options.js +639 -0
- package/src/core/editor.js +181 -108
- package/src/core/event/actions/index.js +229 -0
- package/src/core/event/effects/common.registry.js +60 -0
- package/src/core/event/effects/keydown.registry.js +551 -0
- package/src/core/event/effects/ruleHelpers.js +145 -0
- package/src/core/{base → event}/eventManager.js +119 -201
- package/src/core/event/executor.js +21 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
- package/src/core/event/handlers/handler_ww_input.js +77 -0
- package/src/core/event/handlers/handler_ww_key.js +228 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
- package/src/core/event/ports.js +211 -0
- package/src/core/event/reducers/keydown.reducer.js +89 -0
- package/src/core/event/rules/keydown.rule.arrow.js +54 -0
- package/src/core/event/rules/keydown.rule.backspace.js +202 -0
- package/src/core/event/rules/keydown.rule.delete.js +126 -0
- package/src/core/event/rules/keydown.rule.enter.js +144 -0
- package/src/core/event/rules/keydown.rule.tab.js +29 -0
- package/src/core/section/constructor.js +79 -388
- package/src/core/section/documentType.js +47 -26
- package/src/core/util/instanceCheck.js +59 -0
- package/src/editorInjector/_classes.js +4 -0
- package/src/editorInjector/_core.js +17 -7
- package/src/editorInjector/index.js +10 -2
- package/src/events.js +6 -0
- package/src/helper/clipboard.js +24 -10
- package/src/helper/converter.js +17 -12
- package/src/helper/dom/domCheck.js +22 -3
- package/src/helper/dom/domQuery.js +91 -45
- package/src/helper/dom/domUtils.js +93 -19
- package/src/helper/dom/index.js +4 -0
- package/src/helper/env.js +11 -7
- package/src/helper/keyCodeMap.js +4 -3
- package/src/langs/ckb.js +1 -1
- package/src/langs/cs.js +1 -1
- package/src/langs/da.js +1 -1
- package/src/langs/de.js +1 -1
- package/src/langs/en.js +1 -1
- package/src/langs/es.js +1 -1
- package/src/langs/fa.js +1 -1
- package/src/langs/fr.js +1 -1
- package/src/langs/he.js +1 -1
- package/src/langs/hu.js +1 -1
- package/src/langs/it.js +1 -1
- package/src/langs/ja.js +1 -1
- package/src/langs/km.js +1 -1
- package/src/langs/ko.js +1 -1
- package/src/langs/lv.js +1 -1
- package/src/langs/nl.js +1 -1
- package/src/langs/pl.js +1 -1
- package/src/langs/pt_br.js +10 -10
- package/src/langs/ro.js +1 -1
- package/src/langs/ru.js +1 -1
- package/src/langs/se.js +1 -1
- package/src/langs/tr.js +1 -1
- package/src/langs/uk.js +1 -1
- package/src/langs/ur.js +1 -1
- package/src/langs/zh_cn.js +1 -1
- package/src/modules/ApiManager.js +25 -18
- package/src/modules/Browser.js +52 -61
- package/src/modules/ColorPicker.js +37 -38
- package/src/modules/Controller.js +85 -79
- package/src/modules/Figure.js +275 -187
- package/src/modules/FileManager.js +86 -92
- package/src/modules/HueSlider.js +67 -35
- package/src/modules/Modal.js +84 -77
- package/src/modules/ModalAnchorEditor.js +62 -79
- package/src/modules/SelectMenu.js +89 -86
- package/src/plugins/browser/audioGallery.js +9 -5
- package/src/plugins/browser/fileBrowser.js +10 -6
- package/src/plugins/browser/fileGallery.js +9 -5
- package/src/plugins/browser/imageGallery.js +9 -5
- package/src/plugins/browser/videoGallery.js +11 -6
- package/src/plugins/command/blockquote.js +1 -0
- package/src/plugins/command/exportPDF.js +11 -8
- package/src/plugins/command/fileUpload.js +41 -29
- package/src/plugins/command/list_bulleted.js +2 -1
- package/src/plugins/command/list_numbered.js +2 -1
- package/src/plugins/dropdown/align.js +8 -2
- package/src/plugins/dropdown/backgroundColor.js +19 -11
- package/src/plugins/dropdown/font.js +15 -9
- package/src/plugins/dropdown/fontColor.js +19 -11
- package/src/plugins/dropdown/formatBlock.js +7 -2
- package/src/plugins/dropdown/hr.js +7 -3
- package/src/plugins/dropdown/layout.js +6 -2
- package/src/plugins/dropdown/lineHeight.js +8 -3
- package/src/plugins/dropdown/list.js +2 -1
- package/src/plugins/dropdown/paragraphStyle.js +15 -11
- package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
- package/src/plugins/dropdown/template.js +6 -2
- package/src/plugins/dropdown/textStyle.js +7 -3
- package/src/plugins/field/mention.js +33 -27
- package/src/plugins/input/fontSize.js +44 -37
- package/src/plugins/input/pageNavigator.js +3 -2
- package/src/plugins/modal/audio.js +90 -85
- package/src/plugins/modal/drawing.js +58 -66
- package/src/plugins/modal/embed.js +193 -180
- package/src/plugins/modal/image.js +441 -439
- package/src/plugins/modal/link.js +31 -8
- package/src/plugins/modal/math.js +23 -22
- package/src/plugins/modal/video.js +233 -230
- package/src/plugins/popup/anchor.js +24 -18
- package/src/suneditor.js +69 -24
- package/src/typedef.js +42 -19
- package/types/assets/icons/defaultIcons.d.ts +8 -0
- package/types/core/class/char.d.ts +1 -1
- package/types/core/class/component.d.ts +29 -7
- package/types/core/class/format.d.ts +4 -354
- package/types/core/class/html.d.ts +13 -4
- package/types/core/class/inline.d.ts +263 -0
- package/types/core/class/listFormat.d.ts +135 -0
- package/types/core/class/menu.d.ts +10 -2
- package/types/core/class/offset.d.ts +24 -26
- package/types/core/class/selection.d.ts +2 -0
- package/types/core/class/toolbar.d.ts +24 -11
- package/types/core/class/ui.d.ts +1 -1
- package/types/core/class/viewer.d.ts +1 -1
- package/types/core/config/context.d.ts +157 -0
- package/types/core/config/frameContext.d.ts +367 -0
- package/types/core/config/options.d.ts +1119 -0
- package/types/core/editor.d.ts +101 -66
- package/types/core/event/actions/index.d.ts +47 -0
- package/types/core/event/effects/common.registry.d.ts +50 -0
- package/types/core/event/effects/keydown.registry.d.ts +73 -0
- package/types/core/event/effects/ruleHelpers.d.ts +31 -0
- package/types/core/{base → event}/eventManager.d.ts +15 -46
- package/types/core/event/executor.d.ts +6 -0
- package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
- package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
- package/types/core/event/ports.d.ts +255 -0
- package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
- package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
- package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
- package/types/core/section/constructor.d.ts +101 -631
- package/types/core/section/documentType.d.ts +14 -4
- package/types/core/util/instanceCheck.d.ts +50 -0
- package/types/editorInjector/_classes.d.ts +4 -0
- package/types/editorInjector/_core.d.ts +17 -7
- package/types/editorInjector/index.d.ts +10 -2
- package/types/events.d.ts +1 -0
- package/types/helper/clipboard.d.ts +2 -2
- package/types/helper/converter.d.ts +6 -9
- package/types/helper/dom/domCheck.d.ts +7 -0
- package/types/helper/dom/domQuery.d.ts +19 -8
- package/types/helper/dom/domUtils.d.ts +24 -2
- package/types/helper/dom/index.d.ts +86 -1
- package/types/helper/env.d.ts +6 -1
- package/types/helper/index.d.ts +7 -1
- package/types/helper/keyCodeMap.d.ts +3 -3
- package/types/index.d.ts +23 -117
- package/types/langs/index.d.ts +2 -2
- package/types/modules/ApiManager.d.ts +1 -8
- package/types/modules/Browser.d.ts +4 -62
- package/types/modules/ColorPicker.d.ts +4 -21
- package/types/modules/Controller.d.ts +8 -64
- package/types/modules/Figure.d.ts +54 -50
- package/types/modules/FileManager.d.ts +1 -13
- package/types/modules/HueSlider.d.ts +13 -3
- package/types/modules/Modal.d.ts +0 -43
- package/types/modules/ModalAnchorEditor.d.ts +0 -73
- package/types/modules/SelectMenu.d.ts +0 -85
- package/types/modules/index.d.ts +3 -3
- package/types/plugins/browser/audioGallery.d.ts +29 -18
- package/types/plugins/browser/fileBrowser.d.ts +38 -27
- package/types/plugins/browser/fileGallery.d.ts +29 -18
- package/types/plugins/browser/imageGallery.d.ts +24 -16
- package/types/plugins/browser/videoGallery.d.ts +29 -18
- package/types/plugins/command/blockquote.d.ts +1 -0
- package/types/plugins/command/exportPDF.d.ts +18 -18
- package/types/plugins/command/fileUpload.d.ts +65 -45
- package/types/plugins/command/list_bulleted.d.ts +1 -0
- package/types/plugins/command/list_numbered.d.ts +1 -0
- package/types/plugins/dropdown/align.d.ts +13 -8
- package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
- package/types/plugins/dropdown/font.d.ts +13 -12
- package/types/plugins/dropdown/fontColor.d.ts +30 -19
- package/types/plugins/dropdown/formatBlock.d.ts +13 -8
- package/types/plugins/dropdown/hr.d.ts +15 -11
- package/types/plugins/dropdown/layout.d.ts +15 -11
- package/types/plugins/dropdown/lineHeight.d.ts +16 -11
- package/types/plugins/dropdown/list.d.ts +1 -0
- package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
- package/types/plugins/dropdown/table/index.d.ts +582 -0
- package/types/plugins/dropdown/table.d.ts +41 -86
- package/types/plugins/dropdown/template.d.ts +15 -11
- package/types/plugins/dropdown/textStyle.d.ts +19 -11
- package/types/plugins/field/mention.d.ts +58 -56
- package/types/plugins/index.d.ts +38 -38
- package/types/plugins/input/fontSize.d.ts +46 -50
- package/types/plugins/modal/audio.d.ts +26 -56
- package/types/plugins/modal/drawing.d.ts +0 -85
- package/types/plugins/modal/embed.d.ts +15 -79
- package/types/plugins/modal/image.d.ts +24 -136
- package/types/plugins/modal/link.d.ts +34 -15
- package/types/plugins/modal/math.d.ts +0 -16
- package/types/plugins/modal/video.d.ts +17 -86
- package/types/plugins/popup/anchor.d.ts +1 -8
- package/types/suneditor.d.ts +70 -19
- package/types/typedef.d.ts +60 -46
- package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
- package/src/core/section/context.js +0 -102
- package/types/core/section/context.d.ts +0 -45
- package/types/langs/_Lang.d.ts +0 -194
- /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
- /package/types/core/{section → base}/actives.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
- /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 './
|
|
11
|
-
import { OnMouseDown_wysiwyg, OnMouseUp_wysiwyg, OnClick_wysiwyg, OnMouseMove_wysiwyg, OnMouseLeave_wysiwyg } from './
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
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.
|
|
161
|
-
this.
|
|
167
|
+
if (this.frameOptions.get('iframe')) {
|
|
168
|
+
this.frameContext.get('_ww').addEventListener(type, listener, useCapture);
|
|
162
169
|
}
|
|
163
|
-
|
|
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.
|
|
189
|
-
this.
|
|
195
|
+
if (this.frameOptions.get('iframe')) {
|
|
196
|
+
this.frameContext.get('_ww').removeEventListener(type, listener, useCapture);
|
|
190
197
|
}
|
|
191
|
-
|
|
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
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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
|
|
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.
|
|
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('
|
|
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('
|
|
781
|
-
this.addEvent(this.context.get('
|
|
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('
|
|
785
|
-
this.addEvent(this.context.get('
|
|
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
|
-
/**
|
|
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 (
|
|
825
|
-
this.addEvent(_w.visualViewport, '
|
|
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.
|
|
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
|
-
|
|
884
|
-
|
|
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 (
|
|
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.
|
|
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
|
-
|
|
920
|
-
|
|
921
|
-
this.
|
|
922
|
-
this.addEvent(
|
|
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 {
|
|
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('
|
|
989
|
-
this.context.get('
|
|
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('
|
|
992
|
-
this.context.get('
|
|
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.
|
|
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 (
|
|
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('
|
|
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.
|
|
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.
|
|
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('
|
|
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
|
-
|
|
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('
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
1391
|
-
|
|
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.
|
|
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
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
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('
|
|
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('
|
|
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.
|
|
1457
|
-
this.
|
|
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
|
|
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('
|
|
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
|
|