@ckeditor/ckeditor5-table 43.0.0-alpha.6 → 43.1.0-alpha.0

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.
@@ -54,18 +54,48 @@ export interface NormalizedDefaultProperties {
54
54
  horizontalAlignment?: string;
55
55
  }
56
56
  /**
57
- * Returns the normalized configuration.
58
- *
59
- * @param options.includeAlignmentProperty Whether the "alignment" property should be added.
60
- * @param options.includePaddingProperty Whether the "padding" property should be added.
61
- * @param options.includeVerticalAlignmentProperty Whether the "verticalAlignment" property should be added.
62
- * @param options.includeHorizontalAlignmentProperty Whether the "horizontalAlignment" property should be added.
63
- * @param options.isRightToLeftContent Whether the content is right-to-left.
57
+ * Options used to determine which properties should be added to the normalized configuration.
64
58
  */
65
- export declare function getNormalizedDefaultProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: {
59
+ export type NormalizeTableDefaultPropertiesOptions = {
60
+ /**
61
+ * Whether the "alignment" property should be added.
62
+ */
66
63
  includeAlignmentProperty?: boolean;
64
+ /**
65
+ * Whether the "padding" property should be added.
66
+ */
67
67
  includePaddingProperty?: boolean;
68
+ /**
69
+ * Whether the "verticalAlignment" property should be added.
70
+ */
68
71
  includeVerticalAlignmentProperty?: boolean;
72
+ /**
73
+ * Whether the "horizontalAlignment" property should be added.
74
+ */
69
75
  includeHorizontalAlignmentProperty?: boolean;
76
+ /**
77
+ * Whether the content is right-to-left.
78
+ */
70
79
  isRightToLeftContent?: boolean;
71
- }): NormalizedDefaultProperties;
80
+ };
81
+ /**
82
+ * Returns the normalized configuration.
83
+ *
84
+ * @param config The configuration to normalize.
85
+ * @param options Options used to determine which properties should be added.
86
+ */
87
+ export declare function getNormalizedDefaultProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: NormalizeTableDefaultPropertiesOptions): NormalizedDefaultProperties;
88
+ /**
89
+ * Returns the normalized default table properties.
90
+ *
91
+ * @param config The configuration to normalize.
92
+ * @param options Options used to determine which properties should be added.
93
+ */
94
+ export declare function getNormalizedDefaultTableProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: NormalizeTableDefaultPropertiesOptions): NormalizedDefaultProperties;
95
+ /**
96
+ * Returns the normalized default cell properties.
97
+ *
98
+ * @param config The configuration to normalize.
99
+ * @param options Options used to determine which properties should be added.
100
+ */
101
+ export declare function getNormalizedDefaultCellProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: NormalizeTableDefaultPropertiesOptions): NormalizedDefaultProperties;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-table",
3
- "version": "43.0.0-alpha.6",
3
+ "version": "43.1.0-alpha.0",
4
4
  "description": "Table feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,13 +13,13 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "ckeditor5": "43.0.0-alpha.6",
17
- "@ckeditor/ckeditor5-clipboard": "43.0.0-alpha.6",
18
- "@ckeditor/ckeditor5-core": "43.0.0-alpha.6",
19
- "@ckeditor/ckeditor5-engine": "43.0.0-alpha.6",
20
- "@ckeditor/ckeditor5-ui": "43.0.0-alpha.6",
21
- "@ckeditor/ckeditor5-utils": "43.0.0-alpha.6",
22
- "@ckeditor/ckeditor5-widget": "43.0.0-alpha.6",
16
+ "ckeditor5": "43.1.0-alpha.0",
17
+ "@ckeditor/ckeditor5-clipboard": "43.1.0-alpha.0",
18
+ "@ckeditor/ckeditor5-core": "43.1.0-alpha.0",
19
+ "@ckeditor/ckeditor5-engine": "43.1.0-alpha.0",
20
+ "@ckeditor/ckeditor5-ui": "43.1.0-alpha.0",
21
+ "@ckeditor/ckeditor5-utils": "43.1.0-alpha.0",
22
+ "@ckeditor/ckeditor5-widget": "43.1.0-alpha.0",
23
23
  "lodash-es": "4.17.21"
24
24
  },
