Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit db80cb1

Browse files
committed
fix: update cleanup logic in SuperDocTemplateBuilder to correctly reference active editor state
1 parent 34aa3ee commit db80cb1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,15 @@ const SuperDocTemplateBuilder = forwardRef<
258258
const bounds = new DOMRect(coords.left, coords.top, 0, 0);
259259

260260
const cleanup = () => {
261-
const currentPos = e.state.selection.from;
262-
const tr = e.state.tr.delete(triggerStart, currentPos);
263-
e.view.dispatch(tr);
261+
const editor = superdocRef.current?.activeEditor;
262+
if (!editor) return;
263+
const currentPos = editor.state.selection.from;
264+
const tr = editor.state.tr.delete(triggerStart, currentPos);
265+
editor.view.dispatch(tr);
264266
};
265267

266268
triggerCleanupRef.current = cleanup;
267-
menuTriggerFromRef.current = from;
269+
menuTriggerFromRef.current = triggerStart;
268270
setMenuPosition(bounds);
269271
setMenuVisible(true);
270272
resetMenuFilter();

0 commit comments

Comments
 (0)