suneditor 3.0.0-rc.4 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/suneditor-contents.min.css +1 -1
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +10 -6
- package/src/assets/design/color.css +14 -2
- package/src/assets/design/typography.css +5 -0
- package/src/assets/icons/defaultIcons.js +22 -4
- package/src/assets/suneditor-contents.css +1 -1
- package/src/assets/suneditor.css +312 -18
- package/src/core/config/eventManager.js +6 -9
- package/src/core/editor.js +1 -1
- package/src/core/event/actions/index.js +5 -0
- package/src/core/event/effects/keydown.registry.js +25 -0
- package/src/core/event/eventOrchestrator.js +69 -2
- package/src/core/event/handlers/handler_ww_mouse.js +1 -0
- package/src/core/event/rules/keydown.rule.backspace.js +9 -1
- package/src/core/kernel/coreKernel.js +4 -0
- package/src/core/kernel/store.js +2 -0
- package/src/core/logic/dom/char.js +11 -0
- package/src/core/logic/dom/format.js +22 -0
- package/src/core/logic/dom/html.js +126 -11
- package/src/core/logic/dom/nodeTransform.js +13 -0
- package/src/core/logic/dom/offset.js +100 -37
- package/src/core/logic/dom/selection.js +54 -22
- package/src/core/logic/panel/finder.js +982 -0
- package/src/core/logic/panel/menu.js +8 -6
- package/src/core/logic/panel/toolbar.js +112 -19
- package/src/core/logic/panel/viewer.js +214 -43
- package/src/core/logic/shell/_commandExecutor.js +7 -1
- package/src/core/logic/shell/commandDispatcher.js +1 -1
- package/src/core/logic/shell/component.js +5 -7
- package/src/core/logic/shell/history.js +24 -0
- package/src/core/logic/shell/shortcuts.js +3 -3
- package/src/core/logic/shell/ui.js +25 -26
- package/src/core/schema/frameContext.js +15 -1
- package/src/core/schema/options.js +180 -39
- package/src/core/section/constructor.js +61 -20
- package/src/core/section/documentType.js +2 -2
- package/src/events.js +12 -0
- package/src/helper/clipboard.js +1 -1
- package/src/helper/converter.js +15 -0
- package/src/helper/dom/domQuery.js +12 -0
- package/src/helper/dom/domUtils.js +26 -14
- package/src/helper/index.js +3 -0
- package/src/helper/markdown.js +876 -0
- package/src/interfaces/plugins.js +7 -5
- package/src/langs/ckb.js +9 -0
- package/src/langs/cs.js +9 -0
- package/src/langs/da.js +9 -0
- package/src/langs/de.js +9 -0
- package/src/langs/en.js +9 -0
- package/src/langs/es.js +9 -0
- package/src/langs/fa.js +9 -0
- package/src/langs/fr.js +9 -0
- package/src/langs/he.js +9 -0
- package/src/langs/hu.js +9 -0
- package/src/langs/it.js +9 -0
- package/src/langs/ja.js +9 -0
- package/src/langs/km.js +9 -0
- package/src/langs/ko.js +9 -0
- package/src/langs/lv.js +9 -0
- package/src/langs/nl.js +9 -0
- package/src/langs/pl.js +9 -0
- package/src/langs/pt_br.js +9 -0
- package/src/langs/ro.js +9 -0
- package/src/langs/ru.js +9 -0
- package/src/langs/se.js +9 -0
- package/src/langs/tr.js +9 -0
- package/src/langs/uk.js +9 -0
- package/src/langs/ur.js +9 -0
- package/src/langs/zh_cn.js +9 -0
- package/src/modules/contract/Browser.js +31 -1
- package/src/modules/contract/ColorPicker.js +6 -0
- package/src/modules/contract/Controller.js +77 -39
- package/src/modules/contract/Figure.js +57 -0
- package/src/modules/contract/Modal.js +6 -0
- package/src/modules/manager/ApiManager.js +53 -4
- package/src/modules/manager/FileManager.js +18 -1
- package/src/modules/ui/ModalAnchorEditor.js +35 -2
- package/src/modules/ui/SelectMenu.js +44 -12
- package/src/plugins/browser/fileBrowser.js +5 -2
- package/src/plugins/command/codeBlock.js +324 -0
- package/src/plugins/command/exportPDF.js +15 -3
- package/src/plugins/command/fileUpload.js +4 -1
- package/src/plugins/dropdown/backgroundColor.js +5 -1
- package/src/plugins/dropdown/blockStyle.js +8 -2
- package/src/plugins/dropdown/fontColor.js +5 -1
- package/src/plugins/dropdown/hr.js +6 -0
- package/src/plugins/dropdown/layout.js +4 -1
- package/src/plugins/dropdown/lineHeight.js +3 -0
- package/src/plugins/dropdown/paragraphStyle.js +5 -5
- package/src/plugins/dropdown/table/index.js +4 -1
- package/src/plugins/dropdown/table/render/table.html.js +1 -1
- package/src/plugins/dropdown/table/services/table.grid.js +16 -8
- package/src/plugins/dropdown/table/services/table.style.js +5 -9
- package/src/plugins/dropdown/template.js +3 -0
- package/src/plugins/dropdown/textStyle.js +5 -1
- package/src/plugins/field/mention.js +5 -1
- package/src/plugins/index.js +3 -0
- package/src/plugins/input/fontSize.js +10 -3
- package/src/plugins/modal/audio.js +7 -3
- package/src/plugins/modal/embed.js +23 -20
- package/src/plugins/modal/image/index.js +5 -1
- package/src/plugins/modal/math.js +7 -2
- package/src/plugins/modal/video/index.js +21 -4
- package/src/themes/cobalt.css +13 -4
- package/src/themes/cream.css +11 -2
- package/src/themes/dark.css +13 -4
- package/src/themes/midnight.css +13 -4
- package/src/typedef.js +4 -4
- package/types/assets/icons/defaultIcons.d.ts +12 -1
- package/types/assets/suneditor.css.d.ts +1 -1
- package/types/core/config/eventManager.d.ts +6 -8
- package/types/core/event/actions/index.d.ts +1 -0
- package/types/core/event/effects/keydown.registry.d.ts +2 -0
- package/types/core/event/eventOrchestrator.d.ts +2 -1
- package/types/core/kernel/coreKernel.d.ts +5 -0
- package/types/core/kernel/store.d.ts +5 -0
- package/types/core/logic/dom/char.d.ts +11 -0
- package/types/core/logic/dom/format.d.ts +22 -0
- package/types/core/logic/dom/html.d.ts +16 -0
- package/types/core/logic/dom/nodeTransform.d.ts +13 -0
- package/types/core/logic/dom/offset.d.ts +23 -2
- package/types/core/logic/dom/selection.d.ts +9 -3
- package/types/core/logic/panel/finder.d.ts +83 -0
- package/types/core/logic/panel/toolbar.d.ts +14 -1
- package/types/core/logic/panel/viewer.d.ts +22 -2
- package/types/core/logic/shell/shortcuts.d.ts +1 -1
- package/types/core/schema/frameContext.d.ts +22 -0
- package/types/core/schema/options.d.ts +362 -79
- package/types/events.d.ts +11 -0
- package/types/helper/converter.d.ts +15 -0
- package/types/helper/dom/domQuery.d.ts +12 -0
- package/types/helper/dom/domUtils.d.ts +23 -2
- package/types/helper/index.d.ts +5 -0
- package/types/helper/markdown.d.ts +27 -0
- package/types/interfaces/plugins.d.ts +7 -5
- package/types/langs/_Lang.d.ts +9 -0
- package/types/modules/contract/Browser.d.ts +36 -2
- package/types/modules/contract/ColorPicker.d.ts +6 -0
- package/types/modules/contract/Controller.d.ts +35 -1
- package/types/modules/contract/Figure.d.ts +57 -0
- package/types/modules/contract/Modal.d.ts +6 -0
- package/types/modules/manager/ApiManager.d.ts +26 -0
- package/types/modules/manager/FileManager.d.ts +17 -0
- package/types/modules/ui/ModalAnchorEditor.d.ts +41 -4
- package/types/modules/ui/SelectMenu.d.ts +40 -2
- package/types/plugins/browser/fileBrowser.d.ts +10 -4
- package/types/plugins/command/codeBlock.d.ts +53 -0
- package/types/plugins/command/fileUpload.d.ts +8 -2
- package/types/plugins/dropdown/backgroundColor.d.ts +10 -2
- package/types/plugins/dropdown/blockStyle.d.ts +14 -2
- package/types/plugins/dropdown/fontColor.d.ts +10 -2
- package/types/plugins/dropdown/hr.d.ts +12 -0
- package/types/plugins/dropdown/layout.d.ts +8 -2
- package/types/plugins/dropdown/lineHeight.d.ts +6 -0
- package/types/plugins/dropdown/paragraphStyle.d.ts +14 -3
- package/types/plugins/dropdown/table/index.d.ts +9 -3
- package/types/plugins/dropdown/template.d.ts +6 -0
- package/types/plugins/dropdown/textStyle.d.ts +10 -2
- package/types/plugins/field/mention.d.ts +10 -2
- package/types/plugins/index.d.ts +3 -0
- package/types/plugins/input/fontSize.d.ts +18 -4
- package/types/plugins/modal/audio.d.ts +14 -6
- package/types/plugins/modal/embed.d.ts +44 -38
- package/types/plugins/modal/image/index.d.ts +9 -1
- package/types/plugins/modal/link.d.ts +6 -2
- package/types/plugins/modal/math.d.ts +23 -5
- package/types/plugins/modal/video/index.d.ts +49 -9
- package/types/typedef.d.ts +5 -2
|
@@ -59,7 +59,7 @@ export default class CommandExecutor {
|
|
|
59
59
|
* @description Execute default command of command button
|
|
60
60
|
*/
|
|
61
61
|
async execute(command, button) {
|
|
62
|
-
if (this.#frameContext.get('isReadOnly') && !/copy|cut|selectAll|codeView|fullScreen|print|preview|showBlocks/.test(command)) return;
|
|
62
|
+
if (this.#frameContext.get('isReadOnly') && !/copy|cut|selectAll|codeView|markdownView|fullScreen|print|preview|showBlocks|finder/.test(command)) return;
|
|
63
63
|
|
|
64
64
|
switch (command) {
|
|
65
65
|
case 'selectAll':
|
|
@@ -83,9 +83,15 @@ export default class CommandExecutor {
|
|
|
83
83
|
this.#frameContext.get('documentType').reHeader();
|
|
84
84
|
}
|
|
85
85
|
break;
|
|
86
|
+
case 'finder':
|
|
87
|
+
this.#$.finder.open(true);
|
|
88
|
+
break;
|
|
86
89
|
case 'codeView':
|
|
87
90
|
this.#$.viewer.codeView(!this.#frameContext.get('isCodeView'));
|
|
88
91
|
break;
|
|
92
|
+
case 'markdownView':
|
|
93
|
+
this.#$.viewer.markdownView(!this.#frameContext.get('isMarkdownView'));
|
|
94
|
+
break;
|
|
89
95
|
case 'fullScreen':
|
|
90
96
|
this.#$.viewer.fullScreen(!this.#frameContext.get('isFullScreen'));
|
|
91
97
|
break;
|
|
@@ -16,7 +16,7 @@ const ACTIVE_EVENT_COMMANDS = ['bold', 'underline', 'italic', 'strike', 'subscri
|
|
|
16
16
|
* - such as undo, redo, saving, full-screen toggle, and text direction commands.
|
|
17
17
|
* @constant {string[]}
|
|
18
18
|
*/
|
|
19
|
-
const BASIC_COMMANDS = ACTIVE_EVENT_COMMANDS.concat(['undo', 'redo', 'save', 'fullScreen', 'showBlocks', 'codeView', 'dir', 'dir_ltr', 'dir_rtl']);
|
|
19
|
+
const BASIC_COMMANDS = ACTIVE_EVENT_COMMANDS.concat(['undo', 'redo', 'save', 'fullScreen', 'showBlocks', 'codeView', 'markdownView', 'finder', 'dir', 'dir_ltr', 'dir_rtl']);
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @description Routes toolbar button commands to their handlers and manages active button states.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dom, env, numbers, unicode, keyCodeMap
|
|
1
|
+
import { dom, env, numbers, unicode, keyCodeMap } from '../../../helper';
|
|
2
2
|
import { Figure } from '../../../modules/contract';
|
|
3
3
|
import { _DragHandle } from '../../../modules/ui';
|
|
4
4
|
|
|
@@ -339,11 +339,8 @@ class Component {
|
|
|
339
339
|
_DragHandle.set('__overInfo', __overInfo === ON_OVER_COMPONENT ? undefined : false);
|
|
340
340
|
if (__overInfo !== ON_OVER_COMPONENT) this.#addGlobalEvent();
|
|
341
341
|
if (!info.isFile) this.#addNotFileGlobalEvent();
|
|
342
|
-
}, 0);
|
|
343
|
-
|
|
344
|
-
converter.debounce(() => {
|
|
345
342
|
dom.utils.addClass(info.container, 'se-component-selected');
|
|
346
|
-
}, 0)
|
|
343
|
+
}, 0);
|
|
347
344
|
|
|
348
345
|
if (notOver && !this.#store.get('hasFocus') && !this.#store.get('_preventFocus')) {
|
|
349
346
|
this.#kernel._eventOrchestrator.__postFocusEvent(this.#frameContext, null);
|
|
@@ -513,10 +510,11 @@ class Component {
|
|
|
513
510
|
if (this.currentInfo) {
|
|
514
511
|
const infoContainer = this.currentInfo.container;
|
|
515
512
|
const infoCover = this.currentInfo.cover;
|
|
516
|
-
|
|
513
|
+
|
|
514
|
+
_w.setTimeout(() => {
|
|
517
515
|
RemoveSelectedClass(infoContainer);
|
|
518
516
|
dom.utils.removeClass(infoCover, 'se-figure-over-selected');
|
|
519
|
-
}, 0)
|
|
517
|
+
}, 0);
|
|
520
518
|
}
|
|
521
519
|
|
|
522
520
|
if (this.#frameContext.get('lineBreaker_t')) {
|
|
@@ -17,6 +17,7 @@ export default function History(kernel) {
|
|
|
17
17
|
const frameContext = contextProvider.frameContext;
|
|
18
18
|
|
|
19
19
|
let delayTime = $.options.get('historyStackDelayTime');
|
|
20
|
+
const maxStackSize = $.options.get('historyStackSize');
|
|
20
21
|
let pushDelay = null;
|
|
21
22
|
let stackIndex, stack, rootStack, rootInitContents;
|
|
22
23
|
let waiting = false;
|
|
@@ -204,6 +205,29 @@ export default function History(kernel) {
|
|
|
204
205
|
|
|
205
206
|
setStack(current, range, rootKey, 1);
|
|
206
207
|
|
|
208
|
+
// Enforce max stack size
|
|
209
|
+
if (root.value.length > maxStackSize) {
|
|
210
|
+
const overflow = root.value.length - maxStackSize;
|
|
211
|
+
root.value.splice(0, overflow);
|
|
212
|
+
root.index -= overflow;
|
|
213
|
+
|
|
214
|
+
// Remove corresponding global stack entries
|
|
215
|
+
let removed = 0;
|
|
216
|
+
for (let i = stack.length - 1; i >= 0 && removed < overflow; i--) {
|
|
217
|
+
if (stack[i] === rootKey) {
|
|
218
|
+
// find the oldest entry for this rootKey
|
|
219
|
+
for (let j = 0; j < stack.length; j++) {
|
|
220
|
+
if (stack[j] === rootKey) {
|
|
221
|
+
stack.splice(j, 1);
|
|
222
|
+
removed++;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
stackIndex -= overflow;
|
|
229
|
+
}
|
|
230
|
+
|
|
207
231
|
if (stackIndex === 1) {
|
|
208
232
|
$.commandDispatcher.applyTargets('undo', (e) => {
|
|
209
233
|
e.disabled = false;
|
|
@@ -106,14 +106,14 @@ class Shortcuts {
|
|
|
106
106
|
* @description Registers custom shortcut keys (keys starting with `_`) into the shortcut map.
|
|
107
107
|
* Called during initialization and when toolbar is reset.
|
|
108
108
|
*/
|
|
109
|
-
|
|
109
|
+
_registerShortcuts() {
|
|
110
110
|
const shortcuts = this.#options.get('shortcuts');
|
|
111
111
|
const reverseCommandArray = this.#options.get('_reverseCommandArray');
|
|
112
112
|
const keyMap = (this.keyMap = new Map());
|
|
113
113
|
const reverseKeys = this.reverseKeys;
|
|
114
114
|
for (const key of Object.keys(shortcuts)) {
|
|
115
|
-
|
|
116
|
-
CreateShortcuts(
|
|
115
|
+
const command = key.startsWith('_') ? '' : key;
|
|
116
|
+
CreateShortcuts(command, null, shortcuts[key], keyMap, reverseCommandArray, reverseKeys);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -28,6 +28,7 @@ class UIManager {
|
|
|
28
28
|
#alertInner;
|
|
29
29
|
#closeListener;
|
|
30
30
|
#closeSignal;
|
|
31
|
+
#bindAlertClick = null;
|
|
31
32
|
#backWrapper;
|
|
32
33
|
|
|
33
34
|
#controllerOnBtnDisabled = false;
|
|
@@ -97,7 +98,7 @@ class UIManager {
|
|
|
97
98
|
this.#alertArea = /** @type {HTMLElement} */ (this.#carrierWrapper.querySelector('.se-alert'));
|
|
98
99
|
this.#alertInner = /** @type {HTMLElement} */ (this.#carrierWrapper.querySelector('.se-alert .se-modal-inner'));
|
|
99
100
|
this.#alertInner.appendChild(alertModal);
|
|
100
|
-
this.#closeListener = [
|
|
101
|
+
this.#closeListener = [this.#OnCloseListener.bind(this), this.#OnClick_alert.bind(this)];
|
|
101
102
|
this.#closeSignal = false;
|
|
102
103
|
this.#backWrapper = /** @type {HTMLElement} */ (this.#carrierWrapper.querySelector('.se-back-wrapper'));
|
|
103
104
|
|
|
@@ -393,7 +394,7 @@ class UIManager {
|
|
|
393
394
|
dom.utils.removeClass(this.alertModal, 'se-alert-error|se-alert-success');
|
|
394
395
|
if (type) dom.utils.addClass(this.alertModal, `se-alert-${type}`);
|
|
395
396
|
|
|
396
|
-
if (this.#closeSignal) this.#
|
|
397
|
+
if (this.#closeSignal) this.#bindAlertClick = this.#eventManager.addEvent(this.#alertInner, 'click', this.#closeListener[1]);
|
|
397
398
|
this.#bindClose &&= this.#eventManager.removeGlobalEvent(this.#bindClose);
|
|
398
399
|
this.#bindClose = this.#eventManager.addGlobalEvent('keydown', this.#closeListener[0]);
|
|
399
400
|
|
|
@@ -408,7 +409,7 @@ class UIManager {
|
|
|
408
409
|
dom.utils.removeClass(this.alertModal, 'se-modal-show');
|
|
409
410
|
dom.utils.removeClass(this.alertModal, 'se-alert-*');
|
|
410
411
|
this.#alertArea.style.display = 'none';
|
|
411
|
-
|
|
412
|
+
this.#bindAlertClick &&= this.#eventManager.removeEvent(this.#bindAlertClick);
|
|
412
413
|
this.#bindClose &&= this.#eventManager.removeGlobalEvent(this.#bindClose);
|
|
413
414
|
}
|
|
414
415
|
|
|
@@ -580,10 +581,10 @@ class UIManager {
|
|
|
580
581
|
const y = eventWysiwyg.scrollTop || eventWysiwyg.scrollY || 0;
|
|
581
582
|
const x = eventWysiwyg.scrollLeft || eventWysiwyg.scrollX || 0;
|
|
582
583
|
|
|
583
|
-
if (this.#store.mode.isBalloon) {
|
|
584
|
+
if (this.#store.mode.isBalloon && this.#context.get('toolbar_main').style.display === 'block') {
|
|
584
585
|
this.#context.get('toolbar_main').style.top = this.#$.toolbar.balloonOffset.top - y + 'px';
|
|
585
586
|
this.#context.get('toolbar_main').style.left = this.#$.toolbar.balloonOffset.left - x + 'px';
|
|
586
|
-
} else if (this.#store.mode.isSubBalloon) {
|
|
587
|
+
} else if (this.#store.mode.isSubBalloon && this.#context.get('toolbar_sub_main').style.display === 'block') {
|
|
587
588
|
this.#context.get('toolbar_sub_main').style.top = this.#$.subToolbar.balloonOffset.top - y + 'px';
|
|
588
589
|
this.#context.get('toolbar_sub_main').style.left = this.#$.subToolbar.balloonOffset.left - x + 'px';
|
|
589
590
|
}
|
|
@@ -855,6 +856,24 @@ class UIManager {
|
|
|
855
856
|
this._initToggleButtons();
|
|
856
857
|
}
|
|
857
858
|
|
|
859
|
+
/**
|
|
860
|
+
* @param {MouseEvent} e - Event object
|
|
861
|
+
*/
|
|
862
|
+
#OnClick_alert(e) {
|
|
863
|
+
const eventTarget = dom.query.getEventTarget(e);
|
|
864
|
+
if (/close/.test(eventTarget.getAttribute('data-command')) || eventTarget === this.#alertInner) {
|
|
865
|
+
this.alertClose();
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* @param {KeyboardEvent} e - Event object
|
|
871
|
+
*/
|
|
872
|
+
#OnCloseListener(e) {
|
|
873
|
+
if (!keyCodeMap.isEsc(e.code)) return;
|
|
874
|
+
this.alertClose();
|
|
875
|
+
}
|
|
876
|
+
|
|
858
877
|
/**
|
|
859
878
|
* @internal
|
|
860
879
|
* @description Destroy the UI instance and release memory
|
|
@@ -869,9 +888,7 @@ class UIManager {
|
|
|
869
888
|
this.#bindClose &&= this.#eventManager.removeGlobalEvent(this.#bindClose);
|
|
870
889
|
|
|
871
890
|
// Remove alert click event listener
|
|
872
|
-
|
|
873
|
-
this.#alertInner.removeEventListener('click', this.#closeListener[1]);
|
|
874
|
-
}
|
|
891
|
+
this.#bindAlertClick &&= this.#eventManager.removeEvent(this.#bindAlertClick);
|
|
875
892
|
|
|
876
893
|
this.opendModal = null;
|
|
877
894
|
this.opendBrowser = null;
|
|
@@ -882,24 +899,6 @@ class UIManager {
|
|
|
882
899
|
}
|
|
883
900
|
}
|
|
884
901
|
|
|
885
|
-
/**
|
|
886
|
-
* @param {MouseEvent} e - Event object
|
|
887
|
-
*/
|
|
888
|
-
function OnClick_alert(e) {
|
|
889
|
-
const eventTarget = dom.query.getEventTarget(e);
|
|
890
|
-
if (/close/.test(eventTarget.getAttribute('data-command')) || eventTarget === this._alertInner) {
|
|
891
|
-
this.alertClose();
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
/**
|
|
896
|
-
* @param {KeyboardEvent} e - Event object
|
|
897
|
-
*/
|
|
898
|
-
function CloseListener(e) {
|
|
899
|
-
if (!keyCodeMap.isEsc(e.code)) return;
|
|
900
|
-
this.alertClose();
|
|
901
|
-
}
|
|
902
|
-
|
|
903
902
|
function CreateAlertHTML({ lang, icons }) {
|
|
904
903
|
const html = '<div><button class="close" data-command="close" title="' + lang.close + '">' + icons.cancel + '</button></div><div><span></span></div>';
|
|
905
904
|
return dom.utils.createElement('DIV', { class: 'se-alert-content' }, html);
|
|
@@ -30,6 +30,9 @@ import { get as getNumber } from '../../helper/numbers';
|
|
|
30
30
|
* @property {HTMLElement} codeWrapper - Wrapper element for the code-view mode.
|
|
31
31
|
* @property {HTMLElement & HTMLTextAreaElement} code - Code view editing element (a <textarea> or <pre>).
|
|
32
32
|
* @property {HTMLTextAreaElement} codeNumbers - Element displaying line numbers in code view mode.
|
|
33
|
+
* @property {HTMLElement} markdownWrapper - Wrapper element for the markdown-view mode.
|
|
34
|
+
* @property {HTMLTextAreaElement} markdown - Markdown view editing element (a <textarea>).
|
|
35
|
+
* @property {HTMLTextAreaElement} markdownNumbers - Element displaying line numbers in markdown view mode.
|
|
33
36
|
* @property {HTMLElement} placeholder - Placeholder element shown when the editor is empty.
|
|
34
37
|
* @property {HTMLElement} statusbar - Editor status bar element (for resizing, info, etc.).
|
|
35
38
|
* @property {HTMLElement} navigation - Navigation element (e.g., for outline or bookmarks).
|
|
@@ -47,6 +50,7 @@ import { get as getNumber } from '../../helper/numbers';
|
|
|
47
50
|
*
|
|
48
51
|
* === State Flags ===
|
|
49
52
|
* @property {boolean} isCodeView - Whether the editor is currently in code view mode.
|
|
53
|
+
* @property {boolean} isMarkdownView - Whether the editor is currently in markdown view mode.
|
|
50
54
|
* @property {boolean} isFullScreen - Whether the editor is currently in fullscreen mode.
|
|
51
55
|
* @property {boolean} isReadOnly - Whether the editor is set to readonly mode.
|
|
52
56
|
* @property {boolean} isDisabled - Whether the editor is currently disabled.
|
|
@@ -90,7 +94,7 @@ import { get as getNumber } from '../../helper/numbers';
|
|
|
90
94
|
* @param {*} key root key
|
|
91
95
|
* @returns {FrameContexType}
|
|
92
96
|
*/
|
|
93
|
-
export function CreateFrameContext(editorTarget, top, wwFrame, codeWrapper, codeFrame, statusbar, documentTypeInner, key) {
|
|
97
|
+
export function CreateFrameContext(editorTarget, top, wwFrame, codeWrapper, codeFrame, markdownWrapper, markdownFrame, statusbar, documentTypeInner, key) {
|
|
94
98
|
const m = /** @type {FrameContexType} */ (
|
|
95
99
|
new Map([
|
|
96
100
|
['key', key],
|
|
@@ -101,21 +105,31 @@ export function CreateFrameContext(editorTarget, top, wwFrame, codeWrapper, code
|
|
|
101
105
|
['wrapper', top.querySelector('.se-wrapper')],
|
|
102
106
|
['wysiwygFrame', wwFrame],
|
|
103
107
|
['wysiwyg', wwFrame], // options.iframe ? wwFrame.contentDocument.body : wwFrame
|
|
108
|
+
// codeview
|
|
104
109
|
['codeWrapper', codeWrapper],
|
|
105
110
|
['code', codeFrame],
|
|
106
111
|
['codeNumbers', /** @type {HTMLTextAreaElement} */ (codeWrapper?.querySelector('.se-code-view-line'))],
|
|
112
|
+
// markdown
|
|
113
|
+
['markdownWrapper', markdownWrapper],
|
|
114
|
+
['markdown', markdownFrame],
|
|
115
|
+
['markdownNumbers', /** @type {HTMLTextAreaElement} */ (markdownWrapper?.querySelector('.se-markdown-view-line'))],
|
|
116
|
+
// linebreak, toolbar internal
|
|
107
117
|
['lineBreaker_t', top.querySelector('.se-line-breaker-component-t')],
|
|
108
118
|
['lineBreaker_b', top.querySelector('.se-line-breaker-component-b')],
|
|
109
119
|
['_stickyDummy', top.querySelector('.se-toolbar-sticky-dummy')],
|
|
110
120
|
['_toolbarShadow', top.querySelector('.se-toolbar-shadow')],
|
|
111
121
|
['_minHeight', getNumber(wwFrame.style.minHeight || '65', 0)],
|
|
122
|
+
// is
|
|
112
123
|
['isCodeView', false],
|
|
124
|
+
['isMarkdownView', false],
|
|
113
125
|
['isFullScreen', false],
|
|
114
126
|
['isReadOnly', false],
|
|
115
127
|
['isDisabled', false],
|
|
116
128
|
['isChanged', false],
|
|
129
|
+
// index
|
|
117
130
|
['historyIndex', -1],
|
|
118
131
|
['savedIndex', -1],
|
|
132
|
+
// document type
|
|
119
133
|
['documentTypeInner', documentTypeInner.inner],
|
|
120
134
|
['documentTypePage', documentTypeInner.page],
|
|
121
135
|
['documentTypePageMirror', documentTypeInner.pageMirror],
|