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.
Files changed (241) hide show
  1. package/CONTRIBUTING.md +8 -8
  2. package/README.md +44 -49
  3. package/dist/suneditor.min.css +1 -1
  4. package/dist/suneditor.min.js +1 -1
  5. package/package.json +95 -53
  6. package/src/assets/design/color.css +2 -2
  7. package/src/assets/design/size.css +2 -0
  8. package/src/assets/icons/defaultIcons.js +16 -1
  9. package/src/assets/suneditor-contents.css +9 -8
  10. package/src/assets/suneditor.css +29 -26
  11. package/src/core/{section → base}/actives.js +20 -12
  12. package/src/core/base/history.js +4 -4
  13. package/src/core/class/char.js +10 -10
  14. package/src/core/class/component.js +146 -57
  15. package/src/core/class/format.js +94 -2458
  16. package/src/core/class/html.js +187 -129
  17. package/src/core/class/inline.js +1853 -0
  18. package/src/core/class/listFormat.js +582 -0
  19. package/src/core/class/menu.js +14 -3
  20. package/src/core/class/nodeTransform.js +9 -14
  21. package/src/core/class/offset.js +162 -197
  22. package/src/core/class/selection.js +137 -34
  23. package/src/core/class/toolbar.js +73 -52
  24. package/src/core/class/ui.js +11 -11
  25. package/src/core/class/viewer.js +56 -55
  26. package/src/core/config/context.js +122 -0
  27. package/src/core/config/frameContext.js +204 -0
  28. package/src/core/config/options.js +639 -0
  29. package/src/core/editor.js +181 -108
  30. package/src/core/event/actions/index.js +229 -0
  31. package/src/core/event/effects/common.registry.js +60 -0
  32. package/src/core/event/effects/keydown.registry.js +551 -0
  33. package/src/core/event/effects/ruleHelpers.js +145 -0
  34. package/src/core/{base → event}/eventManager.js +119 -201
  35. package/src/core/event/executor.js +21 -0
  36. package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
  37. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
  38. package/src/core/event/handlers/handler_ww_input.js +77 -0
  39. package/src/core/event/handlers/handler_ww_key.js +228 -0
  40. package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
  41. package/src/core/event/ports.js +211 -0
  42. package/src/core/event/reducers/keydown.reducer.js +89 -0
  43. package/src/core/event/rules/keydown.rule.arrow.js +54 -0
  44. package/src/core/event/rules/keydown.rule.backspace.js +202 -0
  45. package/src/core/event/rules/keydown.rule.delete.js +126 -0
  46. package/src/core/event/rules/keydown.rule.enter.js +144 -0
  47. package/src/core/event/rules/keydown.rule.tab.js +29 -0
  48. package/src/core/section/constructor.js +79 -388
  49. package/src/core/section/documentType.js +47 -26
  50. package/src/core/util/instanceCheck.js +59 -0
  51. package/src/editorInjector/_classes.js +4 -0
  52. package/src/editorInjector/_core.js +17 -7
  53. package/src/editorInjector/index.js +10 -2
  54. package/src/events.js +6 -0
  55. package/src/helper/clipboard.js +24 -10
  56. package/src/helper/converter.js +17 -12
  57. package/src/helper/dom/domCheck.js +22 -3
  58. package/src/helper/dom/domQuery.js +91 -45
  59. package/src/helper/dom/domUtils.js +93 -19
  60. package/src/helper/dom/index.js +4 -0
  61. package/src/helper/env.js +11 -7
  62. package/src/helper/keyCodeMap.js +4 -3
  63. package/src/langs/ckb.js +1 -1
  64. package/src/langs/cs.js +1 -1
  65. package/src/langs/da.js +1 -1
  66. package/src/langs/de.js +1 -1
  67. package/src/langs/en.js +1 -1
  68. package/src/langs/es.js +1 -1
  69. package/src/langs/fa.js +1 -1
  70. package/src/langs/fr.js +1 -1
  71. package/src/langs/he.js +1 -1
  72. package/src/langs/hu.js +1 -1
  73. package/src/langs/it.js +1 -1
  74. package/src/langs/ja.js +1 -1
  75. package/src/langs/km.js +1 -1
  76. package/src/langs/ko.js +1 -1
  77. package/src/langs/lv.js +1 -1
  78. package/src/langs/nl.js +1 -1
  79. package/src/langs/pl.js +1 -1
  80. package/src/langs/pt_br.js +10 -10
  81. package/src/langs/ro.js +1 -1
  82. package/src/langs/ru.js +1 -1
  83. package/src/langs/se.js +1 -1
  84. package/src/langs/tr.js +1 -1
  85. package/src/langs/uk.js +1 -1
  86. package/src/langs/ur.js +1 -1
  87. package/src/langs/zh_cn.js +1 -1
  88. package/src/modules/ApiManager.js +25 -18
  89. package/src/modules/Browser.js +52 -61
  90. package/src/modules/ColorPicker.js +37 -38
  91. package/src/modules/Controller.js +85 -79
  92. package/src/modules/Figure.js +275 -187
  93. package/src/modules/FileManager.js +86 -92
  94. package/src/modules/HueSlider.js +67 -35
  95. package/src/modules/Modal.js +84 -77
  96. package/src/modules/ModalAnchorEditor.js +62 -79
  97. package/src/modules/SelectMenu.js +89 -86
  98. package/src/plugins/browser/audioGallery.js +9 -5
  99. package/src/plugins/browser/fileBrowser.js +10 -6
  100. package/src/plugins/browser/fileGallery.js +9 -5
  101. package/src/plugins/browser/imageGallery.js +9 -5
  102. package/src/plugins/browser/videoGallery.js +11 -6
  103. package/src/plugins/command/blockquote.js +1 -0
  104. package/src/plugins/command/exportPDF.js +11 -8
  105. package/src/plugins/command/fileUpload.js +41 -29
  106. package/src/plugins/command/list_bulleted.js +2 -1
  107. package/src/plugins/command/list_numbered.js +2 -1
  108. package/src/plugins/dropdown/align.js +8 -2
  109. package/src/plugins/dropdown/backgroundColor.js +19 -11
  110. package/src/plugins/dropdown/font.js +15 -9
  111. package/src/plugins/dropdown/fontColor.js +19 -11
  112. package/src/plugins/dropdown/formatBlock.js +7 -2
  113. package/src/plugins/dropdown/hr.js +7 -3
  114. package/src/plugins/dropdown/layout.js +6 -2
  115. package/src/plugins/dropdown/lineHeight.js +8 -3
  116. package/src/plugins/dropdown/list.js +2 -1
  117. package/src/plugins/dropdown/paragraphStyle.js +15 -11
  118. package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
  119. package/src/plugins/dropdown/template.js +6 -2
  120. package/src/plugins/dropdown/textStyle.js +7 -3
  121. package/src/plugins/field/mention.js +33 -27
  122. package/src/plugins/input/fontSize.js +44 -37
  123. package/src/plugins/input/pageNavigator.js +3 -2
  124. package/src/plugins/modal/audio.js +90 -85
  125. package/src/plugins/modal/drawing.js +58 -66
  126. package/src/plugins/modal/embed.js +193 -180
  127. package/src/plugins/modal/image.js +441 -439
  128. package/src/plugins/modal/link.js +31 -8
  129. package/src/plugins/modal/math.js +23 -22
  130. package/src/plugins/modal/video.js +233 -230
  131. package/src/plugins/popup/anchor.js +24 -18
  132. package/src/suneditor.js +69 -24
  133. package/src/typedef.js +42 -19
  134. package/types/assets/icons/defaultIcons.d.ts +8 -0
  135. package/types/core/class/char.d.ts +1 -1
  136. package/types/core/class/component.d.ts +29 -7
  137. package/types/core/class/format.d.ts +4 -354
  138. package/types/core/class/html.d.ts +13 -4
  139. package/types/core/class/inline.d.ts +263 -0
  140. package/types/core/class/listFormat.d.ts +135 -0
  141. package/types/core/class/menu.d.ts +10 -2
  142. package/types/core/class/offset.d.ts +24 -26
  143. package/types/core/class/selection.d.ts +2 -0
  144. package/types/core/class/toolbar.d.ts +24 -11
  145. package/types/core/class/ui.d.ts +1 -1
  146. package/types/core/class/viewer.d.ts +1 -1
  147. package/types/core/config/context.d.ts +157 -0
  148. package/types/core/config/frameContext.d.ts +367 -0
  149. package/types/core/config/options.d.ts +1119 -0
  150. package/types/core/editor.d.ts +101 -66
  151. package/types/core/event/actions/index.d.ts +47 -0
  152. package/types/core/event/effects/common.registry.d.ts +50 -0
  153. package/types/core/event/effects/keydown.registry.d.ts +73 -0
  154. package/types/core/event/effects/ruleHelpers.d.ts +31 -0
  155. package/types/core/{base → event}/eventManager.d.ts +15 -46
  156. package/types/core/event/executor.d.ts +6 -0
  157. package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
  158. package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
  159. package/types/core/event/ports.d.ts +255 -0
  160. package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
  161. package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
  162. package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
  163. package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
  164. package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
  165. package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
  166. package/types/core/section/constructor.d.ts +101 -631
  167. package/types/core/section/documentType.d.ts +14 -4
  168. package/types/core/util/instanceCheck.d.ts +50 -0
  169. package/types/editorInjector/_classes.d.ts +4 -0
  170. package/types/editorInjector/_core.d.ts +17 -7
  171. package/types/editorInjector/index.d.ts +10 -2
  172. package/types/events.d.ts +1 -0
  173. package/types/helper/clipboard.d.ts +2 -2
  174. package/types/helper/converter.d.ts +6 -9
  175. package/types/helper/dom/domCheck.d.ts +7 -0
  176. package/types/helper/dom/domQuery.d.ts +19 -8
  177. package/types/helper/dom/domUtils.d.ts +24 -2
  178. package/types/helper/dom/index.d.ts +86 -1
  179. package/types/helper/env.d.ts +6 -1
  180. package/types/helper/index.d.ts +7 -1
  181. package/types/helper/keyCodeMap.d.ts +3 -3
  182. package/types/index.d.ts +23 -117
  183. package/types/langs/index.d.ts +2 -2
  184. package/types/modules/ApiManager.d.ts +1 -8
  185. package/types/modules/Browser.d.ts +4 -62
  186. package/types/modules/ColorPicker.d.ts +4 -21
  187. package/types/modules/Controller.d.ts +8 -64
  188. package/types/modules/Figure.d.ts +54 -50
  189. package/types/modules/FileManager.d.ts +1 -13
  190. package/types/modules/HueSlider.d.ts +13 -3
  191. package/types/modules/Modal.d.ts +0 -43
  192. package/types/modules/ModalAnchorEditor.d.ts +0 -73
  193. package/types/modules/SelectMenu.d.ts +0 -85
  194. package/types/modules/index.d.ts +3 -3
  195. package/types/plugins/browser/audioGallery.d.ts +29 -18
  196. package/types/plugins/browser/fileBrowser.d.ts +38 -27
  197. package/types/plugins/browser/fileGallery.d.ts +29 -18
  198. package/types/plugins/browser/imageGallery.d.ts +24 -16
  199. package/types/plugins/browser/videoGallery.d.ts +29 -18
  200. package/types/plugins/command/blockquote.d.ts +1 -0
  201. package/types/plugins/command/exportPDF.d.ts +18 -18
  202. package/types/plugins/command/fileUpload.d.ts +65 -45
  203. package/types/plugins/command/list_bulleted.d.ts +1 -0
  204. package/types/plugins/command/list_numbered.d.ts +1 -0
  205. package/types/plugins/dropdown/align.d.ts +13 -8
  206. package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
  207. package/types/plugins/dropdown/font.d.ts +13 -12
  208. package/types/plugins/dropdown/fontColor.d.ts +30 -19
  209. package/types/plugins/dropdown/formatBlock.d.ts +13 -8
  210. package/types/plugins/dropdown/hr.d.ts +15 -11
  211. package/types/plugins/dropdown/layout.d.ts +15 -11
  212. package/types/plugins/dropdown/lineHeight.d.ts +16 -11
  213. package/types/plugins/dropdown/list.d.ts +1 -0
  214. package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
  215. package/types/plugins/dropdown/table/index.d.ts +582 -0
  216. package/types/plugins/dropdown/table.d.ts +41 -86
  217. package/types/plugins/dropdown/template.d.ts +15 -11
  218. package/types/plugins/dropdown/textStyle.d.ts +19 -11
  219. package/types/plugins/field/mention.d.ts +58 -56
  220. package/types/plugins/index.d.ts +38 -38
  221. package/types/plugins/input/fontSize.d.ts +46 -50
  222. package/types/plugins/modal/audio.d.ts +26 -56
  223. package/types/plugins/modal/drawing.d.ts +0 -85
  224. package/types/plugins/modal/embed.d.ts +15 -79
  225. package/types/plugins/modal/image.d.ts +24 -136
  226. package/types/plugins/modal/link.d.ts +34 -15
  227. package/types/plugins/modal/math.d.ts +0 -16
  228. package/types/plugins/modal/video.d.ts +17 -86
  229. package/types/plugins/popup/anchor.d.ts +1 -8
  230. package/types/suneditor.d.ts +70 -19
  231. package/types/typedef.d.ts +60 -46
  232. package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
  233. package/src/core/section/context.js +0 -102
  234. package/types/core/section/context.d.ts +0 -45
  235. package/types/langs/_Lang.d.ts +0 -194
  236. /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
  237. /package/types/core/{section → base}/actives.d.ts +0 -0
  238. /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
  239. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
  240. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
  241. /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
