File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
gui/src/components/mainInput/TipTapEditor Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import { AppDispatch } from "../../../redux/store";
1010import { loadSession , saveCurrentSession } from "../../../redux/thunks/session" ;
1111import { CodeBlock , PromptBlock } from "./extensions" ;
1212import { insertCurrentFileContextMention } from "./utils/insertCurrentFileContextMention" ;
13- import { Mention } from "@tiptap/extension-mention" ;
1413
1514/**
1615 * Hook for setting up main editor specific webview listeners
@@ -206,15 +205,18 @@ export function useMainEditorWebviewListeners({
206205 if ( ! editor ) return ;
207206 let chain = editor . chain ( ) ;
208207
209- for ( let payload of data . data ) {
210- const node = editor . schema . nodes [ Mention . name ] . create ( {
211- name : payload . name ,
212- id : payload . fullPath ,
213- label : payload . name ,
214- itemType : payload . type ,
215- } ) ;
216-
217- chain . insertContent ( [ node . toJSON ( ) , { type : "text" , text : " " } ] ) ;
208+ for ( let mention of data . data ) {
209+ chain
210+ . insertContent ( {
211+ type : "mention" ,
212+ attrs : {
213+ id : mention . fullPath ,
214+ query : mention . fullPath ,
215+ itemType : mention . type ,
216+ label : mention . name ,
217+ } ,
218+ } )
219+ . insertContent ( " " ) ;
218220 }
219221
220222 chain . run ( ) ;
You can’t perform that action at this time.
0 commit comments