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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import CoreInjector from '../editorInjector/_core';
|
|
2
2
|
import { dom, env, keyCodeMap } from '../helper';
|
|
3
3
|
|
|
4
|
+
const { _w } = env;
|
|
4
5
|
const MENU_MIN_HEIGHT = 38;
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -18,6 +19,19 @@ const MENU_MIN_HEIGHT = 38;
|
|
|
18
19
|
* @description Creates a select menu
|
|
19
20
|
*/
|
|
20
21
|
class SelectMenu extends CoreInjector {
|
|
22
|
+
#dirPosition;
|
|
23
|
+
#dirSubPosition;
|
|
24
|
+
#textDirDiff;
|
|
25
|
+
#refer;
|
|
26
|
+
#keydownTarget;
|
|
27
|
+
#selectMethod;
|
|
28
|
+
#bindClose_key;
|
|
29
|
+
#bindClose_mousedown;
|
|
30
|
+
#bindClose_click;
|
|
31
|
+
#events;
|
|
32
|
+
#eventHandlers;
|
|
33
|
+
#globalEventHandlers;
|
|
34
|
+
|
|
21
35
|
/**
|
|
22
36
|
* @constructor
|
|
23
37
|
* @param {*} inst The instance object that called the constructor.
|
|
@@ -42,28 +56,28 @@ class SelectMenu extends CoreInjector {
|
|
|
42
56
|
this.checkList = !!params.checkList;
|
|
43
57
|
this.position = positionItems[0];
|
|
44
58
|
this.subPosition = positionItems[1];
|
|
45
|
-
this._dirPosition = /^(left|right)$/.test(this.position) ? (this.position === 'left' ? 'right' : 'left') : this.position;
|
|
46
|
-
this._dirSubPosition = /^(left|right)$/.test(this.subPosition) ? (this.subPosition === 'left' ? 'right' : 'left') : this.subPosition;
|
|
47
|
-
this._textDirDiff = params.dir === 'ltr' ? false : params.dir === 'rtl' ? true : null;
|
|
48
59
|
this.splitNum = params.splitNum || 0;
|
|
49
60
|
this.horizontal = !!this.splitNum;
|
|
50
61
|
this.openMethod = params.openMethod;
|
|
51
62
|
this.closeMethod = params.closeMethod;
|
|
52
|
-
|
|
53
|
-
this
|
|
54
|
-
this
|
|
55
|
-
this
|
|
56
|
-
this
|
|
57
|
-
this
|
|
58
|
-
this
|
|
59
|
-
this
|
|
60
|
-
this
|
|
63
|
+
|
|
64
|
+
this.#dirPosition = /^(left|right)$/.test(this.position) ? (this.position === 'left' ? 'right' : 'left') : this.position;
|
|
65
|
+
this.#dirSubPosition = /^(left|right)$/.test(this.subPosition) ? (this.subPosition === 'left' ? 'right' : 'left') : this.subPosition;
|
|
66
|
+
this.#textDirDiff = params.dir === 'ltr' ? false : params.dir === 'rtl' ? true : null;
|
|
67
|
+
this.#refer = null;
|
|
68
|
+
this.#keydownTarget = null;
|
|
69
|
+
this.#selectMethod = null;
|
|
70
|
+
this.#bindClose_key = null;
|
|
71
|
+
this.#bindClose_mousedown = null;
|
|
72
|
+
this.#bindClose_click = null;
|
|
73
|
+
this.#events = null;
|
|
74
|
+
this.#eventHandlers = {
|
|
61
75
|
mousedown: this.#OnMousedown_list.bind(this),
|
|
62
76
|
mousemove: this.#OnMouseMove_list.bind(this),
|
|
63
77
|
click: this.#OnClick_list.bind(this),
|
|
64
78
|
keydown: this.#OnKeyDown_refer.bind(this)
|
|
65
79
|
};
|
|
66
|
-
this
|
|
80
|
+
this.#globalEventHandlers = { keydown: this.#CloseListener_key.bind(this), mousedown: this.#CloseListener_mousedown.bind(this), click: this.#CloseListener_click.bind(this) };
|
|
67
81
|
}
|
|
68
82
|
|
|
69
83
|
/**
|
|
@@ -73,16 +87,16 @@ class SelectMenu extends CoreInjector {
|
|
|
73
87
|
*/
|
|
74
88
|
create(items, menus) {
|
|
75
89
|
this.form.firstElementChild.innerHTML = '';
|
|
76
|
-
menus
|
|
90
|
+
menus ||= items;
|
|
77
91
|
let html = '';
|
|
78
92
|
for (let i = 0, len = menus.length; i < len; i++) {
|
|
79
93
|
if (i > 0 && i % this.splitNum === 0) {
|
|
80
|
-
this
|
|
94
|
+
this.#createFormat(html);
|
|
81
95
|
html = '';
|
|
82
96
|
}
|
|
83
97
|
html += `<li class="se-select-item" data-index="${i}">${typeof menus[i] === 'string' ? menus[i] : /** @type {HTMLElement} */ (menus[i]).outerHTML}</li>`;
|
|
84
98
|
}
|
|
85
|
-
this
|
|
99
|
+
this.#createFormat(html);
|
|
86
100
|
|
|
87
101
|
this.items = /** @type {Array<string|Node>} */ (items);
|
|
88
102
|
this.menus = Array.from(this.form.querySelectorAll('li'));
|
|
@@ -95,11 +109,10 @@ class SelectMenu extends CoreInjector {
|
|
|
95
109
|
* @param {(command: string) => void} selectMethod - The function to execute when an item is selected.
|
|
96
110
|
* @param {{class?: string, style?: string}} [attr={}] - Additional attributes for the select menu container.
|
|
97
111
|
*/
|
|
98
|
-
on(referElement, selectMethod, attr) {
|
|
99
|
-
|
|
100
|
-
this
|
|
101
|
-
this
|
|
102
|
-
this._selectMethod = selectMethod;
|
|
112
|
+
on(referElement, selectMethod, attr = {}) {
|
|
113
|
+
this.#refer = /** @type {HTMLElement} */ (referElement);
|
|
114
|
+
this.#keydownTarget = dom.check.isInputElement(referElement) ? referElement : this.frameContext.get('_ww');
|
|
115
|
+
this.#selectMethod = selectMethod;
|
|
103
116
|
this.form = dom.utils.createElement(
|
|
104
117
|
'DIV',
|
|
105
118
|
{
|
|
@@ -119,12 +132,12 @@ class SelectMenu extends CoreInjector {
|
|
|
119
132
|
open(position, onItemQuerySelector) {
|
|
120
133
|
this.editor.selectMenuOn = true;
|
|
121
134
|
if (typeof this.openMethod === 'function') this.openMethod();
|
|
122
|
-
this
|
|
123
|
-
this
|
|
135
|
+
this.#addEvents();
|
|
136
|
+
this.#addGlobalEvent();
|
|
124
137
|
const positionItems = position ? position.split('-') : [];
|
|
125
|
-
const mainPosition = positionItems[0] || (this
|
|
126
|
-
const subPosition = positionItems[1] || (this
|
|
127
|
-
this
|
|
138
|
+
const mainPosition = positionItems[0] || (this.#textDirDiff !== null && this.#textDirDiff !== this.options.get('_rtl') ? this.#dirPosition : this.position);
|
|
139
|
+
const subPosition = positionItems[1] || (this.#textDirDiff !== null && this.#textDirDiff !== this.options.get('_rtl') ? this.#dirSubPosition : this.subPosition);
|
|
140
|
+
this.#setPosition(mainPosition, subPosition, onItemQuerySelector);
|
|
128
141
|
this.isOpen = true;
|
|
129
142
|
}
|
|
130
143
|
|
|
@@ -133,9 +146,9 @@ class SelectMenu extends CoreInjector {
|
|
|
133
146
|
*/
|
|
134
147
|
close() {
|
|
135
148
|
this.editor.selectMenuOn = false;
|
|
136
|
-
dom.utils.removeClass(this
|
|
137
|
-
this
|
|
138
|
-
|
|
149
|
+
dom.utils.removeClass(this.#refer, 'on');
|
|
150
|
+
this.#init();
|
|
151
|
+
this.form?.removeAttribute('style');
|
|
139
152
|
this.isOpen = false;
|
|
140
153
|
if (typeof this.closeMethod === 'function') this.closeMethod();
|
|
141
154
|
}
|
|
@@ -154,25 +167,23 @@ class SelectMenu extends CoreInjector {
|
|
|
154
167
|
* @param {number} index Item index
|
|
155
168
|
*/
|
|
156
169
|
setItem(index) {
|
|
157
|
-
this
|
|
170
|
+
this.#selectItem(index);
|
|
158
171
|
}
|
|
159
172
|
|
|
160
173
|
/**
|
|
161
|
-
* @private
|
|
162
174
|
* @description Appends a formatted list of items to the menu.
|
|
163
175
|
* @param {string} html - The HTML string representing the menu items.
|
|
164
176
|
*/
|
|
165
|
-
|
|
177
|
+
#createFormat(html) {
|
|
166
178
|
this.form.firstElementChild.innerHTML += `<ul class="se-list-basic se-list-checked${this.horizontal ? ' se-list-horizontal' : ''}">${html}</ul>`;
|
|
167
179
|
}
|
|
168
180
|
|
|
169
181
|
/**
|
|
170
|
-
* @private
|
|
171
182
|
* @description Resets the menu state and removes event listeners.
|
|
172
183
|
*/
|
|
173
|
-
|
|
174
|
-
this
|
|
175
|
-
this
|
|
184
|
+
#init() {
|
|
185
|
+
this.#removeEvents();
|
|
186
|
+
this.#removeGlobalEvent();
|
|
176
187
|
this.index = -1;
|
|
177
188
|
this.item = null;
|
|
178
189
|
if (this._onItem) {
|
|
@@ -182,24 +193,22 @@ class SelectMenu extends CoreInjector {
|
|
|
182
193
|
}
|
|
183
194
|
|
|
184
195
|
/**
|
|
185
|
-
* @private
|
|
186
196
|
* @description Moves the selection up or down by a specified number of items.
|
|
187
197
|
* @param {number} num - The number of items to move (negative for up, positive for down).
|
|
188
198
|
*/
|
|
189
|
-
|
|
199
|
+
#moveItem(num) {
|
|
190
200
|
num = this.index + num;
|
|
191
201
|
const len = this.menuLen;
|
|
192
202
|
const selectIndex = (this.index = num >= len ? 0 : num < 0 ? len - 1 : num);
|
|
193
203
|
|
|
194
|
-
this
|
|
204
|
+
this.#selectItem(selectIndex);
|
|
195
205
|
}
|
|
196
206
|
|
|
197
207
|
/**
|
|
198
|
-
* @private
|
|
199
208
|
* @description Highlights and selects an item by index.
|
|
200
209
|
* @param {number} selectIndex - The index of the item to select.
|
|
201
210
|
*/
|
|
202
|
-
|
|
211
|
+
#selectItem(selectIndex) {
|
|
203
212
|
dom.utils.removeClass(this.form, 'se-select-menu-mouse-move');
|
|
204
213
|
|
|
205
214
|
const len = this.menuLen;
|
|
@@ -216,17 +225,16 @@ class SelectMenu extends CoreInjector {
|
|
|
216
225
|
}
|
|
217
226
|
|
|
218
227
|
/**
|
|
219
|
-
* @private
|
|
220
228
|
* @description Sets the position of the select menu relative to the reference element.
|
|
221
229
|
* @param {string} position Menu position ("left"|"right") | ("top"|"bottom")
|
|
222
230
|
* @param {string} subPosition Sub position ("middle"|"top"|"bottom") | ("center"|"left"|"right")
|
|
223
231
|
* @param {string} [onItemQuerySelector] - A query selector string to highlight a specific item.
|
|
224
232
|
* @param {boolean} [_re=false] - Whether this is a retry after adjusting the position.
|
|
225
233
|
*/
|
|
226
|
-
|
|
234
|
+
#setPosition(position, subPosition, onItemQuerySelector, _re) {
|
|
227
235
|
const originP = position;
|
|
228
236
|
const form = this.form;
|
|
229
|
-
const target = this
|
|
237
|
+
const target = this.#refer;
|
|
230
238
|
form.style.visibility = 'hidden';
|
|
231
239
|
form.style.display = 'block';
|
|
232
240
|
dom.utils.removeClass(form, 'se-select-menu-scroll');
|
|
@@ -254,7 +262,7 @@ class SelectMenu extends CoreInjector {
|
|
|
254
262
|
const targetOffsetTop = target.offsetTop;
|
|
255
263
|
const targetGlobalTop = globalTarget.top;
|
|
256
264
|
const targetHeight = target.offsetHeight;
|
|
257
|
-
const wbottom = dom.utils.getClientSize().h - (targetGlobalTop -
|
|
265
|
+
const wbottom = dom.utils.getClientSize().h - (targetGlobalTop - _w.scrollY + targetHeight);
|
|
258
266
|
const sideAddH = side ? targetHeight : 0;
|
|
259
267
|
let overH = 10000;
|
|
260
268
|
switch (position) {
|
|
@@ -308,7 +316,7 @@ class SelectMenu extends CoreInjector {
|
|
|
308
316
|
}
|
|
309
317
|
|
|
310
318
|
if (overH < MENU_MIN_HEIGHT && !_re && position !== 'middle') {
|
|
311
|
-
this
|
|
319
|
+
this.#setPosition(position === 'top' ? 'bottpm' : 'top', subPosition, onItemQuerySelector, true);
|
|
312
320
|
return;
|
|
313
321
|
}
|
|
314
322
|
|
|
@@ -331,15 +339,15 @@ class SelectMenu extends CoreInjector {
|
|
|
331
339
|
let overW = 0;
|
|
332
340
|
switch (side + '-' + (side ? originP : subPosition)) {
|
|
333
341
|
case 'true-left':
|
|
334
|
-
overW = globalTarget.left -
|
|
342
|
+
overW = globalTarget.left - _w.scrollX + fl;
|
|
335
343
|
if (overW < 0) l = l = targetL + targetW + 1;
|
|
336
344
|
break;
|
|
337
345
|
case 'true-right':
|
|
338
|
-
overW =
|
|
346
|
+
overW = _w.innerWidth - (fl + formW);
|
|
339
347
|
if (overW < 0) l = targetL - formW - 1;
|
|
340
348
|
break;
|
|
341
349
|
case 'false-center': {
|
|
342
|
-
overW =
|
|
350
|
+
overW = _w.innerWidth - (fl + formW);
|
|
343
351
|
if (overW < 0) l += overW - 4;
|
|
344
352
|
form.style.left = l + 'px';
|
|
345
353
|
const centerfl = this.editor.offset.getGlobal(form).left;
|
|
@@ -347,7 +355,7 @@ class SelectMenu extends CoreInjector {
|
|
|
347
355
|
break;
|
|
348
356
|
}
|
|
349
357
|
case 'false-left':
|
|
350
|
-
overW =
|
|
358
|
+
overW = _w.innerWidth - (globalTarget.left - _w.scrollX + formW);
|
|
351
359
|
if (overW < 0) l += overW - 4;
|
|
352
360
|
break;
|
|
353
361
|
case 'false-right':
|
|
@@ -369,59 +377,54 @@ class SelectMenu extends CoreInjector {
|
|
|
369
377
|
}
|
|
370
378
|
|
|
371
379
|
/**
|
|
372
|
-
* @private
|
|
373
380
|
* @description Selects an item and triggers the callback function.
|
|
374
381
|
* @param {number} index - The index of the item to select.
|
|
375
382
|
*/
|
|
376
|
-
|
|
383
|
+
#select(index) {
|
|
377
384
|
if (this.checkList) dom.utils.toggleClass(this.menus[index], 'se-checked');
|
|
378
|
-
this
|
|
385
|
+
this.#selectMethod(this.getItem(index));
|
|
379
386
|
}
|
|
380
387
|
|
|
381
388
|
/**
|
|
382
|
-
* @private
|
|
383
389
|
* @description Adds event listeners for menu interactions.
|
|
384
390
|
*/
|
|
385
|
-
|
|
386
|
-
this
|
|
387
|
-
this
|
|
388
|
-
this.form.addEventListener('mousedown', this.
|
|
389
|
-
this.form.addEventListener('mousemove', this.
|
|
390
|
-
this.form.addEventListener('click', this.
|
|
391
|
-
this.
|
|
391
|
+
#addEvents() {
|
|
392
|
+
this.#removeEvents();
|
|
393
|
+
this.#events = this.#eventHandlers;
|
|
394
|
+
this.form.addEventListener('mousedown', this.#events.mousedown);
|
|
395
|
+
this.form.addEventListener('mousemove', this.#events.mousemove);
|
|
396
|
+
this.form.addEventListener('click', this.#events.click);
|
|
397
|
+
this.#keydownTarget.addEventListener('keydown', this.#events.keydown);
|
|
392
398
|
}
|
|
393
399
|
|
|
394
400
|
/**
|
|
395
|
-
* @private
|
|
396
401
|
* @description Removes event listeners for menu interactions.
|
|
397
402
|
*/
|
|
398
|
-
|
|
399
|
-
if (!this
|
|
400
|
-
this.form.removeEventListener('mousedown', this.
|
|
401
|
-
this.form.removeEventListener('mousemove', this.
|
|
402
|
-
this.form.removeEventListener('click', this.
|
|
403
|
-
this.
|
|
404
|
-
this
|
|
403
|
+
#removeEvents() {
|
|
404
|
+
if (!this.#events) return;
|
|
405
|
+
this.form.removeEventListener('mousedown', this.#events.mousedown);
|
|
406
|
+
this.form.removeEventListener('mousemove', this.#events.mousemove);
|
|
407
|
+
this.form.removeEventListener('click', this.#events.click);
|
|
408
|
+
this.#keydownTarget.removeEventListener('keydown', this.#events.keydown);
|
|
409
|
+
this.#events = null;
|
|
405
410
|
}
|
|
406
411
|
|
|
407
412
|
/**
|
|
408
|
-
* @private
|
|
409
413
|
* @description Adds global event listeners for closing the menu.
|
|
410
414
|
*/
|
|
411
|
-
|
|
412
|
-
this
|
|
413
|
-
this
|
|
414
|
-
this
|
|
415
|
+
#addGlobalEvent() {
|
|
416
|
+
this.#removeGlobalEvent();
|
|
417
|
+
this.#bindClose_key = this.eventManager.addGlobalEvent('keydown', this.#globalEventHandlers.keydown, true);
|
|
418
|
+
this.#bindClose_mousedown = this.eventManager.addGlobalEvent('mousedown', this.#globalEventHandlers.mousedown, true);
|
|
415
419
|
}
|
|
416
420
|
|
|
417
421
|
/**
|
|
418
|
-
* @private
|
|
419
422
|
* @description Removes global event listeners for closing the menu.
|
|
420
423
|
*/
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
424
|
+
#removeGlobalEvent() {
|
|
425
|
+
this.#bindClose_key &&= this.eventManager.removeGlobalEvent(this.#bindClose_key);
|
|
426
|
+
this.#bindClose_mousedown &&= this.eventManager.removeGlobalEvent(this.#bindClose_mousedown);
|
|
427
|
+
this.#bindClose_click &&= this.eventManager.removeGlobalEvent(this.#bindClose_click);
|
|
425
428
|
}
|
|
426
429
|
|
|
427
430
|
/**
|
|
@@ -465,14 +468,14 @@ class SelectMenu extends CoreInjector {
|
|
|
465
468
|
if (this.index > -1) {
|
|
466
469
|
e.preventDefault();
|
|
467
470
|
e.stopPropagation();
|
|
468
|
-
this
|
|
471
|
+
this.#select(this.index);
|
|
469
472
|
} else {
|
|
470
473
|
this.close();
|
|
471
474
|
}
|
|
472
475
|
break;
|
|
473
476
|
}
|
|
474
477
|
|
|
475
|
-
if (moveIndex) this
|
|
478
|
+
if (moveIndex) this.#moveItem(moveIndex);
|
|
476
479
|
}
|
|
477
480
|
|
|
478
481
|
/**
|
|
@@ -510,7 +513,7 @@ class SelectMenu extends CoreInjector {
|
|
|
510
513
|
}
|
|
511
514
|
|
|
512
515
|
if (!index) return;
|
|
513
|
-
this
|
|
516
|
+
this.#select(Number(index));
|
|
514
517
|
}
|
|
515
518
|
|
|
516
519
|
/**
|
|
@@ -527,10 +530,10 @@ class SelectMenu extends CoreInjector {
|
|
|
527
530
|
#CloseListener_mousedown(e) {
|
|
528
531
|
const eventTarget = dom.query.getEventTarget(e);
|
|
529
532
|
if (this.form.contains(eventTarget)) return;
|
|
530
|
-
if (e.target !== this
|
|
533
|
+
if (e.target !== this.#refer) {
|
|
531
534
|
this.close();
|
|
532
535
|
} else if (!dom.check.isInputElement(eventTarget)) {
|
|
533
|
-
this
|
|
536
|
+
this.#bindClose_click = this.eventManager.addGlobalEvent('click', this.#globalEventHandlers.click, true);
|
|
534
537
|
}
|
|
535
538
|
}
|
|
536
539
|
|
|
@@ -538,8 +541,8 @@ class SelectMenu extends CoreInjector {
|
|
|
538
541
|
* @param {MouseEvent} e - Event object
|
|
539
542
|
*/
|
|
540
543
|
#CloseListener_click(e) {
|
|
541
|
-
this
|
|
542
|
-
if (e.target === this
|
|
544
|
+
this.#bindClose_click = this.eventManager.removeGlobalEvent(this.#bindClose_click);
|
|
545
|
+
if (e.target === this.#refer) {
|
|
543
546
|
e.stopPropagation();
|
|
544
547
|
this.close();
|
|
545
548
|
}
|
|
@@ -5,6 +5,14 @@ import { Browser } from '../../modules';
|
|
|
5
5
|
* @typedef {import('../../modules/Browser').BrowserFile} BrowserFile_audioGallery
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} AudioGalleryPluginOptions
|
|
10
|
+
* @property {Array<BrowserFile_audioGallery>} [data] - Direct data without server calls
|
|
11
|
+
* @property {string} [url] - Server request URL
|
|
12
|
+
* @property {Object<string, string>} [headers] - Server request headers
|
|
13
|
+
* @property {string|((item: BrowserFile_audioGallery) => string)} [thumbnail] - Default thumbnail
|
|
14
|
+
*/
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* @class
|
|
10
18
|
* @extends EditorInjector
|
|
@@ -18,11 +26,7 @@ class AudioGallery extends EditorInjector {
|
|
|
18
26
|
/**
|
|
19
27
|
* @constructor
|
|
20
28
|
* @param {__se__EditorCore} editor - The root editor instance
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {Array<*>=} pluginOptions.data - direct data without server calls
|
|
23
|
-
* @param {string} pluginOptions.url - server request url
|
|
24
|
-
* @param {Object<string, string>=} pluginOptions.headers - server request headers
|
|
25
|
-
* @param {string|((item: BrowserFile_audioGallery) => string)} pluginOptions.thumbnail - default thumbnail
|
|
29
|
+
* @param {AudioGalleryPluginOptions} pluginOptions
|
|
26
30
|
*/
|
|
27
31
|
constructor(editor, pluginOptions) {
|
|
28
32
|
// plugin bisic properties
|
|
@@ -5,6 +5,15 @@ import { Browser } from '../../modules';
|
|
|
5
5
|
* @typedef {import('../../modules/Browser').BrowserFile} BrowserFile_fileBrowser
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} FileBrowserPluginOptions
|
|
10
|
+
* @property {Object<string, *>|Array<*>} [data] - Direct data without server calls
|
|
11
|
+
* @property {string} [url] - Server request URL
|
|
12
|
+
* @property {Object<string, string>} [headers] - Server request headers
|
|
13
|
+
* @property {string|((item: BrowserFile_fileBrowser) => string)} [thumbnail] - Default thumbnail
|
|
14
|
+
* @property {Array<string>} [props] - Additional tag names
|
|
15
|
+
*/
|
|
16
|
+
|
|
8
17
|
/**
|
|
9
18
|
* @class
|
|
10
19
|
* @extends EditorInjector
|
|
@@ -18,12 +27,7 @@ class FileBrowser extends EditorInjector {
|
|
|
18
27
|
/**
|
|
19
28
|
* @constructor
|
|
20
29
|
* @param {__se__EditorCore} editor - The root editor instance
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {Object<string, *>|Array<*>=} pluginOptions.data - direct data without server calls
|
|
23
|
-
* @param {string} pluginOptions.url - server request url
|
|
24
|
-
* @param {Object<string, string>=} pluginOptions.headers - server request headers
|
|
25
|
-
* @param {string|((item: BrowserFile_fileBrowser) => string)} pluginOptions.thumbnail - default thumbnail
|
|
26
|
-
* @param {Array<string>} pluginOptions.props - additional tag names
|
|
30
|
+
* @param {FileBrowserPluginOptions} pluginOptions
|
|
27
31
|
*/
|
|
28
32
|
constructor(editor, pluginOptions) {
|
|
29
33
|
// plugin bisic properties
|
|
@@ -5,6 +5,14 @@ import { Browser } from '../../modules';
|
|
|
5
5
|
* @typedef {import('../../modules/Browser').BrowserFile} BrowserFile_fileGallery
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} FileGalleryPluginOptions
|
|
10
|
+
* @property {Array<BrowserFile_fileGallery>} [data] - Direct data without server calls
|
|
11
|
+
* @property {string} [url] - Server request URL
|
|
12
|
+
* @property {Object<string, string>} [headers] - Server request headers
|
|
13
|
+
* @property {string|((item: BrowserFile_fileGallery) => string)} [thumbnail] - Default thumbnail
|
|
14
|
+
*/
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* @class
|
|
10
18
|
* @extends EditorInjector
|
|
@@ -18,11 +26,7 @@ class FileGallery extends EditorInjector {
|
|
|
18
26
|
/**
|
|
19
27
|
* @constructor
|
|
20
28
|
* @param {__se__EditorCore} editor - The root editor instance
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {Array<*>=} pluginOptions.data - direct data without server calls
|
|
23
|
-
* @param {string} pluginOptions.url - server request url
|
|
24
|
-
* @param {Object<string, string>=} pluginOptions.headers - server request headers
|
|
25
|
-
* @param {string|((item: BrowserFile_fileGallery) => string)} pluginOptions.thumbnail - default thumbnail
|
|
29
|
+
* @param {FileGalleryPluginOptions} pluginOptions
|
|
26
30
|
*/
|
|
27
31
|
constructor(editor, pluginOptions) {
|
|
28
32
|
// plugin bisic properties
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import EditorInjector from '../../editorInjector';
|
|
2
2
|
import { Browser } from '../../modules';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @typedef ImageGalleryPluginOptions
|
|
6
|
+
* @property {Array<*>} [data] - Direct data without server calls
|
|
7
|
+
* @property {string} [url] - Server request URL
|
|
8
|
+
* @property {Object<string, string>} [headers] - Server request headers
|
|
9
|
+
*/
|
|
10
|
+
|
|
4
11
|
/**
|
|
5
12
|
* @class
|
|
6
13
|
* @extends EditorInjector
|
|
@@ -14,10 +21,7 @@ class ImageGallery extends EditorInjector {
|
|
|
14
21
|
/**
|
|
15
22
|
* @constructor
|
|
16
23
|
* @param {__se__EditorCore} editor - The root editor instance
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {Array<*>=} pluginOptions.data - direct data without server calls
|
|
19
|
-
* @param {string=} pluginOptions.url - server request url
|
|
20
|
-
* @param {Object<string, string>=} pluginOptions.headers - server request headers
|
|
24
|
+
* @param {ImageGalleryPluginOptions} pluginOptions
|
|
21
25
|
*/
|
|
22
26
|
constructor(editor, pluginOptions) {
|
|
23
27
|
// plugin bisic properties
|
|
@@ -73,7 +77,7 @@ class ImageGallery extends EditorInjector {
|
|
|
73
77
|
} else {
|
|
74
78
|
const file = { name: target.getAttribute('data-name'), size: 0 };
|
|
75
79
|
this.plugins.image.init();
|
|
76
|
-
this.plugins.image.create(target.getAttribute('data-command'), null, this.width, this.height, 'none', file, target.alt);
|
|
80
|
+
this.plugins.image.create(target.getAttribute('data-command'), null, this.width, this.height, 'none', file, target.alt, true);
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
}
|
|
@@ -5,6 +5,14 @@ import { Browser } from '../../modules';
|
|
|
5
5
|
* @typedef {import('../../modules/Browser').BrowserFile} BrowserFile_videoGallery
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} VideoGalleryPluginOptions
|
|
10
|
+
* @property {Array<BrowserFile_videoGallery>} [data] - Direct data without server calls
|
|
11
|
+
* @property {string} [url] - Server request URL
|
|
12
|
+
* @property {Object<string, string>} [headers] - Server request headers
|
|
13
|
+
* @property {string|((item: BrowserFile_videoGallery) => string)} [thumbnail] - Default thumbnail
|
|
14
|
+
*/
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* @class
|
|
10
18
|
* @extends EditorInjector
|
|
@@ -18,11 +26,7 @@ class VideoGallery extends EditorInjector {
|
|
|
18
26
|
/**
|
|
19
27
|
* @constructor
|
|
20
28
|
* @param {__se__EditorCore} editor - The root editor instance
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {Array<*>=} pluginOptions.data - direct data without server calls
|
|
23
|
-
* @param {string=} pluginOptions.url - server request url
|
|
24
|
-
* @param {Object<string, string>=} pluginOptions.headers - server request headers
|
|
25
|
-
* @param {string|((item: BrowserFile_videoGallery) => string)} pluginOptions.thumbnail - default thumbnail
|
|
29
|
+
* @param {VideoGalleryPluginOptions} pluginOptions
|
|
26
30
|
*/
|
|
27
31
|
constructor(editor, pluginOptions) {
|
|
28
32
|
// plugin bisic properties
|
|
@@ -94,7 +98,8 @@ class VideoGallery extends EditorInjector {
|
|
|
94
98
|
this.width,
|
|
95
99
|
this.height,
|
|
96
100
|
false,
|
|
97
|
-
file
|
|
101
|
+
file,
|
|
102
|
+
true
|
|
98
103
|
);
|
|
99
104
|
}
|
|
100
105
|
}
|
|
@@ -30,6 +30,7 @@ class Blockquote extends EditorInjector {
|
|
|
30
30
|
* @param {?HTMLElement=} element - Node element where the cursor is currently located
|
|
31
31
|
* @param {?HTMLElement=} target - The plugin's toolbar button element
|
|
32
32
|
* @returns {boolean} - Whether the plugin is active
|
|
33
|
+
* - If it returns "undefined", it will no longer be called in this scope.
|
|
33
34
|
*/
|
|
34
35
|
active(element, target) {
|
|
35
36
|
if (/blockquote/i.test(element?.nodeName)) {
|
|
@@ -4,6 +4,12 @@ import { ApiManager } from '../../modules';
|
|
|
4
4
|
|
|
5
5
|
const { _w, _d } = env;
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @typedef ExportPDFPluginOptions
|
|
9
|
+
* @property {string} apiUrl - Server request URL for PDF generation
|
|
10
|
+
* @property {string} [fileName="suneditor-pdf"] - Name of the generated PDF file
|
|
11
|
+
*/
|
|
12
|
+
|
|
7
13
|
/**
|
|
8
14
|
* @class
|
|
9
15
|
* @description Export PDF plugin
|
|
@@ -16,9 +22,7 @@ class ExportPDF extends EditorInjector {
|
|
|
16
22
|
/**
|
|
17
23
|
* @constructor
|
|
18
24
|
* @param {__se__EditorCore} editor - The root editor instance
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {string} pluginOptions.apiUrl - server request url
|
|
21
|
-
* @param {string} pluginOptions.fileName - file name
|
|
25
|
+
* @param {ExportPDFPluginOptions} pluginOptions - plugin options
|
|
22
26
|
*/
|
|
23
27
|
constructor(editor, pluginOptions) {
|
|
24
28
|
super(editor);
|
|
@@ -61,11 +65,11 @@ class ExportPDF extends EditorInjector {
|
|
|
61
65
|
let ww = null;
|
|
62
66
|
|
|
63
67
|
try {
|
|
64
|
-
const standardWW = this.
|
|
68
|
+
const standardWW = this.frameContext.get('documentTypePageMirror') || this.frameContext.get('wysiwygFrame');
|
|
65
69
|
const editableDiv = dom.utils.createElement('div', { class: standardWW.className }, standardWW.innerHTML);
|
|
66
70
|
ww = dom.utils.createElement('div', { style: `position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;` }, editableDiv);
|
|
67
71
|
|
|
68
|
-
const innerPadding =
|
|
72
|
+
const innerPadding = _w.getComputedStyle(standardWW).padding;
|
|
69
73
|
const inlineWW = dom.utils.applyInlineStylesAll(editableDiv, true, this.options.get('allUsedStyles'));
|
|
70
74
|
inlineWW.style.padding = inlineWW.style.paddingTop = inlineWW.style.paddingBottom = inlineWW.style.paddingLeft = inlineWW.style.paddingRight = '0';
|
|
71
75
|
ww.innerHTML = `
|
|
@@ -83,7 +87,7 @@ class ExportPDF extends EditorInjector {
|
|
|
83
87
|
if ((await this.triggerEvent('onExportPDFBefore', { target: ww })) === false) return;
|
|
84
88
|
|
|
85
89
|
// at server
|
|
86
|
-
await this
|
|
90
|
+
await this.#createByServer(ww);
|
|
87
91
|
return;
|
|
88
92
|
} catch (error) {
|
|
89
93
|
console.error('[SUNEDITOR.plugins.exportPDF.error]', error.message);
|
|
@@ -94,13 +98,12 @@ class ExportPDF extends EditorInjector {
|
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
/**
|
|
97
|
-
* @private
|
|
98
101
|
* @description Sends the editor content to the server for PDF generation.
|
|
99
102
|
* @param {HTMLElement} ww - A temporary container holding the formatted editor content.
|
|
100
103
|
* @returns {Promise<void>} Resolves when the PDF file is successfully downloaded.
|
|
101
104
|
* @throws {Error} Throws an error if the server response indicates a failure.
|
|
102
105
|
*/
|
|
103
|
-
async
|
|
106
|
+
async #createByServer(ww) {
|
|
104
107
|
const data = {
|
|
105
108
|
fileName: this.fileName,
|
|
106
109
|
htmlContent: ww.innerHTML
|