File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/core/src/extensions/TableHandles Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11import { Plugin , PluginKey , PluginView } from "prosemirror-state" ;
22import {
3+ CellSelection ,
34 addColumnAfter ,
45 addColumnBefore ,
56 addRowAfter ,
67 addRowBefore ,
7- CellSelection ,
88 deleteColumn ,
99 deleteRow ,
1010 mergeCells ,
1111 splitCell ,
1212} from "prosemirror-tables" ;
1313import { Decoration , DecorationSet , EditorView } from "prosemirror-view" ;
1414import {
15+ RelativeCellIndices ,
1516 addRowsOrColumns ,
1617 areInSameColumn ,
1718 canColumnBeDraggedInto ,
@@ -22,7 +23,6 @@ import {
2223 getDimensionsOfTable ,
2324 moveColumn ,
2425 moveRow ,
25- RelativeCellIndices ,
2626} from "../../api/blockManipulation/tables/tables.js" ;
2727import { nodeToBlock } from "../../api/nodeConversions/nodeToBlock.js" ;
2828import { getNodeById } from "../../api/nodeUtil.js" ;
@@ -539,7 +539,12 @@ export class TableHandlesView<
539539
540540 // Hide handles if the table block has been removed.
541541 this . state . block = this . editor . getBlock ( this . state . block . id ) ! ;
542- if ( ! this . state . block ) {
542+ if (
543+ ! this . state . block ||
544+ // when collaborating, the table element might be replaced and out of date
545+ // because yjs replaces the element when for example you change the color via the side menu
546+ ! this . tableElement ?. isConnected
547+ ) {
543548 this . state . show = false ;
544549 this . state . showAddOrRemoveRowsButton = false ;
545550 this . state . showAddOrRemoveColumnsButton = false ;
@@ -569,6 +574,7 @@ export class TableHandlesView<
569574
570575 // Update bounding boxes.
571576 const tableBody = this . tableElement ! . querySelector ( "tbody" ) ;
577+
572578 if ( ! tableBody ) {
573579 throw new Error (
574580 "Table block does not contain a 'tbody' HTML element. This should never happen."
You can’t perform that action at this time.
0 commit comments