@ckeditor/ckeditor5-table 37.0.0-alpha.0 → 37.0.0-alpha.2

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 (73) hide show
  1. package/README.md +1 -1
  2. package/build/table.js +1 -1
  3. package/ckeditor5-metadata.json +6 -6
  4. package/package.json +27 -27
  5. package/src/augmentation.d.ts +76 -0
  6. package/src/augmentation.js +5 -0
  7. package/src/commands/insertcolumncommand.d.ts +0 -6
  8. package/src/commands/insertrowcommand.d.ts +0 -6
  9. package/src/commands/inserttablecommand.d.ts +0 -6
  10. package/src/commands/inserttablecommand.js +0 -1
  11. package/src/commands/mergecellcommand.d.ts +0 -8
  12. package/src/commands/mergecellscommand.d.ts +0 -5
  13. package/src/commands/removecolumncommand.d.ts +0 -5
  14. package/src/commands/removerowcommand.d.ts +0 -5
  15. package/src/commands/selectcolumncommand.d.ts +0 -5
  16. package/src/commands/selectrowcommand.d.ts +0 -5
  17. package/src/commands/setheadercolumncommand.d.ts +0 -5
  18. package/src/commands/setheaderrowcommand.d.ts +0 -5
  19. package/src/commands/splitcellcommand.d.ts +0 -6
  20. package/src/converters/table-cell-refresh-handler.d.ts +1 -1
  21. package/src/converters/table-headings-refresh-handler.d.ts +1 -1
  22. package/src/converters/tableproperties.d.ts +1 -1
  23. package/src/converters/upcasttable.js +28 -25
  24. package/src/index.d.ts +31 -0
  25. package/src/index.js +1 -0
  26. package/src/plaintableoutput.d.ts +0 -5
  27. package/src/table.d.ts +0 -5
  28. package/src/tablecaption/tablecaptionediting.d.ts +0 -5
  29. package/src/tablecaption/tablecaptionui.d.ts +0 -5
  30. package/src/tablecaption/toggletablecaptioncommand.d.ts +0 -5
  31. package/src/tablecaption.d.ts +0 -5
  32. package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +0 -5
  33. package/src/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +0 -5
  34. package/src/tablecellproperties/commands/tablecellborderstylecommand.d.ts +0 -5
  35. package/src/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +0 -5
  36. package/src/tablecellproperties/commands/tablecellheightcommand.d.ts +0 -5
  37. package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +0 -5
  38. package/src/tablecellproperties/commands/tablecellpaddingcommand.d.ts +0 -5
  39. package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +0 -5
  40. package/src/tablecellproperties/tablecellpropertiesediting.d.ts +0 -6
  41. package/src/tablecellproperties/tablecellpropertiesediting.js +0 -1
  42. package/src/tablecellproperties/tablecellpropertiesui.d.ts +0 -6
  43. package/src/tablecellproperties/tablecellpropertiesui.js +0 -1
  44. package/src/tablecellproperties.d.ts +0 -5
  45. package/src/tablecellwidth/commands/tablecellwidthcommand.d.ts +1 -6
  46. package/src/tablecellwidth/tablecellwidthediting.d.ts +0 -6
  47. package/src/tablecellwidth/tablecellwidthediting.js +0 -1
  48. package/src/tableclipboard.d.ts +0 -5
  49. package/src/tablecolumnresize/tablecolumnresizeediting.d.ts +0 -5
  50. package/src/tablecolumnresize.d.ts +0 -5
  51. package/src/tableconfig.d.ts +2 -12
  52. package/src/tableediting.d.ts +0 -5
  53. package/src/tablekeyboard.d.ts +0 -5
  54. package/src/tablemouse/mouseeventsobserver.d.ts +9 -9
  55. package/src/tablemouse/mouseeventsobserver.js +1 -1
  56. package/src/tablemouse.d.ts +0 -5
  57. package/src/tableproperties/commands/tablealignmentcommand.d.ts +0 -5
  58. package/src/tableproperties/commands/tablebackgroundcolorcommand.d.ts +0 -5
  59. package/src/tableproperties/commands/tablebordercolorcommand.d.ts +0 -5
  60. package/src/tableproperties/commands/tableborderstylecommand.d.ts +0 -5
  61. package/src/tableproperties/commands/tableborderwidthcommand.d.ts +0 -5
  62. package/src/tableproperties/commands/tableheightcommand.d.ts +0 -5
  63. package/src/tableproperties/commands/tablewidthcommand.d.ts +0 -5
  64. package/src/tableproperties/tablepropertiesediting.d.ts +0 -6
  65. package/src/tableproperties/tablepropertiesediting.js +0 -1
  66. package/src/tableproperties/tablepropertiesui.d.ts +0 -6
  67. package/src/tableproperties/tablepropertiesui.js +0 -1
  68. package/src/tableproperties.d.ts +0 -5
  69. package/src/tableselection.d.ts +0 -5
  70. package/src/tabletoolbar.d.ts +0 -6
  71. package/src/tabletoolbar.js +0 -1
  72. package/src/tableui.d.ts +0 -5
  73. package/src/tableutils.d.ts +0 -5
