suneditor 3.0.0-alpha.2 → 3.0.0-alpha.20
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/.eslintrc.json +4 -3
- package/CONTRIBUTING.md +4 -2
- package/README.md +19 -11
- package/README_V3_TEMP.md +705 -0
- package/dist/suneditor.min.css +1 -0
- package/dist/suneditor.min.js +1 -0
- package/example.md +587 -0
- package/package.json +15 -9
- package/src/assets/icons/_default.js +166 -131
- package/src/assets/{suneditor-content.css → suneditor-contents.css} +182 -45
- package/src/assets/suneditor.css +1195 -556
- package/src/assets/variables.css +138 -0
- package/src/core/base/eventHandlers/handler_toolbar.js +35 -14
- package/src/core/base/eventHandlers/handler_ww_clipboard.js +29 -4
- package/src/core/base/eventHandlers/handler_ww_dragDrop.js +59 -15
- package/src/core/base/eventHandlers/handler_ww_key_input.js +426 -212
- package/src/core/base/eventHandlers/handler_ww_mouse.js +108 -32
- package/src/core/base/eventManager.js +540 -209
- package/src/core/base/events.js +616 -320
- package/src/core/base/history.js +93 -39
- package/src/core/class/char.js +29 -13
- package/src/core/class/component.js +332 -145
- package/src/core/class/format.js +671 -509
- package/src/core/class/html.js +504 -290
- package/src/core/class/menu.js +114 -47
- package/src/core/class/nodeTransform.js +111 -66
- package/src/core/class/offset.js +409 -105
- package/src/core/class/selection.js +220 -108
- package/src/core/class/shortcuts.js +68 -8
- package/src/core/class/toolbar.js +106 -116
- package/src/core/class/ui.js +330 -0
- package/src/core/class/viewer.js +178 -74
- package/src/core/editor.js +489 -384
- package/src/core/section/actives.js +118 -22
- package/src/core/section/constructor.js +504 -170
- package/src/core/section/context.js +28 -23
- package/src/core/section/documentType.js +561 -0
- package/src/editorInjector/_classes.js +19 -5
- package/src/editorInjector/_core.js +71 -7
- package/src/editorInjector/index.js +63 -1
- package/src/helper/converter.js +137 -19
- package/src/helper/dom/domCheck.js +294 -0
- package/src/helper/dom/domQuery.js +609 -0
- package/src/helper/dom/domUtils.js +533 -0
- package/src/helper/dom/index.js +12 -0
- package/src/helper/env.js +42 -19
- package/src/helper/index.js +7 -4
- package/src/helper/keyCodeMap.js +183 -0
- package/src/helper/numbers.js +8 -8
- package/src/helper/unicode.js +5 -5
- package/src/langs/ckb.js +69 -3
- package/src/langs/cs.js +67 -1
- package/src/langs/da.js +68 -2
- package/src/langs/de.js +68 -3
- package/src/langs/en.js +29 -1
- package/src/langs/es.js +68 -3
- package/src/langs/fa.js +70 -2
- package/src/langs/fr.js +68 -2
- package/src/langs/he.js +68 -3
- package/src/langs/hu.js +226 -0
- package/src/langs/index.js +3 -2
- package/src/langs/it.js +65 -0
- package/src/langs/ja.js +68 -3
- package/src/langs/ko.js +66 -1
- package/src/langs/lv.js +68 -3
- package/src/langs/nl.js +68 -3
- package/src/langs/pl.js +68 -3
- package/src/langs/pt_br.js +65 -0
- package/src/langs/ro.js +69 -4
- package/src/langs/ru.js +68 -3
- package/src/langs/se.js +68 -3
- package/src/langs/tr.js +68 -0
- package/src/langs/ua.js +68 -3
- package/src/langs/ur.js +71 -6
- package/src/langs/zh_cn.js +69 -4
- package/src/modules/ApiManager.js +77 -54
- package/src/modules/Browser.js +667 -0
- package/src/modules/ColorPicker.js +162 -102
- package/src/modules/Controller.js +233 -136
- package/src/modules/Figure.js +913 -489
- package/src/modules/FileManager.js +141 -72
- package/src/modules/HueSlider.js +113 -61
- package/src/modules/Modal.js +292 -113
- package/src/modules/ModalAnchorEditor.js +380 -230
- package/src/modules/SelectMenu.js +270 -168
- package/src/modules/_DragHandle.js +2 -1
- package/src/modules/index.js +3 -3
- package/src/plugins/browser/audioGallery.js +83 -0
- package/src/plugins/browser/fileBrowser.js +103 -0
- package/src/plugins/browser/fileGallery.js +83 -0
- package/src/plugins/browser/imageGallery.js +81 -0
- package/src/plugins/browser/videoGallery.js +103 -0
- package/src/plugins/command/blockquote.js +40 -27
- package/src/plugins/command/exportPDF.js +134 -0
- package/src/plugins/command/fileUpload.js +226 -158
- package/src/plugins/command/list_bulleted.js +93 -47
- package/src/plugins/command/list_numbered.js +93 -47
- package/src/plugins/dropdown/align.js +66 -54
- package/src/plugins/dropdown/backgroundColor.js +76 -45
- package/src/plugins/dropdown/font.js +71 -47
- package/src/plugins/dropdown/fontColor.js +78 -46
- package/src/plugins/dropdown/formatBlock.js +74 -33
- package/src/plugins/dropdown/hr.js +102 -51
- package/src/plugins/dropdown/layout.js +37 -26
- package/src/plugins/dropdown/lineHeight.js +54 -38
- package/src/plugins/dropdown/list.js +60 -45
- package/src/plugins/dropdown/paragraphStyle.js +51 -30
- package/src/plugins/dropdown/table.js +1269 -777
- package/src/plugins/dropdown/template.js +38 -26
- package/src/plugins/dropdown/textStyle.js +43 -31
- package/src/plugins/field/mention.js +144 -82
- package/src/plugins/index.js +32 -6
- package/src/plugins/input/fontSize.js +161 -108
- package/src/plugins/input/pageNavigator.js +70 -0
- package/src/plugins/modal/audio.js +341 -169
- package/src/plugins/modal/drawing.js +530 -0
- package/src/plugins/modal/embed.js +886 -0
- package/src/plugins/modal/image.js +673 -358
- package/src/plugins/modal/link.js +100 -71
- package/src/plugins/modal/math.js +384 -168
- package/src/plugins/modal/video.js +693 -336
- package/src/plugins/popup/anchor.js +222 -0
- package/src/suneditor.js +54 -12
- package/src/themes/dark.css +85 -0
- package/src/typedef.js +86 -0
- package/types/assets/icons/_default.d.ts +152 -0
- package/types/core/base/eventHandlers/handler_toolbar.d.ts +41 -0
- package/types/core/base/eventHandlers/handler_ww_clipboard.d.ts +40 -0
- package/types/core/base/eventHandlers/handler_ww_dragDrop.d.ts +35 -0
- package/types/core/base/eventHandlers/handler_ww_key_input.d.ts +45 -0
- package/types/core/base/eventHandlers/handler_ww_mouse.d.ts +39 -0
- package/types/core/base/eventManager.d.ts +377 -0
- package/types/core/base/events.d.ts +297 -0
- package/types/core/base/history.d.ts +81 -0
- package/types/core/class/char.d.ts +60 -0
- package/types/core/class/component.d.ts +259 -0
- package/types/core/class/format.d.ts +615 -0
- package/types/core/class/html.d.ts +377 -0
- package/types/core/class/menu.d.ts +118 -0
- package/types/core/class/nodeTransform.d.ts +93 -0
- package/types/core/class/offset.d.ts +512 -0
- package/types/core/class/selection.d.ts +188 -0
- package/types/core/class/shortcuts.d.ts +142 -0
- package/types/core/class/toolbar.d.ts +189 -0
- package/types/core/class/ui.d.ts +144 -0
- package/types/core/class/viewer.d.ts +140 -0
- package/types/core/editor.d.ts +606 -0
- package/types/core/section/actives.d.ts +46 -0
- package/types/core/section/constructor.d.ts +748 -0
- package/types/core/section/context.d.ts +45 -0
- package/types/core/section/documentType.d.ts +178 -0
- package/types/editorInjector/_classes.d.ts +41 -0
- package/types/editorInjector/_core.d.ts +92 -0
- package/types/editorInjector/index.d.ts +71 -0
- package/types/helper/converter.d.ts +150 -0
- package/types/helper/dom/domCheck.d.ts +182 -0
- package/types/helper/dom/domQuery.d.ts +214 -0
- package/types/helper/dom/domUtils.d.ts +211 -0
- package/types/helper/dom/index.d.ts +9 -0
- package/types/helper/env.d.ts +149 -0
- package/types/helper/index.d.ts +163 -0
- package/types/helper/keyCodeMap.d.ts +110 -0
- package/types/helper/numbers.d.ts +43 -0
- package/types/helper/unicode.d.ts +28 -0
- package/types/index.d.ts +0 -0
- package/{typings/Lang.d.ts → types/langs/_Lang.d.ts} +170 -103
- package/types/langs/ckb.d.ts +384 -0
- package/types/langs/cs.d.ts +384 -0
- package/types/langs/da.d.ts +384 -0
- package/types/langs/de.d.ts +384 -0
- package/types/langs/en.d.ts +384 -0
- package/types/langs/es.d.ts +384 -0
- package/types/langs/fa.d.ts +384 -0
- package/types/langs/fr.d.ts +384 -0
- package/types/langs/he.d.ts +384 -0
- package/types/langs/hu.d.ts +384 -0
- package/types/langs/index.d.ts +48 -0
- package/types/langs/it.d.ts +384 -0
- package/types/langs/ja.d.ts +384 -0
- package/types/langs/ko.d.ts +384 -0
- package/types/langs/lv.d.ts +384 -0
- package/types/langs/nl.d.ts +384 -0
- package/types/langs/pl.d.ts +384 -0
- package/types/langs/pt_br.d.ts +384 -0
- package/types/langs/ro.d.ts +384 -0
- package/types/langs/ru.d.ts +384 -0
- package/types/langs/se.d.ts +384 -0
- package/types/langs/tr.d.ts +384 -0
- package/types/langs/ua.d.ts +384 -0
- package/types/langs/ur.d.ts +384 -0
- package/types/langs/zh_cn.d.ts +384 -0
- package/types/modules/ApiManager.d.ts +125 -0
- package/types/modules/Browser.d.ts +326 -0
- package/types/modules/ColorPicker.d.ts +131 -0
- package/types/modules/Controller.d.ts +231 -0
- package/types/modules/Figure.d.ts +504 -0
- package/types/modules/FileManager.d.ts +202 -0
- package/types/modules/HueSlider.d.ts +136 -0
- package/types/modules/Modal.d.ts +117 -0
- package/types/modules/ModalAnchorEditor.d.ts +236 -0
- package/types/modules/SelectMenu.d.ts +194 -0
- package/types/modules/_DragHandle.d.ts +7 -0
- package/types/modules/index.d.ts +26 -0
- package/types/plugins/browser/audioGallery.d.ts +55 -0
- package/types/plugins/browser/fileBrowser.d.ts +64 -0
- package/types/plugins/browser/fileGallery.d.ts +55 -0
- package/types/plugins/browser/imageGallery.d.ts +51 -0
- package/types/plugins/browser/videoGallery.d.ts +57 -0
- package/types/plugins/command/blockquote.d.ts +28 -0
- package/types/plugins/command/exportPDF.d.ts +46 -0
- package/types/plugins/command/fileUpload.d.ts +156 -0
- package/types/plugins/command/list_bulleted.d.ts +56 -0
- package/types/plugins/command/list_numbered.d.ts +56 -0
- package/types/plugins/dropdown/align.d.ts +60 -0
- package/types/plugins/dropdown/backgroundColor.d.ts +63 -0
- package/types/plugins/dropdown/font.d.ts +54 -0
- package/types/plugins/dropdown/fontColor.d.ts +63 -0
- package/types/plugins/dropdown/formatBlock.d.ts +58 -0
- package/types/plugins/dropdown/hr.d.ts +81 -0
- package/types/plugins/dropdown/layout.d.ts +40 -0
- package/types/plugins/dropdown/lineHeight.d.ts +50 -0
- package/types/plugins/dropdown/list.d.ts +39 -0
- package/types/plugins/dropdown/paragraphStyle.d.ts +54 -0
- package/types/plugins/dropdown/table.d.ts +579 -0
- package/types/plugins/dropdown/template.d.ts +40 -0
- package/types/plugins/dropdown/textStyle.d.ts +41 -0
- package/types/plugins/field/mention.d.ts +102 -0
- package/types/plugins/index.d.ts +107 -0
- package/types/plugins/input/fontSize.d.ts +170 -0
- package/types/plugins/input/pageNavigator.d.ts +28 -0
- package/types/plugins/modal/audio.d.ts +269 -0
- package/types/plugins/modal/drawing.d.ts +246 -0
- package/types/plugins/modal/embed.d.ts +387 -0
- package/types/plugins/modal/image.d.ts +451 -0
- package/types/plugins/modal/link.d.ts +128 -0
- package/types/plugins/modal/math.d.ts +193 -0
- package/types/plugins/modal/video.d.ts +485 -0
- package/types/plugins/popup/anchor.d.ts +56 -0
- package/types/suneditor.d.ts +51 -0
- package/types/typedef-global.d.ts +144 -0
- package/src/core/class/notice.js +0 -42
- package/src/helper/domUtils.js +0 -1177
- package/src/modules/FileBrowser.js +0 -271
- package/src/plugins/command/exportPdf.js +0 -168
- package/src/plugins/fileBrowser/imageGallery.js +0 -81
- package/src/themes/test.css +0 -61
- package/typings/CommandPlugin.d.ts +0 -8
- package/typings/DialogPlugin.d.ts +0 -20
- package/typings/FileBrowserPlugin.d.ts +0 -30
- package/typings/Module.d.ts +0 -15
- package/typings/Plugin.d.ts +0 -42
- package/typings/SubmenuPlugin.d.ts +0 -8
- package/typings/_classes.d.ts +0 -17
- package/typings/_colorPicker.d.ts +0 -60
- package/typings/_core.d.ts +0 -55
- package/typings/align.d.ts +0 -5
- package/typings/audio.d.ts +0 -5
- package/typings/backgroundColor.d.ts +0 -5
- package/typings/blockquote.d.ts +0 -5
- package/typings/char.d.ts +0 -39
- package/typings/component.d.ts +0 -38
- package/typings/context.d.ts +0 -39
- package/typings/converter.d.ts +0 -33
- package/typings/dialog.d.ts +0 -28
- package/typings/domUtils.d.ts +0 -361
- package/typings/editor.d.ts +0 -7
- package/typings/editor.ts +0 -542
- package/typings/env.d.ts +0 -70
- package/typings/eventManager.d.ts +0 -37
- package/typings/events.d.ts +0 -262
- package/typings/fileBrowser.d.ts +0 -42
- package/typings/fileManager.d.ts +0 -67
- package/typings/font.d.ts +0 -5
- package/typings/fontColor.d.ts +0 -5
- package/typings/fontSize.d.ts +0 -5
- package/typings/format.d.ts +0 -191
- package/typings/formatBlock.d.ts +0 -5
- package/typings/history.d.ts +0 -48
- package/typings/horizontalRule.d.ts +0 -5
- package/typings/image.d.ts +0 -5
- package/typings/imageGallery.d.ts +0 -5
- package/typings/index.d.ts +0 -21
- package/typings/index.modules.d.ts +0 -11
- package/typings/index.plugins.d.ts +0 -58
- package/typings/lineHeight.d.ts +0 -5
- package/typings/link.d.ts +0 -5
- package/typings/list.d.ts +0 -5
- package/typings/math.d.ts +0 -5
- package/typings/mediaContainer.d.ts +0 -25
- package/typings/mention.d.ts +0 -5
- package/typings/node.d.ts +0 -57
- package/typings/notice.d.ts +0 -16
- package/typings/numbers.d.ts +0 -29
- package/typings/offset.d.ts +0 -24
- package/typings/options.d.ts +0 -589
- package/typings/paragraphStyle.d.ts +0 -5
- package/typings/resizing.d.ts +0 -141
- package/typings/selection.d.ts +0 -94
- package/typings/shortcuts.d.ts +0 -13
- package/typings/suneditor.d.ts +0 -9
- package/typings/table.d.ts +0 -5
- package/typings/template.d.ts +0 -5
- package/typings/textStyle.d.ts +0 -5
- package/typings/toolbar.d.ts +0 -32
- package/typings/unicode.d.ts +0 -25
- package/typings/video.d.ts +0 -5
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
export default Format;
|
|
2
|
+
export type FormatThis = Omit<Format & Partial<__se__EditorInjector>, 'format'>;
|
|
3
|
+
export type NodeStyleContainerType = {
|
|
4
|
+
ancestor?: (Node | null) | undefined;
|
|
5
|
+
offset?: (number | null) | undefined;
|
|
6
|
+
container?: (Node | null) | undefined;
|
|
7
|
+
endContainer?: (Node | null) | undefined;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Omit<Format & Partial<__se__EditorInjector>, 'format'>} FormatThis
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Object} NodeStyleContainerType
|
|
14
|
+
* @property {?Node=} ancestor
|
|
15
|
+
* @property {?number=} offset
|
|
16
|
+
* @property {?Node=} container
|
|
17
|
+
* @property {?Node=} endContainer
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @constructor
|
|
21
|
+
* @this {FormatThis}
|
|
22
|
+
* @description Classes related to editor formats such as line creation, line retrieval from selected range, etc.
|
|
23
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
24
|
+
*/
|
|
25
|
+
declare function Format(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, editor: __se__EditorCore): void;
|
|
26
|
+
declare class Format {
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {Omit<Format & Partial<__se__EditorInjector>, 'format'>} FormatThis
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {Object} NodeStyleContainerType
|
|
32
|
+
* @property {?Node=} ancestor
|
|
33
|
+
* @property {?number=} offset
|
|
34
|
+
* @property {?Node=} container
|
|
35
|
+
* @property {?Node=} endContainer
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* @constructor
|
|
39
|
+
* @this {FormatThis}
|
|
40
|
+
* @description Classes related to editor formats such as line creation, line retrieval from selected range, etc.
|
|
41
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
42
|
+
*/
|
|
43
|
+
constructor(editor: __se__EditorCore);
|
|
44
|
+
_listCamel: any;
|
|
45
|
+
_listKebab: any;
|
|
46
|
+
_formatLineCheck: any;
|
|
47
|
+
_formatBrLineCheck: any;
|
|
48
|
+
_formatBlockCheck: any;
|
|
49
|
+
_formatClosureBlockCheck: any;
|
|
50
|
+
_formatClosureBrLineCheck: any;
|
|
51
|
+
_textStyleTagsCheck: RegExp;
|
|
52
|
+
/**
|
|
53
|
+
* @this {FormatThis}
|
|
54
|
+
* @description Replace the line tag of the current selection.
|
|
55
|
+
* @param {Node} element Line element (P, DIV..)
|
|
56
|
+
*/
|
|
57
|
+
setLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): void;
|
|
58
|
+
/**
|
|
59
|
+
* @this {FormatThis}
|
|
60
|
+
* @description If a parent node that contains an argument node finds a format node (format.isLine), it returns that node.
|
|
61
|
+
* @param {Node} node Reference node.
|
|
62
|
+
* @param {?(current: Node) => boolean=} validation Additional validation function.
|
|
63
|
+
* @returns {HTMLElement|null}
|
|
64
|
+
*/
|
|
65
|
+
getLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, node: Node, validation?: (((current: Node) => boolean) | null) | undefined): HTMLElement | null;
|
|
66
|
+
/**
|
|
67
|
+
* @this {FormatThis}
|
|
68
|
+
* @description Replace the br-line tag of the current selection.
|
|
69
|
+
* @param {Node} element BR-Line element (PRE..)
|
|
70
|
+
*/
|
|
71
|
+
setBrLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): void;
|
|
72
|
+
/**
|
|
73
|
+
* @this {FormatThis}
|
|
74
|
+
* @description If a parent node that contains an argument node finds a "brLine" (format.isBrLine), it returns that node.
|
|
75
|
+
* @param {Node} element Reference node.
|
|
76
|
+
* @param {?(current: Node) => boolean=} validation Additional validation function.
|
|
77
|
+
* @returns {HTMLBRElement|null}
|
|
78
|
+
*/
|
|
79
|
+
getBrLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node, validation?: (((current: Node) => boolean) | null) | undefined): HTMLBRElement | null;
|
|
80
|
+
/**
|
|
81
|
+
* @this {FormatThis}
|
|
82
|
+
* @description Append "line" element to sibling node of argument element.
|
|
83
|
+
* - If the "lineNode" argument value is present, the tag of that argument value is inserted,
|
|
84
|
+
* - If not, the currently selected format tag is inserted.
|
|
85
|
+
* @param {Node} element Insert as siblings of that element
|
|
86
|
+
* @param {?string|Node=} lineNode Node name or node obejct to be inserted
|
|
87
|
+
* @returns {HTMLElement}
|
|
88
|
+
*/
|
|
89
|
+
addLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node, lineNode?: ((string | Node) | null) | undefined): HTMLElement;
|
|
90
|
+
/**
|
|
91
|
+
* @this {FormatThis}
|
|
92
|
+
* @description If a parent node that contains an argument node finds a format node (format.isBlock), it returns that node.
|
|
93
|
+
* @param {Node} element Reference node.
|
|
94
|
+
* @param {?(current: Node) => boolean=} validation Additional validation function.
|
|
95
|
+
* @returns {HTMLElement|null}
|
|
96
|
+
*/
|
|
97
|
+
getBlock(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node, validation?: (((current: Node) => boolean) | null) | undefined): HTMLElement | null;
|
|
98
|
+
/**
|
|
99
|
+
* @this {FormatThis}
|
|
100
|
+
* @description Appended all selected "line" element to the argument element("block") and insert
|
|
101
|
+
* @param {Node} blockElement Element of wrap the arguments (BLOCKQUOTE...)
|
|
102
|
+
*/
|
|
103
|
+
applyBlock(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, blockElement: Node): void;
|
|
104
|
+
/**
|
|
105
|
+
* @this {FormatThis}
|
|
106
|
+
* @description The elements of the "selectedFormats" array are detached from the "blockElement" element. ("LI" tags are converted to "P" tags)
|
|
107
|
+
* - When "selectedFormats" is null, all elements are detached and return {cc: parentNode, sc: nextSibling, ec: previousSibling, removeArray: [Array of removed elements]}.
|
|
108
|
+
* @param {Node} blockElement "block" element (PRE, BLOCKQUOTE, OL, UL...)
|
|
109
|
+
* @param {Object} [options] Options
|
|
110
|
+
* @param {Array<Node>} [options.selectedFormats=null] Array of "line" elements (P, DIV, LI...) to remove.
|
|
111
|
+
* - If null, Applies to all elements and return {cc: parentNode, sc: nextSibling, ec: previousSibling}
|
|
112
|
+
* @param {Node} [options.newBlockElement=null] The node(blockElement) to replace the currently wrapped node.
|
|
113
|
+
* @param {boolean} [options.shouldDelete=false] If true, deleted without detached.
|
|
114
|
+
* @param {boolean} [options.skipHistory=false] When true, it does not update the history stack and the selection object and return EdgeNodes (dom-query-GetEdgeChildNodes)
|
|
115
|
+
* @returns {{cc: Node, sc: Node, so: number, ec: Node, eo: number, removeArray: Array<Node>|null}} Node information after deletion
|
|
116
|
+
* - cc: Common parent container node
|
|
117
|
+
* - sc: Start container node
|
|
118
|
+
* - so: Start offset
|
|
119
|
+
* - ec: End container node
|
|
120
|
+
* - eo: End offset
|
|
121
|
+
* - removeArray: Array of removed elements
|
|
122
|
+
*/
|
|
123
|
+
removeBlock(
|
|
124
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
125
|
+
blockElement: Node,
|
|
126
|
+
{
|
|
127
|
+
selectedFormats,
|
|
128
|
+
newBlockElement,
|
|
129
|
+
shouldDelete,
|
|
130
|
+
skipHistory
|
|
131
|
+
}?: {
|
|
132
|
+
selectedFormats?: Array<Node>;
|
|
133
|
+
newBlockElement?: Node;
|
|
134
|
+
shouldDelete?: boolean;
|
|
135
|
+
skipHistory?: boolean;
|
|
136
|
+
}
|
|
137
|
+
): {
|
|
138
|
+
cc: Node;
|
|
139
|
+
sc: Node;
|
|
140
|
+
so: number;
|
|
141
|
+
ec: Node;
|
|
142
|
+
eo: number;
|
|
143
|
+
removeArray: Array<Node> | null;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* @this {FormatThis}
|
|
147
|
+
* @description Append all selected "line" element to the list and insert.
|
|
148
|
+
* @param {string} type List type. (ol | ul):[listStyleType]
|
|
149
|
+
* @param {Array<Node>} selectedCells "line" elements or list cells.
|
|
150
|
+
* @param {boolean} nested If true, indenting existing list cells.
|
|
151
|
+
*/
|
|
152
|
+
applyList(
|
|
153
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
154
|
+
type: string,
|
|
155
|
+
selectedCells: Array<Node>,
|
|
156
|
+
nested: boolean
|
|
157
|
+
): {
|
|
158
|
+
sc: Node;
|
|
159
|
+
so: number;
|
|
160
|
+
ec: Node;
|
|
161
|
+
eo: number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @this {FormatThis}
|
|
165
|
+
* @description "selectedCells" array are detached from the list element.
|
|
166
|
+
* - The return value is applied when the first and last lines of "selectedFormats" are "LI" respectively.
|
|
167
|
+
* @param {Array<Node>} selectedCells Array of ["line", li] elements(LI, P...) to remove.
|
|
168
|
+
* @param {boolean} shouldDelete If true, It does not just remove the list, it deletes the content.
|
|
169
|
+
* @returns {{sc: Node, ec: Node}} Node information after deletion
|
|
170
|
+
* - sc: Start container node
|
|
171
|
+
* - ec: End container node
|
|
172
|
+
*/
|
|
173
|
+
removeList(
|
|
174
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
175
|
+
selectedCells: Array<Node>,
|
|
176
|
+
shouldDelete: boolean
|
|
177
|
+
): {
|
|
178
|
+
sc: Node;
|
|
179
|
+
ec: Node;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* @this {FormatThis}
|
|
183
|
+
* @description Indent more the selected lines.
|
|
184
|
+
* - margin size : 'status.indentSize'px
|
|
185
|
+
*/
|
|
186
|
+
indent(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>): void;
|
|
187
|
+
/**
|
|
188
|
+
* @this {FormatThis}
|
|
189
|
+
* @description Indent less the selected lines.
|
|
190
|
+
* - margin size - "status.indentSize"px
|
|
191
|
+
*/
|
|
192
|
+
outdent(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>): void;
|
|
193
|
+
/**
|
|
194
|
+
* @this {FormatThis}
|
|
195
|
+
* @description Adds, updates, or deletes style nodes from selected text (a, span, strong, etc.).
|
|
196
|
+
* @param {?Node} styleNode The element to be added to the selection. If null, only existing nodes are modified or removed.
|
|
197
|
+
* @param {Object} [options] Options
|
|
198
|
+
* @param {Array<string>} [options.stylesToModify=null] Array of style or class names to check and modify.
|
|
199
|
+
* (e.g., ['font-size'], ['.className'], ['font-family', 'color', '.className'])
|
|
200
|
+
* @param {Array<string>} [options.nodesToRemove=null] Array of node names to remove.
|
|
201
|
+
* If empty array or null when styleNode is null, all formats are removed.
|
|
202
|
+
* (e.g., ['span'], ['strong', 'em'])
|
|
203
|
+
* @param {boolean} [options.strictRemove=false] If true, only removes nodes from nodesToRemove if all styles and classes are removed.
|
|
204
|
+
* @returns {HTMLElement} The element that was added to or modified in the selection.
|
|
205
|
+
*
|
|
206
|
+
* @details
|
|
207
|
+
* 1. If styleNode is provided, a node with the same tags and attributes is added to the selected text.
|
|
208
|
+
* 2. If the same tag already exists, only its attributes are updated.
|
|
209
|
+
* 3. If styleNode is null, existing nodes are updated or removed without adding new ones.
|
|
210
|
+
* 4. Styles matching those in stylesToModify are removed. (Use CSS attribute names, e.g., "background-color")
|
|
211
|
+
* 5. Classes matching those in stylesToModify (prefixed with ".") are removed.
|
|
212
|
+
* 6. stylesToModify is used to avoid duplicate property values from styleNode.
|
|
213
|
+
* 7. Nodes with all styles and classes removed are deleted if they match styleNode, are in nodesToRemove, or if styleNode is null.
|
|
214
|
+
* 8. Tags matching names in nodesToRemove are deleted regardless of their style and class.
|
|
215
|
+
* 9. If strictRemove is true, nodes in nodesToRemove are only removed if all their styles and classes are removed.
|
|
216
|
+
* 10. The function won't modify nodes if the parent has the same class and style values.
|
|
217
|
+
* - However, if nodesToRemove has values, it will work and separate text nodes even if there's no node to replace.
|
|
218
|
+
*/
|
|
219
|
+
applyInlineElement(
|
|
220
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
221
|
+
styleNode: Node | null,
|
|
222
|
+
{
|
|
223
|
+
stylesToModify,
|
|
224
|
+
nodesToRemove,
|
|
225
|
+
strictRemove
|
|
226
|
+
}?: {
|
|
227
|
+
stylesToModify?: Array<string>;
|
|
228
|
+
nodesToRemove?: Array<string>;
|
|
229
|
+
strictRemove?: boolean;
|
|
230
|
+
}
|
|
231
|
+
): HTMLElement;
|
|
232
|
+
/**
|
|
233
|
+
* @this {FormatThis}
|
|
234
|
+
* @description Remove format of the currently selected text.
|
|
235
|
+
*/
|
|
236
|
+
removeInlineElement(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>): void;
|
|
237
|
+
/**
|
|
238
|
+
* @this {FormatThis}
|
|
239
|
+
* @description Check if the container and offset values are the edges of the "line"
|
|
240
|
+
* @param {Node} node The node of the selection object. (range.startContainer..)
|
|
241
|
+
* @param {number} offset The offset of the selection object. (selection.getRange().startOffset...)
|
|
242
|
+
* @param {"front"|"end"} dir Select check point - "front": Front edge, "end": End edge, undefined: Both edge.
|
|
243
|
+
* @returns {node is HTMLElement}
|
|
244
|
+
*/
|
|
245
|
+
isEdgeLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, node: Node, offset: number, dir: 'front' | 'end'): node is HTMLElement;
|
|
246
|
+
/**
|
|
247
|
+
* @this {FormatThis}
|
|
248
|
+
* @description It is judged whether it is a node related to the text style.
|
|
249
|
+
* @param {Node|string} element The node to check
|
|
250
|
+
* @returns {element is HTMLElement}
|
|
251
|
+
*/
|
|
252
|
+
isTextStyleNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): element is HTMLElement;
|
|
253
|
+
/**
|
|
254
|
+
* @this {FormatThis}
|
|
255
|
+
* @description It is judged whether it is the "line" element.
|
|
256
|
+
* - (P, DIV, H[1-6], PRE, LI | class="__se__format__line_xxx")
|
|
257
|
+
* - "line" element also contain "brLine" element
|
|
258
|
+
* @param {Node|string} element The node to check
|
|
259
|
+
* @returns {element is HTMLElement}
|
|
260
|
+
*/
|
|
261
|
+
isLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): element is HTMLElement;
|
|
262
|
+
/**
|
|
263
|
+
* @this {FormatThis}
|
|
264
|
+
* @description It is judged whether it is the only "line" element, not "brLine".
|
|
265
|
+
* @param {Node|string} element The node to check
|
|
266
|
+
* @returns {element is HTMLElement}
|
|
267
|
+
*/
|
|
268
|
+
isLineOnly(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): element is HTMLElement;
|
|
269
|
+
/**
|
|
270
|
+
* @this {FormatThis}
|
|
271
|
+
* @description It is judged whether it is the "brLine" element.
|
|
272
|
+
* - (PRE | class="__se__format__br_line_xxx")
|
|
273
|
+
* - "brLine" elements is included in the "line" element.
|
|
274
|
+
* - "brLine" elements's line break is "BR" tag.
|
|
275
|
+
* ※ Entering the Enter key in the space on the last line ends "brLine" and appends "line".
|
|
276
|
+
* @param {Node|string} element The node to check
|
|
277
|
+
* @returns {element is HTMLElement}
|
|
278
|
+
*/
|
|
279
|
+
isBrLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): element is HTMLElement;
|
|
280
|
+
/**
|
|
281
|
+
* @this {FormatThis}
|
|
282
|
+
* @description It is judged whether it is the "block" element.
|
|
283
|
+
* - (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__block_xxx")
|
|
284
|
+
* - "block" is wrap the "line" and "component"
|
|
285
|
+
* @param {Node|string} element The node to check
|
|
286
|
+
* @returns {element is HTMLElement}
|
|
287
|
+
*/
|
|
288
|
+
isBlock(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): element is HTMLElement;
|
|
289
|
+
/**
|
|
290
|
+
* @this {FormatThis}
|
|
291
|
+
* @description It is judged whether it is the "closureBlock" element.
|
|
292
|
+
* - (TH, TD | class="__se__format__block_closure_xxx")
|
|
293
|
+
* - "closureBlock" elements is included in the "block".
|
|
294
|
+
* - "closureBlock" element is wrap the "line" and "component"
|
|
295
|
+
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
296
|
+
* - ※ Use it only in special cases. ([ex] format of table cells)
|
|
297
|
+
* @param {Node|string} element The node to check
|
|
298
|
+
* @returns {element is HTMLElement}
|
|
299
|
+
*/
|
|
300
|
+
isClosureBlock(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): element is HTMLElement;
|
|
301
|
+
/**
|
|
302
|
+
* @this {FormatThis}
|
|
303
|
+
* @description It is judged whether it is the "closureBrLine" element.
|
|
304
|
+
* - (class="__se__format__br_line__closure_xxx")
|
|
305
|
+
* - "closureBrLine" elements is included in the "brLine".
|
|
306
|
+
* - "closureBrLine" elements's line break is "BR" tag.
|
|
307
|
+
* - ※ You cannot exit this format with the Enter key or Backspace key.
|
|
308
|
+
* - ※ Use it only in special cases. ([ex] format of table cells)
|
|
309
|
+
* @param {Node|string} element The node to check
|
|
310
|
+
* @returns {element is HTMLElement}
|
|
311
|
+
*/
|
|
312
|
+
isClosureBrLine(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): element is HTMLElement;
|
|
313
|
+
/**
|
|
314
|
+
* @this {FormatThis}
|
|
315
|
+
* @description Returns a "line" array from selected range.
|
|
316
|
+
* @param {?(current: Node) => boolean=} validation The validation function. (Replaces the default validation format.isLine(current))
|
|
317
|
+
* @returns {Array<HTMLElement>}
|
|
318
|
+
*/
|
|
319
|
+
getLines(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, validation?: (((current: Node) => boolean) | null) | undefined): Array<HTMLElement>;
|
|
320
|
+
/**
|
|
321
|
+
* @this {FormatThis}
|
|
322
|
+
* @description Get lines and components from the selected range. (P, DIV, H[1-6], OL, UL, TABLE..)
|
|
323
|
+
* - If some of the component are included in the selection, get the entire that component.
|
|
324
|
+
* @param {boolean} removeDuplicate If true, if there is a parent and child tag among the selected elements, the child tag is excluded.
|
|
325
|
+
* @returns {Array<HTMLElement>}
|
|
326
|
+
*/
|
|
327
|
+
getLinesAndComponents(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, removeDuplicate: boolean): Array<HTMLElement>;
|
|
328
|
+
/**
|
|
329
|
+
* @private
|
|
330
|
+
* @this {FormatThis}
|
|
331
|
+
* @description A function that distinguishes areas where "selection" should not be placed
|
|
332
|
+
* @param {Node} element Element
|
|
333
|
+
* @returns {boolean}
|
|
334
|
+
*/
|
|
335
|
+
_isExcludeSelectionElement(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): boolean;
|
|
336
|
+
/**
|
|
337
|
+
* @private
|
|
338
|
+
* @this {FormatThis}
|
|
339
|
+
* @description A function that distinguishes non-formatting HTML elements or tags from formatting ones.
|
|
340
|
+
* @param {Node} element Element
|
|
341
|
+
* @returns {boolean}
|
|
342
|
+
*/
|
|
343
|
+
_nonFormat(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): boolean;
|
|
344
|
+
/**
|
|
345
|
+
* @private
|
|
346
|
+
* @this {FormatThis}
|
|
347
|
+
* @description Nodes that must remain undetached when changing text nodes (A, Label, Code, Span:font-size)
|
|
348
|
+
* @param {Node|string} element Element to check
|
|
349
|
+
* @returns {boolean}
|
|
350
|
+
*/
|
|
351
|
+
_isNonSplitNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): boolean;
|
|
352
|
+
/**
|
|
353
|
+
* @private
|
|
354
|
+
* @this {FormatThis}
|
|
355
|
+
* @description Nodes without text
|
|
356
|
+
* @param {Node|string} element Element to check
|
|
357
|
+
* @returns {boolean}
|
|
358
|
+
*/
|
|
359
|
+
_notTextNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node | string): boolean;
|
|
360
|
+
/**
|
|
361
|
+
* @private
|
|
362
|
+
* @this {FormatThis}
|
|
363
|
+
* @description Nodes that need to be added without modification when changing text nodes
|
|
364
|
+
* @param {Node} element Element to check
|
|
365
|
+
* @returns {boolean}
|
|
366
|
+
*/
|
|
367
|
+
_isIgnoreNodeChange(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): boolean;
|
|
368
|
+
/**
|
|
369
|
+
* @private
|
|
370
|
+
* @this {FormatThis}
|
|
371
|
+
* @description Get current selected lines and selected node info.
|
|
372
|
+
* @returns {{lines: Array<HTMLElement>, firstNode: Node, lastNode: Node, firstPath: Array<number>, lastPath: Array<number>, startOffset: number, endOffset: number}}
|
|
373
|
+
*/
|
|
374
|
+
_lineWork(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>): {
|
|
375
|
+
lines: Array<HTMLElement>;
|
|
376
|
+
firstNode: Node;
|
|
377
|
+
lastNode: Node;
|
|
378
|
+
firstPath: Array<number>;
|
|
379
|
+
lastPath: Array<number>;
|
|
380
|
+
startOffset: number;
|
|
381
|
+
endOffset: number;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* @private
|
|
385
|
+
* @this {FormatThis}
|
|
386
|
+
* @description Attaches a nested list structure by merging adjacent lists if applicable.
|
|
387
|
+
* - Ensures that the nested list is placed correctly in the document structure.
|
|
388
|
+
* @param {Element} originList The original list element where the nested list is inserted.
|
|
389
|
+
* @param {Element} innerList The nested list element.
|
|
390
|
+
* @param {Element} prev The previous sibling element.
|
|
391
|
+
* @param {Element} next The next sibling element.
|
|
392
|
+
* @param {{s: Array<number> | null, e: Array<number> | null, sl: Node | null, el: Node | null}} nodePath Object storing the start and end node paths.
|
|
393
|
+
* - s : Start node path.
|
|
394
|
+
* - e : End node path.
|
|
395
|
+
* - sl : Start node's parent element.
|
|
396
|
+
* - el : End node's parent element.
|
|
397
|
+
* @returns {Node} The attached inner list.
|
|
398
|
+
*/
|
|
399
|
+
_attachNested(
|
|
400
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
401
|
+
originList: Element,
|
|
402
|
+
innerList: Element,
|
|
403
|
+
prev: Element,
|
|
404
|
+
next: Element,
|
|
405
|
+
nodePath: {
|
|
406
|
+
s: Array<number> | null;
|
|
407
|
+
e: Array<number> | null;
|
|
408
|
+
sl: Node | null;
|
|
409
|
+
el: Node | null;
|
|
410
|
+
}
|
|
411
|
+
): Node;
|
|
412
|
+
/**
|
|
413
|
+
* @private
|
|
414
|
+
* @this {FormatThis}
|
|
415
|
+
* @description Detaches a nested list structure by extracting list items from their parent list.
|
|
416
|
+
* - Ensures proper restructuring of the list elements.
|
|
417
|
+
* @param {Array<HTMLElement>} cells The list items to be detached.
|
|
418
|
+
* @returns {{cc: Node, sc: Node, ec: Node}} An object containing reference nodes for repositioning.
|
|
419
|
+
* - cc : The parent node of the first list item.
|
|
420
|
+
* - sc : The first list item.
|
|
421
|
+
* - ec : The last list item.
|
|
422
|
+
*/
|
|
423
|
+
_detachNested(
|
|
424
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
425
|
+
cells: Array<HTMLElement>
|
|
426
|
+
): {
|
|
427
|
+
cc: Node;
|
|
428
|
+
sc: Node;
|
|
429
|
+
ec: Node;
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* @private
|
|
433
|
+
* @this {FormatThis}
|
|
434
|
+
* @description Nest list cells or cancel nested cells.
|
|
435
|
+
* @param selectedCells List cells.
|
|
436
|
+
* @param nested Nested or cancel nested.
|
|
437
|
+
*/
|
|
438
|
+
_applyNestedList(
|
|
439
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
440
|
+
selectedCells: any,
|
|
441
|
+
nested: any
|
|
442
|
+
): {
|
|
443
|
+
sc: any;
|
|
444
|
+
so: number;
|
|
445
|
+
ec: any;
|
|
446
|
+
eo: number;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* @private
|
|
450
|
+
* @this {FormatThis}
|
|
451
|
+
* @description Detach Nested all nested lists under the "baseNode".
|
|
452
|
+
* - Returns a list with nested removed.
|
|
453
|
+
* @param {HTMLElement} baseNode Element on which to base.
|
|
454
|
+
* @param {boolean} all If true, it also detach all nested lists of a returned list.
|
|
455
|
+
* @returns {Node} Result element
|
|
456
|
+
*/
|
|
457
|
+
_removeNestedList(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, baseNode: HTMLElement, all: boolean): Node;
|
|
458
|
+
/**
|
|
459
|
+
* @private
|
|
460
|
+
* @this {FormatThis}
|
|
461
|
+
* @description wraps text nodes of line selected text.
|
|
462
|
+
* @param {Node} element The node of the line that contains the selected text node.
|
|
463
|
+
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
464
|
+
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
465
|
+
* @param {Node} startCon The startContainer property of the selection object.
|
|
466
|
+
* @param {number} startOff The startOffset property of the selection object.
|
|
467
|
+
* @param {Node} endCon The endContainer property of the selection object.
|
|
468
|
+
* @param {number} endOff The endOffset property of the selection object.
|
|
469
|
+
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
470
|
+
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
471
|
+
* @param {boolean} collapsed range.collapsed
|
|
472
|
+
* @returns {{ancestor: *, startContainer: *, startOffset: *, endContainer: *, endOffset: *}}
|
|
473
|
+
*/
|
|
474
|
+
_setNode_oneLine(
|
|
475
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
476
|
+
element: Node,
|
|
477
|
+
newInnerNode: Node,
|
|
478
|
+
validation: (current: Node) => Node | null,
|
|
479
|
+
startCon: Node,
|
|
480
|
+
startOff: number,
|
|
481
|
+
endCon: Node,
|
|
482
|
+
endOff: number,
|
|
483
|
+
isRemoveFormat: boolean,
|
|
484
|
+
isRemoveNode: boolean,
|
|
485
|
+
collapsed: boolean,
|
|
486
|
+
_removeCheck: any,
|
|
487
|
+
_getMaintainedNode: any,
|
|
488
|
+
_isMaintainedNode: any
|
|
489
|
+
): {
|
|
490
|
+
ancestor: any;
|
|
491
|
+
startContainer: any;
|
|
492
|
+
startOffset: any;
|
|
493
|
+
endContainer: any;
|
|
494
|
+
endOffset: any;
|
|
495
|
+
};
|
|
496
|
+
/**
|
|
497
|
+
* @private
|
|
498
|
+
* @this {FormatThis}
|
|
499
|
+
* @description wraps first line selected text.
|
|
500
|
+
* @param {Node} element The node of the line that contains the selected text node.
|
|
501
|
+
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
502
|
+
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
503
|
+
* @param {Node} startCon The startContainer property of the selection object.
|
|
504
|
+
* @param {number} startOff The startOffset property of the selection object.
|
|
505
|
+
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
506
|
+
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
507
|
+
* @returns {NodeStyleContainerType} { ancestor, container, offset, endContainer }
|
|
508
|
+
*/
|
|
509
|
+
_setNode_startLine(
|
|
510
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
511
|
+
element: Node,
|
|
512
|
+
newInnerNode: Node,
|
|
513
|
+
validation: (current: Node) => Node | null,
|
|
514
|
+
startCon: Node,
|
|
515
|
+
startOff: number,
|
|
516
|
+
isRemoveFormat: boolean,
|
|
517
|
+
isRemoveNode: boolean,
|
|
518
|
+
_removeCheck: any,
|
|
519
|
+
_getMaintainedNode: any,
|
|
520
|
+
_isMaintainedNode: any,
|
|
521
|
+
_endContainer: any
|
|
522
|
+
): NodeStyleContainerType;
|
|
523
|
+
/**
|
|
524
|
+
* @private
|
|
525
|
+
* @this {FormatThis}
|
|
526
|
+
* @description wraps mid lines selected text.
|
|
527
|
+
* @param {HTMLElement} element The node of the line that contains the selected text node.
|
|
528
|
+
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
529
|
+
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
530
|
+
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
531
|
+
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
532
|
+
* @param {Node} _endContainer Offset node of last line already modified (end.container)
|
|
533
|
+
* @returns {NodeStyleContainerType} { ancestor, endContainer: "If end container is renewed, returned renewed node" }
|
|
534
|
+
*/
|
|
535
|
+
_setNode_middleLine(
|
|
536
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
537
|
+
element: HTMLElement,
|
|
538
|
+
newInnerNode: Node,
|
|
539
|
+
validation: (current: Node) => Node | null,
|
|
540
|
+
isRemoveFormat: boolean,
|
|
541
|
+
isRemoveNode: boolean,
|
|
542
|
+
_removeCheck: any,
|
|
543
|
+
_endContainer: Node
|
|
544
|
+
): NodeStyleContainerType;
|
|
545
|
+
/**
|
|
546
|
+
* @private
|
|
547
|
+
* @this {FormatThis}
|
|
548
|
+
* @description wraps last line selected text.
|
|
549
|
+
* @param {Node} element The node of the line that contains the selected text node.
|
|
550
|
+
* @param {Node} newInnerNode The dom that will wrap the selected text area
|
|
551
|
+
* @param {(current: Node) => Node|null} validation Check if the node should be stripped.
|
|
552
|
+
* @param {Node} endCon The endContainer property of the selection object.
|
|
553
|
+
* @param {number} endOff The endOffset property of the selection object.
|
|
554
|
+
* @param {boolean} isRemoveFormat Is the remove all formats command?
|
|
555
|
+
* @param {boolean} isRemoveNode "newInnerNode" is remove node?
|
|
556
|
+
* @returns {NodeStyleContainerType} { ancestor, container, offset }
|
|
557
|
+
*/
|
|
558
|
+
_setNode_endLine(
|
|
559
|
+
this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>,
|
|
560
|
+
element: Node,
|
|
561
|
+
newInnerNode: Node,
|
|
562
|
+
validation: (current: Node) => Node | null,
|
|
563
|
+
endCon: Node,
|
|
564
|
+
endOff: number,
|
|
565
|
+
isRemoveFormat: boolean,
|
|
566
|
+
isRemoveNode: boolean,
|
|
567
|
+
_removeCheck: any,
|
|
568
|
+
_getMaintainedNode: any,
|
|
569
|
+
_isMaintainedNode: any
|
|
570
|
+
): NodeStyleContainerType;
|
|
571
|
+
/**
|
|
572
|
+
* @private
|
|
573
|
+
* @this {FormatThis}
|
|
574
|
+
* @description Node with font-size style
|
|
575
|
+
* @param {Node} element Element to check
|
|
576
|
+
* @returns {boolean}
|
|
577
|
+
*/
|
|
578
|
+
_sn_isSizeNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, element: Node): boolean;
|
|
579
|
+
/**
|
|
580
|
+
* @private
|
|
581
|
+
* @this {FormatThis}
|
|
582
|
+
* @description Return the parent maintained tag. (bind and use a util object)
|
|
583
|
+
* @param {boolean} _isRemove is remove anchor
|
|
584
|
+
* @param {boolean} _isSizeNode is size span node
|
|
585
|
+
* @param {Node} element Element
|
|
586
|
+
* @returns {Node|null}
|
|
587
|
+
*/
|
|
588
|
+
_sn_getMaintainedNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, _isRemove: boolean, _isSizeNode: boolean, element: Node): Node | null;
|
|
589
|
+
/**
|
|
590
|
+
* @private
|
|
591
|
+
* @this {FormatThis}
|
|
592
|
+
* @description Check if element is a tag that should be persisted. (bind and use a util object)
|
|
593
|
+
* @param {boolean} _isRemove is remove anchor
|
|
594
|
+
* @param {boolean} _isSizeNode is size span node
|
|
595
|
+
* @param {Node} element Element
|
|
596
|
+
* @returns {boolean}
|
|
597
|
+
*/
|
|
598
|
+
_sn_isMaintainedNode(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, _isRemove: boolean, _isSizeNode: boolean, element: Node): boolean;
|
|
599
|
+
/**
|
|
600
|
+
* @private
|
|
601
|
+
* @this {FormatThis}
|
|
602
|
+
* @description If certain styles are applied to all child nodes of the list cell, the style of the list cell is also changed. (bold, color, size)
|
|
603
|
+
* @param {Node} el List cell element. <li>
|
|
604
|
+
* @param {?Node} child Variable for recursive call. ("null" on the first call)
|
|
605
|
+
*/
|
|
606
|
+
_sn_setCommonListStyle(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, el: Node, child: Node | null): void;
|
|
607
|
+
/**
|
|
608
|
+
* @private
|
|
609
|
+
* @this {FormatThis}
|
|
610
|
+
* @description Watch the applied text nodes and adjust the common styles of the list.
|
|
611
|
+
* @param {Node} el "LI" element
|
|
612
|
+
* @param {Array|null} styleArray Refer style array
|
|
613
|
+
*/
|
|
614
|
+
_sn_resetCommonListCell(this: Omit<Format & Partial<import('../../editorInjector').default>, 'format'>, el: Node, styleArray: any[] | null): boolean;
|
|
615
|
+
}
|