Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix `Position -1 is outside of fragment` error

Abdullah Attaf81c30222a33
diff --git a/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx b/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx
index 8efb99dea..5621a1d02 100644
--- a/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx
+++ b/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx
@@ -72,6 +72,8 @@ export function HoverPopupHandler(props: FloatingMenuProps) {
const { popup: Popup } = PopupHandler;
const pos = editor.current.view.posAtDOM(element, 0);
+ if (pos < 0) return;
+
const node = editor.current.view.state.doc.nodeAt(pos);
if (!node) return;