@underverse-ui/underverse 1.0.102 → 1.0.104

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "1.0.102",
3
+ "version": "1.0.104",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 225,
6
6
  "exports": [
package/dist/index.cjs CHANGED
@@ -23278,8 +23278,8 @@ function useLocale2() {
23278
23278
  }
23279
23279
 
23280
23280
  // src/components/UEditor/UEditor.tsx
23281
- var import_react53 = __toESM(require("react"), 1);
23282
- var import_react54 = require("@tiptap/react");
23281
+ var import_react54 = __toESM(require("react"), 1);
23282
+ var import_react55 = require("@tiptap/react");
23283
23283
 
23284
23284
  // src/components/UEditor/extensions.ts
23285
23285
  var import_extension_document = __toESM(require("@tiptap/extension-document"), 1);
@@ -32052,47 +32052,210 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
32052
32052
  );
32053
32053
 
32054
32054
  // src/components/UEditor/use-table-interactions.ts
32055
+ var import_react53 = __toESM(require("react"), 1);
32056
+
32057
+ // src/components/UEditor/use-table-row-resize.ts
32055
32058
  var import_react52 = __toESM(require("react"), 1);
32059
+ function useTableRowResize({
32060
+ editor,
32061
+ setHoveredTableCell,
32062
+ clearHoveredTableCell,
32063
+ showRowGuide,
32064
+ clearAllTableResizeHover,
32065
+ scheduleTableLayoutSync
32066
+ }) {
32067
+ const commitFrameRef = (0, import_react52.useRef)(null);
32068
+ const stateRef = (0, import_react52.useRef)(null);
32069
+ const commitPreview = import_react52.default.useCallback(() => {
32070
+ if (!editor) return;
32071
+ const state = stateRef.current;
32072
+ if (!state) return;
32073
+ const nextHeight = state.pendingHeight;
32074
+ if (nextHeight === state.previewHeight) {
32075
+ document.body.style.cursor = "row-resize";
32076
+ showRowGuide(state.tableElement, state.rowElement, state.cellElement);
32077
+ scheduleTableLayoutSync();
32078
+ return;
32079
+ }
32080
+ state.previewHeight = nextHeight;
32081
+ const tr = editor.view.state.tr;
32082
+ tr.setNodeMarkup(state.rowPos, void 0, {
32083
+ ...state.rowNode.attrs,
32084
+ rowHeight: nextHeight
32085
+ });
32086
+ tr.setMeta("addToHistory", false);
32087
+ editor.view.dispatch(tr);
32088
+ state.rowNode = editor.view.state.doc.nodeAt(state.rowPos) ?? state.rowNode;
32089
+ const refreshedRow = state.tableElement.rows.item(state.rowElement.rowIndex);
32090
+ if (refreshedRow instanceof HTMLTableRowElement) {
32091
+ state.rowElement = refreshedRow;
32092
+ const refreshedCell = refreshedRow.cells.item(state.cellIndex);
32093
+ if (refreshedCell instanceof HTMLTableCellElement) {
32094
+ state.cellElement = refreshedCell;
32095
+ }
32096
+ }
32097
+ document.body.style.cursor = "row-resize";
32098
+ showRowGuide(state.tableElement, state.rowElement, state.cellElement);
32099
+ scheduleTableLayoutSync();
32100
+ }, [editor, scheduleTableLayoutSync, showRowGuide]);
32101
+ const scheduleCommit = import_react52.default.useCallback(() => {
32102
+ if (commitFrameRef.current !== null) return;
32103
+ commitFrameRef.current = window.requestAnimationFrame(() => {
32104
+ commitFrameRef.current = null;
32105
+ commitPreview();
32106
+ });
32107
+ }, [commitPreview]);
32108
+ const syncActiveGuide = import_react52.default.useCallback(() => {
32109
+ const state = stateRef.current;
32110
+ if (!state) return false;
32111
+ setHoveredTableCell(state.cellElement);
32112
+ showRowGuide(state.tableElement, state.rowElement, state.cellElement);
32113
+ return true;
32114
+ }, [setHoveredTableCell, showRowGuide]);
32115
+ const isResizing = import_react52.default.useCallback(() => stateRef.current !== null, []);
32116
+ const beginResize = import_react52.default.useCallback((event, table, row, cell) => {
32117
+ if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
32118
+ return false;
32119
+ }
32120
+ setHoveredTableCell(cell);
32121
+ const rowInfo = findTableRowNodeInfo(editor.view, row);
32122
+ if (!rowInfo) return false;
32123
+ const startHeight = row.getBoundingClientRect().height;
32124
+ stateRef.current = {
32125
+ rowElement: row,
32126
+ tableElement: table,
32127
+ cellElement: cell,
32128
+ cellIndex: cell.cellIndex,
32129
+ rowPos: rowInfo.pos,
32130
+ rowNode: rowInfo.node,
32131
+ startY: event.clientY,
32132
+ startHeight,
32133
+ previewHeight: startHeight,
32134
+ pendingHeight: startHeight
32135
+ };
32136
+ showRowGuide(table, row, cell);
32137
+ document.body.style.cursor = "row-resize";
32138
+ event.preventDefault();
32139
+ event.stopPropagation();
32140
+ return true;
32141
+ }, [editor, setHoveredTableCell, showRowGuide]);
32142
+ const handlePointerMove = import_react52.default.useCallback((event) => {
32143
+ const state = stateRef.current;
32144
+ if (!state) return;
32145
+ const nextHeight = Math.max(
32146
+ MIN_TABLE_ROW_HEIGHT,
32147
+ Math.round(state.startHeight + (event.clientY - state.startY))
32148
+ );
32149
+ if (nextHeight === state.pendingHeight) {
32150
+ document.body.style.cursor = "row-resize";
32151
+ showRowGuide(state.tableElement, state.rowElement, state.cellElement);
32152
+ return;
32153
+ }
32154
+ state.pendingHeight = nextHeight;
32155
+ document.body.style.cursor = "row-resize";
32156
+ scheduleCommit();
32157
+ }, [scheduleCommit, showRowGuide]);
32158
+ const handlePointerUp = import_react52.default.useCallback((event) => {
32159
+ if (!editor) return;
32160
+ const state = stateRef.current;
32161
+ if (!state) return;
32162
+ const nextHeight = Math.max(
32163
+ MIN_TABLE_ROW_HEIGHT,
32164
+ Math.round(state.startHeight + (event.clientY - state.startY))
32165
+ );
32166
+ state.pendingHeight = nextHeight;
32167
+ if (commitFrameRef.current !== null) {
32168
+ window.cancelAnimationFrame(commitFrameRef.current);
32169
+ commitFrameRef.current = null;
32170
+ }
32171
+ commitPreview();
32172
+ const latestState = stateRef.current ?? state;
32173
+ const rowNode = editor.view.state.doc.nodeAt(latestState.rowPos) ?? latestState.rowNode;
32174
+ if (rowNode.attrs.rowHeight !== nextHeight) {
32175
+ const tr = editor.view.state.tr;
32176
+ tr.setNodeMarkup(latestState.rowPos, void 0, {
32177
+ ...rowNode.attrs,
32178
+ rowHeight: nextHeight
32179
+ });
32180
+ editor.view.dispatch(tr);
32181
+ }
32182
+ stateRef.current = null;
32183
+ document.body.style.cursor = "";
32184
+ clearHoveredTableCell();
32185
+ clearAllTableResizeHover();
32186
+ scheduleTableLayoutSync();
32187
+ }, [clearAllTableResizeHover, clearHoveredTableCell, commitPreview, editor, scheduleTableLayoutSync]);
32188
+ const cancelResize = import_react52.default.useCallback(() => {
32189
+ if (!stateRef.current) return;
32190
+ if (commitFrameRef.current !== null) {
32191
+ window.cancelAnimationFrame(commitFrameRef.current);
32192
+ commitFrameRef.current = null;
32193
+ }
32194
+ stateRef.current = null;
32195
+ document.body.style.cursor = "";
32196
+ clearHoveredTableCell();
32197
+ clearAllTableResizeHover();
32198
+ scheduleTableLayoutSync();
32199
+ }, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
32200
+ const cleanup = import_react52.default.useCallback(() => {
32201
+ if (commitFrameRef.current !== null) {
32202
+ window.cancelAnimationFrame(commitFrameRef.current);
32203
+ commitFrameRef.current = null;
32204
+ }
32205
+ stateRef.current = null;
32206
+ document.body.style.cursor = "";
32207
+ }, []);
32208
+ return {
32209
+ beginResize,
32210
+ cancelResize,
32211
+ cleanup,
32212
+ handlePointerMove,
32213
+ handlePointerUp,
32214
+ isResizing,
32215
+ syncActiveGuide
32216
+ };
32217
+ }
32218
+
32219
+ // src/components/UEditor/use-table-interactions.ts
32056
32220
  function useUEditorTableInteractions(editor) {
32057
- const editorContentRef = (0, import_react52.useRef)(null);
32058
- const tableColumnGuideRef = (0, import_react52.useRef)(null);
32059
- const tableRowGuideRef = (0, import_react52.useRef)(null);
32060
- const activeTableCellHighlightRef = (0, import_react52.useRef)(null);
32061
- const hoveredTableCellRef = (0, import_react52.useRef)(null);
32062
- const activeTableCellRef = (0, import_react52.useRef)(null);
32063
- const tableLayoutSyncFrameRef = (0, import_react52.useRef)(null);
32064
- const rowResizeCommitFrameRef = (0, import_react52.useRef)(null);
32065
- const rowResizeStateRef = (0, import_react52.useRef)(null);
32066
- const setEditorResizeCursor = import_react52.default.useCallback((cursor) => {
32221
+ const editorContentRef = (0, import_react53.useRef)(null);
32222
+ const tableColumnGuideRef = (0, import_react53.useRef)(null);
32223
+ const tableRowGuideRef = (0, import_react53.useRef)(null);
32224
+ const activeTableCellHighlightRef = (0, import_react53.useRef)(null);
32225
+ const hoveredTableCellRef = (0, import_react53.useRef)(null);
32226
+ const activeTableCellRef = (0, import_react53.useRef)(null);
32227
+ const suppressActiveCellHighlightRef = (0, import_react53.useRef)(false);
32228
+ const tableLayoutSyncFrameRef = (0, import_react53.useRef)(null);
32229
+ const setEditorResizeCursor = import_react53.default.useCallback((cursor) => {
32067
32230
  const proseMirror = editorContentRef.current?.querySelector(".ProseMirror");
32068
32231
  if (proseMirror) {
32069
32232
  proseMirror.style.cursor = cursor;
32070
32233
  }
32071
32234
  }, []);
32072
- const hideColumnGuide = import_react52.default.useCallback(() => {
32235
+ const hideColumnGuide = import_react53.default.useCallback(() => {
32073
32236
  editorContentRef.current?.classList.remove("resize-cursor");
32074
32237
  const guide = tableColumnGuideRef.current;
32075
32238
  if (guide) {
32076
32239
  guide.style.opacity = "0";
32077
32240
  }
32078
32241
  }, []);
32079
- const hideRowGuide = import_react52.default.useCallback(() => {
32242
+ const hideRowGuide = import_react53.default.useCallback(() => {
32080
32243
  editorContentRef.current?.classList.remove("resize-row-cursor");
32081
32244
  const guide = tableRowGuideRef.current;
32082
32245
  if (guide) {
32083
32246
  guide.style.opacity = "0";
32084
32247
  }
32085
32248
  }, []);
32086
- const clearAllTableResizeHover = import_react52.default.useCallback(() => {
32249
+ const clearAllTableResizeHover = import_react53.default.useCallback(() => {
32087
32250
  setEditorResizeCursor("");
32088
32251
  hideColumnGuide();
32089
32252
  hideRowGuide();
32090
32253
  }, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
32091
- const updateActiveCellHighlight = import_react52.default.useCallback((cell) => {
32254
+ const updateActiveCellHighlight = import_react53.default.useCallback((cell) => {
32092
32255
  const surface = editorContentRef.current;
32093
32256
  const highlight = activeTableCellHighlightRef.current;
32094
32257
  if (!highlight) return;
32095
- if (!surface || !cell) {
32258
+ if (suppressActiveCellHighlightRef.current || !surface || !cell) {
32096
32259
  highlight.style.display = "none";
32097
32260
  return;
32098
32261
  }
@@ -32103,7 +32266,7 @@ function useUEditorTableInteractions(editor) {
32103
32266
  highlight.style.width = `${metrics.width}px`;
32104
32267
  highlight.style.height = `${metrics.height}px`;
32105
32268
  }, []);
32106
- const scheduleTableLayoutSync = import_react52.default.useCallback(() => {
32269
+ const scheduleTableLayoutSync = import_react53.default.useCallback(() => {
32107
32270
  if (tableLayoutSyncFrameRef.current !== null) return;
32108
32271
  tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
32109
32272
  tableLayoutSyncFrameRef.current = null;
@@ -32111,22 +32274,22 @@ function useUEditorTableInteractions(editor) {
32111
32274
  editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
32112
32275
  });
32113
32276
  }, [updateActiveCellHighlight]);
32114
- const setActiveTableCell = import_react52.default.useCallback((cell) => {
32277
+ const setActiveTableCell = import_react53.default.useCallback((cell) => {
32115
32278
  if (activeTableCellRef.current === cell) return;
32116
32279
  activeTableCellRef.current = cell;
32117
32280
  updateActiveCellHighlight(activeTableCellRef.current);
32118
32281
  }, [updateActiveCellHighlight]);
32119
- const clearActiveTableCell = import_react52.default.useCallback(() => {
32282
+ const clearActiveTableCell = import_react53.default.useCallback(() => {
32120
32283
  activeTableCellRef.current = null;
32121
32284
  updateActiveCellHighlight(null);
32122
32285
  }, [updateActiveCellHighlight]);
32123
- const setHoveredTableCell = import_react52.default.useCallback((cell) => {
32286
+ const setHoveredTableCell = import_react53.default.useCallback((cell) => {
32124
32287
  hoveredTableCellRef.current = cell;
32125
32288
  }, []);
32126
- const clearHoveredTableCell = import_react52.default.useCallback(() => {
32289
+ const clearHoveredTableCell = import_react53.default.useCallback(() => {
32127
32290
  hoveredTableCellRef.current = null;
32128
32291
  }, []);
32129
- const showColumnGuide = import_react52.default.useCallback((table, row, cell) => {
32292
+ const showColumnGuide = import_react53.default.useCallback((table, row, cell) => {
32130
32293
  const surface = editorContentRef.current;
32131
32294
  const guide = tableColumnGuideRef.current;
32132
32295
  if (!surface || !guide) return;
@@ -32139,7 +32302,7 @@ function useUEditorTableInteractions(editor) {
32139
32302
  surface.classList.add("resize-cursor");
32140
32303
  setEditorResizeCursor("col-resize");
32141
32304
  }, [setEditorResizeCursor]);
32142
- const showRowGuide = import_react52.default.useCallback((table, row, cell) => {
32305
+ const showRowGuide = import_react53.default.useCallback((table, row, cell) => {
32143
32306
  const surface = editorContentRef.current;
32144
32307
  const guide = tableRowGuideRef.current;
32145
32308
  if (!surface || !guide) return;
@@ -32152,50 +32315,27 @@ function useUEditorTableInteractions(editor) {
32152
32315
  surface.classList.add("resize-row-cursor");
32153
32316
  setEditorResizeCursor("row-resize");
32154
32317
  }, [setEditorResizeCursor]);
32155
- const commitRowResizePreview = import_react52.default.useCallback(() => {
32156
- if (!editor) return;
32157
- const state = rowResizeStateRef.current;
32158
- if (!state) return;
32159
- const nextHeight = state.pendingHeight;
32160
- if (nextHeight === state.previewHeight) {
32161
- document.body.style.cursor = "row-resize";
32162
- showRowGuide(state.tableElement, state.rowElement, state.cellElement);
32163
- scheduleTableLayoutSync();
32164
- return;
32165
- }
32166
- state.previewHeight = nextHeight;
32167
- const tr = editor.view.state.tr;
32168
- tr.setNodeMarkup(state.rowPos, void 0, {
32169
- ...state.rowNode.attrs,
32170
- rowHeight: nextHeight
32171
- });
32172
- tr.setMeta("addToHistory", false);
32173
- editor.view.dispatch(tr);
32174
- state.rowNode = editor.view.state.doc.nodeAt(state.rowPos) ?? state.rowNode;
32175
- const refreshedRow = state.tableElement.rows.item(state.rowElement.rowIndex);
32176
- if (refreshedRow instanceof HTMLTableRowElement) {
32177
- state.rowElement = refreshedRow;
32178
- const refreshedCell = refreshedRow.cells.item(state.cellIndex);
32179
- if (refreshedCell instanceof HTMLTableCellElement) {
32180
- state.cellElement = refreshedCell;
32181
- }
32182
- }
32183
- document.body.style.cursor = "row-resize";
32184
- showRowGuide(state.tableElement, state.rowElement, state.cellElement);
32185
- scheduleTableLayoutSync();
32186
- }, [editor, scheduleTableLayoutSync, showRowGuide]);
32187
- const scheduleRowResizeCommit = import_react52.default.useCallback(() => {
32188
- if (rowResizeCommitFrameRef.current !== null) return;
32189
- rowResizeCommitFrameRef.current = window.requestAnimationFrame(() => {
32190
- rowResizeCommitFrameRef.current = null;
32191
- commitRowResizePreview();
32192
- });
32193
- }, [commitRowResizePreview]);
32194
- const syncActiveTableCellFromSelection = import_react52.default.useCallback(() => {
32318
+ const {
32319
+ beginResize,
32320
+ cancelResize,
32321
+ cleanup: cleanupRowResize,
32322
+ handlePointerMove: handleRowResizePointerMove,
32323
+ handlePointerUp: handleRowResizePointerUp,
32324
+ isResizing: isRowResizing,
32325
+ syncActiveGuide: syncActiveRowResizeGuide
32326
+ } = useTableRowResize({
32327
+ editor,
32328
+ setHoveredTableCell,
32329
+ clearHoveredTableCell,
32330
+ showRowGuide,
32331
+ clearAllTableResizeHover,
32332
+ scheduleTableLayoutSync
32333
+ });
32334
+ const syncActiveTableCellFromSelection = import_react53.default.useCallback(() => {
32195
32335
  if (!editor) return;
32196
32336
  setActiveTableCell(getSelectionTableCell(editor.view));
32197
32337
  }, [editor, setActiveTableCell]);
32198
- (0, import_react52.useEffect)(() => {
32338
+ (0, import_react53.useEffect)(() => {
32199
32339
  if (!editor) return void 0;
32200
32340
  const proseMirror = editor.view.dom;
32201
32341
  const surface = editorContentRef.current;
@@ -32216,10 +32356,7 @@ function useUEditorTableInteractions(editor) {
32216
32356
  updateActiveCellHighlight(activeTableCellRef.current);
32217
32357
  };
32218
32358
  const handleEditorMouseMove = (event) => {
32219
- const activeRowResize = rowResizeStateRef.current;
32220
- if (activeRowResize) {
32221
- setHoveredTableCell(activeRowResize.cellElement);
32222
- showRowGuide(activeRowResize.tableElement, activeRowResize.rowElement, activeRowResize.cellElement);
32359
+ if (syncActiveRowResizeGuide()) {
32223
32360
  return;
32224
32361
  }
32225
32362
  const target = resolveEventElement(event.target);
@@ -32257,7 +32394,7 @@ function useUEditorTableInteractions(editor) {
32257
32394
  };
32258
32395
  const handleEditorMouseLeave = () => {
32259
32396
  clearHoveredTableCell();
32260
- if (!rowResizeStateRef.current) {
32397
+ if (!isRowResizing()) {
32261
32398
  clearAllTableResizeHover();
32262
32399
  }
32263
32400
  };
@@ -32278,87 +32415,31 @@ function useUEditorTableInteractions(editor) {
32278
32415
  const row = cell.closest("tr");
32279
32416
  const table = cell.closest("table");
32280
32417
  if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) return;
32281
- if (!isRowResizeHotspot(cell, event.clientX, event.clientY)) {
32282
- return;
32418
+ if (beginResize(event, table, row, cell)) {
32419
+ suppressActiveCellHighlightRef.current = true;
32420
+ updateActiveCellHighlight(null);
32283
32421
  }
32284
- setHoveredTableCell(cell);
32285
- const rowInfo = findTableRowNodeInfo(editor.view, row);
32286
- if (!rowInfo) return;
32287
- const startHeight = row.getBoundingClientRect().height;
32288
- rowResizeStateRef.current = {
32289
- rowElement: row,
32290
- tableElement: table,
32291
- cellElement: cell,
32292
- cellIndex: cell.cellIndex,
32293
- rowPos: rowInfo.pos,
32294
- rowNode: rowInfo.node,
32295
- startY: event.clientY,
32296
- startHeight,
32297
- previewHeight: startHeight,
32298
- pendingHeight: startHeight
32299
- };
32300
- showRowGuide(table, row, cell);
32301
- document.body.style.cursor = "row-resize";
32302
- event.preventDefault();
32303
- event.stopPropagation();
32304
32422
  };
32305
32423
  const handlePointerMove = (event) => {
32306
- const state = rowResizeStateRef.current;
32307
- if (!state) return;
32308
- const nextHeight = Math.max(
32309
- MIN_TABLE_ROW_HEIGHT,
32310
- Math.round(state.startHeight + (event.clientY - state.startY))
32311
- );
32312
- if (nextHeight === state.pendingHeight) {
32313
- document.body.style.cursor = "row-resize";
32314
- showRowGuide(state.tableElement, state.rowElement, state.cellElement);
32315
- return;
32316
- }
32317
- state.pendingHeight = nextHeight;
32318
- document.body.style.cursor = "row-resize";
32319
- scheduleRowResizeCommit();
32424
+ handleRowResizePointerMove(event);
32320
32425
  };
32321
32426
  const handlePointerUp = (event) => {
32322
- const state = rowResizeStateRef.current;
32323
- if (!state) return;
32324
- const nextHeight = Math.max(
32325
- MIN_TABLE_ROW_HEIGHT,
32326
- Math.round(state.startHeight + (event.clientY - state.startY))
32327
- );
32328
- state.pendingHeight = nextHeight;
32329
- if (rowResizeCommitFrameRef.current !== null) {
32330
- window.cancelAnimationFrame(rowResizeCommitFrameRef.current);
32331
- rowResizeCommitFrameRef.current = null;
32332
- }
32333
- commitRowResizePreview();
32334
- const latestState = rowResizeStateRef.current ?? state;
32335
- const rowNode = editor.view.state.doc.nodeAt(latestState.rowPos) ?? latestState.rowNode;
32336
- if (rowNode.attrs.rowHeight !== nextHeight) {
32337
- const tr = editor.view.state.tr;
32338
- tr.setNodeMarkup(latestState.rowPos, void 0, {
32339
- ...rowNode.attrs,
32340
- rowHeight: nextHeight
32427
+ const wasRowResizing = isRowResizing();
32428
+ handleRowResizePointerUp(event);
32429
+ if (wasRowResizing) {
32430
+ suppressActiveCellHighlightRef.current = false;
32431
+ requestAnimationFrame(() => {
32432
+ updateActiveCellHighlight(activeTableCellRef.current);
32341
32433
  });
32342
- editor.view.dispatch(tr);
32343
32434
  }
32344
- rowResizeStateRef.current = null;
32345
- document.body.style.cursor = "";
32346
- clearHoveredTableCell();
32347
- clearAllTableResizeHover();
32348
- scheduleTableLayoutSync();
32349
32435
  };
32350
32436
  const handleWindowBlur = () => {
32351
- const state = rowResizeStateRef.current;
32352
- if (!state) return;
32353
- if (rowResizeCommitFrameRef.current !== null) {
32354
- window.cancelAnimationFrame(rowResizeCommitFrameRef.current);
32355
- rowResizeCommitFrameRef.current = null;
32437
+ const wasRowResizing = isRowResizing();
32438
+ cancelResize();
32439
+ if (wasRowResizing) {
32440
+ suppressActiveCellHighlightRef.current = false;
32441
+ updateActiveCellHighlight(activeTableCellRef.current);
32356
32442
  }
32357
- rowResizeStateRef.current = null;
32358
- document.body.style.cursor = "";
32359
- clearHoveredTableCell();
32360
- clearAllTableResizeHover();
32361
- scheduleTableLayoutSync();
32362
32443
  };
32363
32444
  proseMirror.addEventListener("mousemove", handleEditorMouseMove);
32364
32445
  proseMirror.addEventListener("mouseleave", handleEditorMouseLeave);
@@ -32401,17 +32482,14 @@ function useUEditorTableInteractions(editor) {
32401
32482
  window.cancelAnimationFrame(tableLayoutSyncFrameRef.current);
32402
32483
  tableLayoutSyncFrameRef.current = null;
32403
32484
  }
32404
- if (rowResizeCommitFrameRef.current !== null) {
32405
- window.cancelAnimationFrame(rowResizeCommitFrameRef.current);
32406
- rowResizeCommitFrameRef.current = null;
32407
- }
32485
+ cleanupRowResize();
32486
+ suppressActiveCellHighlightRef.current = false;
32408
32487
  document.body.style.cursor = "";
32409
32488
  clearActiveTableCell();
32410
32489
  clearHoveredTableCell();
32411
32490
  clearAllTableResizeHover();
32412
- rowResizeStateRef.current = null;
32413
32491
  };
32414
- }, [clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, commitRowResizePreview, editor, hideColumnGuide, hideRowGuide, scheduleRowResizeCommit, scheduleTableLayoutSync, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
32492
+ }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
32415
32493
  return {
32416
32494
  editorContentRef,
32417
32495
  tableColumnGuideRef,
@@ -32422,7 +32500,7 @@ function useUEditorTableInteractions(editor) {
32422
32500
 
32423
32501
  // src/components/UEditor/UEditor.tsx
32424
32502
  var import_jsx_runtime84 = require("react/jsx-runtime");
32425
- var UEditor = import_react53.default.forwardRef(({
32503
+ var UEditor = import_react54.default.forwardRef(({
32426
32504
  content = "",
32427
32505
  onChange,
32428
32506
  onHtmlChange,
@@ -32453,9 +32531,9 @@ var UEditor = import_react53.default.forwardRef(({
32453
32531
  }, ref) => {
32454
32532
  const t = useSmartTranslations("UEditor");
32455
32533
  const effectivePlaceholder = placeholder ?? t("placeholder");
32456
- const inFlightPrepareRef = (0, import_react53.useRef)(null);
32457
- const lastAppliedContentRef = (0, import_react53.useRef)(content ?? "");
32458
- const extensions = (0, import_react53.useMemo)(
32534
+ const inFlightPrepareRef = (0, import_react54.useRef)(null);
32535
+ const lastAppliedContentRef = (0, import_react54.useRef)(content ?? "");
32536
+ const extensions = (0, import_react54.useMemo)(
32459
32537
  () => buildUEditorExtensions({
32460
32538
  placeholder: effectivePlaceholder,
32461
32539
  translate: t,
@@ -32469,7 +32547,7 @@ var UEditor = import_react53.default.forwardRef(({
32469
32547
  }),
32470
32548
  [effectivePlaceholder, t, maxCharacters, uploadImage, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, editable]
32471
32549
  );
32472
- const editor = (0, import_react54.useEditor)({
32550
+ const editor = (0, import_react55.useEditor)({
32473
32551
  immediatelyRender: false,
32474
32552
  extensions,
32475
32553
  content,
@@ -32515,7 +32593,7 @@ var UEditor = import_react53.default.forwardRef(({
32515
32593
  tableRowGuideRef,
32516
32594
  activeTableCellHighlightRef
32517
32595
  } = useUEditorTableInteractions(editor);
32518
- (0, import_react53.useImperativeHandle)(
32596
+ (0, import_react54.useImperativeHandle)(
32519
32597
  ref,
32520
32598
  () => ({
32521
32599
  prepareContentForSave: async ({ throwOnError = false } = {}) => {
@@ -32538,7 +32616,7 @@ var UEditor = import_react53.default.forwardRef(({
32538
32616
  }),
32539
32617
  [content, editor, uploadImageForSave, uploadImageConcurrency]
32540
32618
  );
32541
- (0, import_react53.useEffect)(() => {
32619
+ (0, import_react54.useEffect)(() => {
32542
32620
  if (!editor) return;
32543
32621
  const nextContent = content ?? "";
32544
32622
  if (lastAppliedContentRef.current === nextContent) return;
@@ -32624,12 +32702,13 @@ var UEditor = import_react53.default.forwardRef(({
32624
32702
  {
32625
32703
  ref: activeTableCellHighlightRef,
32626
32704
  "aria-hidden": "true",
32705
+ "data-ueditor-active-cell-highlight": "",
32627
32706
  className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10 transition-[left,top,width,height] duration-100"
32628
32707
  }
32629
32708
  ),
32630
32709
  editable && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TableControls, { editor, containerRef: editorContentRef }),
32631
32710
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
32632
- import_react54.EditorContent,
32711
+ import_react55.EditorContent,
32633
32712
  {
32634
32713
  editor,
32635
32714
  className: "min-h-full"