@@ -1,11 +1,11 @@
1
- import EditorInjector from '../../editorInjector';
2
- import { dom, numbers, converter, env, keyCodeMap } from '../../helper';
3
- import { Controller, SelectMenu, ColorPicker, Figure, _DragHandle } from '../../modules';
1
+ import EditorInjector from '../../../editorInjector';
2
+ import { dom, numbers, converter, env, keyCodeMap } from '../../../helper';
3
+ import { Controller, SelectMenu, ColorPicker, Figure, _DragHandle } from '../../../modules';
4
4
 
5
5
  const { _w, ON_OVER_COMPONENT } = env;
6
6
 
7
- const ROW_SELECT_MARGIN = 5;
8
- const CELL_SELECT_MARGIN = 2;
7
+ const ROW_SELECT_MARGIN = 6;
8
+ const CELL_SELECT_MARGIN = 6;
9
9
  const CELL_DECIMAL_END = 0;
10
10
 
11
11
  const RESIZE_CELL_CLASS = '.se-table-resize-line';
@@ -61,6 +61,14 @@ const DEFAULT_COLOR_LIST = [
61
61
  '#000000'
62
62
  ];
63
63
 
64
+ /**
65
+ * @typedef {Object} TablePluginOptions
66
+ * @property {"x"|"y"|"xy"} [scrollType='x'] - Scroll type ('x', 'y', 'xy')
67
+ * @property {"top"|"bottom"} [captionPosition='bottom'] - Caption position ('top', 'bottom')
68
+ * @property {"cell"|"table"} [cellControllerPosition='cell'] - Cell controller position ('cell', 'table')
69
+ * @property {Array} [colorList] - Color list, used in cell color picker
70
+ */
71
+
64
72
  /**
65
73
  * @class
66
74
  * @description Table Plugin
@@ -79,14 +87,51 @@ class Table extends EditorInjector {
79
87
  return dom.check.isTable(node) ? node : null;
80
88
  }
81
89
 
90
+ /** @type {HTMLElement} */
91
+ #figure;
92
+ /** @type {HTMLTableCellElement} */
93
+ #tdElement;
94
+ /** @type {HTMLTableRowElement} */
95
+ #trElement;
96
+ /** @type {HTMLTableRowElement[]|HTMLCollectionOf<HTMLTableRowElement>} */
97
+ #trElements;
98
+ /** @type {HTMLTableElement} */
99
+ #selectedTable;
100
+ /** @type {HTMLTableCellElement} */
101
+ #fixedCell;
102
+ /** @type {HTMLTableCellElement} */
103
+ #selectedCell;
104
+ /** @type {HTMLTableCellElement[]} */
105
+ #selectedCells;
106
+ #resizing;
107
+ #resizeLine;
108
+ #resizeLinePrev;
109
+ #tableXY;
110
+ #maxWidth;
111
+ #fixedColumn;
112
+ #physical_cellCnt;
113
+ #logical_cellCnt;
114
+ #cellCnt;
115
+ #rowCnt;
116
+ #rowIndex;
117
+ #physical_cellIndex;
118
+ #logical_cellIndex;
119
+ #current_colSpan;
120
+ #current_rowSpan;
121
+ #shift;
122
+ #_s;
123
+ #fixedCellName;
124
+ #ref;
125
+ #bindMultiOn;
126
+ #bindMultiOff;
127
+ #bindShiftOff;
128
+ #bindTouchOff;
129
+ #globalEvents;
130
+
82
131
  /**
83
132
  * @constructor
84
133
  * @param {__se__EditorCore} editor - The root editor instance
85
- * @param {Object} pluginOptions
86
- * @param {"x"|"y"|"xy"} [pluginOptions.scrollType='x'] - Scroll type ('x', 'y', 'xy')
87
- * @param {"top"|"bottom"} [pluginOptions.captionPosition='bottom'] - Caption position ('top', 'bottom')
88
- * @param {"cell"|"table"} [pluginOptions.cellControllerPosition='cell'] - Cell controller position ('cell', 'table')
89
- * @param {Array} [pluginOptions.colorList] - Color list, used in cell color picker
134
+ * @param {TablePluginOptions} pluginOptions - Plugin options
90
135
  */
91
136
  constructor(editor, pluginOptions) {
92
137
  // plugin bisic properties
@@ -115,12 +160,17 @@ class Table extends EditorInjector {
115
160
  });
116
161
 
117
162
  // members - Controller
118
- this.controller_cell = new Controller(this, controller_cell.html, { position: this.cellControllerTop ? 'top' : 'bottom' });
119
- this.controller_table = new Controller(this, controller_table, { position: 'top' });
120
163
  if (this.cellControllerTop) {
164
+ this.controller_cell = new Controller(this, controller_cell.html, { position: 'top' });
165
+ this.controller_table = new Controller(this, controller_table, { position: 'top' });
121
166
  this.controller_cell.sibling = this.controller_table.form;
122
- this.controller_cell.siblingPosition = 'top';
167
+ this.controller_table.sibling = this.controller_cell.form;
168
+ this.controller_table.siblingMain = true;
169
+ } else {
170
+ this.controller_table = new Controller(this, controller_table, { position: 'top' });
171
+ this.controller_cell = new Controller(this, controller_cell.html, { position: 'bottom' });
123
172
  }
173
+
124
174
  // props
125
175
  const propsTargetForms = [this.controller_table.form, this.controller_cell.form];
126
176
  this.controller_props = new Controller(this, controller_props.html, { position: 'bottom', parents: propsTargetForms, isInsideForm: true });
