@ckeditor/ckeditor5-table 47.4.0 → 47.5.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.
package/dist/index.js CHANGED
@@ -72,8 +72,8 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
72
72
  }
73
73
  const localDefaultValue = getDefaultValueAdjusted(defaultValue, '', data);
74
74
  let value = viewElement.getAttribute(attributeName);
75
- if (value && attributeType == 'length' && !value.endsWith('px')) {
76
- value += 'px';
75
+ if (value && attributeType == 'length') {
76
+ value = parseFloat(value) + (value.endsWith('%') ? '%' : 'px');
77
77
  }
78
78
  if (localDefaultValue !== value) {
79
79
  return value;
@@ -185,8 +185,8 @@ const FLOAT_VALUES_REG_EXP = /^(left|none|right)$/;
185
185
  return;
186
186
  }
187
187
  const modelElement = modelRange?.start?.nodeAfter;
188
- // If model element has already border style attribute, skip the conversion.
189
- if (!modelElement || modelElement.hasAttribute(modelAttributes.style)) {
188
+ // If model element has any non-default border attribute, skip the conversion.
189
+ if (!modelElement || Object.values(modelAttributes).some((attributeName)=>modelElement.hasAttribute(attributeName))) {
190
190
  return;
191
191
  }
192
192
  conversionApi.writer.setAttribute(modelAttributes.style, 'none', modelElement);
@@ -11381,9 +11381,14 @@ const toPx = /* #__PURE__ */ toUnit('px');
11381
11381
  const modelTable = modelLeftCell.findAncestor('table');
11382
11382
  const leftColumnIndex = getColumnEdgesIndexes(modelLeftCell, this._tableUtilsPlugin).rightEdge;
11383
11383
  const lastColumnIndex = this._tableUtilsPlugin.getColumns(modelTable) - 1;
11384
+ let tableAlignment = modelTable.getAttribute('tableAlignment');
11385
+ if (modelTable.getAttribute('tableType') !== 'layout') {
11386
+ tableAlignment ||= editor.config.get('table.tableProperties.defaultProperties.alignment');
11387
+ tableAlignment ||= 'center';
11388
+ }
11384
11389
  const isRightEdge = leftColumnIndex === lastColumnIndex;
11385
- const isTableCentered = !modelTable.hasAttribute('tableAlignment');
11386
11390
  const isLtrContent = editor.locale.contentLanguageDirection !== 'rtl';
11391
+ const isTableCentered = tableAlignment === 'center';
11387
11392
  const viewTable = viewLeftCell.findAncestor('table');
11388
11393
  const viewFigure = viewTable.findAncestor('figure');
11389
11394
  const viewColgroup = [