From 665282f6320be7bbd44ec8781c8821d8fe2d8f95 Mon Sep 17 00:00:00 2001 From: vldf Date: Tue, 9 Sep 2025 11:09:40 +0300 Subject: [PATCH] fix `addToEdit` handling --- .../useMainEditorWebviewListeners.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gui/src/components/mainInput/TipTapEditor/useMainEditorWebviewListeners.ts b/gui/src/components/mainInput/TipTapEditor/useMainEditorWebviewListeners.ts index 1cc552ad3..60ddbe5e5 100644 --- a/gui/src/components/mainInput/TipTapEditor/useMainEditorWebviewListeners.ts +++ b/gui/src/components/mainInput/TipTapEditor/useMainEditorWebviewListeners.ts @@ -10,7 +10,6 @@ import { AppDispatch } from "../../../redux/store"; import { loadSession, saveCurrentSession } from "../../../redux/thunks/session"; import { CodeBlock, PromptBlock } from "./extensions"; import { insertCurrentFileContextMention } from "./utils/insertCurrentFileContextMention"; -import { Mention } from "@tiptap/extension-mention"; /** * Hook for setting up main editor specific webview listeners @@ -206,15 +205,18 @@ export function useMainEditorWebviewListeners({ if (!editor) return; let chain = editor.chain(); - for (let payload of data.data) { - const node = editor.schema.nodes[Mention.name].create({ - name: payload.name, - id: payload.fullPath, - label: payload.name, - itemType: payload.type, - }); - - chain.insertContent([node.toJSON(), { type: "text", text: " " }]); + for (let mention of data.data) { + chain + .insertContent({ + type: "mention", + attrs: { + id: mention.fullPath, + query: mention.fullPath, + itemType: mention.type, + label: mention.name, + }, + }) + .insertContent(" "); } chain.run();