@@ -239,59 +289,49 @@ class Table extends EditorInjector {
239
289
  /** @type {HTMLButtonElement} */
240
290
  this.unmergeButton = controller_cell.unmergeButton;
241
291
 
242
- // members - private
243
- this._resizing = false;
244
- this._resizeLine = null;
245
- this._resizeLinePrev = null;
246
-
247
- /** @type {HTMLElement} */
248
- this._figure = null;
249
292
  /**
250
293
  * @description Same value a "this._selectedTable", but it maintain prev table element
251
294
  * @type {HTMLTableElement}
252
295
  */
253
296
  this._element = null;
254
- /** @type {HTMLTableCellElement} */
255
- this._tdElement = null;
256
- /** @type {HTMLTableRowElement} */
257
- this._trElement = null;
258
- /** @type {HTMLTableRowElement[]|HTMLCollectionOf<HTMLTableRowElement>} */
259
- this._trElements = null;
260
-
261
- this._tableXY = [];
262
- this._maxWidth = true;
263
- this._fixedColumn = false;
264
- this._physical_cellCnt = 0;
265
- this._logical_cellCnt = 0;
266
- this._cellCnt = 0;
267
- this._rowCnt = 0;
268
- this._rowIndex = 0;
269
- this._physical_cellIndex = 0;
270
- this._logical_cellIndex = 0;
271
- this._current_colSpan = 0;
272
- this._current_rowSpan = 0;
273
297
 
274
- // member - multi selecte
275
- /** @type {HTMLTableElement} */
276
- this._selectedTable = null;
277
- /** @type {HTMLTableCellElement} */
278
- this._fixedCell = null;
279
- /** @type {HTMLTableCellElement} */
280
- this._selectedCell = null;
281
- /** @type {HTMLTableCellElement[]} */
282
- this._selectedCells = null;
298
+ // members - private
299
+ this.#resizing = false;
300
+ this.#resizeLine = null;
301
+ this.#resizeLinePrev = null;
302
+ this.#figure = null;
303
+ this.#tdElement = null;
304
+ this.#trElement = null;
305
+ this.#trElements = null;
306
+ this.#tableXY = [];
307
+ this.#maxWidth = true;
308
+ this.#fixedColumn = false;
309
+ this.#physical_cellCnt = 0;
310
+ this.#logical_cellCnt = 0;
311
+ this.#cellCnt = 0;
312
+ this.#rowCnt = 0;
313
+ this.#rowIndex = 0;
314
+ this.#physical_cellIndex = 0;
315
+ this.#logical_cellIndex = 0;
316
+ this.#current_colSpan = 0;
317
+ this.#current_rowSpan = 0;
283
318
 
284
- this._shift = false;
285
- this.__s = false;
286
- this._fixedCellName = null;
287
- this._ref = null;
319
+ // member - multi selecte
320
+ this.#selectedTable = null;
321
+ this.#fixedCell = null;
322
+ this.#selectedCell = null;
323
+ this.#selectedCells = null;
324
+ this.#shift = false;
325
+ this.#_s = false;
326
+ this.#fixedCellName = null;
327
+ this.#ref = null;
288
328
 
289
329
  // member - global events
290
- this._bindMultiOn = this.#OnCellMultiSelect.bind(this);
291
- this._bindMultiOff = this.#OffCellMultiSelect.bind(this);
292
- this._bindShiftOff = this.#OffCellShift.bind(this);
293
- this._bindTouchOff = this.#OffCellTouch.bind(this);
294
- this.__globalEvents = {
330
+ this.#bindMultiOn = this.#OnCellMultiSelect.bind(this);
331
+ this.#bindMultiOff = this.#OffCellMultiSelect.bind(this);
332
+ this.#bindShiftOff = this.#OffCellShift.bind(this);
333
+ this.#bindTouchOff = this.#OffCellTouch.bind(this);
334
+ this.#globalEvents = {
295
335
  on: null,
296
336
  off: null,
297
337
  shiftOff: null,
@@ -314,8 +354,8 @@ class Table extends EditorInjector {
314
354
  */
315
355
  action() {
316
356
  const oTable = dom.utils.createElement('TABLE');
317
- const x = this._tableXY[0];
318
- const y = this._tableXY[1];
357
+ const x = this.#tableXY[0];
358
+ const y = this.#tableXY[1];
319
359
 
320
360
  const body = `<tbody>${`<tr>${CreateCellsString('td', x)}</tr>`.repeat(y)}</tbody>`;
321
361
  const colGroup = `<colgroup>${`<col style="width: ${numbers.get(100 / x, CELL_DECIMAL_END)}%;">`.repeat(x)}</colgroup>`;
@@ -327,10 +367,11 @@ class Table extends EditorInjector {
327
367
  scrollTypeClass = ` se-scroll-figure-${this.figureScroll}`;
328
368
  }
329
369
 
330
- const figure = dom.utils.createElement('FIGURE', { class: 'se-flex-component se-input-component' + scrollTypeClass });
370
+ const figure = dom.utils.createElement('FIGURE', { class: 'se-flex-component se-input-component' + scrollTypeClass, style: 'width: 100%;' });
331
371
  figure.appendChild(oTable);
372
+ this.#maxWidth = true;
332
373
 
333
- if (this.component.insert(figure, { skipCharCount: false, skipSelection: false, skipHistory: false })) {
374
+ if (this.component.insert(figure, { insertBehavior: 'none' })) {
334
375
  this._resetTablePicker();
335
376
  const target = oTable.querySelector('td div');
336
377
  this.selection.setRange(target, 0, target, 0);
@@ -344,27 +385,52 @@ class Table extends EditorInjector {
344
385
  */
345
386
  select(target) {
346
387
  this._figureOpen(target);
347
- if (!this._figure) this.setTableInfo(target);
388
+ if (!this.#figure) this.setTableInfo(target);
348
389
 
349
- const targetWidth = this._figure?.style.width || '100%';
350
- this._maxWidth = targetWidth === '100%';
351
- this._fixedColumn = dom.utils.hasClass(target, 'se-table-layout-fixed') || target.style.tableLayout === 'fixed';
352
- this._setTableStyle(this._maxWidth ? 'width|column' : 'width', true);
390
+ this.#maxWidth = this.#figure?.style.width === '100%';
391
+ this.#fixedColumn = dom.utils.hasClass(target, 'se-table-layout-fixed') || target.style.tableLayout === 'fixed';
392
+ this.#setTableStyle(this.#maxWidth ? 'width|column' : 'width', true);
353
393
 
354
394
  if (_DragHandle.get('__overInfo') === ON_OVER_COMPONENT) return;
355
395
 
356
- if (!this._tdElement) return;
357
- this.setCellInfo(this._tdElement, true);
396
+ if (!this.#tdElement) return;
397
+ this.setCellInfo(this.#tdElement, true);
358
398
 
359
399
  // controller open
360
- const btnDisabled = this._selectedCells?.length > 1;
400
+ const btnDisabled = this.#selectedCells?.length > 1;
361
401
  const figureEl = dom.query.getParentElement(target, dom.check.isFigure);
362
402
  this.controller_table.open(figureEl, null, { isWWTarget: false, initMethod: null, addOffset: null, disabled: btnDisabled });
363
403
 
364
- if (!this._fixedCell) return;
404
+ if (!this.#fixedCell) return;
365
405
 
366
- this._setUnMergeButton();
367
- this.controller_cell.open(this._tdElement, this.cellControllerTop ? figureEl : null, { isWWTarget: false, initMethod: null, addOffset: null, disabled: btnDisabled });
406
+ this.#setUnMergeButton();
407
+ this.controller_cell.open(this.#tdElement, this.cellControllerTop ? figureEl : null, { isWWTarget: false, initMethod: null, addOffset: null, disabled: btnDisabled });
408
+ }
409
+
410
+ /**
411
+ * @editorMethod Editor.Component
412
+ * @description Method to delete a component of a plugin, called by the "FileManager", "Controller" module.
413
+ * @param {HTMLElement} target Target element
414
+ * @returns {Promise<void>}
415
+ */
416
+ destroy(target) {
417
+ if (!target) return;
418
+
419
+ const emptyDiv = target.parentNode;
420
+ dom.utils.removeItem(target);
421
+
422
+ this._closeTableSelectInfo();
423
+
424
+ if (emptyDiv !== this.frameContext.get('wysiwyg'))
425
+ this.nodeTransform.removeAllParents(
426
+ emptyDiv,
427
+ function (current) {
428
+ return current.childNodes.length === 0;
429
+ },
430
+ null
431
+ );
432
+ this.editor.focus();
433
+ this.history.push(false);
368
434
  }
369
435
 
370
436
  /**
@@ -423,14 +489,74 @@ class Table extends EditorInjector {
423
489
  query: 'table',
424
490
  method: (element) => {
425
491
  const ColgroupEl = element.querySelector('colgroup');
426
- let FigureEl = dom.check.isFigure(element.parentNode) ? element.parentNode : null;
427
- if (ColgroupEl && FigureEl) return;
492
+ let FigureEl = /** @type {HTMLElement} */ (dom.check.isFigure(element.parentNode) ? element.parentNode : null);
428
493
 
429
494
  // create colgroup
430
495
  if (!ColgroupEl) {
431
- const maxCount = GetMaxColumns(element);
432
- const colGroup = dom.utils.createElement('colgroup', null, `<col style="width: ${numbers.get(100 / maxCount, CELL_DECIMAL_END)}%;">`.repeat(maxCount));
496
+ const rows = element.rows;
497
+ const maxColumnCount = GetMaxColumns(element);
498
+ const colWidths = new Array(maxColumnCount).fill(null);
499
+
500
+ for (let r = 0, rLen = rows.length, cellsCount; r < rLen; r++) {
501
+ const cellsInRow = rows[r].cells;
502
+ cellsCount = cellsInRow.length;
503
+ let currentLogicalCol = 0;
504
+ const rowColOccupancy = new Array(maxColumnCount).fill(false);
505
+
506
+ for (let c = 0; c < cellsCount; c++) {
507
+ const cell = cellsInRow[c];
508
+ const cellWidth = cell.style.width;
509
+ const colSpan = cell.colSpan || 1;
510
+
511
+ while (currentLogicalCol < maxColumnCount && rowColOccupancy[currentLogicalCol]) {
512
+ currentLogicalCol++;
513
+ }
514
+
515
+ if (currentLogicalCol >= maxColumnCount) break;
516
+ if (cellWidth && !colWidths[currentLogicalCol]) colWidths[currentLogicalCol] = cellWidth;
517
+
518
+ for (let i = 0; i < colSpan; i++) {
519
+ if (currentLogicalCol + i >= maxColumnCount || !cellWidth) continue;
520
+
521
+ rowColOccupancy[currentLogicalCol + i] = true;
522
+ const currentPxWidth = parseFloat(cellWidth);
523
+
524
+ for (let j = 0; j < colSpan; j++) {
525
+ const targetColIndex = currentLogicalCol + j;
526
+ if (targetColIndex >= maxColumnCount) continue;
527
+
528
+ const existingWidth = colWidths[targetColIndex];
529
+ if (existingWidth === null) {
530
+ colWidths[targetColIndex] = `width: ${cellWidth};`;
531
+ } else {
532
+ const existingPxWidth = parseFloat(existingWidth.replace('width: ', '').replace(';', ''));
533
+ if (colSpan === 1 && currentPxWidth !== existingPxWidth) {
534
+ colWidths[targetColIndex] = `width: ${cellWidth};`;
535
+ }
536
+ }
537
+ }
538
+ }
539
+ currentLogicalCol += colSpan;
540
+ }
541
+
542
+ if (cellsCount === maxColumnCount) break;
543
+ }
544
+
545
+ const colHTML = [];
546
+ for (let i = 0; i < maxColumnCount; i++) {
547
+ const colStyle = colWidths[i] ? ` style="${colWidths[i]}"` : '';
548
+ colHTML.push(`<col${colStyle}>`);
549
+ }
550
+
551
+ const colGroup = dom.utils.createElement('colgroup', null, colHTML.join(''));
433
552
  element.insertBefore(colGroup, element.firstElementChild);
553
+
554
+ for (let r = 0; r < rows.length; r++) {
555
+ const cellsInRow = rows[r].cells;
556
+ for (let c = 0; c < cellsInRow.length; c++) {
557
+ dom.utils.setStyle(cellsInRow[c], 'width', '');
558
+ }
559
+ }
434
560
  }
435
561
 
436
562
  // figure
@@ -442,6 +568,13 @@ class Table extends EditorInjector {
442
568
  dom.utils.addClass(FigureEl, 'se-flex-component|se-input-component');
443
569
  }
444
570
 
571
+ // table width
572
+ const tableWidth = element.style.width;
573
+ if (tableWidth) {
574
+ FigureEl.style.width = tableWidth === 'auto' ? 'max-content' : tableWidth;
575
+ dom.utils.setStyle(element, 'width', '');
576
+ }
577
+
445
578
  // scroll
446
579
  if (!this.figureScroll) {
447
580
  dom.utils.removeClass(FigureEl, this.figureScrollList.join('|'));
@@ -471,11 +604,11 @@ class Table extends EditorInjector {
471
604
  * @param {__se__PluginMouseEventInfo} params
472
605
  */
473
606
  onMouseMove({ event }) {
474
- if (this._resizing) return;
607
+ if (this.#resizing) return;
475
608
 
476
609
  const eventTarget = dom.query.getEventTarget(event);
477
610
  const target = dom.query.getParentElement(eventTarget, IsResizeEls);
478
- if (!target || this._fixedCell) {
611
+ if (!target || event.buttons === 1) {
479
612
  this.__hideResizeLine();
480
613
  return;
481
614
  }
@@ -484,10 +617,10 @@ class Table extends EditorInjector {
484
617
  if (cellEdge.is) {
485
618
  if (this._element) this._element.style.cursor = '';
486
619
  this.__removeGlobalEvents();
487
- if (this._resizeLine?.style.display === 'block') this._resizeLine.style.display = 'none';
488
- this._resizeLine = this.editor.frameContext.get('wrapper').querySelector(RESIZE_CELL_CLASS);
489
- this._setResizeLinePosition(dom.query.getParentElement(target, dom.check.isTable), target, this._resizeLine, cellEdge.isLeft);
490
- this._resizeLine.style.display = 'block';
620
+ if (this.#resizeLine?.style.display === 'block') this.#resizeLine.style.display = 'none';
621
+ this.#resizeLine = this.frameContext.get('wrapper').querySelector(RESIZE_CELL_CLASS);
622
+ this._setResizeLinePosition(dom.query.getParentElement(target, dom.check.isTable), target, this.#resizeLine, cellEdge.isLeft);
623
+ this.#resizeLine.style.display = 'block';
491
624
  return;
492
625
  }
493
626
 
@@ -496,10 +629,10 @@ class Table extends EditorInjector {
496
629
  this.__removeGlobalEvents();
497
630
  this._element = dom.query.getParentElement(target, dom.check.isTable);
498
631
  this._element.style.cursor = 'ns-resize';
499
- if (this._resizeLine?.style.display === 'block') this._resizeLine.style.display = 'none';
500
- this._resizeLine = this.editor.frameContext.get('wrapper').querySelector(RESIZE_ROW_CLASS);
501
- this._setResizeRowPosition(dom.query.getParentElement(target, dom.check.isTable), target, this._resizeLine);
502
- this._resizeLine.style.display = 'block';
632
+ if (this.#resizeLine?.style.display === 'block') this.#resizeLine.style.display = 'none';
633
+ this.#resizeLine = this.frameContext.get('wrapper').querySelector(RESIZE_ROW_CLASS);
634
+ this._setResizeRowPosition(dom.query.getParentElement(target, dom.check.isTable), target, this.#resizeLine);
635
+ this.#resizeLine.style.display = 'block';
503
636
  return;
504
637
  }
505
638
 
@@ -512,10 +645,10 @@ class Table extends EditorInjector {
512
645
  * @description Executes the event function of "scroll".
513
646
  */
514
647
  onScroll() {
515
- if (this._resizeLine?.style.display !== 'block') return;
648
+ if (this.#resizeLine?.style.display !== 'block') return;
516
649
  // delete resize line position
517
650
  if (this._element) this._element.style.cursor = '';
518
- this._resizeLine.style.display = 'none';
651
+ this.#resizeLine.style.display = 'none';
519
652
  }
520
653
 
521
654
  /**
@@ -524,7 +657,7 @@ class Table extends EditorInjector {
524
657
  * @param {__se__PluginMouseEventInfo} params
525
658
  */
526
659
  onMouseDown({ event }) {
527
- this._ref = this._selectedCell = null;
660
+ this.#ref = this.#selectedCell = null;
528
661
  const eventTarget = dom.query.getEventTarget(event);
529
662
  const target = /** @type {HTMLTableCellElement} */ (dom.query.getParentElement(eventTarget, IsResizeEls));
530
663
  if (!target) return;
@@ -538,15 +671,15 @@ class Table extends EditorInjector {
538
671
  try {
539
672
  this._deleteStyleSelectedCells();
540
673
  this.setCellInfo(target, true);
541
- const colIndex = this._logical_cellIndex - (cellEdge.isLeft ? 1 : 0);
674
+ const colIndex = this.#logical_cellIndex + this.#current_colSpan - (cellEdge.isLeft ? 1 : 0);
542
675
 
543
676
  // ready
544
677
  this.ui.enableBackWrapper('ew-resize');
545
- if (!this._resizeLine) this._resizeLine = this.editor.frameContext.get('wrapper').querySelector(RESIZE_CELL_CLASS);
546
- this._resizeLinePrev = this.editor.frameContext.get('wrapper').querySelector(RESIZE_CELL_PREV_CLASS);
678
+ this.#resizeLine ||= this.frameContext.get('wrapper').querySelector(RESIZE_CELL_CLASS);
679
+ this.#resizeLinePrev = this.frameContext.get('wrapper').querySelector(RESIZE_CELL_PREV_CLASS);
547
680
 
548
681
  // select figure
549
- if (colIndex < 0 || colIndex === this._logical_cellCnt - 1) {
682
+ if (colIndex < 0 || colIndex === this.#logical_cellCnt - 1) {
550
683
  this._startFigureResizing(cellEdge.startX, colIndex < 0);
551
684
  return;
552
685
  }
@@ -558,7 +691,7 @@ class Table extends EditorInjector {
558
691
  console.warn('[SUNEDITOR.plugins.table.error]', err);
559
692
  this.__removeGlobalEvents();
560
693
  } finally {
561
- this._fixedCell = this._selectedCell = null;
694
+ this.#fixedCell = this.#selectedCell = null;
562
695
  }
563
696
 
564
697
  return;
@@ -582,8 +715,8 @@ class Table extends EditorInjector {
582
715
 
583
716
  // ready
584
717
  this.ui.enableBackWrapper('ns-resize');
585
- if (!this._resizeLine) this._resizeLine = this.editor.frameContext.get('wrapper').querySelector(RESIZE_ROW_CLASS);
586
- this._resizeLinePrev = this.editor.frameContext.get('wrapper').querySelector(RESIZE_ROW_PREV_CLASS);
718
+ this.#resizeLine ||= this.frameContext.get('wrapper').querySelector(RESIZE_ROW_CLASS);
719
+ this.#resizeLinePrev = this.frameContext.get('wrapper').querySelector(RESIZE_ROW_PREV_CLASS);
587
720
 
588
721
  this._startRowResizing(row, rowEdge.startY, numbers.get(_w.getComputedStyle(row).height, CELL_DECIMAL_END));
589
722
  this._toggleEditor(false);
@@ -591,13 +724,13 @@ class Table extends EditorInjector {
591
724
  console.warn('[SUNEDITOR.plugins.table.error]', err);
592
725
  this.__removeGlobalEvents();
593
726
  } finally {
594
- this._fixedCell = this._selectedCell = null;
727
+ this.#fixedCell = this.#selectedCell = null;
595
728
  }
596
729
 
597
730
  return;
598
731
  }
599
732
 
600
- if (this._shift && target !== this._fixedCell) return;
733
+ if (this.#shift && target !== this.#fixedCell) return;
601
734
 
602
735
  this._deleteStyleSelectedCells();
603
736
  if (/^TR$/i.test(target.nodeName)) return;
@@ -610,9 +743,9 @@ class Table extends EditorInjector {
610
743
  * @description Executes the event function of "mouseup".
611
744
  */
612
745
  onMouseUp() {
613
- this._shift = false;
614
- if (!this.cellControllerTop) {
615
- this.controller_cell.resetPosition(this._fixedCell);
746
+ this.#shift = false;
747
+ if (this.cellControllerTop && this.controller_cell.isOpen) {
748
+ this.controller_cell.resetPosition(this.#fixedCell);
616
749
  }
617
750
  }
618
751
 
@@ -630,17 +763,17 @@ class Table extends EditorInjector {
630
763
  * @param {__se__PluginKeyEventInfo} params
631
764
  */
632
765
  onKeyDown({ event, range, line }) {
633
- this._ref = null;
766
+ this.#ref = null;
634
767
 
635
768
  const keyCode = event.code;
636
769
  const isTab = keyCodeMap.isTab(keyCode);
637
- if (this.editor.selectMenuOn || this._resizing || (!isTab && this.__s) || keyCodeMap.isCtrl(event)) return;
770
+ if (this.editor.selectMenuOn || this.#resizing || (!isTab && this.#_s) || keyCodeMap.isCtrl(event)) return;
638
771
 
639
772
  if (!this.cellControllerTop) {
640
773
  this.controller_cell.hide();
641
774
  }
642
775
 
643
- this.__s = keyCodeMap.isShift(event);
776
+ this.#_s = keyCodeMap.isShift(event);
644
777
 
645
778
  // table tabkey
646
779
  if (isTab) {
@@ -649,19 +782,19 @@ class Table extends EditorInjector {
649
782
  if (tableCell && range.collapsed && dom.check.isEdgePoint(range.startContainer, range.startOffset)) {
650
783
  this._closeController();
651
784
 
652
- const shift = this.__s;
653
- this._shift = this.__s = false;
785
+ const shift = this.#_s;
786
+ this.#shift = this.#_s = false;
654
787
 
655
788
  /** @type {HTMLTableElement} */
656
789
  const table = dom.query.getParentElement(tableCell, 'table');
657
790
  /** @type {HTMLTableCellElement[]} */
658
- const cells = dom.query.getListChildren(table, dom.check.isTableCell);
791
+ const cells = dom.query.getListChildren(table, dom.check.isTableCell, null);
659
792
  const idx = shift ? dom.utils.prevIndex(cells, tableCell) : dom.utils.nextIndex(cells, tableCell);
660
793
 
661
794
  if (idx === cells.length && !shift) {
662
795
  if (!dom.query.getParentElement(tableCell, 'thead')) {
663
796
  const rows = table.rows;
664
- const newRow = this.insertBodyRow(table, rows.length, this._cellCnt);
797
+ const newRow = this.insertBodyRow(table, rows.length, this.#cellCnt);
665
798
  const firstTd = newRow.querySelector('td div');
666
799
  this.selection.setRange(firstTd, 0, firstTd, 0);
667
800
  }
@@ -700,12 +833,12 @@ class Table extends EditorInjector {
700
833
  return;
701
834
  }
702
835
 
703
- if (this._shift || this._ref) return;
836
+ if (this.#shift || this.#ref) return;
704
837
 
705
- cell = /** @type {HTMLTableCellElement} */ (cell || dom.query.getParentElement(line, dom.check.isTableCell));
838
+ cell ||= /** @type {HTMLTableCellElement} */ (dom.query.getParentElement(line, dom.check.isTableCell));
706
839
  if (cell) {
707
- this.__s = false;
708
- this._fixedCell = cell;
840
+ this.#_s = false;
841
+ this.#fixedCell = cell;
709
842
  this._closeController();
710
843
  this.#StyleSelectCells(cell, event.shiftKey);
711
844
  return false;
@@ -718,13 +851,13 @@ class Table extends EditorInjector {
718
851
  * @param {__se__PluginKeyEventInfo} params
719
852
  */
720
853
  onKeyUp({ line }) {
721
- this.__s = false;
722
- if (this._shift && dom.query.getParentElement(line, dom.check.isTableCell) === this._fixedCell) {
854
+ this.#_s = false;
855
+ if (this.#shift && dom.query.getParentElement(line, dom.check.isTableCell) === this.#fixedCell) {
723
856
  this._deleteStyleSelectedCells();
724
857
  this._toggleEditor(true);
725
858
  this.__removeGlobalEvents();
726
859
  }
727
- this._shift = false;
860
+ this.#shift = false;
728
861
  }
729
862
 
730
863
  /**
@@ -766,7 +899,7 @@ class Table extends EditorInjector {
766
899
  this.selectMenu_column.open();
767
900
  break;
768
901
  case 'onrow':
769
- this.selectMenu_row.menus[0].style.display = this.selectMenu_row.menus[1].style.display = /^TH$/i.test(this._tdElement?.nodeName) ? 'none' : '';
902
+ this.selectMenu_row.menus[0].style.display = this.selectMenu_row.menus[1].style.display = /^TH$/i.test(this.#tdElement?.nodeName) ? 'none' : '';
770
903
  this.selectMenu_row.open();
771
904
  break;
772
905
  case 'openTableProperties':
@@ -814,14 +947,11 @@ class Table extends EditorInjector {
814
947
  // alignment
815
948
  this._setAlignProps(this.propTargets.cell_alignment, this._propsAlignCache, true);
816
949
  this._setAlignProps(this.propTargets.cell_alignment_vertical, this._propsVerticalAlignCache, true);
817
- if (dom.check.isTable(propsCache[0][0]) && this._figure) {
818
- this._figure.style.float = this._propsAlignCache;
950
+ if (dom.check.isTable(propsCache[0][0]) && this.#figure) {
951
+ this.#figure.style.float = this._propsAlignCache;
819
952
  }
820
953
  break;
821
954
  }
822
- case 'close_props':
823
- this.controller_props.close();
824
- break;
825
955
  case 'props_align':
826
956
  this._setAlignProps(this.propTargets.cell_alignment, target.getAttribute('data-value'), false);
827
957
  break;
@@ -829,52 +959,43 @@ class Table extends EditorInjector {
829
959
  this._setAlignProps(this.propTargets.cell_alignment_vertical, target.getAttribute('data-value'), false);
830
960
  break;
831
961
  case 'merge':
832
- this.mergeCells(this._selectedCells);
962
+ this.mergeCells(this.#selectedCells);
833
963
  break;
834
964
  case 'unmerge':
835
- this.unmergeCells(this._selectedCells);
965
+ this.unmergeCells(this.#selectedCells);
836
966
  break;
837
967
  case 'resize':
838
- this._maxWidth = !this._maxWidth;
839
- this._setTableStyle('width', false);
968
+ this.#maxWidth = !this.#maxWidth;
969
+ this.#setTableStyle('width', false);
840
970
  this._historyPush();
841
- this.component.select(this._element, Table.key, { isInput: true });
971
+ _w.setTimeout(() => {
972
+ this.component.select(this._element, Table.key, { isInput: true });
973
+ }, 0);
842
974
  break;
843
975
  case 'layout':
844
- this._fixedColumn = !this._fixedColumn;
845
- this._setTableStyle('column', false);
976
+ this.#fixedColumn = !this.#fixedColumn;
977
+ this.#setTableStyle('column', false);
846
978
  this._historyPush();
847
- this.component.select(this._element, Table.key, { isInput: true });
979
+ _w.setTimeout(() => {
980
+ this.component.select(this._element, Table.key, { isInput: true });
981
+ }, 0);
848
982
  break;
849
983
  case 'copy':
850
- this.component.copy(this._figure);
984
+ this.component.copy(this.#figure);
851
985
  break;
852
986
  case 'remove': {
853
- const emptyDiv = this._figure?.parentNode;
854
- dom.utils.removeItem(this._figure);
855
-
856
- this._closeTableSelectInfo();
857
-
858
- if (emptyDiv !== this.editor.frameContext.get('wysiwyg'))
859
- this.nodeTransform.removeAllParents(
860
- emptyDiv,
861
- function (current) {
862
- return current.childNodes.length === 0;
863
- },
864
- null
865
- );
866
- this.editor.focus();
867
- this.history.push(false);
987
+ this.destroy(this.#figure);
868
988
  }
869
989
  }
870
990
 
991
+ // [close_props]
871
992
  if (!/(^props_|^revert|Properties$)/.test(command)) {
872
993
  this.controller_props.close();
873
994
  this.controller_colorPicker.close();
874
995
  }
875
996
 
876
997
  if (!/^(remove|props_|on|open|merge)/.test(command)) {
877
- this._setCellControllerPosition(this._tdElement, this._shift);
998
+ this._setCellControllerPosition(this.#tdElement, this.#shift);
878
999
  }
879
1000
  }
880
1001
 
@@ -887,30 +1008,30 @@ class Table extends EditorInjector {
887
1008
  this._deleteStyleSelectedCells();
888
1009
  this._toggleEditor(true);
889
1010
 
890
- this._figure = null;
891
1011
  this._element = null;
892
- this._trElement = null;
893
- this._trElements = null;
894
- this._tableXY = [];
895
- this._maxWidth = false;
896
- this._fixedColumn = false;
897
- this._physical_cellCnt = 0;
898
- this._logical_cellCnt = 0;
899
- this._rowCnt = 0;
900
- this._rowIndex = 0;
901
- this._physical_cellIndex = 0;
902
- this._logical_cellIndex = 0;
903
- this._current_colSpan = 0;
904
- this._current_rowSpan = 0;
905
-
906
- this._shift = false;
907
- this._selectedCells = null;
908
- this._selectedTable = null;
909
- this._ref = null;
910
-
911
- this._fixedCell = null;
912
- this._selectedCell = null;
913
- this._fixedCellName = null;
1012
+ this.#figure = null;
1013
+ this.#trElement = null;
1014
+ this.#trElements = null;
1015
+ this.#tableXY = [];
1016
+ this.#maxWidth = false;
1017
+ this.#fixedColumn = false;
1018
+ this.#physical_cellCnt = 0;
1019
+ this.#logical_cellCnt = 0;
1020
+ this.#rowCnt = 0;
1021
+ this.#rowIndex = 0;
1022
+ this.#physical_cellIndex = 0;
1023
+ this.#logical_cellIndex = 0;
1024
+ this.#current_colSpan = 0;
1025
+ this.#current_rowSpan = 0;
1026
+
1027
+ this.#shift = false;
1028
+ this.#selectedCells = null;
1029
+ this.#selectedTable = null;
1030
+ this.#ref = null;
1031
+
1032
+ this.#fixedCell = null;
1033
+ this.#selectedCell = null;
1034
+ this.#fixedCellName = null;
914
1035
 
915
1036
  const { border_format, border_color, border_style, border_width, back_color, font_color, cell_alignment, cell_alignment_vertical, font_bold, font_underline, font_italic, font_strike } = this.propTargets;
916
1037
  dom.utils.removeClass([border_format, border_color, border_style, border_width, back_color, font_color, cell_alignment, cell_alignment_vertical, font_bold, font_underline, font_italic, font_strike], 'on');
@@ -924,11 +1045,11 @@ class Table extends EditorInjector {
924
1045
  const firstCell = cells[0];
925
1046
  const lastCell = dom.query.findVisualLastCell(cells);
926
1047
 
927
- this._selectedCells = cells;
928
- this._fixedCell = firstCell;
929
- this._selectedCell = lastCell;
930
- this._fixedCellName = firstCell.nodeName;
931
- this._selectedTable = dom.query.getParentElement(firstCell, 'TABLE');
1048
+ this.#selectedCells = cells;
1049
+ this.#fixedCell = firstCell;
1050
+ this.#selectedCell = lastCell;
1051
+ this.#fixedCellName = firstCell.nodeName;
1052
+ this.#selectedTable = dom.query.getParentElement(firstCell, 'TABLE');
932
1053
 
933
1054
  this._setMultiCells(firstCell, lastCell);
934
1055
  }
@@ -939,8 +1060,8 @@ class Table extends EditorInjector {
939
1060
  * @returns {HTMLTableElement} The `<table>` element that is the parent of the provided `element`.
940
1061
  */
941
1062
  setTableInfo(element) {
942
- const table = (this._element = this._selectedTable = dom.query.getParentElement(element, 'TABLE'));
943
- this._figure = dom.query.getParentElement(table, dom.check.isFigure) || table;
1063
+ const table = (this._element = this.#selectedTable = dom.query.getParentElement(element, 'TABLE'));
1064
+ this.#figure = dom.query.getParentElement(table, dom.check.isFigure) || table;
944
1065
  return /** @type {HTMLTableElement} */ (table);
945
1066
  }
946
1067
 
@@ -952,8 +1073,8 @@ class Table extends EditorInjector {
952
1073
  setCellInfo(tdElement, reset) {
953
1074
  const table = this.setTableInfo(tdElement);
954
1075
  if (!table) return;
955
- this._fixedCell = tdElement;
956
- this._trElement = /** @type {HTMLTableRowElement} */ (tdElement.parentNode);
1076
+ this.#fixedCell = tdElement;
1077
+ this.#trElement = /** @type {HTMLTableRowElement} */ (tdElement.parentNode);
957
1078
 
958
1079
  // hedaer
959
1080
  if (table.querySelector('thead')) dom.utils.addClass(this.headerButton, 'active');
@@ -963,15 +1084,15 @@ class Table extends EditorInjector {
963
1084
  if (table.querySelector('caption')) dom.utils.addClass(this.captionButton, 'active');
964
1085
  else dom.utils.removeClass(this.captionButton, 'active');
965
1086
 
966
- if (reset || this._physical_cellCnt === 0) {
967
- if (this._tdElement !== tdElement) {
968
- this._tdElement = tdElement;
969
- this._trElement = /** @type {HTMLTableRowElement} */ (tdElement.parentNode);
1087
+ if (reset || this.#physical_cellCnt === 0) {
1088
+ if (this.#tdElement !== tdElement) {
1089
+ this.#tdElement = tdElement;
1090
+ this.#trElement = /** @type {HTMLTableRowElement} */ (tdElement.parentNode);
970
1091
  }
971
1092
 
972
- if (!this._selectedCells?.length) this._selectedCells = [tdElement];
1093
+ if (!this.#selectedCells?.length) this.#selectedCells = [tdElement];
973
1094
 
974
- const rows = (this._trElements = table.rows);
1095
+ const rows = (this.#trElements = table.rows);
975
1096
  const cellIndex = tdElement.cellIndex;
976
1097
 
977
1098
  let cellCnt = 0;
@@ -980,17 +1101,17 @@ class Table extends EditorInjector {
980
1101
  }
981
1102
 
982
1103
  // row cnt, row index
983
- const rowIndex = (this._rowIndex = this._trElement.rowIndex);
984
- this._rowCnt = rows.length;
1104
+ const rowIndex = (this.#rowIndex = this.#trElement.rowIndex);
1105
+ this.#rowCnt = rows.length;
985
1106
 
986
1107
  // cell cnt, physical cell index
987
- this._physical_cellCnt = this._trElement.cells.length;
988
- this._logical_cellCnt = this._cellCnt = cellCnt;
989
- this._physical_cellIndex = cellIndex;
1108
+ this.#physical_cellCnt = this.#trElement.cells.length;
1109
+ this.#logical_cellCnt = this.#cellCnt = cellCnt;
1110
+ this.#physical_cellIndex = cellIndex;
990
1111
 
991
1112
  // span
992
- this._current_colSpan = this._tdElement.colSpan - 1;
993
- this._current_rowSpan = this._trElement.cells[cellIndex].rowSpan - 1;
1113
+ this.#current_colSpan = this.#tdElement.colSpan - 1;
1114
+ this.#current_rowSpan = this.#trElement.cells[cellIndex].rowSpan - 1;
994
1115
 
995
1116
  // find logcal cell index
996
1117
  let rowSpanArr = [];
@@ -1030,7 +1151,7 @@ class Table extends EditorInjector {
1030
1151
 
1031
1152
  // logcal cell index
1032
1153
  if (i === rowIndex && c === cellIndex) {
1033
- this._logical_cellIndex = logcalIndex;
1154
+ this.#logical_cellIndex = logcalIndex;
1034
1155
  break;
1035
1156
  }
1036
1157
 
@@ -1063,9 +1184,9 @@ class Table extends EditorInjector {
1063
1184
  */
1064
1185
  setRowInfo(trElement) {
1065
1186
  const table = this.setTableInfo(trElement);
1066
- const rows = (this._trElements = table.rows);
1067
- this._rowCnt = rows.length;
1068
- this._rowIndex = trElement.rowIndex;
1187
+ const rows = (this.#trElements = table.rows);
1188
+ this.#rowCnt = rows.length;
1189
+ this.#rowIndex = trElement.rowIndex;
1069
1190
  }
1070
1191
 
1071
1192
  /**
@@ -1078,16 +1199,16 @@ class Table extends EditorInjector {
1078
1199
  const isRow = type === 'row';
1079
1200
 
1080
1201
  if (isRow) {
1081
- const tableAttr = this._trElement.parentElement;
1202
+ const tableAttr = this.#trElement.parentElement;
1082
1203
  if (/^THEAD$/i.test(tableAttr.nodeName)) {
1083
1204
  if (option === 'up') {
1084
1205
  return;
1085
1206
  } else if (!tableAttr.nextElementSibling || !/^TBODY$/i.test(tableAttr.nextElementSibling.nodeName)) {
1086
1207
  if (!option) {
1087
- dom.utils.removeItem(this._figure);
1208
+ dom.utils.removeItem(this.#figure);
1088
1209
  this._closeTableSelectInfo();
1089
1210
  } else {
1090
- table.innerHTML += '<tbody><tr>' + CreateCellsString('td', this._logical_cellCnt) + '</tr></tbody>';
1211
+ table.innerHTML += '<tbody><tr>' + CreateCellsString('td', this.#logical_cellCnt) + '</tr></tbody>';
1091
1212
  }
1092
1213
  return;
1093
1214
  }
@@ -1095,9 +1216,9 @@ class Table extends EditorInjector {
1095
1216
  }
1096
1217
 
1097
1218
  // multi
1098
- if (this._ref) {
1099
- const positionCell = this._tdElement;
1100
- const selectedCells = this._selectedCells;
1219
+ if (this.#ref) {
1220
+ const positionCell = this.#tdElement;
1221
+ const selectedCells = this.#selectedCells;
1101
1222
  // multi - row
1102
1223
  if (isRow) {
1103
1224
  // remove row
@@ -1119,7 +1240,7 @@ class Table extends EditorInjector {
1119
1240
  }
1120
1241
  } else {
1121
1242
  // edit row
1122
- this.setCellInfo(option === 'up' ? selectedCells[0] : selectedCells[selectedCells.length - 1], true);
1243
+ this.setCellInfo(option === 'up' ? selectedCells[0] : selectedCells.at(-1), true);
1123
1244
  this.editRow(option, null, positionCell);
1124
1245
  }
1125
1246
  } else {
@@ -1193,12 +1314,12 @@ class Table extends EditorInjector {
1193
1314
 
1194
1315
  const remove = !option;
1195
1316
  const up = option === 'up';
1196
- const originRowIndex = this._rowIndex;
1197
- const rowIndex = remove || up ? originRowIndex : originRowIndex + this._current_rowSpan + 1;
1317
+ const originRowIndex = this.#rowIndex;
1318
+ const rowIndex = remove || up ? originRowIndex : originRowIndex + this.#current_rowSpan + 1;
1198
1319
  const sign = remove ? -1 : 1;
1199
1320
 
1200
- const rows = this._trElements;
1201
- let cellCnt = this._logical_cellCnt;
1321
+ const rows = this.#trElements;
1322
+ let cellCnt = this.#logical_cellCnt;
1202
1323
 
1203
1324
  for (let i = 0, len = originRowIndex + (remove ? -1 : 0), cell; i <= len; i++) {
1204
1325
  cell = rows[i].cells;
@@ -1269,7 +1390,7 @@ class Table extends EditorInjector {
1269
1390
  }
1270
1391
 
1271
1392
  if (!remove) {
1272
- this._setCellControllerPosition(positionResetElement || this._tdElement, true);
1393
+ this._setCellControllerPosition(positionResetElement || this.#tdElement, true);
1273
1394
  } else {
1274
1395
  this._closeController();
1275
1396
  }
@@ -1290,10 +1411,10 @@ class Table extends EditorInjector {
1290
1411
 
1291
1412
  const remove = !option;
1292
1413
  const left = option === 'left';
1293
- const colSpan = this._current_colSpan;
1294
- const cellIndex = remove || left ? this._logical_cellIndex : this._logical_cellIndex + colSpan + 1;
1414
+ const colSpan = this.#current_colSpan;
1415
+ const cellIndex = remove || left ? this.#logical_cellIndex : this.#logical_cellIndex + colSpan + 1;
1295
1416
 
1296
- const rows = this._trElements;
1417
+ const rows = this.#trElements;
1297
1418
  let rowSpanArr = [];
1298
1419
  let spanIndex = [];
1299
1420
  let passCell = 0;
@@ -1301,7 +1422,7 @@ class Table extends EditorInjector {
1301
1422
  const removeCell = [];
1302
1423
  const removeSpanArr = [];
1303
1424
 
1304
- for (let i = 0, len = this._rowCnt, row, cells, newCell, applySpan, cellColSpan; i < len; i++) {
1425
+ for (let i = 0, len = this.#rowCnt, row, cells, newCell, applySpan, cellColSpan; i < len; i++) {
1305
1426
  row = rows[i];
1306
1427
  insertIndex = cellIndex;
1307
1428
  applySpan = false;
@@ -1436,7 +1557,7 @@ class Table extends EditorInjector {
1436
1557
  row = /** @type {HTMLTableRowElement} */ (removeCell[r].parentNode);
1437
1558
  dom.utils.removeItem(removeCell[r]);
1438
1559
  if (row.cells.length === 0) {
1439
- if (!removeFirst) removeFirst = dom.utils.getArrayIndex(rows, row);
1560
+ removeFirst ||= dom.utils.getArrayIndex(rows, row);
1440
1561
  removeEnd = dom.utils.getArrayIndex(rows, row);
1441
1562
  dom.utils.removeItem(row);
1442
1563
  }
@@ -1449,10 +1570,10 @@ class Table extends EditorInjector {
1449
1570
 
1450
1571
  this._closeController();
1451
1572
  } else {
1452
- this._setCellControllerPosition(positionResetElement || this._tdElement, true);
1573
+ this._setCellControllerPosition(positionResetElement || this.#tdElement, true);
1453
1574
  }
1454
1575
 
1455
- return positionResetElement || this._tdElement;
1576
+ return positionResetElement || this.#tdElement;
1456
1577
  }
1457
1578
 
1458
1579
  /**
@@ -1520,14 +1641,14 @@ class Table extends EditorInjector {
1520
1641
  this.setCellInfo(targetTD, true);
1521
1642
 
1522
1643
  const targetInfo = {
1523
- physicalCellCnt: this._physical_cellCnt,
1524
- logicalCellCnt: this._logical_cellCnt,
1525
- rowCnt: this._rowCnt,
1526
- rowInex: this._rowIndex,
1527
- physicalCellIndex: this._physical_cellIndex,
1528
- logicalCellIndex: this._logical_cellIndex,
1529
- currentColSpan: this._current_colSpan,
1530
- currentRowSpan: this._current_rowSpan
1644
+ physicalCellCnt: this.#physical_cellCnt,
1645
+ logicalCellCnt: this.#logical_cellCnt,
1646
+ rowCnt: this.#rowCnt,
1647
+ rowInex: this.#rowIndex,
1648
+ physicalCellIndex: this.#physical_cellIndex,
1649
+ logicalCellIndex: this.#logical_cellIndex,
1650
+ currentColSpan: this.#current_colSpan,
1651
+ currentRowSpan: this.#current_rowSpan
1531
1652
  };
1532
1653
 
1533
1654
  // --- [expand] target table ---
@@ -1546,7 +1667,7 @@ class Table extends EditorInjector {
1546
1667
  for (let i = 0; i < addColCnt; i++) {
1547
1668
  this.editCell('right', lastCell);
1548
1669
  }
1549
- targetRows = this._trElements = targetTable.rows;
1670
+ targetRows = this.#trElements = targetTable.rows;
1550
1671
  }
1551
1672
 
1552
1673
  // --- [Un_merge] cells ---
@@ -1580,7 +1701,7 @@ class Table extends EditorInjector {
1580
1701
  if (rs > 1 || cs > 1) {
1581
1702
  for (let rsOffset = 1; rsOffset < rs; rsOffset++) {
1582
1703
  const rowIndex = r + rsOffset;
1583
- if (!un_mergeRowSpanMap[rowIndex]) un_mergeRowSpanMap[rowIndex] = [];
1704
+ un_mergeRowSpanMap[rowIndex] ||= [];
1584
1705
  for (let csOffset = 0; csOffset < cs; csOffset++) {
1585
1706
  un_mergeRowSpanMap[rowIndex][logicalIndex + csOffset] = true;
1586
1707
  }
@@ -1598,7 +1719,7 @@ class Table extends EditorInjector {
1598
1719
 
1599
1720
  if (unmergeCells.length > 0) {
1600
1721
  this.unmergeCells(unmergeCells, true);
1601
- targetRows = this._trElements = targetTable.rows;
1722
+ targetRows = this.#trElements = targetTable.rows;
1602
1723
  }
1603
1724
 
1604
1725
  // --- [merge] cells ---
@@ -1621,7 +1742,7 @@ class Table extends EditorInjector {
1621
1742
 
1622
1743
  for (let rsOffset = 1; rsOffset < rs; rsOffset++) {
1623
1744
  const rowIndex = r + rsOffset;
1624
- if (!copyCowSpanMap[rowIndex]) copyCowSpanMap[rowIndex] = [];
1745
+ copyCowSpanMap[rowIndex] ||= [];
1625
1746
  for (let csOffset = 0; csOffset < cs; csOffset++) {
1626
1747
  copyCowSpanMap[rowIndex][copyIndex + csOffset] = true;
1627
1748
  }
@@ -1658,7 +1779,7 @@ class Table extends EditorInjector {
1658
1779
  if (trs > 1) {
1659
1780
  for (let rsOffset = 1; rsOffset < trs; rsOffset++) {
1660
1781
  const rIndex = targetR + rsOffset;
1661
- if (!targetRowSpanMap[rIndex]) targetRowSpanMap[rIndex] = [];
1782
+ targetRowSpanMap[rIndex] ||= [];
1662
1783
  for (let i = 0; i < tcs; i++) {
1663
1784
  targetRowSpanMap[rIndex][logicalIndex + i] = true;
1664
1785
  }
@@ -1683,11 +1804,11 @@ class Table extends EditorInjector {
1683
1804
 
1684
1805
  if (mergeGroups.length > 0) {
1685
1806
  for (const mc of mergeGroups) {
1686
- this._ref = null;
1687
- this._trElements = targetTable.rows;
1807
+ this.#ref = null;
1808
+ this.#trElements = targetTable.rows;
1688
1809
  this.mergeCells(mc, true);
1689
1810
  }
1690
- targetRows = this._trElements = targetTable.rows;
1811
+ targetRows = this.#trElements = targetTable.rows;
1691
1812
  }
1692
1813
 
1693
1814
  // --- [result] paste cell data ---
@@ -1721,7 +1842,7 @@ class Table extends EditorInjector {
1721
1842
  if (trs > 1) {
1722
1843
  for (let rs = 1; rs < trs; rs++) {
1723
1844
  const rr = r + rs;
1724
- if (!rowSpanMap[rr]) rowSpanMap[rr] = [];
1845
+ rowSpanMap[rr] ||= [];
1725
1846
  for (let cs = 0; cs < tcs; cs++) {
1726
1847
  rowSpanMap[rr][tLogicalIndex + cs] = true;
1727
1848
  }
@@ -1745,8 +1866,8 @@ class Table extends EditorInjector {
1745
1866
 
1746
1867
  // select cell
1747
1868
  this.selectCells(selectedCells);
1748
- this._setMergeSplitButton();
1749
- this._setUnMergeButton();
1869
+ this.#setMergeSplitButton();
1870
+ this.#setUnMergeButton();
1750
1871
  this.#focusEdge(selectedCells[0]);
1751
1872
 
1752
1873
  // history push
@@ -1778,10 +1899,10 @@ class Table extends EditorInjector {
1778
1899
 
1779
1900
  this.setTableInfo(cloneTable);
1780
1901
  selectedCells = clonedSelectedCells;
1781
- this._ref = null;
1902
+ this.#ref = null;
1782
1903
  this._setMultiCells(selectedCells[0], dom.query.findVisualLastCell(selectedCells));
1783
1904
 
1784
- const ref = this._ref;
1905
+ const ref = this.#ref;
1785
1906
  const mergeCell = selectedCells[0];
1786
1907
 
1787
1908
  let emptyRowFirst = null;
@@ -1813,7 +1934,7 @@ class Table extends EditorInjector {
1813
1934
  }
1814
1935
 
1815
1936
  if (emptyRowFirst) {
1816
- const rows = this._trElements;
1937
+ const rows = this.#trElements;
1817
1938
  const rowIndexFirst = dom.utils.getArrayIndex(rows, emptyRowFirst);
1818
1939
  const rowIndexLast = dom.utils.getArrayIndex(rows, emptyRowLast || emptyRowFirst);
1819
1940
  const removeRows = [];
@@ -1849,7 +1970,7 @@ class Table extends EditorInjector {
1849
1970
  originTable.replaceWith(cloneTable);
1850
1971
  this._closeTableSelectInfo();
1851
1972
 
1852
- this._setMergeSplitButton();
1973
+ this.#setMergeSplitButton();
1853
1974
  this._setController(mergeCell);
1854
1975
 
1855
1976
  this.#focusEdge(mergeCell);
@@ -1869,7 +1990,7 @@ class Table extends EditorInjector {
1869
1990
  const originTable = selectedCells[0].closest('table');
1870
1991
  const { cloneTable, clonedSelectedCells } = skipPostProcess ? { cloneTable: originTable, clonedSelectedCells: selectedCells } : this.#cloneTable(originTable, selectedCells);
1871
1992
 
1872
- this._ref = null;
1993
+ this.#ref = null;
1873
1994
  this.setTableInfo(cloneTable);
1874
1995
  selectedCells = clonedSelectedCells;
1875
1996
 
@@ -1913,7 +2034,7 @@ class Table extends EditorInjector {
1913
2034
  }
1914
2035
  }
1915
2036
 
1916
- this._selectedCells = null;
2037
+ this.#selectedCells = null;
1917
2038
 
1918
2039
  if (skipPostProcess) return;
1919
2040
 
@@ -1926,16 +2047,16 @@ class Table extends EditorInjector {
1926
2047
  if (firstCell !== lastCell) {
1927
2048
  lastCell = !newLastCell || lastCell.closest('tr').rowIndex > newLastCell.closest('tr').rowIndex || lastCell.cellIndex > newLastCell.cellIndex ? lastCell : newLastCell;
1928
2049
  this._setMultiCells(firstCell, lastCell);
1929
- this._selectedCells = Array.from(table.querySelectorAll('.se-selected-table-cell'));
2050
+ this.#selectedCells = Array.from(table.querySelectorAll('.se-selected-table-cell'));
1930
2051
  } else {
1931
2052
  this.setCellInfo(lastCell, true);
1932
2053
  }
1933
2054
 
1934
- this._fixedCell = firstCell;
1935
- this._selectedCell = lastCell;
2055
+ this.#fixedCell = firstCell;
2056
+ this.#selectedCell = lastCell;
1936
2057
  dom.utils.addClass(lastCell, 'se-selected-cell-focus');
1937
2058
 
1938
- this._setUnMergeButton();
2059
+ this.#setUnMergeButton();
1939
2060
  this.controller_cell.resetPosition(lastCell);
1940
2061
 
1941
2062
  // history push
@@ -1966,7 +2087,7 @@ class Table extends EditorInjector {
1966
2087
 
1967
2088
  if (!active) {
1968
2089
  const header = dom.utils.createElement('THEAD');
1969
- header.innerHTML = '<tr>' + CreateCellsString('th', this._logical_cellCnt) + '</tr>';
2090
+ header.innerHTML = '<tr>' + CreateCellsString('th', this.#logical_cellCnt) + '</tr>';
1970
2091
  table.insertBefore(header, table.firstElementChild);
1971
2092
  } else {
1972
2093
  dom.utils.removeItem(table.querySelector('thead'));
@@ -1974,10 +2095,10 @@ class Table extends EditorInjector {
1974
2095
 
1975
2096
  dom.utils.toggleClass(btn, 'active');
1976
2097
 
1977
- if (/TH/i.test(this._tdElement.nodeName)) {
2098
+ if (/TH/i.test(this.#tdElement.nodeName)) {
1978
2099
  this._closeController();
1979
2100
  } else {
1980
- this._setCellControllerPosition(this._tdElement, false);
2101
+ this._setCellControllerPosition(this.#tdElement, false);
1981
2102
  }
1982
2103
  }
1983
2104
 
@@ -1998,25 +2119,24 @@ class Table extends EditorInjector {
1998
2119
  }
1999
2120
 
2000
2121
  dom.utils.toggleClass(btn, 'active');
2001
- this._setCellControllerPosition(this._tdElement, false);
2122
+ this._setCellControllerPosition(this.#tdElement, false);
2002
2123
  }
2003
2124
 
2004
2125
  /**
2005
- * @private
2006
2126
  * @description Updates table styles.
2007
2127
  * @param {string} styles - Styles to update.
2008
2128
  * @param {boolean} ondisplay - Whether to update display.
2009
2129
  */
2010
- _setTableStyle(styles, ondisplay) {
2130
+ #setTableStyle(styles, ondisplay) {
2011
2131
  if (styles.includes('width')) {
2012
- const targets = this._figure;
2132
+ const targets = this.#figure;
2013
2133
  if (!targets) return;
2014
2134
 
2015
2135
  let sizeIcon, text;
2016
- if (!this._maxWidth) {
2136
+ if (!this.#maxWidth) {
2017
2137
  sizeIcon = this.icons.expansion;
2018
2138
  text = this.maxText;
2019
- if (!ondisplay) targets.style.width = 'min-content';
2139
+ if (!ondisplay) targets.style.width = 'max-content';
2020
2140
  } else {
2021
2141
  sizeIcon = this.icons.reduction;
2022
2142
  text = this.minText;
@@ -2028,7 +2148,7 @@ class Table extends EditorInjector {
2028
2148
  }
2029
2149
 
2030
2150
  if (styles.includes('column')) {
2031
- if (!this._fixedColumn) {
2151
+ if (!this.#fixedColumn) {
2032
2152
  dom.utils.removeClass(this._element, 'se-table-layout-fixed');
2033
2153
  dom.utils.addClass(this._element, 'se-table-layout-auto');
2034
2154
  dom.utils.removeClass(this.columnFixedButton, 'active');
@@ -2041,11 +2161,10 @@ class Table extends EditorInjector {
2041
2161
  }
2042
2162
 
2043
2163
  /**
2044
- * @private
2045
2164
  * @description Sets the merge/split button visibility.
2046
2165
  */
2047
- _setMergeSplitButton() {
2048
- if (!this._ref) {
2166
+ #setMergeSplitButton() {
2167
+ if (!this.#ref) {
2049
2168
  this.splitButton.style.display = 'block';
2050
2169
  this.mergeButton.style.display = 'none';
2051
2170
  } else {
@@ -2055,11 +2174,10 @@ class Table extends EditorInjector {
2055
2174
  }
2056
2175
 
2057
2176
  /**
2058
- * @private
2059
2177
  * @description Sets the unmerge button visibility.
2060
2178
  */
2061
- _setUnMergeButton() {
2062
- if (this.findMergedCells(!this._selectedCells?.length ? [this._fixedCell] : this._selectedCells).length > 0) {
2179
+ #setUnMergeButton() {
2180
+ if (this.findMergedCells(!this.#selectedCells?.length ? [this.#fixedCell] : this.#selectedCells).length > 0) {
2063
2181
  this.unmergeButton.disabled = false;
2064
2182
  } else {
2065
2183
  this.unmergeButton.disabled = true;
@@ -2072,17 +2190,17 @@ class Table extends EditorInjector {
2072
2190
  * @param {HTMLTableCellElement} tdElement - The target table cell.
2073
2191
  */
2074
2192
  _setController(tdElement) {
2075
- if (!this.selection.get().isCollapsed && !this._selectedCell) {
2193
+ if (!this.selection.get().isCollapsed && !this.#selectedCell) {
2076
2194
  this._deleteStyleSelectedCells();
2077
2195
  return;
2078
2196
  }
2079
2197
 
2080
- this._setUnMergeButton();
2198
+ this.#setUnMergeButton();
2081
2199
 
2082
- this._tdElement = tdElement;
2083
- if (this._fixedCell === tdElement) dom.utils.addClass(tdElement, 'se-selected-cell-focus');
2084
- if (!this._selectedCells?.length) this._selectedCells = [tdElement];
2085
- const tableElement = this._selectedTable || this._element || dom.query.getParentElement(tdElement, 'TABLE');
2200
+ this.#tdElement = tdElement;
2201
+ if (this.#fixedCell === tdElement) dom.utils.addClass(tdElement, 'se-selected-cell-focus');
2202
+ if (!this.#selectedCells?.length) this.#selectedCells = [tdElement];
2203
+ const tableElement = this.#selectedTable || this._element || dom.query.getParentElement(tdElement, 'TABLE');
2086
2204
  this.component.select(tableElement, Table.key, { isInput: true });
2087
2205
  }
2088
2206
 
@@ -2094,7 +2212,7 @@ class Table extends EditorInjector {
2094
2212
  */
2095
2213
  _setCellControllerPosition(tdElement, reset) {
2096
2214
  this.setCellInfo(tdElement, reset);
2097
- this.controller_cell.resetPosition(this.cellControllerTop ? dom.query.getParentElement(tdElement, dom.check.isTable) : tdElement);
2215
+ if (!this.cellControllerTop) this.controller_cell.resetPosition(tdElement);
2098
2216
  }
2099
2217
 
2100
2218
  /**
@@ -2113,7 +2231,27 @@ class Table extends EditorInjector {
2113
2231
  * @param {Node} target - The target figure element.
2114
2232
  */
2115
2233
  _figureOpen(target) {
2116
- this.figure.open(target, { nonResizing: true, nonSizeInfo: true, nonBorder: true, figureTarget: true, __fileManagerInfo: false });
2234
+ this.figure.open(target, { nonResizing: true, nonSizeInfo: true, nonBorder: true, figureTarget: true, infoOnly: false });
2235
+ }
2236
+
2237
+ /**
2238
+ * @private
2239
+ * @description Converts the width of <col> elements to percentages.
2240
+ * @param {HTMLTableElement} target - The target table element.
2241
+ */
2242
+ _resizePercentCol(target) {
2243
+ const cols = target.querySelector('colgroup').querySelectorAll('col');
2244
+ const tableTotalWidth = target.offsetWidth;
2245
+
2246
+ cols.forEach((col) => {
2247
+ const colWidthString = col.style.width;
2248
+
2249
+ if (!colWidthString.endsWith('%')) {
2250
+ const pixelWidth = col.offsetWidth || numbers.get(colWidthString, CELL_DECIMAL_END);
2251
+ const percentage = (pixelWidth / tableTotalWidth) * 100;
2252
+ col.style.width = percentage + '%';
2253
+ }
2254
+ });
2117
2255
  }
2118
2256
 
2119
2257
  /**
@@ -2125,12 +2263,13 @@ class Table extends EditorInjector {
2125
2263
  * @param {boolean} isLeftEdge Whether the resizing is on the left edge.
2126
2264
  */
2127
2265
  _startCellResizing(col, startX, startWidth, isLeftEdge) {
2128
- this._setResizeLinePosition(this._figure, this._tdElement, this._resizeLinePrev, isLeftEdge);
2129
- this._resizeLinePrev.style.display = 'block';
2266
+ this._resizePercentCol(this._element);
2267
+ this._setResizeLinePosition(this.#figure, this.#tdElement, this.#resizeLinePrev, isLeftEdge);
2268
+ this.#resizeLinePrev.style.display = 'block';
2130
2269
  const prevValue = col.style.width;
2131
2270
  const nextCol = /** @type {HTMLElement} */ (col.nextElementSibling);
2132
2271
  const nextColPrevValue = nextCol.style.width;
2133
- const realWidth = dom.utils.hasClass(this._element, 'se-table-layout-fixed') ? nextColPrevValue : converter.getWidthInPercentage(col);
2272
+ const realWidth = dom.utils.hasClass(this._element, 'se-table-layout-fixed') ? nextColPrevValue : converter.getWidthInPercentage(nextCol || col);
2134
2273
 
2135
2274
  if (_DragHandle.get('__dragHandler')) _DragHandle.get('__dragHandler').style.display = 'none';
2136
2275
  this._addResizeGlobalEvents(
@@ -2138,9 +2277,9 @@ class Table extends EditorInjector {
2138
2277
  this,
2139
2278
  col,
2140
2279
  nextCol,
2141
- this._figure,
2142
- this._tdElement,
2143
- this._resizeLine,
2280
+ this.#figure,
2281
+ this.#tdElement,
2282
+ this.#resizeLine,
2144
2283
  isLeftEdge,
2145
2284
  startX,
2146
2285
  startWidth,
@@ -2150,6 +2289,7 @@ class Table extends EditorInjector {
2150
2289
  ),
2151
2290
  () => {
2152
2291
  this.__removeGlobalEvents();
2292
+ this._resizePercentCol(this._element);
2153
2293
  this.history.push(true);
2154
2294
  this.component.select(this._element, Table.key, { isInput: true });
2155
2295
  },
@@ -2197,12 +2337,12 @@ class Table extends EditorInjector {
2197
2337
  * @param {number} startHeight The initial height of the row.
2198
2338
  */
2199
2339
  _startRowResizing(row, startY, startHeight) {
2200
- this._setResizeRowPosition(this._figure, row, this._resizeLinePrev);
2201
- this._resizeLinePrev.style.display = 'block';
2340
+ this._setResizeRowPosition(this.#figure, row, this.#resizeLinePrev);
2341
+ this.#resizeLinePrev.style.display = 'block';
2202
2342
  const prevValue = row.style.height;
2203
2343
 
2204
2344
  this._addResizeGlobalEvents(
2205
- this._rowResize.bind(this, row, this._figure, this._resizeLine, startY, startHeight),
2345
+ this._rowResize.bind(this, row, this.#figure, this.#resizeLine, startY, startHeight),
2206
2346
  () => {
2207
2347
  this.__removeGlobalEvents();
2208
2348
  this.history.push(true);
@@ -2235,16 +2375,17 @@ class Table extends EditorInjector {
2235
2375
  * @param {boolean} isLeftEdge Whether the resizing is on the left edge.
2236
2376
  */
2237
2377
  _startFigureResizing(startX, isLeftEdge) {
2238
- const figure = this._figure;
2239
- this._setResizeLinePosition(figure, figure, this._resizeLinePrev, isLeftEdge);
2240
- this._resizeLinePrev.style.display = 'block';
2378
+ const figure = this.#figure;
2379
+ this._setResizeLinePosition(figure, figure, this.#resizeLinePrev, isLeftEdge);
2380
+ this.#resizeLinePrev.style.display = 'block';
2241
2381
  const realWidth = converter.getWidthInPercentage(figure);
2242
2382
 
2243
2383
  if (_DragHandle.get('__dragHandler')) _DragHandle.get('__dragHandler').style.display = 'none';
2244
2384
  this._addResizeGlobalEvents(
2245
- this._figureResize.bind(this, figure, this._resizeLine, isLeftEdge, startX, figure.offsetWidth, numbers.get(realWidth, CELL_DECIMAL_END)),
2385
+ this._figureResize.bind(this, figure, this.#resizeLine, isLeftEdge, startX, figure.offsetWidth, numbers.get(realWidth, CELL_DECIMAL_END)),
2246
2386
  () => {
2247
2387
  this.__removeGlobalEvents();
2388
+ if (numbers.get(figure.style.width, 0) > 100) figure.style.width = '100%';
2248
2389
  // figure reopen
2249
2390
  this.component.select(this._element, Table.key, { isInput: true });
2250
2391
  },
@@ -2328,8 +2469,8 @@ class Table extends EditorInjector {
2328
2469
  * @description Deletes styles from selected table cells.
2329
2470
  */
2330
2471
  _deleteStyleSelectedCells() {
2331
- dom.utils.removeClass([this._fixedCell, this._selectedCell], 'se-selected-cell-focus');
2332
- const table = this._fixedCell?.closest('table');
2472
+ dom.utils.removeClass([this.#fixedCell, this.#selectedCell], 'se-selected-cell-focus');
2473
+ const table = this.#fixedCell?.closest('table');
2333
2474
  if (table) {
2334
2475
  const selectedCells = table.querySelectorAll('.se-selected-table-cell');
2335
2476
  for (let i = 0, len = selectedCells.length; i < len; i++) {
@@ -2343,8 +2484,8 @@ class Table extends EditorInjector {
2343
2484
  * @description Restores styles for selected table cells.
2344
2485
  */
2345
2486
  _recallStyleSelectedCells() {
2346
- if (this._selectedCells) {
2347
- const selectedCells = this._selectedCells;
2487
+ if (this.#selectedCells) {
2488
+ const selectedCells = this.#selectedCells;
2348
2489
  for (let i = 0, len = selectedCells.length; i < len; i++) {
2349
2490
  dom.utils.addClass(selectedCells[i], 'se-selected-table-cell');
2350
2491
  }
@@ -2359,10 +2500,10 @@ class Table extends EditorInjector {
2359
2500
  * @param {(...args: *) => void} keyDownFn The function handling the keydown event.
2360
2501
  */
2361
2502
  _addResizeGlobalEvents(resizeFn, stopFn, keyDownFn) {
2362
- this.__globalEvents.resize = this.eventManager.addGlobalEvent('mousemove', resizeFn, false);
2363
- this.__globalEvents.resizeStop = this.eventManager.addGlobalEvent('mouseup', stopFn, false);
2364
- this.__globalEvents.resizeKeyDown = this.eventManager.addGlobalEvent('keydown', keyDownFn, false);
2365
- this._resizing = true;
2503
+ this.#globalEvents.resize = this.eventManager.addGlobalEvent('mousemove', resizeFn, false);
2504
+ this.#globalEvents.resizeStop = this.eventManager.addGlobalEvent('mouseup', stopFn, false);
2505
+ this.#globalEvents.resizeKeyDown = this.eventManager.addGlobalEvent('keydown', keyDownFn, false);
2506
+ this.#resizing = true;
2366
2507
  }
2367
2508
 
2368
2509
  /**
@@ -2371,7 +2512,7 @@ class Table extends EditorInjector {
2371
2512
  * @param {boolean} enabled Whether to enable or disable the editor.
2372
2513
  */
2373
2514
  _toggleEditor(enabled) {
2374
- const wysiwyg = this.editor.frameContext.get('wysiwyg');
2515
+ const wysiwyg = this.frameContext.get('wysiwyg');
2375
2516
  wysiwyg.setAttribute('contenteditable', enabled.toString());
2376
2517
  if (enabled) dom.utils.removeClass(wysiwyg, 'se-disabled');
2377
2518
  else dom.utils.addClass(wysiwyg, 'se-disabled');
@@ -2385,7 +2526,7 @@ class Table extends EditorInjector {
2385
2526
  _setCtrlProps(type) {
2386
2527
  this._typeCache = type;
2387
2528
  const isTable = type === 'table';
2388
- const targets = isTable ? [this._element] : this._selectedCells;
2529
+ const targets = isTable ? [this._element] : this.#selectedCells;
2389
2530
  if (!targets || targets.length === 0) return;
2390
2531
 
2391
2532
  const { border_format, border_color, border_style, border_width, back_color, font_color, cell_alignment, cell_alignment_vertical, cell_alignment_table_text, font_bold, font_underline, font_italic, font_strike } = this.propTargets;
@@ -2406,10 +2547,11 @@ class Table extends EditorInjector {
2406
2547
  underline = /underline/i.test(textDecoration),
2407
2548
  strike = /line-through/i.test(textDecoration),
2408
2549
  italic = /italic/i.test(fontStyle),
2409
- align = isTable ? this._figure?.style.float : textAlign,
2550
+ align = isTable ? this.#figure?.style.float : textAlign,
2410
2551
  align_v = verticalAlign;
2411
2552
  this._propsCache = [];
2412
2553
 
2554
+ const tempColorStyles = _w.getComputedStyle(this.eventManager.__focusTemp);
2413
2555
  for (let i = 0, t, isBreak; (t = targets[i]); i++) {
2414
2556
  // eslint-disable-next-line no-shadow
2415
2557
  const { cssText, border, backgroundColor, color, textAlign, verticalAlign, fontWeight, textDecoration, fontStyle } = t.style;
@@ -2418,12 +2560,24 @@ class Table extends EditorInjector {
2418
2560
 
2419
2561
  const { c, s, w } = this._getBorderStyle(border);
2420
2562
 
2563
+ // colors
2564
+ let hexBackColor = backgroundColor;
2565
+ let hexColor = color;
2566
+ if (hexBackColor) {
2567
+ this.eventManager.__focusTemp.style.backgroundColor = hexBackColor;
2568
+ hexBackColor = tempColorStyles.backgroundColor;
2569
+ }
2570
+ if (hexColor) {
2571
+ this.eventManager.__focusTemp.style.color = hexColor;
2572
+ hexColor = tempColorStyles.color;
2573
+ }
2574
+
2421
2575
  if (b_color && cellBorder.c !== c) b_color = '';
2422
2576
  if (b_style && cellBorder.s !== s) b_style = '';
2423
2577
  if (b_width && cellBorder.w !== w) b_width = '';
2424
- if (backColor !== converter.rgb2hex(backgroundColor)) backColor = '';
2425
- if (fontColor !== converter.rgb2hex(color)) fontColor = '';
2426
- if (align !== (isTable ? this._figure?.style.float : textAlign)) align = '';
2578
+ if (backColor !== converter.rgb2hex(hexBackColor)) backColor = '';
2579
+ if (fontColor !== converter.rgb2hex(hexColor)) fontColor = '';
2580
+ if (align !== (isTable ? this.#figure?.style.float : textAlign)) align = '';
2427
2581
  if (align_v && align_v !== verticalAlign) align_v = '';
2428
2582
  if (bold && bold !== /.+/.test(fontWeight)) bold = false;
2429
2583
  if (underline && underline !== /underline/i.test(textDecoration)) underline = false;
@@ -2440,7 +2594,7 @@ class Table extends EditorInjector {
2440
2594
  dom.utils.removeClass(border_format, 'active');
2441
2595
 
2442
2596
  // border - styles
2443
- b_style = b_style || BORDER_LIST[0];
2597
+ b_style ||= BORDER_LIST[0];
2444
2598
  border_style.textContent = b_style;
2445
2599
  border_color.style.borderColor = border_color.value = b_color;
2446
2600
  border_width.value = b_width;
@@ -2548,7 +2702,7 @@ class Table extends EditorInjector {
2548
2702
  target.disabled = true;
2549
2703
 
2550
2704
  const isTable = this.controller_table.form.contains(this.controller_props.currentTarget);
2551
- const targets = isTable ? [this._element] : this._selectedCells;
2705
+ const targets = isTable ? [this._element] : this.#selectedCells;
2552
2706
  const tr = /** @type {HTMLTableCellElement} */ (targets[0]);
2553
2707
  const trStyles = _w.getComputedStyle(tr);
2554
2708
  const { border_format, border_color, border_style, border_width, back_color, font_color, cell_alignment, cell_alignment_vertical } = this.propTargets;
@@ -2579,7 +2733,7 @@ class Table extends EditorInjector {
2579
2733
  if (!isTable) {
2580
2734
  const trRow = /** @type {HTMLTableRowElement} */ (tr.parentElement);
2581
2735
  // --- target cells roof
2582
- let { rs, re, cs, ce } = this._ref || {
2736
+ let { rs, re, cs, ce } = this.#ref || {
2583
2737
  rs: trRow.rowIndex || 0,
2584
2738
  re: trRow.rowIndex || 0,
2585
2739
  cs: tr.cellIndex || 0,
@@ -2610,7 +2764,6 @@ class Table extends EditorInjector {
2610
2764
  c++;
2611
2765
  }
2612
2766
 
2613
- /* eslint-disable @typescript-eslint/no-unused-vars */
2614
2767
  try {
2615
2768
  if (rowspan > 1) {
2616
2769
  const rowspanNum = rowspan - 1;
@@ -2620,10 +2773,9 @@ class Table extends EditorInjector {
2620
2773
  } else if (colspan > 1) {
2621
2774
  mergeInfo[rowIndex][cellIndex] += colspan - 1;
2622
2775
  }
2623
- } catch (err) {
2776
+ } catch {
2624
2777
  // ignore error
2625
2778
  }
2626
- /* eslint-disable @typescript-eslint/no-unused-vars */
2627
2779
 
2628
2780
  const isBottom = rowIndex + rowspan - 1 === re;
2629
2781
  if (rowIndex === rs) cells.top.push(e);
@@ -2660,9 +2812,9 @@ class Table extends EditorInjector {
2660
2812
  // -- table styles
2661
2813
  const es = tr.style;
2662
2814
  // alignment
2663
- if (this._figure) {
2664
- this._figure.style.float = cellAlignment;
2665
- this._figure.style.verticalAlign = cellAlignmentVertical;
2815
+ if (this.#figure) {
2816
+ this.#figure.style.float = cellAlignment;
2817
+ this.#figure.style.verticalAlign = cellAlignmentVertical;
2666
2818
  }
2667
2819
  // back
2668
2820
  es.backgroundColor = backColor;
@@ -2694,10 +2846,10 @@ class Table extends EditorInjector {
2694
2846
 
2695
2847
  // set cells style
2696
2848
  this.controller_props.close();
2697
- if (this._tdElement) {
2849
+ if (this.#tdElement) {
2698
2850
  this._recallStyleSelectedCells();
2699
- this.setCellInfo(this._tdElement, true);
2700
- dom.utils.addClass(this._tdElement, 'se-selected-cell-focus');
2851
+ this.setCellInfo(this.#tdElement, true);
2852
+ dom.utils.addClass(this.#tdElement, 'se-selected-cell-focus');
2701
2853
  }
2702
2854
  } catch (err) {
2703
2855
  console.warn('[SUNEDITOR.plugins.table.setProps.error]', err);
@@ -2785,19 +2937,19 @@ class Table extends EditorInjector {
2785
2937
  * @param {Node} endCell The last cell in the selection.
2786
2938
  */
2787
2939
  _setMultiCells(startCell, endCell) {
2788
- const rows = this._selectedTable.rows;
2940
+ const rows = this.#selectedTable.rows;
2789
2941
  this._deleteStyleSelectedCells();
2790
2942
 
2791
2943
  dom.utils.addClass(startCell, 'se-selected-table-cell');
2792
2944
 
2793
2945
  if (startCell === endCell) {
2794
- if (!this._shift) return;
2946
+ if (!this.#shift) return;
2795
2947
  }
2796
2948
 
2797
2949
  let findSelectedCell = true;
2798
2950
  let spanIndex = [];
2799
2951
  let rowSpanArr = [];
2800
- const ref = (this._ref = { _i: 0, cs: null, ce: null, rs: null, re: null });
2952
+ const ref = (this.#ref = { _i: 0, cs: null, ce: null, rs: null, re: null });
2801
2953
 
2802
2954
  for (let i = 0, len = rows.length, cells, colSpan; i < len; i++) {
2803
2955
  cells = rows[i].cells;
@@ -2963,9 +3115,9 @@ class Table extends EditorInjector {
2963
3115
  * @description Hides the resize line if it is visible.
2964
3116
  */
2965
3117
  __hideResizeLine() {
2966
- if (this._resizeLine) {
2967
- this._resizeLine.style.display = 'none';
2968
- this._resizeLine = null;
3118
+ if (this.#resizeLine) {
3119
+ this.#resizeLine.style.display = 'none';
3120
+ this.#resizeLine = null;
2969
3121
  }
2970
3122
  }
2971
3123
 
@@ -2975,16 +3127,16 @@ class Table extends EditorInjector {
2975
3127
  */
2976
3128
  __removeGlobalEvents() {
2977
3129
  this._toggleEditor(true);
2978
- this._resizing = false;
3130
+ this.#resizing = false;
2979
3131
  this.ui.disableBackWrapper();
2980
3132
  this.__hideResizeLine();
2981
- if (this._resizeLinePrev) {
2982
- this._resizeLinePrev.style.display = 'none';
2983
- this._resizeLinePrev = null;
3133
+ if (this.#resizeLinePrev) {
3134
+ this.#resizeLinePrev.style.display = 'none';
3135
+ this.#resizeLinePrev = null;
2984
3136
  }
2985
- const globalEvents = this.__globalEvents;
3137
+ const globalEvents = this.#globalEvents;
2986
3138
  for (const k in globalEvents) {
2987
- if (globalEvents[k]) globalEvents[k] = this.eventManager.removeGlobalEvent(globalEvents[k]);
3139
+ globalEvents[k] &&= this.eventManager.removeGlobalEvent(globalEvents[k]);
2988
3140
  }
2989
3141
  }
2990
3142
 
@@ -3023,27 +3175,27 @@ class Table extends EditorInjector {
3023
3175
  * If `true`, the selection will extend to include adjacent cells, otherwise it selects only the provided cell.
3024
3176
  */
3025
3177
  #StyleSelectCells(tdElement, shift) {
3026
- this.__s = shift;
3027
- if (!this._shift && !this._ref) this.__removeGlobalEvents();
3178
+ this.#_s = shift;
3179
+ if (!this.#shift && !this.#ref) this.__removeGlobalEvents();
3028
3180
 
3029
- this._shift = shift;
3030
- this._fixedCell = tdElement;
3031
- if (!this._selectedCells?.length) this._selectedCells = [tdElement];
3032
- this._fixedCellName = tdElement.nodeName;
3033
- this._selectedTable = dom.query.getParentElement(tdElement, 'TABLE');
3181
+ this.#shift = shift;
3182
+ this.#fixedCell = tdElement;
3183
+ if (!this.#selectedCells?.length) this.#selectedCells = [tdElement];
3184
+ this.#fixedCellName = tdElement.nodeName;
3185
+ this.#selectedTable = dom.query.getParentElement(tdElement, 'TABLE');
3034
3186
 
3035
3187
  this._deleteStyleSelectedCells();
3036
3188
  dom.utils.addClass(tdElement, 'se-selected-cell-focus');
3037
3189
 
3038
3190
  if (!shift) {
3039
- this.__globalEvents.on = this.eventManager.addGlobalEvent('mousemove', this._bindMultiOn, false);
3191
+ this.#globalEvents.on = this.eventManager.addGlobalEvent('mousemove', this.#bindMultiOn, false);
3040
3192
  } else {
3041
- this.__globalEvents.shiftOff = this.eventManager.addGlobalEvent('keyup', this._bindShiftOff, false);
3042
- this.__globalEvents.on = this.eventManager.addGlobalEvent('mousedown', this._bindMultiOn, false);
3193
+ this.#globalEvents.shiftOff = this.eventManager.addGlobalEvent('keyup', this.#bindShiftOff, false);
3194
+ this.#globalEvents.on = this.eventManager.addGlobalEvent('mousedown', this.#bindMultiOn, false);
3043
3195
  }
3044
3196
 
3045
- this.__globalEvents.off = this.eventManager.addGlobalEvent('mouseup', this._bindMultiOff, false);
3046
- this.__globalEvents.touchOff = this.eventManager.addGlobalEvent('touchmove', this._bindTouchOff, false);
3197
+ this.#globalEvents.off = this.eventManager.addGlobalEvent('mouseup', this.#bindMultiOff, false);
3198
+ this.#globalEvents.touchOff = this.eventManager.addGlobalEvent('touchmove', this.#bindTouchOff, false);
3047
3199
  }
3048
3200
 
3049
3201
  /**
@@ -3052,11 +3204,11 @@ class Table extends EditorInjector {
3052
3204
  */
3053
3205
  #OnSplitCells(direction) {
3054
3206
  const vertical = direction === 'vertical';
3055
- const currentCell = this._tdElement;
3056
- const rows = this._trElements;
3057
- const currentRow = this._trElement;
3058
- const index = this._logical_cellIndex;
3059
- const rowIndex = this._rowIndex;
3207
+ const currentCell = this.#tdElement;
3208
+ const rows = this.#trElements;
3209
+ const currentRow = this.#trElement;
3210
+ const index = this.#logical_cellIndex;
3211
+ const rowIndex = this.#rowIndex;
3060
3212
  const newCell = CreateCellsHTML(currentCell.nodeName);
3061
3213
 
3062
3214
  // vertical
@@ -3074,7 +3226,7 @@ class Table extends EditorInjector {
3074
3226
  let rowSpanArr = [];
3075
3227
  let spanIndex = [];
3076
3228
 
3077
- for (let i = 0, len = this._rowCnt, cells, colSpan; i < len; i++) {
3229
+ for (let i = 0, len = this.#rowCnt, cells, colSpan; i < len; i++) {
3078
3230
  cells = rows[i].cells;
3079
3231
  colSpan = 0;
3080
3232
  for (let c = 0, cLen = cells.length, cell, cs, rs, logcalIndex; c < cLen; c++) {
@@ -3208,7 +3360,7 @@ class Table extends EditorInjector {
3208
3360
  }
3209
3361
  }
3210
3362
 
3211
- const physicalIndex = this._physical_cellIndex;
3363
+ const physicalIndex = this.#physical_cellIndex;
3212
3364
  const cells = currentRow.cells;
3213
3365
 
3214
3366
  for (let c = 0, cLen = cells.length; c < cLen; c++) {
@@ -3227,8 +3379,8 @@ class Table extends EditorInjector {
3227
3379
  this.history.push(false);
3228
3380
 
3229
3381
  this._setController(currentCell);
3230
- this._selectedCell = this._fixedCell = currentCell;
3231
- if (!this._selectedCells?.length) this._selectedCells = [currentCell];
3382
+ this.#selectedCell = this.#fixedCell = currentCell;
3383
+ if (!this.#selectedCells?.length) this.#selectedCells = [currentCell];
3232
3384
  }
3233
3385
 
3234
3386
  /**
@@ -3295,7 +3447,7 @@ class Table extends EditorInjector {
3295
3447
  this.tableUnHighlight.style.height = y_u + 'em';
3296
3448
 
3297
3449
  dom.utils.changeTxt(this.tableDisplay, x + ' x ' + y);
3298
- this._tableXY = [x, y];
3450
+ this.#tableXY = [x, y];
3299
3451
  }
3300
3452
 
3301
3453
  /**
@@ -3313,9 +3465,9 @@ class Table extends EditorInjector {
3313
3465
  this.editor._preventBlur = true;
3314
3466
  const target = /** @type {HTMLTableCellElement} */ (dom.query.getParentElement(dom.query.getEventTarget(e), dom.check.isTableCell));
3315
3467
 
3316
- if (this._shift) {
3317
- if (target === this._fixedCell) {
3318
- this._shift = false;
3468
+ if (this.#shift) {
3469
+ if (target === this.#fixedCell) {
3470
+ this.#shift = false;
3319
3471
  this._deleteStyleSelectedCells();
3320
3472
  this._toggleEditor(true);
3321
3473
  this.__removeGlobalEvents();
@@ -3323,16 +3475,16 @@ class Table extends EditorInjector {
3323
3475
  } else {
3324
3476
  this._toggleEditor(false);
3325
3477
  }
3326
- } else if (!this._ref) {
3327
- if (target === this._fixedCell) return;
3478
+ } else if (!this.#ref) {
3479
+ if (target === this.#fixedCell) return;
3328
3480
  else this._toggleEditor(false);
3329
3481
  }
3330
3482
 
3331
- if (!target || target === this._selectedCell || this._fixedCellName !== target.nodeName || this._selectedTable !== dom.query.getParentElement(target, 'TABLE')) {
3483
+ if (!target || target === this.#selectedCell || this.#fixedCellName !== target.nodeName || this.#selectedTable !== dom.query.getParentElement(target, 'TABLE')) {
3332
3484
  return;
3333
3485
  }
3334
3486
 
3335
- this._setMultiCells(this._fixedCell, (this._selectedCell = target));
3487
+ this._setMultiCells(this.#fixedCell, (this.#selectedCell = target));
3336
3488
  }
3337
3489
 
3338
3490
  /**
@@ -3342,28 +3494,28 @@ class Table extends EditorInjector {
3342
3494
  #OffCellMultiSelect(e) {
3343
3495
  e.stopPropagation();
3344
3496
 
3345
- if (!this._shift) {
3497
+ if (!this.#shift) {
3346
3498
  this._toggleEditor(true);
3347
3499
  this.__removeGlobalEvents();
3348
- } else if (this.__globalEvents.touchOff) {
3349
- this.__globalEvents.touchOff = this.eventManager.removeGlobalEvent(this.__globalEvents.touchOff);
3500
+ } else {
3501
+ this.#globalEvents.touchOff &&= this.eventManager.removeGlobalEvent(this.#globalEvents.touchOff);
3350
3502
  }
3351
3503
 
3352
- if (!this._fixedCell || !this._selectedTable) return;
3504
+ if (!this.#fixedCell || !this.#selectedTable) return;
3353
3505
 
3354
- this._setMergeSplitButton();
3355
- this._selectedCells = Array.from(this._selectedTable.querySelectorAll('.se-selected-table-cell'));
3506
+ this.#setMergeSplitButton();
3507
+ this.#selectedCells = Array.from(this.#selectedTable.querySelectorAll('.se-selected-table-cell'));
3356
3508
 
3357
- if (this._shift) return;
3509
+ if (this.#shift) return;
3358
3510
 
3359
- if (this._fixedCell && this._selectedCell) {
3360
- this.#focusEdge(this._fixedCell);
3361
- if (this._fixedCell === this._selectedCell) {
3362
- dom.utils.removeClass(this._fixedCell, 'se-selected-table-cell');
3511
+ if (this.#fixedCell && this.#selectedCell) {
3512
+ this.#focusEdge(this.#fixedCell);
3513
+ if (this.#fixedCell === this.#selectedCell) {
3514
+ dom.utils.removeClass(this.#fixedCell, 'se-selected-table-cell');
3363
3515
  }
3364
3516
  }
3365
3517
 
3366
- const displayCell = this._selectedCells?.length > 0 ? this._selectedCell : this._fixedCell;
3518
+ const displayCell = this.#selectedCells?.length > 0 ? this.#selectedCell : this.#fixedCell;
3367
3519
  this._setController(displayCell);
3368
3520
  }
3369
3521
 
@@ -3371,15 +3523,15 @@ class Table extends EditorInjector {
3371
3523
  * @description Handles the removal of shift-based selection.
3372
3524
  */
3373
3525
  #OffCellShift() {
3374
- if (!this._ref) {
3526
+ if (!this.#ref) {
3375
3527
  this._closeController();
3376
3528
  } else {
3377
3529
  this.__removeGlobalEvents();
3378
3530
  this._toggleEditor(true);
3379
3531
 
3380
- this.#focusEdge(this._fixedCell);
3532
+ this.#focusEdge(this.#fixedCell);
3381
3533
 
3382
- const displayCell = this._selectedCells?.length > 0 ? this._selectedCell : this._fixedCell;
3534
+ const displayCell = this.#selectedCells?.length > 0 ? this.#selectedCell : this.#fixedCell;
3383
3535
  this._setController(displayCell);
3384
3536
  }
3385
3537
  }