@@ -23,7 +23,7 @@ export interface MentionInfo {
2323 path : string
2424 displayName : string
2525 icon : string
26- type : "file" | "folder"
26+ type : "file" | "folder" | "url" | "problems" | "terminal" | "git"
2727}
2828
2929export interface LexicalMentionPluginRef {
@@ -129,23 +129,55 @@ export const LexicalMentionPlugin = forwardRef<LexicalMentionPluginRef, LexicalM
129129 // Extract just the paths for display name calculation
130130 const mentionPaths = mentionNodes . map ( ( node ) => node . path )
131131
132+ // SVG data URL for link icon
133+ const linkIconSvg = `data:image/svg+xml,${ encodeURIComponent (
134+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"/></svg>' ,
135+ ) } `
136+
132137 // Convert to MentionInfo objects with all necessary display information
133138 const mentions : MentionInfo [ ] = mentionNodes . map ( ( node ) => {
134139 // Use stored type data if available, otherwise fall back to path-based detection
135140 const storedType = node . data ?. type
136- let type : "file" | "folder"
137-
138- if ( storedType === "file" || storedType === "folder" ) {
139- type = storedType
141+ let type : "file" | "folder" | "url" | "problems" | "terminal" | "git"
142+ let displayName : string
143+ let icon : string
144+
145+ // Determine type and display info based on stored data or path
146+ if ( storedType === ContextMenuOptionType . URL ) {
147+ type = "url"
148+ displayName = node . path
149+ icon = linkIconSvg
150+ } else if ( storedType === ContextMenuOptionType . Problems ) {
151+ type = "problems"
152+ displayName = "Problems"
153+ icon = linkIconSvg // You can change this to a different icon if needed
154+ } else if ( storedType === ContextMenuOptionType . Terminal ) {
155+ type = "terminal"
156+ displayName = "Terminal"
157+ icon = linkIconSvg // You can change this to a different icon if needed
158+ } else if ( storedType === ContextMenuOptionType . Git ) {
159+ type = "git"
160+ displayName = node . path
161+ icon = linkIconSvg // You can change this to a different icon if needed
162+ } else if ( storedType === ContextMenuOptionType . File ) {
163+ type = "file"
164+ displayName = getDisplayName ( node . path , mentionPaths )
165+ icon = getMaterialIconForMention ( node . path , "file" )
166+ } else if ( storedType === ContextMenuOptionType . Folder ) {
167+ type = "folder"
168+ displayName = getDisplayName ( node . path , mentionPaths )
169+ icon = getMaterialIconForMention ( node . path , "folder" )
140170 } else {
141171 // Fall back to path-based detection for backward compatibility
142172 type = isFolder ( node . path ) ? "folder" : "file"
173+ displayName = getDisplayName ( node . path , mentionPaths )
174+ icon = getMaterialIconForMention ( node . path , type )
143175 }
144176
145177 return {
146178 path : node . path ,
147- displayName : getDisplayName ( node . path , mentionPaths ) ,
148- icon : getMaterialIconForMention ( node . path , type ) ,
179+ displayName,
180+ icon,
149181 type,
150182 }
151183 } )
0 commit comments