@ckeditor/ckeditor5-table 46.0.0-alpha.3 → 46.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-table",
3
- "version": "46.0.0-alpha.3",
3
+ "version": "46.0.0-alpha.5",
4
4
  "description": "Table feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,14 +13,14 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "ckeditor5": "46.0.0-alpha.3",
17
- "@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.3",
18
- "@ckeditor/ckeditor5-core": "46.0.0-alpha.3",
19
- "@ckeditor/ckeditor5-engine": "46.0.0-alpha.3",
20
- "@ckeditor/ckeditor5-icons": "46.0.0-alpha.3",
21
- "@ckeditor/ckeditor5-ui": "46.0.0-alpha.3",
22
- "@ckeditor/ckeditor5-utils": "46.0.0-alpha.3",
23
- "@ckeditor/ckeditor5-widget": "46.0.0-alpha.3",
16
+ "ckeditor5": "46.0.0-alpha.5",
17
+ "@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.5",
18
+ "@ckeditor/ckeditor5-core": "46.0.0-alpha.5",
19
+ "@ckeditor/ckeditor5-engine": "46.0.0-alpha.5",
20
+ "@ckeditor/ckeditor5-icons": "46.0.0-alpha.5",
21
+ "@ckeditor/ckeditor5-ui": "46.0.0-alpha.5",
22
+ "@ckeditor/ckeditor5-utils": "46.0.0-alpha.5",
23
+ "@ckeditor/ckeditor5-widget": "46.0.0-alpha.5",
24
24
  "es-toolkit": "1.39.5"
25
25
  },
26
26
  "author": "CKSource (http://cksource.com/)",
@@ -26,6 +26,7 @@ export declare function upcastStyleToAttribute(conversion: Conversion, options:
26
26
  viewElement: string | RegExp;
27
27
  defaultValue: string;
28
28
  reduceBoxSides?: boolean;
29
+ shouldUpcast?: (viewElement: ViewElement) => boolean;
29
30
  }): void;
30
31
  /**
31
32
  * The style values for border styles.
@@ -16,7 +16,7 @@ import { first } from 'ckeditor5/src/utils.js';
16
16
  * @internal
17
17
  */
18
18
  export function upcastStyleToAttribute(conversion, options) {
19
- const { modelAttribute, styleName, attributeName, attributeType, viewElement, defaultValue, reduceBoxSides = false } = options;
19
+ const { modelAttribute, styleName, attributeName, attributeType, viewElement, defaultValue, shouldUpcast = () => true, reduceBoxSides = false } = options;
20
20
  conversion.for('upcast').attributeToAttribute({
21
21
  view: {
22
22
  name: viewElement,
@@ -28,8 +28,7 @@ export function upcastStyleToAttribute(conversion, options) {
28
28
  key: modelAttribute,
29
29
  value: (viewElement, conversionApi, data) => {
30
30
  // Ignore table elements inside figures and figures without the table class.
31
- if (viewElement.name == 'table' && viewElement.parent.name == 'figure' ||
32
- viewElement.name == 'figure' && !viewElement.hasClass('table')) {
31
+ if (!shouldUpcast(viewElement)) {
33
32
  return;
34
33
  }
35
34
  const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
@@ -276,6 +276,11 @@ function enableTableToFigureProperty(schema, conversion, options) {
276
276
  allowAttributes: [modelAttribute]
277
277
  });
278
278
  schema.setAttributeProperties(modelAttribute, { isFormatting: true });
279
- upcastStyleToAttribute(conversion, { viewElement: /^(table|figure)$/, ...options });
279
+ upcastStyleToAttribute(conversion, {
280
+ viewElement: /^(table|figure)$/,
281
+ shouldUpcast: (viewElement) => !(viewElement.name == 'table' && viewElement.parent.name == 'figure' ||
282
+ viewElement.name == 'figure' && !viewElement.hasClass('table')),
283
+ ...options
284
+ });
280
285
  downcastAttributeToStyle(conversion, { modelElement: 'table', ...options });
281
286
  }
package/theme/table.css CHANGED
@@ -54,9 +54,29 @@
54
54
 
55
55
  & > td,
56
56
  & > th {
57
- /* stylelint-enable no-descending-specificity */
57
+ /* Opinionated table content styling: prevents content from shifting
58
+ * when Enter is pressed in the first cell.
59
+ * See: https://github.com/ckeditor/ckeditor5/pull/18801
60
+ */
61
+ & > p:first-of-type {
62
+ margin-top: 0;
63
+ }
64
+
65
+ /* Mirrors the rule above for the last paragraph to keep the
66
+ * experience consistent with the first paragraph.
67
+ *
68
+ * Together, these rules prevent margins from appearing when a
69
+ * bogus paragraph becomes a real paragraph after it receives line
70
+ * height, text alignment, or other block style.
71
+ *
72
+ * See: https://github.com/ckeditor/ckeditor5/pull/18801
73
+ */
74
+ & > p:last-of-type {
75
+ margin-bottom: 0;
76
+ }
77
+
58
78
  min-width: 2em;
59
- padding: .4em;
79
+ padding: 0.4em;
60
80
 
61
81
  /* The border is inherited from .ck-editor__nested-editable styles, so theoretically it's not necessary here.
62
82
  However, the border is a content style, so it should use .ck-content (so it works outside the editor).