File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/zui/ZUIEditor/EditorOverlays Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 5
5
usePositioner ,
6
6
} from '@remirror/react' ;
7
7
import { FC , useCallback , useEffect , useState } from 'react' ;
8
+ import { ProsemirrorNode } from '@remirror/pm/suggest' ;
8
9
import { Box } from '@mui/material' ;
9
10
10
11
import BlockToolbar from './BlockToolbar' ;
@@ -18,6 +19,7 @@ export type BlockDividerData = {
18
19
} ;
19
20
20
21
type BlockData = {
22
+ node : ProsemirrorNode ;
21
23
rect : DOMRect ;
22
24
type : string ;
23
25
} ;
@@ -54,6 +56,7 @@ const EditorOverlays: FC<Props> = ({ blocks, enableVariable }) => {
54
56
const x = nodeRect . x - editorRect . x ;
55
57
const y = nodeRect . y - editorRect . y ;
56
58
setCurrentBlock ( {
59
+ node,
57
60
rect : {
58
61
...nodeRect . toJSON ( ) ,
59
62
left : x ,
@@ -129,7 +132,11 @@ const EditorOverlays: FC<Props> = ({ blocks, enableVariable }) => {
129
132
}
130
133
} ) ;
131
134
132
- const showBlockToolbar = ! showBlockMenu && ! ! currentBlock && ! typing ;
135
+ const isEmptyParagraph =
136
+ currentBlock ?. type == 'paragraph' && currentBlock ?. node . textContent == '' ;
137
+
138
+ const showBlockToolbar =
139
+ ! showBlockMenu && ! ! currentBlock && ! typing && ! isEmptyParagraph ;
133
140
134
141
const showBlockInsert = ! showBlockMenu && ! typing ;
135
142
You can’t perform that action at this time.
0 commit comments