File tree 1 file changed +11
-1
lines changed
packages/components/src/table-block/view
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import type {
8
8
ViewMutationRecord ,
9
9
} from '@milkdown/prose/view'
10
10
import type { Ctx } from '@milkdown/ctx'
11
- import { NodeSelection } from '@milkdown/prose/state'
11
+ import { NodeSelection , TextSelection } from '@milkdown/prose/state'
12
12
import { findParent } from '@milkdown/prose'
13
13
import { CellSelection } from '@milkdown/prose/tables'
14
14
import { defIfNotExists } from '../../__internal__/helper'
@@ -69,8 +69,18 @@ export class TableNodeView implements NodeView {
69
69
( node ) =>
70
70
node . type . name === 'table_cell' || node . type . name === 'table_header'
71
71
) ( $pos )
72
+
72
73
if ( ! node ) return false
73
74
75
+ // if the selection is a text selection, and the current node is the same as the node, return false
76
+ if ( state . selection instanceof TextSelection ) {
77
+ const currentNode = findParent (
78
+ ( node ) =>
79
+ node . type . name === 'table_cell' || node . type . name === 'table_header'
80
+ ) ( state . selection . $from )
81
+ if ( currentNode ?. node === node . node ) return false
82
+ }
83
+
74
84
const { from } = node
75
85
76
86
const selection = NodeSelection . create ( state . doc , from + 1 )
You canβt perform that action at this time.
0 commit comments