File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 66import { Plugin , PluginKey , PluginView } from "prosemirror-state" ;
77import { EditorView } from "prosemirror-view" ;
88
9- export type AIMenuState = UiElementPosition ;
9+ export type AIMenuState = UiElementPosition & {
10+ blockIsEmpty : boolean ;
11+ } ;
1012
1113export class AIMenuView implements PluginView {
1214 public state ?: AIMenuState ;
@@ -100,6 +102,7 @@ export class AIMenuView implements PluginView {
100102 this . state = {
101103 show : true ,
102104 referencePos : this . domElement . getBoundingClientRect ( ) ,
105+ blockIsEmpty : blockInfo . contentNode . content . size === 0 ,
103106 } ;
104107
105108 this . emitUpdate ( ) ;
Original file line number Diff line number Diff line change @@ -41,7 +41,11 @@ export const AIMenuController = (props: { aiMenu?: FC<AIMenuProps> }) => {
4141 return (
4242 < div
4343 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+ } }
4549 { ...getFloatingProps ( ) } >
4650 < Component />
4751 </ div >
You can’t perform that action at this time.
0 commit comments