@ckeditor/ckeditor5-table 48.5.2 → 48.5.3
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-editor.css.map +1 -1
- package/dist/index.js +27 -21
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -3220,8 +3220,10 @@ function updateTableCellType({ writer, table, row, column, cell, scopedHeaders }
|
|
|
3220
3220
|
return;
|
|
3221
3221
|
}
|
|
3222
3222
|
let headerCellType = "header";
|
|
3223
|
-
if (scopedHeaders)
|
|
3224
|
-
|
|
3223
|
+
if (scopedHeaders) {
|
|
3224
|
+
if (row < headingRows) headerCellType = "header-column";
|
|
3225
|
+
else headerCellType = "header-row";
|
|
3226
|
+
}
|
|
3225
3227
|
writer.setAttribute("tableCellType", headerCellType, cell);
|
|
3226
3228
|
}
|
|
3227
3229
|
|
|
@@ -6622,11 +6624,13 @@ var TableKeyboard = class extends Plugin {
|
|
|
6622
6624
|
const tableCell = selection.focus.findAncestor("tableCell");
|
|
6623
6625
|
/* istanbul ignore if: paranoid check -- @preserve */
|
|
6624
6626
|
if (!tableCell) return false;
|
|
6625
|
-
if (!selection.isCollapsed)
|
|
6626
|
-
if (
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6627
|
+
if (!selection.isCollapsed) {
|
|
6628
|
+
if (expandSelection) {
|
|
6629
|
+
if (selection.isBackward == isForward && !selection.containsEntireContent(tableCell)) return false;
|
|
6630
|
+
} else {
|
|
6631
|
+
const selectedElement = selection.getSelectedElement();
|
|
6632
|
+
if (!selectedElement || !model.schema.isObject(selectedElement)) return false;
|
|
6633
|
+
}
|
|
6630
6634
|
}
|
|
6631
6635
|
if (this._isSelectionAtCellEdge(selection, tableCell, isForward)) {
|
|
6632
6636
|
this._navigateFromCellInDirection(tableCell, direction, expandSelection);
|
|
@@ -11025,21 +11029,23 @@ var TableColumnResizeEditing = class extends Plugin {
|
|
|
11025
11029
|
const tableWidthAttributeOld = modelTable.getAttribute("tableWidth");
|
|
11026
11030
|
const tableWidthAttributeNew = this._getResizingTableWidth(viewFigure);
|
|
11027
11031
|
const isTableWidthAttributeChanged = tableWidthAttributeOld !== tableWidthAttributeNew;
|
|
11028
|
-
if (isColumnWidthsAttributeChanged || isTableWidthAttributeChanged)
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11032
|
+
if (isColumnWidthsAttributeChanged || isTableWidthAttributeChanged) {
|
|
11033
|
+
if (this._isResizingAllowed) {
|
|
11034
|
+
const tableWidthInPixels = toPrecision(tableWidthAttributeNew);
|
|
11035
|
+
const tableWidthInPixelsBeforeResize = toPrecision(tableWidthAttributeOld);
|
|
11036
|
+
const columnWidths = isPixelMode ? columnWidthsAttributeNew.map((width) => typeof width === "string" && !width.endsWith("px") ? `${toPrecision(parseFloat(width) / 100 * tableWidthInPixelsBeforeResize)}px` : width) : columnWidthsAttributeNew;
|
|
11037
|
+
editor.execute("resizeTableWidth", {
|
|
11038
|
+
table: modelTable,
|
|
11039
|
+
tableWidth: isPixelMode ? `${toPrecision(tableWidthInPixels)}px` : `${toPrecision(tableWidthAttributeNew)}%`,
|
|
11040
|
+
columnWidths
|
|
11041
|
+
});
|
|
11042
|
+
} else editingView.change((writer) => {
|
|
11043
|
+
if (columnWidthsAttributeOld) for (const viewCol of viewColumns) writer.setStyle("width", columnWidthsAttributeOld.shift(), viewCol);
|
|
11044
|
+
else writer.remove(viewColgroup);
|
|
11045
|
+
if (isTableWidthAttributeChanged) this._setResizingTableWidth(writer, viewFigure, tableWidthAttributeOld || null);
|
|
11046
|
+
if (!columnWidthsAttributeOld && !tableWidthAttributeOld) writer.removeClass("ck-table-resized", viewTable);
|
|
11036
11047
|
});
|
|
11037
|
-
}
|
|
11038
|
-
if (columnWidthsAttributeOld) for (const viewCol of viewColumns) writer.setStyle("width", columnWidthsAttributeOld.shift(), viewCol);
|
|
11039
|
-
else writer.remove(viewColgroup);
|
|
11040
|
-
if (isTableWidthAttributeChanged) this._setResizingTableWidth(writer, viewFigure, tableWidthAttributeOld || null);
|
|
11041
|
-
if (!columnWidthsAttributeOld && !tableWidthAttributeOld) writer.removeClass("ck-table-resized", viewTable);
|
|
11042
|
-
});
|
|
11048
|
+
}
|
|
11043
11049
|
editingView.change((writer) => {
|
|
11044
11050
|
writer.removeClass("ck-table-column-resizer__active", viewResizer);
|
|
11045
11051
|
});
|