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
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { get as getNumber } from '../../helper/numbers';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ================================================================================================================================
|
|
5
|
+
* === FRAME CONTEXT TYPES : Store
|
|
6
|
+
* =================================================================================================================================
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ================================================================================================================================
|
|
11
|
+
* @typedef {Object} FrameContextStore
|
|
12
|
+
*
|
|
13
|
+
* This object stores **all frame-specific states and DOM references** for a SunEditor instance.
|
|
14
|
+
*
|
|
15
|
+
* - Used to manage **multi-root editors** (each frame has its own context).
|
|
16
|
+
* - Holds references to all **key DOM nodes** (WYSIWYG area, toolbars, status bar, code view, etc.).
|
|
17
|
+
* - Maintains **editor state flags** (fullscreen, readonly, code view, content changes).
|
|
18
|
+
* - Provides storage for **document-type editing features** (page layout, headers, etc.).
|
|
19
|
+
* - Keeps **history positions** and other runtime values for undo/redo operations.
|
|
20
|
+
*
|
|
21
|
+
* This structure is **core to how SunEditor manages each editing frame** and is accessed throughout
|
|
22
|
+
* the editor modules (history, toolbar actions, plugins, etc.).
|
|
23
|
+
* -----------------
|
|
24
|
+
*
|
|
25
|
+
* === Identification ===
|
|
26
|
+
* @property {*} key - Unique key identifying this editor instance (useful for multi-root editors).
|
|
27
|
+
* @property {__se__FrameOptions} options - Frame-specific options (toolbar, plugins, behaviors, etc.).
|
|
28
|
+
*
|
|
29
|
+
* === Core DOM References ===
|
|
30
|
+
* @property {Element} originElement - The original source element (usually a <textarea> or target element).
|
|
31
|
+
* @property {HTMLElement} topArea - The outermost container wrapping the entire editor (toolbar + editor + status bar).
|
|
32
|
+
* @property {HTMLElement} container - The `.se-container` element that holds the editor's UI.
|
|
33
|
+
* @property {HTMLElement} wrapper - The `.se-wrapper` element containing the editable area and internal components.
|
|
34
|
+
* @property {HTMLElement} wysiwygFrame - The WYSIWYG frame element (either an <iframe> or a div in inline mode).
|
|
35
|
+
* @property {HTMLElement} wysiwyg - The actual editable content area (usually the iframe’s <body> or a contentEditable div).
|
|
36
|
+
* @property {HTMLElement} eventWysiwyg - Internal reference for wysiwyg events (set on initialization).
|
|
37
|
+
* @property {HTMLElement} codeWrapper - Wrapper element for the code-view mode.
|
|
38
|
+
* @property {HTMLElement} code - Code view editing element (a <textarea> or <pre>).
|
|
39
|
+
* @property {HTMLTextAreaElement} codeNumbers - Element displaying line numbers in code view mode.
|
|
40
|
+
* @property {HTMLElement} placeholder - Placeholder element shown when the editor is empty.
|
|
41
|
+
* @property {HTMLElement} statusbar - Editor status bar element (for resizing, info, etc.).
|
|
42
|
+
* @property {HTMLElement} navigation - Navigation element (e.g., for outline or bookmarks).
|
|
43
|
+
* @property {HTMLElement} charWrapper - Wrapper for the character counter element.
|
|
44
|
+
* @property {HTMLElement} charCounter - Element showing the character counter.
|
|
45
|
+
* @property {Window} [_ww] - The window object of the WYSIWYG frame (iframe window).
|
|
46
|
+
* @property {Document} [_wd] - The document object of the WYSIWYG frame (iframe document).
|
|
47
|
+
*
|
|
48
|
+
* === UI Utilities & Visual Components ===
|
|
49
|
+
* @property {HTMLElement} lineBreaker_t - Top floating line-breaker UI element (for line insertion).
|
|
50
|
+
* @property {HTMLElement} lineBreaker_b - Bottom floating line-breaker UI element (for line insertion).
|
|
51
|
+
* @property {HTMLElement} [_stickyDummy] - Placeholder element used for sticky toolbar behavior.
|
|
52
|
+
* @property {HTMLElement} [_toolbarShadow] - Shadow element below the toolbar for visual effects.
|
|
53
|
+
* @property {HTMLElement} [_figure] - Current active figure component (image, table, etc.).
|
|
54
|
+
*
|
|
55
|
+
* === State Flags ===
|
|
56
|
+
* @property {boolean} isCodeView - Whether the editor is currently in code view mode.
|
|
57
|
+
* @property {boolean} isFullScreen - Whether the editor is currently in fullscreen mode.
|
|
58
|
+
* @property {boolean} isReadOnly - Whether the editor is set to readonly mode.
|
|
59
|
+
* @property {boolean} isDisabled - Whether the editor is currently disabled.
|
|
60
|
+
* @property {boolean} [isShowBlocks] - Whether block structure visualization is enabled.
|
|
61
|
+
* @property {number} isChanged - Whether the content has been changed (-1 means initial state).
|
|
62
|
+
*
|
|
63
|
+
* === History Tracking ===
|
|
64
|
+
* @property {number} historyIndex - Current index in the history stack (undo/redo).
|
|
65
|
+
* @property {number} savedIndex - Last saved index in the history stack.
|
|
66
|
+
*
|
|
67
|
+
* === DocumentType Editing (Optional) ===
|
|
68
|
+
* @property {*} [documentType] - Document-type specific configuration or module reference.
|
|
69
|
+
* @property {HTMLElement} [documentTypeInner] - Inner container for document-type editors.
|
|
70
|
+
* @property {HTMLElement} [documentTypePage] - Page wrapper for paginated editing mode.
|
|
71
|
+
* @property {HTMLElement} [documentTypePageMirror] - Mirror page element used for selection/layout adjustments.
|
|
72
|
+
* @property {boolean} [documentType_use_header] - Whether headers are used in document-type mode.
|
|
73
|
+
* @property {boolean} [documentType_use_page] - Whether page layout is enabled in document-type mode.
|
|
74
|
+
*
|
|
75
|
+
* === Runtime / Computed Values ===
|
|
76
|
+
* @property {number} _minHeight - Minimum height of the wysiwyg area (parsed from inline style or options).
|
|
77
|
+
* @property {*} [wwComputedStyle] - Cached computed styles for the wysiwyg frame.
|
|
78
|
+
* @property {HTMLIFrameElement} [_iframeAuto] - Auto-resizing helper iframe (used for dynamic sizing).
|
|
79
|
+
* @property {number} [_editorHeight] - Current height of the editor.
|
|
80
|
+
* ================================================================================================================================
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
/** @typedef {Map<keyof FrameContextStore|null, *>} FrameContextMap */
|
|
84
|
+
|
|
85
|
+
/** --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* ================================================================================================================================
|
|
89
|
+
* === UTILITIES : Manage Frame Context Map
|
|
90
|
+
* =================================================================================================================================
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @typedef {Object} FrameContextUtil
|
|
95
|
+
* @property {(k: keyof FrameContextStore) => *} get - Get a DOM element from the context by key.
|
|
96
|
+
* @property {(k: keyof FrameContextStore, v: *) => void} set - Set a DOM element in the context by key.
|
|
97
|
+
* @property {(k: keyof FrameContextStore) => boolean} has - Check if a key exists in the context.
|
|
98
|
+
* @property {(k: keyof FrameContextStore) => boolean} delete - Delete a key from the context.
|
|
99
|
+
* @property {() => Object<keyof FrameContextStore, *>} [getAll] - Get all DOM elements in the context as an object.
|
|
100
|
+
* @property {(newMap: *) => void} [reset] - Reset the context with a new Map.
|
|
101
|
+
* @property {() => void} clear - Clear all elements in the context.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @description Elements and variables you should have
|
|
106
|
+
* @param {{target: Element, key: *, options: __se__FrameOptions}} editorTarget Target textarea
|
|
107
|
+
* @param {HTMLElement} top Editor top area
|
|
108
|
+
* @param {HTMLElement} wwFrame Editor wysiwyg frame
|
|
109
|
+
* @param {HTMLElement} codeWrapper Editor code view wrapper
|
|
110
|
+
* @param {HTMLElement} codeFrame Editor code view frame
|
|
111
|
+
* @param {{inner: HTMLElement, page: HTMLElement, pageMirror: HTMLElement}} documentTypeInner Document type elements
|
|
112
|
+
* @param {?HTMLElement} statusbar Editor statusbar
|
|
113
|
+
* @param {*} key root key
|
|
114
|
+
* @returns {FrameContextMap}
|
|
115
|
+
*/
|
|
116
|
+
export function CreateFrameContext(editorTarget, top, wwFrame, codeWrapper, codeFrame, statusbar, documentTypeInner, key) {
|
|
117
|
+
const m = /** @type {FrameContextMap} */ (
|
|
118
|
+
new Map([
|
|
119
|
+
['key', key],
|
|
120
|
+
['options', editorTarget.options],
|
|
121
|
+
['originElement', editorTarget.target],
|
|
122
|
+
['topArea', top],
|
|
123
|
+
['container', top.querySelector('.se-container')],
|
|
124
|
+
['wrapper', top.querySelector('.se-wrapper')],
|
|
125
|
+
['wysiwygFrame', wwFrame],
|
|
126
|
+
['wysiwyg', wwFrame], // options.iframe ? wwFrame.contentDocument.body : wwFrame
|
|
127
|
+
['codeWrapper', codeWrapper],
|
|
128
|
+
['code', codeFrame],
|
|
129
|
+
['codeNumbers', /** @type {HTMLTextAreaElement} */ (codeWrapper?.querySelector('.se-code-view-line'))],
|
|
130
|
+
['lineBreaker_t', top.querySelector('.se-line-breaker-component-t')],
|
|
131
|
+
['lineBreaker_b', top.querySelector('.se-line-breaker-component-b')],
|
|
132
|
+
['_stickyDummy', top.querySelector('.se-toolbar-sticky-dummy')],
|
|
133
|
+
['_toolbarShadow', top.querySelector('.se-toolbar-shadow')],
|
|
134
|
+
['_minHeight', getNumber(wwFrame.style.minHeight || '65', 0)],
|
|
135
|
+
['isCodeView', false],
|
|
136
|
+
['isFullScreen', false],
|
|
137
|
+
['isReadOnly', false],
|
|
138
|
+
['isDisabled', false],
|
|
139
|
+
['isChanged', -1],
|
|
140
|
+
['historyIndex', -1],
|
|
141
|
+
['savedIndex', -1],
|
|
142
|
+
['eventwysiwyg', null],
|
|
143
|
+
['documentTypeInner', documentTypeInner.inner],
|
|
144
|
+
['documentTypePage', documentTypeInner.page],
|
|
145
|
+
['documentTypePageMirror', documentTypeInner.pageMirror]
|
|
146
|
+
])
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
if (statusbar) UpdateStatusbarContext(statusbar, m);
|
|
150
|
+
|
|
151
|
+
const placeholder = top.querySelector('.se-placeholder');
|
|
152
|
+
if (placeholder) m.set('placeholder', placeholder);
|
|
153
|
+
|
|
154
|
+
return m;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @description Update statusbar context
|
|
159
|
+
* @param {HTMLElement} statusbar Statusbar element
|
|
160
|
+
* @param {FrameContextMap|FrameContextUtil} mapper FrameContext map
|
|
161
|
+
*/
|
|
162
|
+
export function UpdateStatusbarContext(statusbar, mapper) {
|
|
163
|
+
statusbar ? mapper.set('statusbar', statusbar) : mapper.delete('statusbar');
|
|
164
|
+
const navigation = statusbar ? statusbar.querySelector('.se-navigation') : null;
|
|
165
|
+
const charWrapper = statusbar ? statusbar.querySelector('.se-char-counter-wrapper') : null;
|
|
166
|
+
const charCounter = statusbar ? statusbar.querySelector('.se-char-counter-wrapper .se-char-counter') : null;
|
|
167
|
+
navigation ? mapper.set('navigation', navigation) : mapper.delete('navigation');
|
|
168
|
+
charWrapper ? mapper.set('charWrapper', charWrapper) : mapper.delete('charWrapper');
|
|
169
|
+
charCounter ? mapper.set('charCounter', charCounter) : mapper.delete('charCounter');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @description Creates a utility wrapper for editor base options.
|
|
174
|
+
* - Provides get, set, has, getAll, and setMany methods with internal Map support.
|
|
175
|
+
* @param {*} editor - The editor instance
|
|
176
|
+
* @returns {FrameContextUtil}
|
|
177
|
+
*/
|
|
178
|
+
export function FrameContextUtil(editor) {
|
|
179
|
+
let store = editor.__frameContext;
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
get(k) {
|
|
183
|
+
return store.get(k);
|
|
184
|
+
},
|
|
185
|
+
set(k, v) {
|
|
186
|
+
return store.set(k, v);
|
|
187
|
+
},
|
|
188
|
+
has(k) {
|
|
189
|
+
return store.has(k);
|
|
190
|
+
},
|
|
191
|
+
delete(k) {
|
|
192
|
+
return store.delete(k);
|
|
193
|
+
},
|
|
194
|
+
getAll() {
|
|
195
|
+
return Object.fromEntries(store.entries());
|
|
196
|
+
},
|
|
197
|
+
reset(newMap) {
|
|
198
|
+
store = editor.__options = newMap;
|
|
199
|
+
},
|
|
200
|
+
clear() {
|
|
201
|
+
store.clear();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|