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
package/src/core/editor.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { env, converter, dom, numbers } from '../helper';
|
|
2
|
-
import Constructor, { InitOptions, UpdateButton, CreateShortcuts, CreateStatusbar
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import Constructor, { InitOptions, UpdateButton, CreateShortcuts, CreateStatusbar } from './section/constructor';
|
|
3
|
+
import { OPTION_FRAME_FIXED_FLAG, OPTION_FIXED_FLAG, BaseOptionsMap, FrameOptionsMap } from './config/options';
|
|
4
|
+
import { ContextUtil } from './config/context';
|
|
5
|
+
import { UpdateStatusbarContext, FrameContextUtil } from './config/frameContext';
|
|
6
|
+
import { BASIC_COMMANDS, ACTIVE_EVENT_COMMANDS, SELECT_ALL, DIR_BTN_ACTIVE, SAVE, COPY_FORMAT, FONT_STYLE, PAGE_BREAK } from './base/actives';
|
|
5
7
|
import History from './base/history';
|
|
6
|
-
import EventManager from './
|
|
8
|
+
import EventManager from './event/eventManager';
|
|
7
9
|
import Events from '../events';
|
|
8
10
|
import DocumentType from './section/documentType';
|
|
9
11
|
|
|
12
|
+
// util
|
|
13
|
+
import InstanceCheck from './util/instanceCheck';
|
|
14
|
+
|
|
10
15
|
// class injector
|
|
11
16
|
import ClassInjector from '../editorInjector/_classes';
|
|
12
17
|
|
|
@@ -15,6 +20,8 @@ import Char from './class/char';
|
|
|
15
20
|
import Component from './class/component';
|
|
16
21
|
import Format from './class/format';
|
|
17
22
|
import HTML from './class/html';
|
|
23
|
+
import Inline from './class/inline';
|
|
24
|
+
import ListFormat from './class/listFormat';
|
|
18
25
|
import Menu from './class/menu';
|
|
19
26
|
import NodeTransform from './class/nodeTransform';
|
|
20
27
|
import Offset from './class/offset';
|
|
@@ -28,14 +35,6 @@ const COMMAND_BUTTONS = '.se-menu-list .se-toolbar-btn[data-command]';
|
|
|
28
35
|
const DISABLE_BUTTONS_CODEVIEW = `${COMMAND_BUTTONS}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`;
|
|
29
36
|
const DISABLE_BUTTONS_CONTROLLER = `${COMMAND_BUTTONS}:not([class~="se-component-enabled"]):not([data-type="MORE"])`;
|
|
30
37
|
|
|
31
|
-
/**
|
|
32
|
-
* @typedef {import('./section/constructor').EditorInitOptions} EditorInitOptions_editor
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @typedef {import('./section/constructor').EditorFrameOptions} EditorFrameOptions_editor
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
38
|
/**
|
|
40
39
|
* @typedef {import('../modules/Controller').ControllerInfo} ControllerInfo_editor
|
|
41
40
|
*/
|
|
@@ -43,8 +42,8 @@ const DISABLE_BUTTONS_CONTROLLER = `${COMMAND_BUTTONS}:not([class~="se-component
|
|
|
43
42
|
/**
|
|
44
43
|
* @constructor
|
|
45
44
|
* @description SunEditor constructor function.
|
|
46
|
-
* @param {Array<{target: Element, key: *, options:
|
|
47
|
-
* @param {
|
|
45
|
+
* @param {Array<{target: Element, key: *, options: __se__EditorFrameOptions}>} multiTargets Target element
|
|
46
|
+
* @param {__se__EditorOptions} options options
|
|
48
47
|
*/
|
|
49
48
|
function Editor(multiTargets, options) {
|
|
50
49
|
const _d = multiTargets[0].target.ownerDocument || env._d;
|
|
@@ -63,47 +62,75 @@ function Editor(multiTargets, options) {
|
|
|
63
62
|
*/
|
|
64
63
|
this.frameRoots = product.frameRoots;
|
|
65
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @description Document object
|
|
67
|
+
* @type {Document}
|
|
68
|
+
*/
|
|
69
|
+
this._d = _d;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @description Window object
|
|
73
|
+
* @type {Window}
|
|
74
|
+
*/
|
|
75
|
+
this._w = _w;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @description Controllers carrier
|
|
79
|
+
* @type {HTMLElement}
|
|
80
|
+
*/
|
|
81
|
+
this.carrierWrapper = product.carrierWrapper;
|
|
82
|
+
|
|
66
83
|
/**
|
|
67
84
|
* @description Editor context object
|
|
68
85
|
* @type {__se__Context}
|
|
69
86
|
*/
|
|
70
|
-
this.
|
|
87
|
+
this.__context = product.context;
|
|
71
88
|
|
|
72
89
|
/**
|
|
73
|
-
* @description
|
|
74
|
-
*
|
|
90
|
+
* @description Utility object that manages the editor's runtime context.
|
|
91
|
+
* Provides methods to get, set, and inspect internal context.
|
|
92
|
+
* @type {ContextUtil}
|
|
75
93
|
*/
|
|
76
|
-
this.
|
|
94
|
+
this.context = ContextUtil(this);
|
|
77
95
|
|
|
78
96
|
/**
|
|
79
|
-
* @description Current focusing frame context
|
|
80
|
-
* @type {
|
|
97
|
+
* @description Current focusing [frame] context
|
|
98
|
+
* @type {import('./config/frameContext').FrameContextMap}
|
|
81
99
|
*/
|
|
82
|
-
this.
|
|
100
|
+
this.__frameContext = new Map();
|
|
83
101
|
|
|
84
102
|
/**
|
|
85
|
-
* @description
|
|
86
|
-
*
|
|
103
|
+
* @description Utility object that manages the editor's runtime [frame] context.
|
|
104
|
+
* Provides methods to get, set, and inspect internal context.
|
|
105
|
+
* @type {FrameContextUtil}
|
|
87
106
|
*/
|
|
88
|
-
this.
|
|
107
|
+
this.frameContext = FrameContextUtil(this);
|
|
89
108
|
|
|
90
109
|
/**
|
|
91
|
-
* @description
|
|
92
|
-
* @type {
|
|
110
|
+
* @description Current focusing [frame] context options
|
|
111
|
+
* @type {__se__FrameOptions}
|
|
93
112
|
*/
|
|
94
|
-
this.
|
|
113
|
+
this.__frameOptions = new Map();
|
|
95
114
|
|
|
96
115
|
/**
|
|
97
|
-
* @description
|
|
98
|
-
*
|
|
116
|
+
* @description Utility object that manages the editor's runtime [frame] options.
|
|
117
|
+
* Provides methods to get, set, and inspect internal [frame] options.
|
|
118
|
+
* @type {FrameOptionsMap}
|
|
99
119
|
*/
|
|
100
|
-
this.
|
|
120
|
+
this.frameOptions = FrameOptionsMap(this);
|
|
101
121
|
|
|
102
122
|
/**
|
|
103
|
-
* @description Editor options
|
|
123
|
+
* @description Editor row options
|
|
104
124
|
* @type {Map<string, *>}
|
|
105
125
|
*/
|
|
106
|
-
this.
|
|
126
|
+
this.__options = product.options;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @description Utility object that manages the editor's runtime options.
|
|
130
|
+
* Provides methods to get, set, and inspect internal editor options.
|
|
131
|
+
* @type {BaseOptionsMap}
|
|
132
|
+
*/
|
|
133
|
+
this.options = BaseOptionsMap(this);
|
|
107
134
|
|
|
108
135
|
/**
|
|
109
136
|
* @description Plugins
|
|
@@ -146,6 +173,8 @@ function Editor(multiTargets, options) {
|
|
|
146
173
|
codeIndentSize: 2,
|
|
147
174
|
currentNodes: [],
|
|
148
175
|
currentNodesMap: [],
|
|
176
|
+
initViewportHeight: 0,
|
|
177
|
+
currentViewportHeight: 0,
|
|
149
178
|
onSelected: false,
|
|
150
179
|
rootKey: product.rootId,
|
|
151
180
|
_range: null,
|
|
@@ -209,9 +238,9 @@ function Editor(multiTargets, options) {
|
|
|
209
238
|
/**
|
|
210
239
|
* @description Shoutcuts reverse key array
|
|
211
240
|
* - An array of key codes generated with the reverseButtons option, used to reverse the action for a specific key combination.
|
|
212
|
-
* @type {
|
|
241
|
+
* @type {Set<string>}
|
|
213
242
|
*/
|
|
214
|
-
this.reverseKeys =
|
|
243
|
+
this.reverseKeys = new Set();
|
|
215
244
|
|
|
216
245
|
/**
|
|
217
246
|
* @description A map with the plugin's buttons having an "active" method and the default command buttons with an "active" action.
|
|
@@ -265,9 +294,13 @@ function Editor(multiTargets, options) {
|
|
|
265
294
|
// ------ base ------
|
|
266
295
|
/** @description History class instance @type {ReturnType<typeof import('./base/history').default>} */
|
|
267
296
|
this.history = null;
|
|
268
|
-
/** @description EventManager class instance @type {import('./
|
|
297
|
+
/** @description EventManager class instance @type {import('./event/eventManager').default} */
|
|
269
298
|
this.eventManager = null;
|
|
270
299
|
|
|
300
|
+
// ----- util -----
|
|
301
|
+
/** @description iframe-safe instanceof check utility class @type {import('./util/instanceCheck').default} */
|
|
302
|
+
this.instanceCheck = null;
|
|
303
|
+
|
|
271
304
|
// ------ class ------
|
|
272
305
|
/** @description Toolbar class instance @type {import('./class/toolbar').default} */
|
|
273
306
|
this.toolbar = null;
|
|
@@ -281,6 +314,10 @@ function Editor(multiTargets, options) {
|
|
|
281
314
|
this.format = null;
|
|
282
315
|
/** @description HTML class instance @type {import('./class/html').default} */
|
|
283
316
|
this.html = null;
|
|
317
|
+
/** @description Inline format class instance @type {import('./class/inline').default} */
|
|
318
|
+
this.inline = null;
|
|
319
|
+
/** @description List format class instance @type {import('./class/listFormat').default} */
|
|
320
|
+
this.listFormat = null;
|
|
284
321
|
/** @description Menu class instance @type {import('./class/menu').default} */
|
|
285
322
|
this.menu = null;
|
|
286
323
|
/** @description NodeTransform class instance @type {import('./class/nodeTransform').default} */
|
|
@@ -311,7 +348,7 @@ function Editor(multiTargets, options) {
|
|
|
311
348
|
|
|
312
349
|
/**
|
|
313
350
|
* @description Closest ShadowRoot to editor if found
|
|
314
|
-
* @type {ShadowRoot}
|
|
351
|
+
* @type {ShadowRoot & { getSelection?: () => Selection }} - Chromium-based browsers (Chrome, Edge, etc.) has a getSelection method on the ShadowRoot
|
|
315
352
|
*/
|
|
316
353
|
this._shadowRoot = null;
|
|
317
354
|
|
|
@@ -354,13 +391,13 @@ function Editor(multiTargets, options) {
|
|
|
354
391
|
|
|
355
392
|
/**
|
|
356
393
|
* @description List of buttons to run plugins in the toolbar
|
|
357
|
-
* @type {Array<HTMLElement
|
|
394
|
+
* @type {Object<string, Array<HTMLElement>>}
|
|
358
395
|
*/
|
|
359
396
|
this._pluginCallButtons = product.pluginCallButtons;
|
|
360
397
|
|
|
361
398
|
/**
|
|
362
399
|
* @description List of buttons to run plugins in the Sub-Toolbar
|
|
363
|
-
* @type {Array<HTMLElement
|
|
400
|
+
* @type {Object<string, Array<HTMLElement>>|[]}
|
|
364
401
|
*/
|
|
365
402
|
this._pluginCallButtons_sub = product.pluginCallButtons_sub;
|
|
366
403
|
|
|
@@ -413,7 +450,7 @@ function Editor(multiTargets, options) {
|
|
|
413
450
|
|
|
414
451
|
/**
|
|
415
452
|
* @description plugin retainFormat info Map()
|
|
416
|
-
* @type {Map<string, (
|
|
453
|
+
* @type {Map<string, { key: string, method: (...args: *) => * }>}
|
|
417
454
|
*/
|
|
418
455
|
this._MELInfo = null;
|
|
419
456
|
|
|
@@ -454,7 +491,7 @@ function Editor(multiTargets, options) {
|
|
|
454
491
|
|
|
455
492
|
/**
|
|
456
493
|
* @description Origin options
|
|
457
|
-
* @type {
|
|
494
|
+
* @type {__se__EditorOptions}
|
|
458
495
|
*/
|
|
459
496
|
this._originOptions = options;
|
|
460
497
|
|
|
@@ -577,6 +614,10 @@ Editor.prototype = {
|
|
|
577
614
|
this.html.set(`<${this.options.get('defaultLine')}><br></${this.options.get('defaultLine')}>`);
|
|
578
615
|
this.focus();
|
|
579
616
|
this.history.push(false);
|
|
617
|
+
// document type
|
|
618
|
+
if (this.frameContext.has('documentType_use_header')) {
|
|
619
|
+
this.frameContext.get('documentType').reHeader();
|
|
620
|
+
}
|
|
580
621
|
break;
|
|
581
622
|
case 'codeView':
|
|
582
623
|
this.viewer.codeView(!this.frameContext.get('isCodeView'));
|
|
@@ -597,7 +638,7 @@ Editor.prototype = {
|
|
|
597
638
|
this.history.redo();
|
|
598
639
|
break;
|
|
599
640
|
case 'removeFormat':
|
|
600
|
-
this.
|
|
641
|
+
this.inline.remove();
|
|
601
642
|
this.focus();
|
|
602
643
|
break;
|
|
603
644
|
case 'print':
|
|
@@ -684,8 +725,7 @@ Editor.prototype = {
|
|
|
684
725
|
* @returns {boolean}
|
|
685
726
|
*/
|
|
686
727
|
isEmpty(fc) {
|
|
687
|
-
|
|
688
|
-
const wysiwyg = fc.get('wysiwyg');
|
|
728
|
+
const wysiwyg = (fc || this.frameContext).get('wysiwyg');
|
|
689
729
|
return dom.check.isZeroWidth(wysiwyg.textContent) && !wysiwyg.querySelector(this.options.get('allowedEmptyTags')) && (wysiwyg.innerText.match(/\n/g) || '').length <= 1;
|
|
690
730
|
},
|
|
691
731
|
|
|
@@ -707,8 +747,8 @@ Editor.prototype = {
|
|
|
707
747
|
if (typeof plugins[k].setDir === 'function') plugins[k].setDir(dir);
|
|
708
748
|
}
|
|
709
749
|
|
|
710
|
-
const toolbarWrapper = this.context.get('
|
|
711
|
-
const statusbarWrapper = this.context.get('
|
|
750
|
+
const toolbarWrapper = this.context.get('toolbar_wrapper');
|
|
751
|
+
const statusbarWrapper = this.context.get('statusbar_wrapper');
|
|
712
752
|
if (rtl) {
|
|
713
753
|
this.applyFrameRoots((e) => {
|
|
714
754
|
dom.utils.addClass([e.get('topArea'), e.get('wysiwyg'), e.get('documentTypePageMirror')], 'se-rtl');
|
|
@@ -721,9 +761,13 @@ Editor.prototype = {
|
|
|
721
761
|
dom.utils.removeClass([this.carrierWrapper, toolbarWrapper, statusbarWrapper], 'se-rtl');
|
|
722
762
|
}
|
|
723
763
|
|
|
724
|
-
const lineNodes = dom.query.getListChildren(
|
|
725
|
-
|
|
726
|
-
|
|
764
|
+
const lineNodes = dom.query.getListChildren(
|
|
765
|
+
fc.get('wysiwyg'),
|
|
766
|
+
(current) => {
|
|
767
|
+
return this.format.isLine(current) && !!(current.style.marginRight || current.style.marginLeft || current.style.textAlign);
|
|
768
|
+
},
|
|
769
|
+
null
|
|
770
|
+
);
|
|
727
771
|
|
|
728
772
|
for (let i = 0, n, l, r; (n = lineNodes[i]); i++) {
|
|
729
773
|
n = lineNodes[i];
|
|
@@ -743,11 +787,11 @@ Editor.prototype = {
|
|
|
743
787
|
DIR_BTN_ACTIVE(this, rtl);
|
|
744
788
|
|
|
745
789
|
// document type
|
|
746
|
-
if (fc.has('
|
|
790
|
+
if (fc.has('documentType_use_header')) {
|
|
747
791
|
if (rtl) fc.get('wrapper').appendChild(fc.get('documentTypeInner'));
|
|
748
792
|
else fc.get('wrapper').insertBefore(fc.get('documentTypeInner'), fc.get('wysiwygFrame'));
|
|
749
793
|
}
|
|
750
|
-
if (fc.has('
|
|
794
|
+
if (fc.has('documentType_use_page')) {
|
|
751
795
|
if (rtl) fc.get('wrapper').insertBefore(fc.get('documentTypePage'), fc.get('wysiwygFrame'));
|
|
752
796
|
else fc.get('wrapper').appendChild(fc.get('documentTypePage'));
|
|
753
797
|
}
|
|
@@ -765,7 +809,7 @@ Editor.prototype = {
|
|
|
765
809
|
|
|
766
810
|
/**
|
|
767
811
|
* @description Add or reset option property (Editor is reloaded)
|
|
768
|
-
* @param {
|
|
812
|
+
* @param {__se__EditorOptions} newOptions Options
|
|
769
813
|
*/
|
|
770
814
|
resetOptions(newOptions) {
|
|
771
815
|
this.viewer.codeView(false);
|
|
@@ -815,7 +859,7 @@ Editor.prototype = {
|
|
|
815
859
|
const newFrameMap = newO.frameMap;
|
|
816
860
|
/** --------- [root start] --------- */
|
|
817
861
|
for (let i = 0, len = newOptionKeys.length, k; i < len; i++) {
|
|
818
|
-
k = newOptionKeys[i] || null;
|
|
862
|
+
k = /** @type {keyof import('./config/options').AllBaseOptions} */ (newOptionKeys[i] || null);
|
|
819
863
|
|
|
820
864
|
if (newRootKeys.has(k)) {
|
|
821
865
|
const diff = rootDiff.get(k);
|
|
@@ -922,7 +966,7 @@ Editor.prototype = {
|
|
|
922
966
|
this._originOptions = _originOptions;
|
|
923
967
|
|
|
924
968
|
// --- [toolbar] ---
|
|
925
|
-
const toolbar = this.context.get('
|
|
969
|
+
const toolbar = this.context.get('toolbar_main');
|
|
926
970
|
// width
|
|
927
971
|
if (/inline|balloon/i.test(options.get('mode')) && newOptionKeys.includes('toolbar_width')) {
|
|
928
972
|
toolbar.style.width = options.get('toolbar_width');
|
|
@@ -1008,7 +1052,7 @@ Editor.prototype = {
|
|
|
1008
1052
|
*/
|
|
1009
1053
|
focusEdge(focusEl) {
|
|
1010
1054
|
this._preventBlur = false;
|
|
1011
|
-
|
|
1055
|
+
focusEl ||= this.frameContext.get('wysiwyg').lastElementChild;
|
|
1012
1056
|
|
|
1013
1057
|
const fileComponentInfo = this.component.get(focusEl);
|
|
1014
1058
|
if (fileComponentInfo) {
|
|
@@ -1058,9 +1102,9 @@ Editor.prototype = {
|
|
|
1058
1102
|
|
|
1059
1103
|
/** remove element */
|
|
1060
1104
|
dom.utils.removeItem(this.carrierWrapper);
|
|
1061
|
-
dom.utils.removeItem(this.context.get('
|
|
1062
|
-
dom.utils.removeItem(this.context.get('
|
|
1063
|
-
dom.utils.removeItem(this.context.get('
|
|
1105
|
+
dom.utils.removeItem(this.context.get('toolbar_wrapper'));
|
|
1106
|
+
dom.utils.removeItem(this.context.get('toolbar_sub_wrapper'));
|
|
1107
|
+
dom.utils.removeItem(this.context.get('statusbar_wrapper'));
|
|
1064
1108
|
this.applyFrameRoots((e) => {
|
|
1065
1109
|
dom.utils.removeItem(e.get('topArea'));
|
|
1066
1110
|
e.get('options').clear();
|
|
@@ -1085,7 +1129,7 @@ Editor.prototype = {
|
|
|
1085
1129
|
delete obj[k];
|
|
1086
1130
|
}
|
|
1087
1131
|
|
|
1088
|
-
obj = ['eventManager', 'char', 'component', 'format', 'html', 'menu', 'nodeTransform', 'offset', 'selection', 'shortcuts', 'toolbar', 'ui', 'viewer'];
|
|
1132
|
+
obj = ['eventManager', 'instanceCheck', 'char', 'component', 'format', 'html', 'inline', 'listFormat', 'menu', 'nodeTransform', 'offset', 'selection', 'shortcuts', 'toolbar', 'ui', 'viewer'];
|
|
1089
1133
|
for (let i = 0, len = obj.length, c; i < len; i++) {
|
|
1090
1134
|
c = this[obj[i]];
|
|
1091
1135
|
for (const k in c) {
|
|
@@ -1114,8 +1158,8 @@ Editor.prototype = {
|
|
|
1114
1158
|
* @param {__se__FrameContext} rt Root target[key] FrameContext
|
|
1115
1159
|
*/
|
|
1116
1160
|
_setFrameInfo(rt) {
|
|
1117
|
-
this.frameContext
|
|
1118
|
-
this.frameOptions
|
|
1161
|
+
this.frameContext.reset(rt);
|
|
1162
|
+
this.frameOptions.reset(rt.get('options'));
|
|
1119
1163
|
rt.set('_editorHeight', rt.get('wysiwygFrame').offsetHeight);
|
|
1120
1164
|
this._lineBreaker_t = rt.get('lineBreaker_t');
|
|
1121
1165
|
this._lineBreaker_b = rt.get('lineBreaker_b');
|
|
@@ -1174,10 +1218,10 @@ Editor.prototype = {
|
|
|
1174
1218
|
if (this.options.get('type') === 'document') {
|
|
1175
1219
|
e.set('documentType', new DocumentType(this, e));
|
|
1176
1220
|
if (e.get('documentType').useHeader) {
|
|
1177
|
-
e.set('
|
|
1221
|
+
e.set('documentType_use_header', true);
|
|
1178
1222
|
}
|
|
1179
1223
|
if (e.get('documentType').usePage) {
|
|
1180
|
-
e.set('
|
|
1224
|
+
e.set('documentType_use_page', true);
|
|
1181
1225
|
e.get('documentTypePageMirror').innerHTML = e.get('wysiwyg').innerHTML;
|
|
1182
1226
|
}
|
|
1183
1227
|
}
|
|
@@ -1191,15 +1235,17 @@ Editor.prototype = {
|
|
|
1191
1235
|
_resourcesStateChange(fc) {
|
|
1192
1236
|
this._iframeAutoHeight(fc);
|
|
1193
1237
|
this._checkPlaceholder(fc);
|
|
1194
|
-
|
|
1238
|
+
// document type page
|
|
1239
|
+
if (fc.has('documentType_use_page')) {
|
|
1195
1240
|
fc.get('documentTypePageMirror').innerHTML = fc.get('wysiwyg').innerHTML;
|
|
1241
|
+
fc.get('documentType').rePage(true);
|
|
1196
1242
|
}
|
|
1197
1243
|
},
|
|
1198
1244
|
|
|
1199
1245
|
/**
|
|
1200
1246
|
* @private
|
|
1201
1247
|
* @description Modify the height value of the iframe when the height of the iframe is automatic.
|
|
1202
|
-
* @param {__se__FrameContext} fc - Frame context object
|
|
1248
|
+
* @param {__se__FrameContext|FrameContextUtil} fc - Frame context object
|
|
1203
1249
|
*/
|
|
1204
1250
|
_iframeAutoHeight(fc) {
|
|
1205
1251
|
const autoFrame = fc.get('_iframeAuto');
|
|
@@ -1218,7 +1264,7 @@ Editor.prototype = {
|
|
|
1218
1264
|
/**
|
|
1219
1265
|
* @private
|
|
1220
1266
|
* @description Call the "onResizeEditor" event
|
|
1221
|
-
* @param {__se__FrameContext} fc - Frame context object
|
|
1267
|
+
* @param {__se__FrameContext|FrameContextUtil} fc - Frame context object
|
|
1222
1268
|
* @param {number} h - Height value
|
|
1223
1269
|
* @param {ResizeObserverEntry} resizeObserverEntry - ResizeObserverEntry object
|
|
1224
1270
|
*/
|
|
@@ -1235,7 +1281,7 @@ Editor.prototype = {
|
|
|
1235
1281
|
}
|
|
1236
1282
|
|
|
1237
1283
|
// document type page
|
|
1238
|
-
if (fc.has('
|
|
1284
|
+
if (fc.has('documentType_use_page')) {
|
|
1239
1285
|
fc.get('documentType').resizePage();
|
|
1240
1286
|
}
|
|
1241
1287
|
},
|
|
@@ -1246,7 +1292,7 @@ Editor.prototype = {
|
|
|
1246
1292
|
* @param {?__se__FrameContext=} fc - Frame context object, If null fc is this.frameContext
|
|
1247
1293
|
*/
|
|
1248
1294
|
_checkPlaceholder(fc) {
|
|
1249
|
-
fc
|
|
1295
|
+
fc ||= /** @type {__se__FrameContext} */ (this.frameContext);
|
|
1250
1296
|
const placeholder = fc.get('placeholder');
|
|
1251
1297
|
|
|
1252
1298
|
if (placeholder) {
|
|
@@ -1266,9 +1312,12 @@ Editor.prototype = {
|
|
|
1266
1312
|
/**
|
|
1267
1313
|
* @private
|
|
1268
1314
|
* @description Initializ editor
|
|
1269
|
-
* @param {
|
|
1315
|
+
* @param {__se__EditorOptions} options Options
|
|
1270
1316
|
*/
|
|
1271
1317
|
__editorInit(options) {
|
|
1318
|
+
this.status.initViewportHeight = this._w.visualViewport.height;
|
|
1319
|
+
this.eventManager.__setViewportSize();
|
|
1320
|
+
|
|
1272
1321
|
this.applyFrameRoots((e) => {
|
|
1273
1322
|
this.__setEditorParams(e);
|
|
1274
1323
|
});
|
|
@@ -1283,6 +1332,9 @@ Editor.prototype = {
|
|
|
1283
1332
|
this.applyFrameRoots((e) => {
|
|
1284
1333
|
this.eventManager._addFrameEvents(e);
|
|
1285
1334
|
this._initWysiwygArea(e, e.get('options').get('value'));
|
|
1335
|
+
if (e.get('options').get('iframe') && e.get('options').get('height') === 'auto') {
|
|
1336
|
+
this.__callResizeFunction(e, e.get('wysiwygFrame').offsetHeight, null);
|
|
1337
|
+
}
|
|
1286
1338
|
});
|
|
1287
1339
|
|
|
1288
1340
|
this.eventManager.__eventDoc = null;
|
|
@@ -1290,29 +1342,37 @@ Editor.prototype = {
|
|
|
1290
1342
|
this._componentsInfoReset = false;
|
|
1291
1343
|
this._checkComponents(true);
|
|
1292
1344
|
|
|
1293
|
-
this._w.setTimeout(
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1345
|
+
this._w.setTimeout(
|
|
1346
|
+
function () {
|
|
1347
|
+
// Check if instance was destroyed (e.g., in SSR with dynamic imports mistake)
|
|
1348
|
+
if (!this.context) {
|
|
1349
|
+
console.warn('[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.');
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
// toolbar visibility
|
|
1354
|
+
this.context.get('toolbar_main').style.visibility = '';
|
|
1355
|
+
// roots
|
|
1356
|
+
this.applyFrameRoots((e) => {
|
|
1357
|
+
// observer
|
|
1358
|
+
if (this.eventManager._wwFrameObserver) this.eventManager._wwFrameObserver.observe(e.get('wysiwygFrame'));
|
|
1359
|
+
if (this.eventManager._toolbarObserver) this.eventManager._toolbarObserver.observe(e.get('_toolbarShadow'));
|
|
1360
|
+
// resource state
|
|
1361
|
+
this._resourcesStateChange(e);
|
|
1362
|
+
});
|
|
1363
|
+
// history reset
|
|
1364
|
+
this.history.reset();
|
|
1365
|
+
// user event
|
|
1366
|
+
this.triggerEvent('onload', {});
|
|
1367
|
+
}.bind(this),
|
|
1368
|
+
0
|
|
1369
|
+
);
|
|
1310
1370
|
},
|
|
1311
1371
|
|
|
1312
1372
|
/**
|
|
1313
1373
|
* @private
|
|
1314
1374
|
* @description Initializ core variable
|
|
1315
|
-
* @param {
|
|
1375
|
+
* @param {__se__EditorOptions} options Options
|
|
1316
1376
|
*/
|
|
1317
1377
|
__init(options) {
|
|
1318
1378
|
// file components
|
|
@@ -1331,6 +1391,7 @@ Editor.prototype = {
|
|
|
1331
1391
|
['onMouseUp', []],
|
|
1332
1392
|
['onScroll', []],
|
|
1333
1393
|
['onClick', []],
|
|
1394
|
+
['onBeforeInput', []],
|
|
1334
1395
|
['onInput', []],
|
|
1335
1396
|
['onKeyDown', []],
|
|
1336
1397
|
['onKeyUp', []],
|
|
@@ -1397,7 +1458,7 @@ Editor.prototype = {
|
|
|
1397
1458
|
// plugin maintain
|
|
1398
1459
|
if (plugin.retainFormat) {
|
|
1399
1460
|
const info = plugin.retainFormat();
|
|
1400
|
-
this._MELInfo.set(info.query, info.method);
|
|
1461
|
+
this._MELInfo.set(info.query, { key: plugin.constructor.key, method: info.method });
|
|
1401
1462
|
}
|
|
1402
1463
|
}
|
|
1403
1464
|
|
|
@@ -1425,20 +1486,24 @@ Editor.prototype = {
|
|
|
1425
1486
|
delete this._pluginCallButtons;
|
|
1426
1487
|
delete this._pluginCallButtons_sub;
|
|
1427
1488
|
|
|
1428
|
-
this.__cachingButtons();
|
|
1489
|
+
this.__cachingButtons('all');
|
|
1429
1490
|
this.__cachingShortcuts();
|
|
1430
1491
|
},
|
|
1431
1492
|
|
|
1432
1493
|
/**
|
|
1433
1494
|
* @private
|
|
1434
1495
|
* @description Caching basic buttons to use
|
|
1496
|
+
* @param {string} mode 'all' | 'main' | 'sub'
|
|
1435
1497
|
*/
|
|
1436
|
-
__cachingButtons() {
|
|
1498
|
+
__cachingButtons(mode) {
|
|
1437
1499
|
const ctx = this.context;
|
|
1438
1500
|
this.__setDisabledButtons();
|
|
1439
|
-
|
|
1440
|
-
if (
|
|
1441
|
-
this.__saveCommandButtons(this.
|
|
1501
|
+
|
|
1502
|
+
if (/all|main/.test(mode)) {
|
|
1503
|
+
this.__saveCommandButtons(this.allCommandButtons, ctx.get('toolbar_buttonTray'));
|
|
1504
|
+
}
|
|
1505
|
+
if (/all|sub/.test(mode) && this.options.has('_subMode')) {
|
|
1506
|
+
this.__saveCommandButtons(this.subAllCommandButtons, ctx.get('toolbar_sub_buttonTray'));
|
|
1442
1507
|
}
|
|
1443
1508
|
},
|
|
1444
1509
|
|
|
@@ -1450,12 +1515,12 @@ Editor.prototype = {
|
|
|
1450
1515
|
__setDisabledButtons() {
|
|
1451
1516
|
const ctx = this.context;
|
|
1452
1517
|
|
|
1453
|
-
this._codeViewDisabledButtons = converter.nodeListToArray(ctx.get('
|
|
1454
|
-
this._controllerOnDisabledButtons = converter.nodeListToArray(ctx.get('
|
|
1518
|
+
this._codeViewDisabledButtons = converter.nodeListToArray(ctx.get('toolbar_buttonTray').querySelectorAll(DISABLE_BUTTONS_CODEVIEW));
|
|
1519
|
+
this._controllerOnDisabledButtons = converter.nodeListToArray(ctx.get('toolbar_buttonTray').querySelectorAll(DISABLE_BUTTONS_CONTROLLER));
|
|
1455
1520
|
|
|
1456
1521
|
if (this.options.has('_subMode')) {
|
|
1457
|
-
this._codeViewDisabledButtons = this._codeViewDisabledButtons.concat(converter.nodeListToArray(ctx.get('
|
|
1458
|
-
this._controllerOnDisabledButtons = this._controllerOnDisabledButtons.concat(converter.nodeListToArray(ctx.get('
|
|
1522
|
+
this._codeViewDisabledButtons = this._codeViewDisabledButtons.concat(converter.nodeListToArray(ctx.get('toolbar_sub_buttonTray').querySelectorAll(DISABLE_BUTTONS_CODEVIEW)));
|
|
1523
|
+
this._controllerOnDisabledButtons = this._controllerOnDisabledButtons.concat(converter.nodeListToArray(ctx.get('toolbar_sub_buttonTray').querySelectorAll(DISABLE_BUTTONS_CONTROLLER)));
|
|
1459
1524
|
}
|
|
1460
1525
|
},
|
|
1461
1526
|
|
|
@@ -1559,12 +1624,6 @@ Editor.prototype = {
|
|
|
1559
1624
|
}
|
|
1560
1625
|
}
|
|
1561
1626
|
|
|
1562
|
-
// wisywig attributes
|
|
1563
|
-
const attr = frameOptions.get('editableFrameAttributes');
|
|
1564
|
-
for (const k in attr) {
|
|
1565
|
-
e.get('wysiwyg').setAttribute(k, attr[k]);
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
1627
|
// init, validate
|
|
1569
1628
|
if (frameOptions.get('iframe')) {
|
|
1570
1629
|
e.set('_ww', e.get('wysiwygFrame').contentWindow);
|
|
@@ -1577,6 +1636,12 @@ Editor.prototype = {
|
|
|
1577
1636
|
e.set('_ww', _w);
|
|
1578
1637
|
e.set('_wd', this._d);
|
|
1579
1638
|
}
|
|
1639
|
+
|
|
1640
|
+
// wisywig attributes
|
|
1641
|
+
const attr = frameOptions.get('editableFrameAttributes');
|
|
1642
|
+
for (const k in attr) {
|
|
1643
|
+
e.get('wysiwyg').setAttribute(k, attr[k]);
|
|
1644
|
+
}
|
|
1580
1645
|
},
|
|
1581
1646
|
|
|
1582
1647
|
/**
|
|
@@ -1588,7 +1653,7 @@ Editor.prototype = {
|
|
|
1588
1653
|
this.events = { ...Events, ...this.options.get('events') };
|
|
1589
1654
|
this.triggerEvent = async (eventName, eventData) => {
|
|
1590
1655
|
// [iframe] wysiwyg is disabled, the event is not called.
|
|
1591
|
-
if (eventData?.frameContext?.get('wysiwyg')
|
|
1656
|
+
if (dom.check.isNonEditable(eventData?.frameContext?.get('wysiwyg'))) return false;
|
|
1592
1657
|
const eventHandler = this.events[eventName];
|
|
1593
1658
|
if (typeof eventHandler === 'function') {
|
|
1594
1659
|
return await eventHandler({ editor: this, ...eventData });
|
|
@@ -1602,14 +1667,16 @@ Editor.prototype = {
|
|
|
1602
1667
|
// eventManager
|
|
1603
1668
|
this.eventManager = new EventManager(this);
|
|
1604
1669
|
|
|
1605
|
-
// util
|
|
1670
|
+
// util
|
|
1671
|
+
this.instanceCheck = new InstanceCheck(this);
|
|
1672
|
+
|
|
1673
|
+
// main classes
|
|
1606
1674
|
this.offset = new Offset(this);
|
|
1607
1675
|
this.shortcuts = new Shortcuts(this);
|
|
1608
|
-
// main classes
|
|
1609
1676
|
this.toolbar = new Toolbar(this, { keyName: 'toolbar', balloon: this.isBalloon, balloonAlways: this.isBalloonAlways, inline: this.isInline, res: this._responsiveButtons });
|
|
1610
1677
|
if (this.options.has('_subMode')) {
|
|
1611
1678
|
this.subToolbar = new Toolbar(this, {
|
|
1612
|
-
keyName: '
|
|
1679
|
+
keyName: 'toolbar_sub',
|
|
1613
1680
|
balloon: this.isSubBalloon,
|
|
1614
1681
|
balloonAlways: this.isSubBalloonAlways,
|
|
1615
1682
|
inline: false,
|
|
@@ -1621,6 +1688,8 @@ Editor.prototype = {
|
|
|
1621
1688
|
this.nodeTransform = new NodeTransform(this);
|
|
1622
1689
|
this.component = new Component(this);
|
|
1623
1690
|
this.format = new Format(this);
|
|
1691
|
+
this.inline = new Inline(this);
|
|
1692
|
+
this.listFormat = new ListFormat(this);
|
|
1624
1693
|
this.menu = new Menu(this);
|
|
1625
1694
|
this.char = new Char(this);
|
|
1626
1695
|
this.ui = new UI(this);
|
|
@@ -1633,6 +1702,8 @@ Editor.prototype = {
|
|
|
1633
1702
|
ClassInjector.call(this.component, this);
|
|
1634
1703
|
ClassInjector.call(this.format, this);
|
|
1635
1704
|
ClassInjector.call(this.html, this);
|
|
1705
|
+
ClassInjector.call(this.inline, this);
|
|
1706
|
+
ClassInjector.call(this.listFormat, this);
|
|
1636
1707
|
ClassInjector.call(this.menu, this);
|
|
1637
1708
|
ClassInjector.call(this.nodeTransform, this);
|
|
1638
1709
|
ClassInjector.call(this.offset, this);
|
|
@@ -1649,6 +1720,8 @@ Editor.prototype = {
|
|
|
1649
1720
|
delete this.component['component'];
|
|
1650
1721
|
delete this.format['format'];
|
|
1651
1722
|
delete this.html['html'];
|
|
1723
|
+
delete this.inline['inline'];
|
|
1724
|
+
delete this.listFormat['listFormat'];
|
|
1652
1725
|
delete this.menu['menu'];
|
|
1653
1726
|
delete this.nodeTransform['nodeTransform'];
|
|
1654
1727
|
delete this.offset['offset'];
|
|
@@ -1665,7 +1738,7 @@ Editor.prototype = {
|
|
|
1665
1738
|
/**
|
|
1666
1739
|
* @private
|
|
1667
1740
|
* @description Creates the editor instance and initializes components.
|
|
1668
|
-
* @param {
|
|
1741
|
+
* @param {__se__EditorOptions} originOptions - The initial editor options.
|
|
1669
1742
|
* @returns {Promise<void>}
|
|
1670
1743
|
*/
|
|
1671
1744
|
async __Create(originOptions) {
|
|
@@ -1696,7 +1769,7 @@ Editor.prototype = {
|
|
|
1696
1769
|
if (e.get('options').get('iframe')) {
|
|
1697
1770
|
const iframeLoaded = new Promise((resolve) => {
|
|
1698
1771
|
this.eventManager.addEvent(e.get('wysiwygFrame'), 'load', ({ target }) => {
|
|
1699
|
-
this.__setIframeDocument(target, this.
|
|
1772
|
+
this.__setIframeDocument(target, this.__options, e.get('options'));
|
|
1700
1773
|
resolve();
|
|
1701
1774
|
});
|
|
1702
1775
|
});
|