25
25
  "author": "CKSource (http://cksource.com/)",
@@ -18,7 +18,7 @@ import TableCellHorizontalAlignmentCommand from './commands/tablecellhorizontala
18
18
  import TableCellBorderStyleCommand from './commands/tablecellborderstylecommand.js';
19
19
  import TableCellBorderColorCommand from './commands/tablecellbordercolorcommand.js';
20
20
  import TableCellBorderWidthCommand from './commands/tablecellborderwidthcommand.js';
21
- import { getNormalizedDefaultProperties } from '../utils/table-properties.js';
21
+ import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
22
22
  import { enableProperty } from '../utils/common.js';
23
23
  const VALIGN_VALUES_REG_EXP = /^(top|middle|bottom)$/;
24
24
  const ALIGN_VALUES_REG_EXP = /^(left|center|right|justify)$/;
@@ -62,7 +62,7 @@ export default class TableCellPropertiesEditing extends Plugin {
62
62
  const schema = editor.model.schema;
63
63
  const conversion = editor.conversion;
64
64
  editor.config.define('table.tableCellProperties.defaultProperties', {});
65
- const defaultTableCellProperties = getNormalizedDefaultProperties(editor.config.get('table.tableCellProperties.defaultProperties'), {
65
+ const defaultTableCellProperties = getNormalizedDefaultCellProperties(editor.config.get('table.tableCellProperties.defaultProperties'), {
66
66
  includeVerticalAlignmentProperty: true,
67
67
  includeHorizontalAlignmentProperty: true,
68
68
  includePaddingProperty: true,
@@ -13,7 +13,7 @@ import { debounce } from 'lodash-es';
13
13
  import { getTableWidgetAncestor } from '../utils/ui/widget.js';
14
14
  import { getBalloonCellPositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
15
15
  import tableCellProperties from './../../theme/icons/table-cell-properties.svg';
16
- import { getNormalizedDefaultProperties } from '../utils/table-properties.js';
16
+ import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
17
17
  const ERROR_TEXT_TIMEOUT = 500;
18
18
  // Map of view properties and related commands.
19
19
  const propertyToCommandMap = {
@@ -62,7 +62,7 @@ export default class TableCellPropertiesUI extends Plugin {
62
62
  init() {
63
63
  const editor = this.editor;
64
64
  const t = editor.t;
65
- this._defaultTableCellProperties = getNormalizedDefaultProperties(editor.config.get('table.tableCellProperties.defaultProperties'), {
65
+ this._defaultTableCellProperties = getNormalizedDefaultCellProperties(editor.config.get('table.tableCellProperties.defaultProperties'), {
66
66
  includeVerticalAlignmentProperty: true,
67
67
  includeHorizontalAlignmentProperty: true,
68
68
  includePaddingProperty: true,
@@ -8,7 +8,7 @@
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import TableEditing from './../tableediting.js';
10
10
  import TableCellWidthCommand from './commands/tablecellwidthcommand.js';
11
- import { getNormalizedDefaultProperties } from '../utils/table-properties.js';
11
+ import { getNormalizedDefaultCellProperties } from '../utils/table-properties.js';
12
12
  import { enableProperty } from '../utils/common.js';
13
13
  /**
14
14
  * The table cell width editing feature.
@@ -34,7 +34,7 @@ export default class TableCellWidthEditing extends Plugin {
34
34
  */
35
35
  init() {
36
36
  const editor = this.editor;
37
- const defaultTableCellProperties = getNormalizedDefaultProperties(editor.config.get('table.tableCellProperties.defaultProperties'));
37
+ const defaultTableCellProperties = getNormalizedDefaultCellProperties(editor.config.get('table.tableCellProperties.defaultProperties'));
38
38
  enableProperty(editor.model.schema, editor.conversion, {
39
39
  modelAttribute: 'tableCellWidth',
40
40
  styleName: 'width',
@@ -16,7 +16,7 @@ import TableBorderWidthCommand from './commands/tableborderwidthcommand.js';
16
16
  import TableWidthCommand from './commands/tablewidthcommand.js';
17
17
  import TableHeightCommand from './commands/tableheightcommand.js';
18
18
  import TableAlignmentCommand from './commands/tablealignmentcommand.js';
19
- import { getNormalizedDefaultProperties } from '../utils/table-properties.js';
19
+ import { getNormalizedDefaultTableProperties } from '../utils/table-properties.js';
20
20
  const ALIGN_VALUES_REG_EXP = /^(left|center|right)$/;
21
21
  const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
22
22
  /**
@@ -57,7 +57,7 @@ export default class TablePropertiesEditing extends Plugin {
57
57
  const schema = editor.model.schema;
58
58
  const conversion = editor.conversion;
59
59
  editor.config.define('table.tableProperties.defaultProperties', {});
60
- const defaultTableProperties = getNormalizedDefaultProperties(editor.config.get('table.tableProperties.defaultProperties'), {
60
+ const defaultTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {
61
61
  includeAlignmentProperty: true
62
62
  });
63
63
  editor.data.addStyleProcessorRules(addBorderRules);
@@ -13,7 +13,7 @@ import tableProperties from './../../theme/icons/table-properties.svg';
13
13
  import { colorFieldValidator, getLocalizedColorErrorText, getLocalizedLengthErrorText, lengthFieldValidator, lineWidthFieldValidator, defaultColors } from '../utils/ui/table-properties.js';
14
14
  import { getSelectionAffectedTableWidget } from '../utils/ui/widget.js';
15
15
  import { getBalloonTablePositionData, repositionContextualBalloon } from '../utils/ui/contextualballoon.js';
16
- import { getNormalizedDefaultProperties } from '../utils/table-properties.js';
16
+ import { getNormalizedDefaultTableProperties } from '../utils/table-properties.js';
17
17
  const ERROR_TEXT_TIMEOUT = 500;
18
18
  // Map of view properties and related commands.
19
19
  const propertyToCommandMap = {
@@ -64,7 +64,7 @@ export default class TablePropertiesUI extends Plugin {
64
64
  init() {
65
65
  const editor = this.editor;
66
66
  const t = editor.t;
67
- this._defaultTableProperties = getNormalizedDefaultProperties(editor.config.get('table.tableProperties.defaultProperties'), {
67
+ this._defaultTableProperties = getNormalizedDefaultTableProperties(editor.config.get('table.tableProperties.defaultProperties'), {
68
68
  includeAlignmentProperty: true
69
69
  });
70
70
  this._balloon = editor.plugins.get(ContextualBalloon);
@@ -50,18 +50,48 @@ export interface NormalizedDefaultProperties {
50
50
  horizontalAlignment?: string;
51
51
  }
52
52
  /**
53
- * Returns the normalized configuration.
54
- *
55
- * @param options.includeAlignmentProperty Whether the "alignment" property should be added.
56
- * @param options.includePaddingProperty Whether the "padding" property should be added.
57
- * @param options.includeVerticalAlignmentProperty Whether the "verticalAlignment" property should be added.
58
- * @param options.includeHorizontalAlignmentProperty Whether the "horizontalAlignment" property should be added.
59
- * @param options.isRightToLeftContent Whether the content is right-to-left.
53
+ * Options used to determine which properties should be added to the normalized configuration.
60
54
  */
61
- export declare function getNormalizedDefaultProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: {
55
+ export type NormalizeTableDefaultPropertiesOptions = {
56
+ /**
57
+ * Whether the "alignment" property should be added.
58
+ */
62
59
  includeAlignmentProperty?: boolean;
60
+ /**
61
+ * Whether the "padding" property should be added.
62
+ */
63
63
  includePaddingProperty?: boolean;
64
+ /**
65
+ * Whether the "verticalAlignment" property should be added.
66
+ */
64
67
  includeVerticalAlignmentProperty?: boolean;
68
+ /**
69
+ * Whether the "horizontalAlignment" property should be added.
70
+ */
65
71
  includeHorizontalAlignmentProperty?: boolean;
72
+ /**
73
+ * Whether the content is right-to-left.
74
+ */
66
75
  isRightToLeftContent?: boolean;
67
- }): NormalizedDefaultProperties;
76
+ };
77
+ /**
78
+ * Returns the normalized configuration.
79
+ *
80
+ * @param config The configuration to normalize.
81
+ * @param options Options used to determine which properties should be added.
82
+ */
83
+ export declare function getNormalizedDefaultProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: NormalizeTableDefaultPropertiesOptions): NormalizedDefaultProperties;
84
+ /**
85
+ * Returns the normalized default table properties.
86
+ *
87
+ * @param config The configuration to normalize.
88
+ * @param options Options used to determine which properties should be added.
89
+ */
90
+ export declare function getNormalizedDefaultTableProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: NormalizeTableDefaultPropertiesOptions): NormalizedDefaultProperties;
91
+ /**
92
+ * Returns the normalized default cell properties.
93
+ *
94
+ * @param config The configuration to normalize.
95
+ * @param options Options used to determine which properties should be added.
96
+ */
97
+ export declare function getNormalizedDefaultCellProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: NormalizeTableDefaultPropertiesOptions): NormalizedDefaultProperties;
@@ -54,11 +54,8 @@ export function addDefaultUnitToNumericValue(value, defaultUnit) {
54
54
  /**
55
55
  * Returns the normalized configuration.
56
56
  *
57
- * @param options.includeAlignmentProperty Whether the "alignment" property should be added.
58
- * @param options.includePaddingProperty Whether the "padding" property should be added.
59
- * @param options.includeVerticalAlignmentProperty Whether the "verticalAlignment" property should be added.
60
- * @param options.includeHorizontalAlignmentProperty Whether the "horizontalAlignment" property should be added.
61
- * @param options.isRightToLeftContent Whether the content is right-to-left.
57
+ * @param config The configuration to normalize.
58
+ * @param options Options used to determine which properties should be added.
62
59
  */
63
60
  export function getNormalizedDefaultProperties(config, options = {}) {
64
61
  const normalizedConfig = {
@@ -84,3 +81,35 @@ export function getNormalizedDefaultProperties(config, options = {}) {
84
81
  }
85
82
  return normalizedConfig;
86
83
  }
84
+ /**
85
+ * Returns the normalized default table properties.
86
+ *
87
+ * @param config The configuration to normalize.
88
+ * @param options Options used to determine which properties should be added.
89
+ */
90
+ export function getNormalizedDefaultTableProperties(config, options) {
91
+ return getNormalizedDefaultProperties({
92
+ // It adds support for border none in the table element, keep it in sync with the content styles
93
+ // See more: https://github.com/ckeditor/ckeditor5/issues/6841#issuecomment-1959195608
94
+ borderStyle: 'double',
95
+ borderColor: 'hsl(0, 0%, 70%)',
96
+ borderWidth: '1px',
97
+ ...config
98
+ }, options);
99
+ }
100
+ /**
101
+ * Returns the normalized default cell properties.
102
+ *
103
+ * @param config The configuration to normalize.
104
+ * @param options Options used to determine which properties should be added.
105
+ */
106
+ export function getNormalizedDefaultCellProperties(config, options) {
107
+ return getNormalizedDefaultProperties({
108
+ // It adds support for border none in the table element, keep it in sync with the content styles
109
+ // See more: https://github.com/ckeditor/ckeditor5/issues/6841#issuecomment-1959195608
110
+ borderStyle: 'solid',
111
+ borderColor: 'hsl(0, 0%, 75%)',
112
+ borderWidth: '1px',
113
+ ...config
114
+ }, options);
115
+ }
package/theme/table.css CHANGED
@@ -42,6 +42,23 @@
42
42
  }
43
43
  }
44
44
 
45
+ /**
46
+ * Expanding the table to the full height of the parent container is necessary because tables
47
+ * are rendered inside <figure> elements, which is kinda buggy in table height calculation.
48
+ * While setting `height: 100%` fixes the issue in the editing mode described here:
49
+ * https://github.com/ckeditor/ckeditor5/issues/6186
50
+ *
51
+ * it's causing another issue with the table height in the print preview mode here:
52
+ * https://github.com/ckeditor/ckeditor5/issues/16856
53
+ *
54
+ * For now, resetting the height to `initial` in the print mode works as a workaround.
55
+ */
56
+ @media print {
57
+ .ck-content .table table {
58
+ height: initial;
59
+ }
60
+ }
61
+
45
62
  /* Text alignment of the table header should match the editor settings and override the native browser styling,
46
63
  when content is available outside the editor. See https://github.com/ckeditor/ckeditor5/issues/6638 */
47
64
  .ck-content[dir="rtl"] .table th {