From 8b03f96a3fc72665fadaa477373fb941226d1474 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Sat, 8 Nov 2025 19:52:58 +0500 Subject: [PATCH] editor: fix column resize handle hiding after column resize --- .../prosemirror-tables/columnresizing.ts | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/editor/src/extensions/table/prosemirror-tables/columnresizing.ts b/packages/editor/src/extensions/table/prosemirror-tables/columnresizing.ts index 71033d0ae..4b37dfca2 100644 --- a/packages/editor/src/extensions/table/prosemirror-tables/columnresizing.ts +++ b/packages/editor/src/extensions/table/prosemirror-tables/columnresizing.ts @@ -121,23 +121,24 @@ export class ResizeState { // eslint-disable-next-line @typescript-eslint/no-this-alias const state = this; const action = tr.getMeta(columnResizingPluginKey); + const decorations = tr.docChanged + ? state.decorations.map(tr.mapping, tr.doc) + : state.decorations; if (action && action.setHandle != null) - return new ResizeState( - action.setHandle, - false, - state.decorations.map(tr.mapping, tr.doc) - ); + return new ResizeState(action.setHandle, false, decorations); if (action && action.setDragging !== undefined) return new ResizeState( state.activeHandle, action.setDragging, - state.decorations.map(tr.mapping, tr.doc) + decorations ); if (action && action.setDecorations !== undefined) { return new ResizeState( state.activeHandle, state.dragging, - action.setDecorations.map(tr.mapping, tr.doc) + tr.docChanged + ? action.setDecorations.map(tr.mapping, tr.doc) + : action.setDecorations ); } if (state.activeHandle > -1 && tr.docChanged) { @@ -145,11 +146,7 @@ export class ResizeState { if (!pointsAtCell(tr.doc.resolve(handle))) { handle = -1; } - return new ResizeState( - handle, - state.dragging, - state.decorations.map(tr.mapping, tr.doc) - ); + return new ResizeState(handle, state.dragging, decorations); } return state; } @@ -330,7 +327,7 @@ function updateColumnWidth( ? attrs.colwidth.slice() : zeroes(attrs.colspan); colwidth[index] = width; - tr.setNodeMarkup(start + pos, null, { ...attrs, colwidth: colwidth }); + tr.setNodeAttribute(start + pos, "colwidth", colwidth); } if (tr.docChanged) view.dispatch(tr); }