File tree 1 file changed +9
-3
lines changed
packages/core/src/extensions/TableHandles 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { Plugin , PluginKey , PluginView } from "prosemirror-state" ;
2
2
import {
3
+ CellSelection ,
3
4
addColumnAfter ,
4
5
addColumnBefore ,
5
6
addRowAfter ,
6
7
addRowBefore ,
7
- CellSelection ,
8
8
deleteColumn ,
9
9
deleteRow ,
10
10
mergeCells ,
11
11
splitCell ,
12
12
} from "prosemirror-tables" ;
13
13
import { Decoration , DecorationSet , EditorView } from "prosemirror-view" ;
14
14
import {
15
+ RelativeCellIndices ,
15
16
addRowsOrColumns ,
16
17
areInSameColumn ,
17
18
canColumnBeDraggedInto ,
@@ -22,7 +23,6 @@ import {
22
23
getDimensionsOfTable ,
23
24
moveColumn ,
24
25
moveRow ,
25
- RelativeCellIndices ,
26
26
} from "../../api/blockManipulation/tables/tables.js" ;
27
27
import { nodeToBlock } from "../../api/nodeConversions/nodeToBlock.js" ;
28
28
import { getNodeById } from "../../api/nodeUtil.js" ;
@@ -539,7 +539,12 @@ export class TableHandlesView<
539
539
540
540
// Hide handles if the table block has been removed.
541
541
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
+ ) {
543
548
this . state . show = false ;
544
549
this . state . showAddOrRemoveRowsButton = false ;
545
550
this . state . showAddOrRemoveColumnsButton = false ;
@@ -569,6 +574,7 @@ export class TableHandlesView<
569
574
570
575
// Update bounding boxes.
571
576
const tableBody = this . tableElement ! . querySelector ( "tbody" ) ;
577
+
572
578
if ( ! tableBody ) {
573
579
throw new Error (
574
580
"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