@@ -4,7 +4,7 @@
4
4
  "name": "Table",
5
5
  "className": "Table",
6
6
  "description": "Adds table creation and editing tools that help content authors bring tabular data into their documents.",
7
- "docs": "features/table.html",
7
+ "docs": "features/tables/tables.html",
8
8
  "path": "src/table.js",
9
9
  "uiComponents": [
10
10
  {
@@ -66,7 +66,7 @@
66
66
  "name": "Table cell properties",
67
67
  "className": "TableCellProperties",
68
68
  "description": "Adds the ability to style individual table cells.",
69
- "docs": "features/table.html#table-and-cell-styling-tools",
69
+ "docs": "features/tables/tables-styling.html",
70
70
  "path": "src/tablecellproperties",
71
71
  "requires": [
72
72
  "Table",
@@ -105,7 +105,7 @@
105
105
  "name": "Table properties",
106
106
  "className": "TableProperties",
107
107
  "description": "Adds the ability to style entire tables.",
108
- "docs": "features/table.html#table-and-cell-styling-tools",
108
+ "docs": "features/tables/tables-styling.html",
109
109
  "path": "src/tableproperties",
110
110
  "requires": [
111
111
  "Table",
@@ -144,7 +144,7 @@
144
144
  "name": "Table toolbar",
145
145
  "className": "TableToolbar",
146
146
  "description": "Creates configurable toolbars for both the table feature and table content. They show up when the table widget or the content inside a table cell are selected.",
147
- "docs": "features/table.html#toolbars",
147
+ "docs": "features/tables/tables.html#toolbars",
148
148
  "path": "src/tabletoolbar.js",
149
149
  "requires": [
150
150
  "Table"
@@ -158,7 +158,7 @@
158
158
  "name": "Table caption",
159
159
  "className": "TableCaption",
160
160
  "description": "Adds support for table captions, which inform the reader about the content of the table. Using captions is also beneficial from the accessibility point of view.",
161
- "docs": "features/table.html#table-caption",
161
+ "docs": "features/tables/tables-caption.html",
162
162
  "path": "src/tablecaption.js",
163
163
  "requires": [
164
164
  "Table"
@@ -174,7 +174,7 @@
174
174
  "name": "Table column resize",
175
175
  "className": "TableColumnResize",
176
176
  "description": "Adds support for table column resize, which allows to set the width of each column in a table using a resize handle.",
177
- "docs": "features/table.html#table-column-resize",
177
+ "docs": "features/tables/tables-resize.html",
178
178
  "path": "src/tablecolumnresize.js",
179
179
  "requires": [
180
180
  "Table"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-table",
3
- "version": "37.0.0-alpha.0",
3
+ "version": "37.0.0-alpha.2",
4
4
  "description": "Table feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,34 +12,34 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "^37.0.0-alpha.0",
15
+ "ckeditor5": "^37.0.0-alpha.2",
16
16
  "lodash-es": "^4.17.15"
17
17
  },
18
18
  "devDependencies": {
19
- "@ckeditor/ckeditor5-alignment": "^37.0.0-alpha.0",
20
- "@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.0",
21
- "@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.0",
22
- "@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.0",
23
- "@ckeditor/ckeditor5-core": "^37.0.0-alpha.0",
24
- "@ckeditor/ckeditor5-dev-utils": "^34.0.0",
25
- "@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.0",
26
- "@ckeditor/ckeditor5-engine": "^37.0.0-alpha.0",
27
- "@ckeditor/ckeditor5-highlight": "^37.0.0-alpha.0",
28
- "@ckeditor/ckeditor5-horizontal-line": "^37.0.0-alpha.0",
29
- "@ckeditor/ckeditor5-html-support": "^37.0.0-alpha.0",
30
- "@ckeditor/ckeditor5-image": "^37.0.0-alpha.0",
31
- "@ckeditor/ckeditor5-indent": "^37.0.0-alpha.0",
32
- "@ckeditor/ckeditor5-link": "^37.0.0-alpha.0",
33
- "@ckeditor/ckeditor5-list": "^37.0.0-alpha.0",
34
- "@ckeditor/ckeditor5-media-embed": "^37.0.0-alpha.0",
35
- "@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.0",
36
- "@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.0",
37
- "@ckeditor/ckeditor5-typing": "^37.0.0-alpha.0",
38
- "@ckeditor/ckeditor5-ui": "^37.0.0-alpha.0",
39
- "@ckeditor/ckeditor5-undo": "^37.0.0-alpha.0",
40
- "@ckeditor/ckeditor5-utils": "^37.0.0-alpha.0",
41
- "@ckeditor/ckeditor5-widget": "^37.0.0-alpha.0",
42
- "@ckeditor/ckeditor5-source-editing": "^37.0.0-alpha.0",
19
+ "@ckeditor/ckeditor5-alignment": "^37.0.0-alpha.2",
20
+ "@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.2",
21
+ "@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.2",
22
+ "@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.2",
23
+ "@ckeditor/ckeditor5-core": "^37.0.0-alpha.2",
24
+ "@ckeditor/ckeditor5-dev-utils": "^35.0.0",
25
+ "@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.2",
26
+ "@ckeditor/ckeditor5-engine": "^37.0.0-alpha.2",
27
+ "@ckeditor/ckeditor5-highlight": "^37.0.0-alpha.2",
28
+ "@ckeditor/ckeditor5-horizontal-line": "^37.0.0-alpha.2",
29
+ "@ckeditor/ckeditor5-html-support": "^37.0.0-alpha.2",
30
+ "@ckeditor/ckeditor5-image": "^37.0.0-alpha.2",
31
+ "@ckeditor/ckeditor5-indent": "^37.0.0-alpha.2",
32
+ "@ckeditor/ckeditor5-link": "^37.0.0-alpha.2",
33
+ "@ckeditor/ckeditor5-list": "^37.0.0-alpha.2",
34
+ "@ckeditor/ckeditor5-media-embed": "^37.0.0-alpha.2",
35
+ "@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.2",
36
+ "@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.2",
37
+ "@ckeditor/ckeditor5-typing": "^37.0.0-alpha.2",
38
+ "@ckeditor/ckeditor5-ui": "^37.0.0-alpha.2",
39
+ "@ckeditor/ckeditor5-undo": "^37.0.0-alpha.2",
40
+ "@ckeditor/ckeditor5-utils": "^37.0.0-alpha.2",
41
+ "@ckeditor/ckeditor5-widget": "^37.0.0-alpha.2",
42
+ "@ckeditor/ckeditor5-source-editing": "^37.0.0-alpha.2",
43
43
  "json-diff": "^0.5.4",
44
44
  "typescript": "^4.8.4",
45
45
  "webpack": "^5.58.1",
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "scripts": {
71
71
  "dll:build": "webpack",
72
- "build": "tsc -p ./tsconfig.release.json",
72
+ "build": "tsc -p ./tsconfig.json",
73
73
  "postversion": "npm run build"
74
74
  },
75
75
  "types": "src/index.d.ts"
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import type { TableConfig, Table, TableCaption, TableCaptionEditing, TableCaptionUI, TableCellProperties, TableCellPropertiesEditing, TableCellPropertiesUI, TableCellWidthEditing, TableClipboard, TableColumnResize, TableColumnResizeEditing, TableEditing, TableKeyboard, TableMouse, TableProperties, TablePropertiesEditing, TablePropertiesUI, TableSelection, TableToolbar, TableUI, TableUtils, PlainTableOutput, InsertColumnCommand, InsertRowCommand, InsertTableCommand, MergeCellCommand, MergeCellsCommand, RemoveColumnCommand, RemoveRowCommand, SelectColumnCommand, SelectRowCommand, SetHeaderColumnCommand, SetHeaderRowCommand, SplitCellCommand, ToggleTableCaptionCommand, TableCellBackgroundColorCommand, TableCellBorderColorCommand, TableCellBorderStyleCommand, TableCellBorderWidthCommand, TableCellHeightCommand, TableCellHorizontalAlignmentCommand, TableCellPaddingCommand, TableCellVerticalAlignmentCommand, TableCellWidthCommand, TableAlignmentCommand, TableBackgroundColorCommand, TableBorderColorCommand, TableBorderStyleCommand, TableBorderWidthCommand, TableHeightCommand, TableWidthCommand } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface EditorConfig {
8
+ /**
9
+ * The configuration of the {@link module:table/table~Table} feature.
10
+ *
11
+ * Read more in {@link module:table/tableconfig~TableConfig}.
12
+ */
13
+ table?: TableConfig;
14
+ }
15
+ interface PluginsMap {
16
+ [Table.pluginName]: Table;
17
+ [TableCaption.pluginName]: TableCaption;
18
+ [TableCaptionEditing.pluginName]: TableCaptionEditing;
19
+ [TableCaptionUI.pluginName]: TableCaptionUI;
20
+ [TableCellProperties.pluginName]: TableCellProperties;
21
+ [TableCellPropertiesEditing.pluginName]: TableCellPropertiesEditing;
22
+ [TableCellPropertiesUI.pluginName]: TableCellPropertiesUI;
23
+ [TableCellWidthEditing.pluginName]: TableCellWidthEditing;
24
+ [TableClipboard.pluginName]: TableClipboard;
25
+ [TableColumnResize.pluginName]: TableColumnResize;
26
+ [TableColumnResizeEditing.pluginName]: TableColumnResizeEditing;
27
+ [TableEditing.pluginName]: TableEditing;
28
+ [TableKeyboard.pluginName]: TableKeyboard;
29
+ [TableMouse.pluginName]: TableMouse;
30
+ [TableProperties.pluginName]: TableProperties;
31
+ [TablePropertiesEditing.pluginName]: TablePropertiesEditing;
32
+ [TablePropertiesUI.pluginName]: TablePropertiesUI;
33
+ [TableSelection.pluginName]: TableSelection;
34
+ [TableToolbar.pluginName]: TableToolbar;
35
+ [TableUI.pluginName]: TableUI;
36
+ [TableUtils.pluginName]: TableUtils;
37
+ [PlainTableOutput.pluginName]: PlainTableOutput;
38
+ }
39
+ interface CommandsMap {
40
+ insertTableColumnLeft: InsertColumnCommand;
41
+ insertTableColumnRight: InsertColumnCommand;
42
+ insertTableRowAbove: InsertRowCommand;
43
+ insertTableRowBelow: InsertRowCommand;
44
+ insertTable: InsertTableCommand;
45
+ mergeTableCellRight: MergeCellCommand;
46
+ mergeTableCellLeft: MergeCellCommand;
47
+ mergeTableCellDown: MergeCellCommand;
48
+ mergeTableCellUp: MergeCellCommand;
49
+ mergeTableCells: MergeCellsCommand;
50
+ removeTableColumn: RemoveColumnCommand;
51
+ removeTableRow: RemoveRowCommand;
52
+ selectTableColumn: SelectColumnCommand;
53
+ selectTableRow: SelectRowCommand;
54
+ setTableColumnHeader: SetHeaderColumnCommand;
55
+ setTableRowHeader: SetHeaderRowCommand;
56
+ splitTableCellVertically: SplitCellCommand;
57
+ splitTableCellHorizontally: SplitCellCommand;
58
+ toggleTableCaption: ToggleTableCaptionCommand;
59
+ tableCellBackgroundColor: TableCellBackgroundColorCommand;
60
+ tableCellBorderColor: TableCellBorderColorCommand;
61
+ tableCellBorderStyle: TableCellBorderStyleCommand;
62
+ tableCellBorderWidth: TableCellBorderWidthCommand;
63
+ tableCellHeight: TableCellHeightCommand;
64
+ tableCellHorizontalAlignment: TableCellHorizontalAlignmentCommand;
65
+ tableCellPadding: TableCellPaddingCommand;
66
+ tableCellVerticalAlignment: TableCellVerticalAlignmentCommand;
67
+ tableCellWidth: TableCellWidthCommand;
68
+ tableAlignment: TableAlignmentCommand;
69
+ tableBackgroundColor: TableBackgroundColorCommand;
70
+ tableBorderColor: TableBorderColorCommand;
71
+ tableBorderStyle: TableBorderStyleCommand;
72
+ tableBorderWidth: TableBorderWidthCommand;
73
+ tableHeight: TableHeightCommand;
74
+ tableWidth: TableWidthCommand;
75
+ }
76
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ export {};
@@ -53,9 +53,3 @@ export default class InsertColumnCommand extends Command {
53
53
  */
54
54
  execute(): void;
55
55
  }
56
- declare module '@ckeditor/ckeditor5-core' {
57
- interface CommandsMap {
58
- insertTableColumnLeft: InsertColumnCommand;
59
- insertTableColumnRight: InsertColumnCommand;
60
- }
61
- }
@@ -52,9 +52,3 @@ export default class InsertRowCommand extends Command {
52
52
  */
53
53
  execute(): void;
54
54
  }
55
- declare module '@ckeditor/ckeditor5-core' {
56
- interface CommandsMap {
57
- insertTableRowAbove: InsertRowCommand;
58
- insertTableRowBelow: InsertRowCommand;
59
- }
60
- }
@@ -6,7 +6,6 @@
6
6
  * @module table/commands/inserttablecommand
7
7
  */
8
8
  import { Command } from 'ckeditor5/src/core';
9
- import '../tableconfig';
10
9
  /**
11
10
  * The insert table command.
12
11
  *
@@ -43,8 +42,3 @@ export default class InsertTableCommand extends Command {
43
42
  headingColumns?: number;
44
43
  }): void;
45
44
  }
46
- declare module '@ckeditor/ckeditor5-core' {
47
- interface CommandsMap {
48
- insertTable: InsertTableCommand;
49
- }
50
- }
@@ -6,7 +6,6 @@
6
6
  * @module table/commands/inserttablecommand
7
7
  */
8
8
  import { Command } from 'ckeditor5/src/core';
9
- import '../tableconfig';
10
9
  /**
11
10
  * The insert table command.
12
11
  *
@@ -66,11 +66,3 @@ export default class MergeCellCommand extends Command {
66
66
  */
67
67
  private _getMergeableCell;
68
68
  }
69
- declare module '@ckeditor/ckeditor5-core' {
70
- interface CommandsMap {
71
- mergeTableCellRight: MergeCellCommand;
72
- mergeTableCellLeft: MergeCellCommand;
73
- mergeTableCellDown: MergeCellCommand;
74
- mergeTableCellUp: MergeCellCommand;
75
- }
76
- }
@@ -26,8 +26,3 @@ export default class MergeCellsCommand extends Command {
26
26
  */
27
27
  execute(): void;
28
28
  }
29
- declare module '@ckeditor/ckeditor5-core' {
30
- interface CommandsMap {
31
- mergeTableCells: MergeCellsCommand;
32
- }
33
- }
@@ -27,8 +27,3 @@ export default class RemoveColumnCommand extends Command {
27
27
  */
28
28
  execute(): void;
29
29
  }
30
- declare module '@ckeditor/ckeditor5-core' {
31
- interface CommandsMap {
32
- removeTableColumn: RemoveColumnCommand;
33
- }
34
- }
@@ -27,8 +27,3 @@ export default class RemoveRowCommand extends Command {
27
27
  */
28
28
  execute(): void;
29
29
  }
30
- declare module '@ckeditor/ckeditor5-core' {
31
- interface CommandsMap {
32
- removeTableRow: RemoveRowCommand;
33
- }
34
- }
@@ -31,8 +31,3 @@ export default class SelectColumnCommand extends Command {
31
31
  */
32
32
  execute(): void;
33
33
  }
34
- declare module '@ckeditor/ckeditor5-core' {
35
- interface CommandsMap {
36
- selectTableColumn: SelectColumnCommand;
37
- }
38
- }
@@ -31,8 +31,3 @@ export default class SelectRowCommand extends Command {
31
31
  */
32
32
  execute(): void;
33
33
  }
34
- declare module '@ckeditor/ckeditor5-core' {
35
- interface CommandsMap {
36
- selectTableRow: SelectRowCommand;
37
- }
38
- }
@@ -48,8 +48,3 @@ export default class SetHeaderColumnCommand extends Command {
48
48
  forceValue?: boolean;
49
49
  }): void;
50
50
  }
51
- declare module '@ckeditor/ckeditor5-core' {
52
- interface CommandsMap {
53
- setTableColumnHeader: SetHeaderColumnCommand;
54
- }
55
- }
@@ -51,8 +51,3 @@ export default class SetHeaderRowCommand extends Command {
51
51
  */
52
52
  private _isInHeading;
53
53
  }
54
- declare module '@ckeditor/ckeditor5-core' {
55
- interface CommandsMap {
56
- setTableRowHeader: SetHeaderRowCommand;
57
- }
58
- }
@@ -41,9 +41,3 @@ export default class SplitCellCommand extends Command {
41
41
  */
42
42
  execute(): void;
43
43
  }
44
- declare module '@ckeditor/ckeditor5-core' {
45
- interface CommandsMap {
46
- splitTableCellVertically: SplitCellCommand;
47
- splitTableCellHorizontally: SplitCellCommand;
48
- }
49
- }
@@ -3,7 +3,7 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
- * @module table/converters/table-cell-refresh-post-fixer
6
+ * @module table/converters/table-cell-refresh-handler
7
7
  */
8
8
  import type { EditingController, Model } from 'ckeditor5/src/engine';
9
9
  /**
@@ -3,7 +3,7 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
- * @module table/converters/table-heading-rows-refresh-post-fixer
6
+ * @module table/converters/table-headings-refresh-handler
7
7
  */
8
8
  import type { EditingController, Model } from 'ckeditor5/src/engine';
9
9
  /**
@@ -3,7 +3,7 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
- * @module table/converters/tableproperites
6
+ * @module table/converters/tableproperties
7
7
  */
8
8
  import type { Conversion, ViewElement } from 'ckeditor5/src/engine';
9
9
  /**
@@ -160,10 +160,8 @@ function getViewTableFromFigure(figureView) {
160
160
  * rows - Sorted `<tr>` elements as they should go into the model - ie. if `<thead>` is inserted after `<tbody>` in the view.
161
161
  */
162
162
  function scanTable(viewTable) {
163
- const tableMeta = {
164
- headingRows: 0,
165
- headingColumns: 0
166
- };
163
+ let headingRows = 0;
164
+ let headingColumns = undefined;
167
165
  // The `<tbody>` and `<thead>` sections in the DOM do not have to be in order `<thead>` -> `<tbody>` and there might be more than one
168
166
  // of them.
169
167
  // As the model does not have these sections, rows from different sections must be sorted.
@@ -184,33 +182,38 @@ function scanTable(viewTable) {
184
182
  for (const tableChild of Array.from(viewTable.getChildren())) {
185
183
  // Only `<thead>`, `<tbody>` & `<tfoot>` from allowed table children can have `<tr>`s.
186
184
  // The else is for future purposes (mainly `<caption>`).
187
- if (tableChild.name === 'tbody' || tableChild.name === 'thead' || tableChild.name === 'tfoot') {
188
- // Save the first `<thead>` in the table as table header - all other ones will be converted to table body rows.
189
- if (tableChild.name === 'thead' && !firstTheadElement) {
190
- firstTheadElement = tableChild;
185
+ if (tableChild.name !== 'tbody' && tableChild.name !== 'thead' && tableChild.name !== 'tfoot') {
186
+ continue;
187
+ }
188
+ // Save the first `<thead>` in the table as table header - all other ones will be converted to table body rows.
189
+ if (tableChild.name === 'thead' && !firstTheadElement) {
190
+ firstTheadElement = tableChild;
191
+ }
192
+ // There might be some extra empty text nodes between the `<tr>`s.
193
+ // Make sure further code operates on `tr`s only. (#145)
194
+ const trs = Array.from(tableChild.getChildren()).filter((el) => el.is('element', 'tr'));
195
+ for (const tr of trs) {
196
+ // This <tr> is a child of a first <thead> element.
197
+ if ((firstTheadElement && tableChild === firstTheadElement) ||
198
+ (tableChild.name === 'tbody' &&
199
+ Array.from(tr.getChildren()).length &&
200
+ Array.from(tr.getChildren()).every(e => e.is('element', 'th')))) {
201
+ headingRows++;
202
+ headRows.push(tr);
191
203
  }
192
- // There might be some extra empty text nodes between the `<tr>`s.
193
- // Make sure further code operates on `tr`s only. (#145)
194
- const trs = Array.from(tableChild.getChildren()).filter((el) => el.is('element', 'tr'));
195
- for (const tr of trs) {
196
- // This <tr> is a child of a first <thead> element.
197
- if (tr.parent.name === 'thead' && tr.parent === firstTheadElement) {
198
- tableMeta.headingRows++;
199
- headRows.push(tr);
200
- }
201
- else {
202
- bodyRows.push(tr);
203
- // For other rows check how many column headings this row has.
204
- const headingCols = scanRowForHeadingColumns(tr);
205
- if (headingCols > tableMeta.headingColumns) {
206
- tableMeta.headingColumns = headingCols;
207
- }
204
+ else {
205
+ bodyRows.push(tr);
206
+ // For other rows check how many column headings this row has.
207
+ const headingCols = scanRowForHeadingColumns(tr);
208
+ if (!headingColumns || headingCols < headingColumns) {
209
+ headingColumns = headingCols;
208
210
  }
209
211
  }
210
212
  }
211
213
  }
212
214
  return {
213
- ...tableMeta,
215
+ headingRows,
216
+ headingColumns: headingColumns || 0,
214
217
  rows: [...headRows, ...bodyRows]
215
218
  };
216
219
  }
package/src/index.d.ts CHANGED
@@ -27,3 +27,34 @@ export { default as TableSelection } from './tableselection';
27
27
  export { default as TableUtils } from './tableutils';
28
28
  export { default as TableColumnResize } from './tablecolumnresize';
29
29
  export { default as TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting';
30
+ export type { TableConfig } from './tableconfig';
31
+ export type { default as InsertColumnCommand } from './commands/insertcolumncommand';
32
+ export type { default as InsertRowCommand } from './commands/insertrowcommand';
33
+ export type { default as InsertTableCommand } from './commands/inserttablecommand';
34
+ export type { default as MergeCellCommand } from './commands/mergecellcommand';
35
+ export type { default as MergeCellsCommand } from './commands/mergecellscommand';
36
+ export type { default as RemoveColumnCommand } from './commands/removecolumncommand';
37
+ export type { default as RemoveRowCommand } from './commands/removerowcommand';
38
+ export type { default as SelectColumnCommand } from './commands/selectcolumncommand';
39
+ export type { default as SelectRowCommand } from './commands/selectrowcommand';
40
+ export type { default as SetHeaderColumnCommand } from './commands/setheadercolumncommand';
41
+ export type { default as SetHeaderRowCommand } from './commands/setheaderrowcommand';
42
+ export type { default as SplitCellCommand } from './commands/splitcellcommand';
43
+ export type { default as ToggleTableCaptionCommand } from './tablecaption/toggletablecaptioncommand';
44
+ export type { default as TableCellBackgroundColorCommand } from './tablecellproperties/commands/tablecellbackgroundcolorcommand';
45
+ export type { default as TableCellBorderColorCommand } from './tablecellproperties/commands/tablecellbordercolorcommand';
46
+ export type { default as TableCellBorderStyleCommand } from './tablecellproperties/commands/tablecellborderstylecommand';
47
+ export type { default as TableCellBorderWidthCommand } from './tablecellproperties/commands/tablecellborderwidthcommand';
48
+ export type { default as TableCellHeightCommand } from './tablecellproperties/commands/tablecellheightcommand';
49
+ export type { default as TableCellHorizontalAlignmentCommand } from './tablecellproperties/commands/tablecellhorizontalalignmentcommand';
50
+ export type { default as TableCellPaddingCommand } from './tablecellproperties/commands/tablecellpaddingcommand';
51
+ export type { default as TableCellVerticalAlignmentCommand } from './tablecellproperties/commands/tablecellverticalalignmentcommand';
52
+ export type { default as TableCellWidthCommand } from './tablecellwidth/commands/tablecellwidthcommand';
53
+ export type { default as TableAlignmentCommand } from './tableproperties/commands/tablealignmentcommand';
54
+ export type { default as TableBackgroundColorCommand } from './tableproperties/commands/tablebackgroundcolorcommand';
55
+ export type { default as TableBorderColorCommand } from './tableproperties/commands/tablebordercolorcommand';
56
+ export type { default as TableBorderStyleCommand } from './tableproperties/commands/tableborderstylecommand';
57
+ export type { default as TableBorderWidthCommand } from './tableproperties/commands/tableborderwidthcommand';
58
+ export type { default as TableHeightCommand } from './tableproperties/commands/tableheightcommand';
59
+ export type { default as TableWidthCommand } from './tableproperties/commands/tablewidthcommand';
60
+ import './augmentation';
package/src/index.js CHANGED
@@ -27,3 +27,4 @@ export { default as TableSelection } from './tableselection';
27
27
  export { default as TableUtils } from './tableutils';
28
28
  export { default as TableColumnResize } from './tablecolumnresize';
29
29
  export { default as TableColumnResizeEditing } from './tablecolumnresize/tablecolumnresizeediting';
30
+ import './augmentation';
@@ -23,8 +23,3 @@ export default class PlainTableOutput extends Plugin {
23
23
  */
24
24
  init(): void;
25
25
  }
26
- declare module '@ckeditor/ckeditor5-core' {
27
- interface PluginsMap {
28
- [PlainTableOutput.pluginName]: PlainTableOutput;
29
- }
30
- }
package/src/table.d.ts CHANGED
@@ -31,8 +31,3 @@ export default class Table extends Plugin {
31
31
  */
32
32
  static get pluginName(): 'Table';
33
33
  }
34
- declare module '@ckeditor/ckeditor5-core' {
35
- interface PluginsMap {
36
- [Table.pluginName]: Table;
37
- }
38
- }
@@ -61,8 +61,3 @@ export default class TableCaptionEditing extends Plugin {
61
61
  */
62
62
  _saveCaption(tableModelElement: Element, caption: Element): void;
63
63
  }
64
- declare module '@ckeditor/ckeditor5-core' {
65
- interface PluginsMap {
66
- [TableCaptionEditing.pluginName]: TableCaptionEditing;
67
- }
68
- }
@@ -19,8 +19,3 @@ export default class TableCaptionUI extends Plugin {
19
19
  */
20
20
  init(): void;
21
21
  }
22
- declare module '@ckeditor/ckeditor5-core' {
23
- interface PluginsMap {
24
- [TableCaptionUI.pluginName]: TableCaptionUI;
25
- }
26
- }
@@ -66,8 +66,3 @@ export default class ToggleTableCaptionCommand extends Command {
66
66
  */
67
67
  private _hideTableCaption;
68
68
  }
69
- declare module '@ckeditor/ckeditor5-core' {
70
- interface CommandsMap {
71
- toggleTableCaption: ToggleTableCaptionCommand;
72
- }
73
- }
@@ -20,8 +20,3 @@ export default class TableCaption extends Plugin {
20
20
  */
21
21
  static get requires(): PluginDependencies;
22
22
  }
23
- declare module '@ckeditor/ckeditor5-core' {
24
- interface PluginsMap {
25
- [TableCaption.pluginName]: TableCaption;
26
- }
27
- }
@@ -30,8 +30,3 @@ export default class TableCellBackgroundColorCommand extends TableCellPropertyCo
30
30
  */
31
31
  constructor(editor: Editor, defaultValue: string);
32
32
  }
33
- declare module '@ckeditor/ckeditor5-core' {
34
- interface CommandsMap {
35
- tableCellBackgroundColor: TableCellBackgroundColorCommand;
36
- }
37
- }
@@ -35,8 +35,3 @@ export default class TableCellBorderColorCommand extends TableCellPropertyComman
35
35
  */
36
36
  protected _getAttribute(tableCell: Element): unknown;
37
37
  }
38
- declare module '@ckeditor/ckeditor5-core' {
39
- interface CommandsMap {
40
- tableCellBorderColor: TableCellBorderColorCommand;
41
- }
42
- }
@@ -35,8 +35,3 @@ export default class TableCellBorderStyleCommand extends TableCellPropertyComman
35
35
  */
36
36
  protected _getAttribute(tableCell: Element): unknown;
37
37
  }
38
- declare module '@ckeditor/ckeditor5-core' {
39
- interface CommandsMap {
40
- tableCellBorderStyle: TableCellBorderStyleCommand;
41
- }
42
- }
@@ -49,8 +49,3 @@ export default class TableCellBorderWidthCommand extends TableCellPropertyComman
49
49
  */
50
50
  protected _getValueToSet(value: string | number | undefined): unknown;
51
51
  }
52
- declare module '@ckeditor/ckeditor5-core' {
53
- interface CommandsMap {
54
- tableCellBorderWidth: TableCellBorderWidthCommand;
55
- }
56
- }
@@ -44,8 +44,3 @@ export default class TableCellHeightCommand extends TableCellPropertyCommand {
44
44
  */
45
45
  protected _getValueToSet(value: string | number | undefined): unknown;
46
46
  }
47
- declare module '@ckeditor/ckeditor5-core' {
48
- interface CommandsMap {
49
- tableCellHeight: TableCellHeightCommand;
50
- }
51
- }
@@ -30,8 +30,3 @@ export default class TableCellHorizontalAlignmentCommand extends TableCellProper
30
30
  */
31
31
  constructor(editor: Editor, defaultValue: string);
32
32
  }
33
- declare module '@ckeditor/ckeditor5-core' {
34
- interface CommandsMap {
35
- tableCellHorizontalAlignment: TableCellHorizontalAlignmentCommand;
36
- }
37
- }
@@ -49,8 +49,3 @@ export default class TableCellPaddingCommand extends TableCellPropertyCommand {
49
49
  */
50
50
  protected _getValueToSet(value: string | number | undefined): unknown;
51
51
  }
52
- declare module '@ckeditor/ckeditor5-core' {
53
- interface CommandsMap {
54
- tableCellPadding: TableCellPaddingCommand;
55
- }
56
- }