File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 6
6
import { Plugin , PluginKey , PluginView } from "prosemirror-state" ;
7
7
import { EditorView } from "prosemirror-view" ;
8
8
9
- export type AIMenuState = UiElementPosition ;
9
+ export type AIMenuState = UiElementPosition & {
10
+ blockIsEmpty : boolean ;
11
+ } ;
10
12
11
13
export class AIMenuView implements PluginView {
12
14
public state ?: AIMenuState ;
@@ -100,6 +102,7 @@ export class AIMenuView implements PluginView {
100
102
this . state = {
101
103
show : true ,
102
104
referencePos : this . domElement . getBoundingClientRect ( ) ,
105
+ blockIsEmpty : blockInfo . contentNode . content . size === 0 ,
103
106
} ;
104
107
105
108
this . emitUpdate ( ) ;
Original file line number Diff line number Diff line change @@ -41,7 +41,11 @@ export const AIMenuController = (props: { aiMenu?: FC<AIMenuProps> }) => {
41
41
return (
42
42
< div
43
43
ref = { ref }
44
- style = { { ...style , width : state . referencePos . width } }
44
+ style = { {
45
+ ...style ,
46
+ width : state . referencePos . width ,
47
+ top : state . blockIsEmpty ? - state . referencePos . height - 3 : style . top ,
48
+ } }
45
49
{ ...getFloatingProps ( ) } >
46
50
< Component />
47
51
</ div >
You can’t perform that action at this time.
0 commit comments