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,582 @@
|
|
|
1
|
+
export default Table;
|
|
2
|
+
export type TableCtrlProps = {
|
|
3
|
+
html: HTMLElement;
|
|
4
|
+
controller_props_title: HTMLElement;
|
|
5
|
+
borderButton: HTMLButtonElement;
|
|
6
|
+
borderFormatButton: HTMLButtonElement;
|
|
7
|
+
cell_alignment: HTMLElement;
|
|
8
|
+
cell_alignment_vertical: HTMLElement;
|
|
9
|
+
cell_alignment_table_text: HTMLElement;
|
|
10
|
+
border_style: HTMLButtonElement;
|
|
11
|
+
border_color: HTMLInputElement;
|
|
12
|
+
border_width: HTMLInputElement;
|
|
13
|
+
back_color: HTMLInputElement;
|
|
14
|
+
font_color: HTMLInputElement;
|
|
15
|
+
palette_border_button: HTMLButtonElement;
|
|
16
|
+
font_bold: HTMLButtonElement;
|
|
17
|
+
font_underline: HTMLButtonElement;
|
|
18
|
+
font_italic: HTMLButtonElement;
|
|
19
|
+
font_strike: HTMLButtonElement;
|
|
20
|
+
};
|
|
21
|
+
export type TablePluginOptions = {
|
|
22
|
+
/**
|
|
23
|
+
* - Scroll type ('x', 'y', 'xy')
|
|
24
|
+
*/
|
|
25
|
+
scrollType?: 'x' | 'y' | 'xy';
|
|
26
|
+
/**
|
|
27
|
+
* - Caption position ('top', 'bottom')
|
|
28
|
+
*/
|
|
29
|
+
captionPosition?: 'top' | 'bottom';
|
|
30
|
+
/**
|
|
31
|
+
* - Cell controller position ('cell', 'table')
|
|
32
|
+
*/
|
|
33
|
+
cellControllerPosition?: 'cell' | 'table';
|
|
34
|
+
/**
|
|
35
|
+
* - Color list, used in cell color picker
|
|
36
|
+
*/
|
|
37
|
+
colorList?: any[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {Object} TablePluginOptions
|
|
41
|
+
* @property {"x"|"y"|"xy"} [scrollType='x'] - Scroll type ('x', 'y', 'xy')
|
|
42
|
+
* @property {"top"|"bottom"} [captionPosition='bottom'] - Caption position ('top', 'bottom')
|
|
43
|
+
* @property {"cell"|"table"} [cellControllerPosition='cell'] - Cell controller position ('cell', 'table')
|
|
44
|
+
* @property {Array} [colorList] - Color list, used in cell color picker
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* @class
|
|
48
|
+
* @description Table Plugin
|
|
49
|
+
*/
|
|
50
|
+
declare class Table extends EditorInjector {
|
|
51
|
+
static key: string;
|
|
52
|
+
static type: string;
|
|
53
|
+
static className: string;
|
|
54
|
+
static options: {
|
|
55
|
+
isInputComponent: boolean;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* @this {Table}
|
|
59
|
+
* @param {HTMLElement} node - The node to check.
|
|
60
|
+
* @returns {HTMLElement|null} Returns a node if the node is a valid component.
|
|
61
|
+
*/
|
|
62
|
+
static component(this: Table, node: HTMLElement): HTMLElement | null;
|
|
63
|
+
/**
|
|
64
|
+
* @constructor
|
|
65
|
+
* @param {__se__EditorCore} editor - The root editor instance
|
|
66
|
+
* @param {TablePluginOptions} pluginOptions - Plugin options
|
|
67
|
+
*/
|
|
68
|
+
constructor(editor: __se__EditorCore, pluginOptions: TablePluginOptions);
|
|
69
|
+
title: any;
|
|
70
|
+
icon: string;
|
|
71
|
+
figureScrollList: string[];
|
|
72
|
+
figureScroll: string;
|
|
73
|
+
captionPosition: string;
|
|
74
|
+
cellControllerTop: boolean;
|
|
75
|
+
controller_cell: Controller;
|
|
76
|
+
controller_table: Controller;
|
|
77
|
+
controller_props: Controller;
|
|
78
|
+
controller_props_title: HTMLElement;
|
|
79
|
+
colorPicker: ColorPicker;
|
|
80
|
+
controller_colorPicker: Controller;
|
|
81
|
+
figure: Figure;
|
|
82
|
+
sliderType: string;
|
|
83
|
+
splitButton: HTMLButtonElement;
|
|
84
|
+
selectMenu_split: SelectMenu;
|
|
85
|
+
selectMenu_column: SelectMenu;
|
|
86
|
+
selectMenu_row: SelectMenu;
|
|
87
|
+
selectMenu_props_border: SelectMenu;
|
|
88
|
+
selectMenu_props_border_format: SelectMenu;
|
|
89
|
+
selectMenu_props_border_format_oneCell: SelectMenu;
|
|
90
|
+
maxText: any;
|
|
91
|
+
minText: any;
|
|
92
|
+
propTargets: {
|
|
93
|
+
cell_alignment: HTMLElement;
|
|
94
|
+
cell_alignment_vertical: HTMLElement;
|
|
95
|
+
cell_alignment_table_text: HTMLElement;
|
|
96
|
+
border_format: HTMLButtonElement;
|
|
97
|
+
border_style: HTMLButtonElement;
|
|
98
|
+
border_color: HTMLInputElement;
|
|
99
|
+
border_width: HTMLInputElement;
|
|
100
|
+
back_color: HTMLInputElement;
|
|
101
|
+
font_color: HTMLInputElement;
|
|
102
|
+
palette_border_button: HTMLButtonElement;
|
|
103
|
+
font_bold: HTMLButtonElement;
|
|
104
|
+
font_underline: HTMLButtonElement;
|
|
105
|
+
font_italic: HTMLButtonElement;
|
|
106
|
+
font_strike: HTMLButtonElement;
|
|
107
|
+
};
|
|
108
|
+
_propsCache: any[];
|
|
109
|
+
_currentFontStyles: any[];
|
|
110
|
+
_propsAlignCache: string;
|
|
111
|
+
_propsVerticalAlignCache: string;
|
|
112
|
+
_typeCache: string;
|
|
113
|
+
/** @type {HTMLElement} */
|
|
114
|
+
tableHighlight: HTMLElement;
|
|
115
|
+
/** @type {HTMLElement} */
|
|
116
|
+
tableUnHighlight: HTMLElement;
|
|
117
|
+
/** @type {HTMLElement} */
|
|
118
|
+
tableDisplay: HTMLElement;
|
|
119
|
+
/** @type {HTMLButtonElement} */
|
|
120
|
+
resizeButton: HTMLButtonElement;
|
|
121
|
+
/** @type {HTMLSpanElement} */
|
|
122
|
+
resizeText: HTMLSpanElement;
|
|
123
|
+
/** @type {HTMLButtonElement} */
|
|
124
|
+
columnFixedButton: HTMLButtonElement;
|
|
125
|
+
/** @type {HTMLButtonElement} */
|
|
126
|
+
headerButton: HTMLButtonElement;
|
|
127
|
+
/** @type {HTMLButtonElement} */
|
|
128
|
+
captionButton: HTMLButtonElement;
|
|
129
|
+
/** @type {HTMLButtonElement} */
|
|
130
|
+
mergeButton: HTMLButtonElement;
|
|
131
|
+
/** @type {HTMLButtonElement} */
|
|
132
|
+
unmergeButton: HTMLButtonElement;
|
|
133
|
+
/**
|
|
134
|
+
* @description Same value a "this._selectedTable", but it maintain prev table element
|
|
135
|
+
* @type {HTMLTableElement}
|
|
136
|
+
*/
|
|
137
|
+
_element: HTMLTableElement;
|
|
138
|
+
/**
|
|
139
|
+
* @editorMethod Editor.core
|
|
140
|
+
* @description Executes the main execution method of the plugin.
|
|
141
|
+
* - Called when an item in the "dropdown" menu is clicked.
|
|
142
|
+
*/
|
|
143
|
+
action(): void;
|
|
144
|
+
/**
|
|
145
|
+
* @editorMethod Editor.component
|
|
146
|
+
* @description Executes the method that is called when a component of a plugin is selected.
|
|
147
|
+
* @param {HTMLElement} target Target component element
|
|
148
|
+
*/
|
|
149
|
+
select(target: HTMLElement): void;
|
|
150
|
+
/**
|
|
151
|
+
* @editorMethod Editor.Component
|
|
152
|
+
* @description Method to delete a component of a plugin, called by the "FileManager", "Controller" module.
|
|
153
|
+
* @param {HTMLElement} target Target element
|
|
154
|
+
* @returns {Promise<void>}
|
|
155
|
+
*/
|
|
156
|
+
destroy(target: HTMLElement): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* @editorMethod Editor.component
|
|
159
|
+
* @description Executes the method that is called when a component copy is requested.
|
|
160
|
+
* @param {__se__PluginCopyComponentParams} params
|
|
161
|
+
* @returns {boolean|void}
|
|
162
|
+
*/
|
|
163
|
+
onCopyComponent({ event, cloneContainer }: __se__PluginCopyComponentParams): boolean | void;
|
|
164
|
+
/**
|
|
165
|
+
* @editorMethod Editor.EventManager
|
|
166
|
+
* @description Executes the event function of "copy".
|
|
167
|
+
* @param {__se__PluginPasteParams} params
|
|
168
|
+
* @returns {boolean|void}
|
|
169
|
+
*/
|
|
170
|
+
onPaste({ event, doc }: __se__PluginPasteParams): boolean | void;
|
|
171
|
+
/**
|
|
172
|
+
* @editorMethod Editor.core
|
|
173
|
+
* @description This method is used to validate and preserve the format of the component within the editor.
|
|
174
|
+
* - It ensures that the structure and attributes of the element are maintained and secure.
|
|
175
|
+
* - The method checks if the element is already wrapped in a valid container and updates its attributes if necessary.
|
|
176
|
+
* - If the element isn't properly contained, a new container is created to retain the format.
|
|
177
|
+
* @returns {{query: string, method: (element: HTMLTableElement) => void}} The format retention object containing the query and method to process the element.
|
|
178
|
+
* - query: The selector query to identify the relevant elements (in this case, 'audio').
|
|
179
|
+
* - method:The function to execute on the element to validate and preserve its format.
|
|
180
|
+
* - The function takes the element as an argument, checks if it is contained correctly, and applies necessary adjustments.
|
|
181
|
+
*/
|
|
182
|
+
retainFormat(): {
|
|
183
|
+
query: string;
|
|
184
|
+
method: (element: HTMLTableElement) => void;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* @editorMethod Editor.core
|
|
188
|
+
* @description Executes the method called when the rtl, ltr mode changes. ("editor.setDir")
|
|
189
|
+
* @param {string} dir Direction ("rtl" or "ltr")
|
|
190
|
+
*/
|
|
191
|
+
setDir(dir: string): void;
|
|
192
|
+
/**
|
|
193
|
+
* @editorMethod Editor.EventManager
|
|
194
|
+
* @description Executes the event function of "mousemove".
|
|
195
|
+
* @param {__se__PluginMouseEventInfo} params
|
|
196
|
+
*/
|
|
197
|
+
onMouseMove({ event }: __se__PluginMouseEventInfo): void;
|
|
198
|
+
/**
|
|
199
|
+
* @editorMethod Editor.EventManager
|
|
200
|
+
* @description Executes the event function of "scroll".
|
|
201
|
+
*/
|
|
202
|
+
onScroll(): void;
|
|
203
|
+
/**
|
|
204
|
+
* @editorMethod Editor.EventManager
|
|
205
|
+
* @description Executes the event function of "mousedown".
|
|
206
|
+
* @param {__se__PluginMouseEventInfo} params
|
|
207
|
+
*/
|
|
208
|
+
onMouseDown({ event }: __se__PluginMouseEventInfo): void;
|
|
209
|
+
/**
|
|
210
|
+
* @editorMethod Editor.EventManager
|
|
211
|
+
* @description Executes the event function of "mouseup".
|
|
212
|
+
*/
|
|
213
|
+
onMouseUp(): void;
|
|
214
|
+
/**
|
|
215
|
+
* @editorMethod Editor.EventManager
|
|
216
|
+
* @description Executes the event function of "mouseleave".
|
|
217
|
+
*/
|
|
218
|
+
onMouseLeave(): void;
|
|
219
|
+
/**
|
|
220
|
+
* @editorMethod Editor.EventManager
|
|
221
|
+
* @description Executes the event function of "keydown".
|
|
222
|
+
* @param {__se__PluginKeyEventInfo} params
|
|
223
|
+
*/
|
|
224
|
+
onKeyDown({ event, range, line }: __se__PluginKeyEventInfo): boolean;
|
|
225
|
+
/**
|
|
226
|
+
* @editorMethod Editor.EventManager
|
|
227
|
+
* @description Executes the event function of "keyup".
|
|
228
|
+
* @param {__se__PluginKeyEventInfo} params
|
|
229
|
+
*/
|
|
230
|
+
onKeyUp({ line }: __se__PluginKeyEventInfo): void;
|
|
231
|
+
/**
|
|
232
|
+
* @editorMethod Modules.ColorPicker
|
|
233
|
+
* @description Executes the method called when a button of "ColorPicker" module is clicked.
|
|
234
|
+
* @param {string} color - Color code (hex)
|
|
235
|
+
*/
|
|
236
|
+
colorPickerAction(color: string): void;
|
|
237
|
+
/**
|
|
238
|
+
* @editorMethod Modules.Controller
|
|
239
|
+
* @description Executes the method that is called when a button is clicked in the "controller".
|
|
240
|
+
* @param {HTMLButtonElement} target Target button element
|
|
241
|
+
*/
|
|
242
|
+
controllerAction(target: HTMLButtonElement): void;
|
|
243
|
+
/**
|
|
244
|
+
* @editorMethod Modules.Controller
|
|
245
|
+
* @description Executes the method called when the "controller" is closed.
|
|
246
|
+
*/
|
|
247
|
+
close(): void;
|
|
248
|
+
/**
|
|
249
|
+
* @description Selects a group of table cells and sets internal state related to multi-cell selection.
|
|
250
|
+
* @param {HTMLTableCellElement[]} cells - An array of table cell elements to be selected.
|
|
251
|
+
*/
|
|
252
|
+
selectCells(cells: HTMLTableCellElement[]): void;
|
|
253
|
+
/**
|
|
254
|
+
* @description Sets the table and figure elements based on the provided cell element, and stores references to them for later use.
|
|
255
|
+
* @param {Node} element The target table cell (`<td>`) element from which the table info will be extracted.
|
|
256
|
+
* @returns {HTMLTableElement} The `<table>` element that is the parent of the provided `element`.
|
|
257
|
+
*/
|
|
258
|
+
setTableInfo(element: Node): HTMLTableElement;
|
|
259
|
+
/**
|
|
260
|
+
* @description Sets various table-related information based on the provided table cell element (`<td>`). This includes updating cell, row, and table attributes, handling spanning cells, and adjusting the UI for elements like headers and captions.
|
|
261
|
+
* @param {HTMLTableCellElement} tdElement The target table cell (`<td>`) element from which table information will be extracted.
|
|
262
|
+
* @param {boolean} reset A flag indicating whether to reset the cell information. If `true`, the cell information will be reset and recalculated.
|
|
263
|
+
*/
|
|
264
|
+
setCellInfo(tdElement: HTMLTableCellElement, reset: boolean): void;
|
|
265
|
+
/**
|
|
266
|
+
* @description Sets row-related information based on the provided table row element (`<tr>`). This includes updating the row count and the index of the selected row.
|
|
267
|
+
* @param {HTMLTableRowElement} trElement The target table row (`<tr>`) element from which row information will be extracted.
|
|
268
|
+
*/
|
|
269
|
+
setRowInfo(trElement: HTMLTableRowElement): void;
|
|
270
|
+
/**
|
|
271
|
+
* @description Edits the table by adding, removing, or modifying rows and cells, based on the provided options. Supports both single and multi-cell/row editing.
|
|
272
|
+
* @param {"row"|"cell"} type The type of element to edit ('row' or 'cell').
|
|
273
|
+
* @param {?"up"|"down"|"left"|"right"} option The action to perform: 'up', 'down', 'left', 'right', or `null` for removing.
|
|
274
|
+
*/
|
|
275
|
+
editTable(type: 'row' | 'cell', option: ('up' | 'down' | 'left' | 'right') | null): void;
|
|
276
|
+
/**
|
|
277
|
+
* @description Edits a table row, either adding, removing, the row
|
|
278
|
+
* @param {?string} option The action to perform on the row ("up"|"down"|null)
|
|
279
|
+
* - null: to remove the row
|
|
280
|
+
* - 'up': to insert the row up
|
|
281
|
+
* - 'down': to insert the row down, or null to remove.
|
|
282
|
+
* @param {?HTMLTableCellElement=} targetCell Target cell, (default: current selected cell)
|
|
283
|
+
* @param {?HTMLTableCellElement=} [positionResetElement] The element to reset the position of (optional). This can be the cell that triggered the row edit.
|
|
284
|
+
*/
|
|
285
|
+
editRow(option: string | null, targetCell?: (HTMLTableCellElement | null) | undefined, positionResetElement?: (HTMLTableCellElement | null) | undefined): void;
|
|
286
|
+
/**
|
|
287
|
+
* @description Edits a table cell(column), either adding, removing, or modifying the cell based on the provided option.
|
|
288
|
+
* @param {?string} option The action to perform on the cell ("left"|"right"|null)
|
|
289
|
+
* - null: to remove the cell
|
|
290
|
+
* - left: to insert a new cell to the left
|
|
291
|
+
* - right: to insert a new cell to the right
|
|
292
|
+
* @param {?HTMLTableCellElement=} targetCell Target cell, (default: current selected cell)
|
|
293
|
+
* @param {?HTMLTableCellElement=} positionResetElement The element to reset the position of (optional). This can be the cell that triggered the column edit.
|
|
294
|
+
* @returns {HTMLTableCellElement} Target table cell
|
|
295
|
+
*/
|
|
296
|
+
editCell(option: string | null, targetCell?: (HTMLTableCellElement | null) | undefined, positionResetElement?: (HTMLTableCellElement | null) | undefined): HTMLTableCellElement;
|
|
297
|
+
/**
|
|
298
|
+
* @description Updates the target table's cells with the data from the copied table.
|
|
299
|
+
* @param {HTMLTableElement} copyTable The table containing the copied data.
|
|
300
|
+
* @param {HTMLTableCellElement} targetTD The starting cell in the target table where data will be pasted.
|
|
301
|
+
*/
|
|
302
|
+
pasteTableCellMatrix(copyTable: HTMLTableElement, targetTD: HTMLTableCellElement): void;
|
|
303
|
+
/**
|
|
304
|
+
* @description Inserts a new row into the table at the specified index to it.
|
|
305
|
+
* @param {HTMLTableElement} table The table element to insert the row into.
|
|
306
|
+
* @param {number} rowIndex The index at which to insert the new row.
|
|
307
|
+
* @param {number} cellCnt The number of cells to create in the new row.
|
|
308
|
+
* @returns {HTMLTableRowElement} The newly inserted row element.
|
|
309
|
+
*/
|
|
310
|
+
insertBodyRow(table: HTMLTableElement, rowIndex: number, cellCnt: number): HTMLTableRowElement;
|
|
311
|
+
/**
|
|
312
|
+
* @description Merges the selected table cells into one cell by combining their contents and adjusting their row and column spans.
|
|
313
|
+
* - This method removes the selected cells, consolidates their contents, and applies the appropriate row and column spans to the merged cell.
|
|
314
|
+
* @param {HTMLTableCellElement[]} selectedCells Cells array
|
|
315
|
+
* @param {boolean} [skipPostProcess=false] - If true, skips table cloning, cell re-selection, history stack push, and rendering.
|
|
316
|
+
*/
|
|
317
|
+
mergeCells(selectedCells: HTMLTableCellElement[], skipPostProcess?: boolean): void;
|
|
318
|
+
/**
|
|
319
|
+
* @description Unmerges a table cell that has been merged using rowspan and/or colspan.
|
|
320
|
+
* @param {HTMLTableCellElement[]} selectedCells - Cells array
|
|
321
|
+
* @param {boolean} [skipPostProcess=false] - If true, skips table cloning, cell re-selection, history stack push, and rendering.
|
|
322
|
+
*/
|
|
323
|
+
unmergeCells(selectedCells: HTMLTableCellElement[], skipPostProcess?: boolean): void;
|
|
324
|
+
/**
|
|
325
|
+
* @description Find merged cells
|
|
326
|
+
* @param {HTMLTableCellElement[]} cells - Cells array
|
|
327
|
+
*/
|
|
328
|
+
findMergedCells(cells: HTMLTableCellElement[]): any[];
|
|
329
|
+
/**
|
|
330
|
+
* @description Toggles the visibility of the table header (`<thead>`). If the header is present, it is removed; if absent, it is added.
|
|
331
|
+
*/
|
|
332
|
+
toggleHeader(): void;
|
|
333
|
+
/**
|
|
334
|
+
* @description Toggles the visibility of the table caption (`<caption>`). If the caption is present, it is removed; if absent, it is added.
|
|
335
|
+
*/
|
|
336
|
+
toggleCaption(): void;
|
|
337
|
+
/**
|
|
338
|
+
* @private
|
|
339
|
+
* @description Sets the controller position for a cell.
|
|
340
|
+
* @param {HTMLTableCellElement} tdElement - The target table cell.
|
|
341
|
+
*/
|
|
342
|
+
private _setController;
|
|
343
|
+
/**
|
|
344
|
+
* @private
|
|
345
|
+
* @description Sets the position of the cell controller.
|
|
346
|
+
* @param {HTMLTableCellElement} tdElement - The target table cell.
|
|
347
|
+
* @param {boolean} reset - Whether to reset the controller position.
|
|
348
|
+
*/
|
|
349
|
+
private _setCellControllerPosition;
|
|
350
|
+
/**
|
|
351
|
+
* @private
|
|
352
|
+
* @description Adds a new entry to the history stack.
|
|
353
|
+
*/
|
|
354
|
+
private _historyPush;
|
|
355
|
+
/**
|
|
356
|
+
* @private
|
|
357
|
+
* @description Opens the figure.
|
|
358
|
+
* @param {Node} target - The target figure element.
|
|
359
|
+
*/
|
|
360
|
+
private _figureOpen;
|
|
361
|
+
/**
|
|
362
|
+
* @private
|
|
363
|
+
* @description Converts the width of <col> elements to percentages.
|
|
364
|
+
* @param {HTMLTableElement} target - The target table element.
|
|
365
|
+
*/
|
|
366
|
+
private _resizePercentCol;
|
|
367
|
+
/**
|
|
368
|
+
* @private
|
|
369
|
+
* @description Starts resizing a table cell.
|
|
370
|
+
* @param {HTMLElement} col The column element.
|
|
371
|
+
* @param {number} startX The starting X position.
|
|
372
|
+
* @param {number} startWidth The initial width of the column.
|
|
373
|
+
* @param {boolean} isLeftEdge Whether the resizing is on the left edge.
|
|
374
|
+
*/
|
|
375
|
+
private _startCellResizing;
|
|
376
|
+
/**
|
|
377
|
+
* @private
|
|
378
|
+
* @description Resizes a table cell.
|
|
379
|
+
* @param {HTMLElement} col The column element.
|
|
380
|
+
* @param {HTMLElement} nextCol The next column element.
|
|
381
|
+
* @param {HTMLElement} figure The table figure element.
|
|
382
|
+
* @param {HTMLElement} tdEl The table cell element.
|
|
383
|
+
* @param {HTMLElement} resizeLine The resize line element.
|
|
384
|
+
* @param {boolean} isLeftEdge Whether the resizing is on the left edge.
|
|
385
|
+
* @param {number} startX The starting X position.
|
|
386
|
+
* @param {number} startWidth The initial width of the column.
|
|
387
|
+
* @param {number} prevWidthPercent The previous width percentage.
|
|
388
|
+
* @param {number} nextColWidthPercent The next column's width percentage.
|
|
389
|
+
* @param {number} tableWidth The total width of the table.
|
|
390
|
+
* @param {MouseEvent} e The mouse event.
|
|
391
|
+
*/
|
|
392
|
+
private _cellResize;
|
|
393
|
+
/**
|
|
394
|
+
* @private
|
|
395
|
+
* @description Starts resizing a table row.
|
|
396
|
+
* @param {HTMLElement} row The table row element.
|
|
397
|
+
* @param {number} startY The starting Y position.
|
|
398
|
+
* @param {number} startHeight The initial height of the row.
|
|
399
|
+
*/
|
|
400
|
+
private _startRowResizing;
|
|
401
|
+
/**
|
|
402
|
+
* @private
|
|
403
|
+
* @description Resizes a table row.
|
|
404
|
+
* @param {HTMLElement} row The table row element.
|
|
405
|
+
* @param {HTMLElement} figure The table figure element.
|
|
406
|
+
* @param {HTMLElement} resizeLine The resize line element.
|
|
407
|
+
* @param {number} startY The starting Y position.
|
|
408
|
+
* @param {number} startHeight The initial height of the row.
|
|
409
|
+
* @param {MouseEvent} e The mouse event.
|
|
410
|
+
*/
|
|
411
|
+
private _rowResize;
|
|
412
|
+
/**
|
|
413
|
+
* @private
|
|
414
|
+
* @description Starts resizing the table figure.
|
|
415
|
+
* @param {number} startX The starting X position.
|
|
416
|
+
* @param {boolean} isLeftEdge Whether the resizing is on the left edge.
|
|
417
|
+
*/
|
|
418
|
+
private _startFigureResizing;
|
|
419
|
+
/**
|
|
420
|
+
* @private
|
|
421
|
+
* @description Resizes the table figure.
|
|
422
|
+
* @param {HTMLElement} figure The table figure element.
|
|
423
|
+
* @param {HTMLElement} resizeLine The resize line element.
|
|
424
|
+
* @param {boolean} isLeftEdge Whether the resizing is on the left edge.
|
|
425
|
+
* @param {number} startX The starting X position.
|
|
426
|
+
* @param {number} startWidth The initial width of the figure.
|
|
427
|
+
* @param {number} constNum A constant number used for width calculation.
|
|
428
|
+
* @param {MouseEvent} e The mouse event.
|
|
429
|
+
*/
|
|
430
|
+
private _figureResize;
|
|
431
|
+
/**
|
|
432
|
+
* @private
|
|
433
|
+
* @description Sets the resize line position.
|
|
434
|
+
* @param {HTMLElement} figure The table figure element.
|
|
435
|
+
* @param {HTMLElement} target The target element.
|
|
436
|
+
* @param {HTMLElement} resizeLine The resize line element.
|
|
437
|
+
* @param {boolean} isLeftEdge Whether the resizing is on the left edge.
|
|
438
|
+
*/
|
|
439
|
+
private _setResizeLinePosition;
|
|
440
|
+
/**
|
|
441
|
+
* @private
|
|
442
|
+
* @description Sets the resize row position.
|
|
443
|
+
* @param {HTMLElement} figure The table figure element.
|
|
444
|
+
* @param {HTMLElement} target The target row element.
|
|
445
|
+
* @param {HTMLElement} resizeLine The resize line element.
|
|
446
|
+
*/
|
|
447
|
+
private _setResizeRowPosition;
|
|
448
|
+
/**
|
|
449
|
+
* @private
|
|
450
|
+
* @description Stops resizing the table.
|
|
451
|
+
* @param {HTMLElement} target The target element.
|
|
452
|
+
* @param {string} prevValue The previous style value.
|
|
453
|
+
* @param {string} styleProp The CSS property being changed.
|
|
454
|
+
* @param {KeyboardEvent} e The keyboard event.
|
|
455
|
+
*/
|
|
456
|
+
private _stopResize;
|
|
457
|
+
/**
|
|
458
|
+
* @private
|
|
459
|
+
* @description Deletes styles from selected table cells.
|
|
460
|
+
*/
|
|
461
|
+
private _deleteStyleSelectedCells;
|
|
462
|
+
/**
|
|
463
|
+
* @private
|
|
464
|
+
* @description Restores styles for selected table cells.
|
|
465
|
+
*/
|
|
466
|
+
private _recallStyleSelectedCells;
|
|
467
|
+
/**
|
|
468
|
+
* @private
|
|
469
|
+
* @description Adds global event listeners for resizing.
|
|
470
|
+
* @param {(...args: *) => void} resizeFn The function handling the resize event.
|
|
471
|
+
* @param {(...args: *) => void} stopFn The function handling the stop event.
|
|
472
|
+
* @param {(...args: *) => void} keyDownFn The function handling the keydown event.
|
|
473
|
+
*/
|
|
474
|
+
private _addResizeGlobalEvents;
|
|
475
|
+
/**
|
|
476
|
+
* @private
|
|
477
|
+
* @description Enables or disables editor mode.
|
|
478
|
+
* @param {boolean} enabled Whether to enable or disable the editor.
|
|
479
|
+
*/
|
|
480
|
+
private _toggleEditor;
|
|
481
|
+
/**
|
|
482
|
+
* @private
|
|
483
|
+
* @description Updates control properties.
|
|
484
|
+
* @param {string} type The type of control property.
|
|
485
|
+
*/
|
|
486
|
+
private _setCtrlProps;
|
|
487
|
+
/**
|
|
488
|
+
* @private
|
|
489
|
+
* @description Sets text alignment properties.
|
|
490
|
+
* @param {Element} el The element to apply alignment to.
|
|
491
|
+
* @param {string} align The alignment value.
|
|
492
|
+
* @param {boolean} reset Whether to reset the alignment.
|
|
493
|
+
*/
|
|
494
|
+
private _setAlignProps;
|
|
495
|
+
/**
|
|
496
|
+
* @private
|
|
497
|
+
* @description Disables or enables border properties.
|
|
498
|
+
* @param {boolean} disabled Whether to disable or enable border properties.
|
|
499
|
+
*/
|
|
500
|
+
private _disableBorderProps;
|
|
501
|
+
/**
|
|
502
|
+
* @private
|
|
503
|
+
* @description Gets the border style.
|
|
504
|
+
* @param {string} borderStyle The border style string.
|
|
505
|
+
* @returns {{w: string, s: string, c: string}} The parsed border style object.
|
|
506
|
+
* - w: The border width.
|
|
507
|
+
* - s: The border style.
|
|
508
|
+
* - c: The border color.
|
|
509
|
+
*/
|
|
510
|
+
private _getBorderStyle;
|
|
511
|
+
/**
|
|
512
|
+
* @private
|
|
513
|
+
* @description Applies properties to table cells.
|
|
514
|
+
* @param {HTMLButtonElement} target The target element.
|
|
515
|
+
*/
|
|
516
|
+
private _submitProps;
|
|
517
|
+
/**
|
|
518
|
+
* @private
|
|
519
|
+
* @description Sets font styles.
|
|
520
|
+
* @param {CSSStyleDeclaration} styles The style object to modify.
|
|
521
|
+
*/
|
|
522
|
+
private _setFontStyle;
|
|
523
|
+
/**
|
|
524
|
+
* @private
|
|
525
|
+
* @description Sets border format and styles.
|
|
526
|
+
* @param {{left: Node[], top: Node[], right: Node[], bottom: Node[], all: Node[]}} cells The table cells categorized by border positions.
|
|
527
|
+
* @param {string} borderKey Border style ("all"|"inside"|"horizon"|"vertical"|"outside"|"left"|"top"|"right"|"bottom")
|
|
528
|
+
* @param {string} s The border style value.
|
|
529
|
+
*/
|
|
530
|
+
private _setBorderStyles;
|
|
531
|
+
/**
|
|
532
|
+
* @private
|
|
533
|
+
* @description Selects multiple table cells and applies selection styles.
|
|
534
|
+
* @param {Node} startCell The first cell in the selection.
|
|
535
|
+
* @param {Node} endCell The last cell in the selection.
|
|
536
|
+
*/
|
|
537
|
+
private _setMultiCells;
|
|
538
|
+
/**
|
|
539
|
+
* @private
|
|
540
|
+
* @description Resets the table picker display.
|
|
541
|
+
*/
|
|
542
|
+
private _resetTablePicker;
|
|
543
|
+
/**
|
|
544
|
+
* @private
|
|
545
|
+
* @description Resets the alignment properties for table cells.
|
|
546
|
+
*/
|
|
547
|
+
private _resetPropsAlign;
|
|
548
|
+
/**
|
|
549
|
+
* @private
|
|
550
|
+
* @description Handles color selection from the color palette.
|
|
551
|
+
* @param {Node} button The button triggering the color palette.
|
|
552
|
+
* @param {string} type The type of color selection.
|
|
553
|
+
* @param {HTMLInputElement} color Color text input element.
|
|
554
|
+
*/
|
|
555
|
+
private _onColorPalette;
|
|
556
|
+
/**
|
|
557
|
+
* @private
|
|
558
|
+
* @description Closes table-related controllers.
|
|
559
|
+
*/
|
|
560
|
+
private _closeController;
|
|
561
|
+
/**
|
|
562
|
+
* @private
|
|
563
|
+
* @description Closes table-related controllers and table figure
|
|
564
|
+
*/
|
|
565
|
+
private _closeTableSelectInfo;
|
|
566
|
+
/**
|
|
567
|
+
* @private
|
|
568
|
+
* @description Hides the resize line if it is visible.
|
|
569
|
+
*/
|
|
570
|
+
private __hideResizeLine;
|
|
571
|
+
/**
|
|
572
|
+
* @private
|
|
573
|
+
* @description Removes global event listeners and resets resize-related properties.
|
|
574
|
+
*/
|
|
575
|
+
private __removeGlobalEvents;
|
|
576
|
+
#private;
|
|
577
|
+
}
|
|
578
|
+
import EditorInjector from '../../../editorInjector';
|
|
579
|
+
import { Controller } from '../../../modules';
|
|
580
|
+
import { ColorPicker } from '../../../modules';
|
|
581
|
+
import { Figure } from '../../../modules';
|
|
582
|
+
import { SelectMenu } from '../../../modules';
|