Skip to content

Commit 4efbf79

Browse files
committed
fix(files): stop the duplicate 'mention' extension-name warning
The @-mention menu extension and the mention node were both named 'mention', so TipTap logged "Duplicate extension names found: ['mention']" on every editor (twice under the collaborative placeholder + live pair). Rename the menu extension to 'mentionMenu' (the node keeps 'mention', its persisted doc-node type) and move its editor.storage.mention -> editor.storage.mentionMenu. Verified the warning no longer fires.
1 parent 8ec18fe commit 4efbf79

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-chip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function MentionChipView({ node, editor }: ReactNodeViewProps) {
3838
const { kind, id, label } = node.attrs as MentionAttrs
3939
const Icon = mentionIcon(kind, id, label) as StyleableIcon | undefined
4040
const iconStyle = Icon ? getBareIconStyle(Icon) : undefined
41-
const navigable = editor.storage.mention?.navigable === true
41+
const navigable = editor.storage.mentionMenu?.navigable === true
4242
const workspaceId = typeof params.workspaceId === 'string' ? params.workspaceId : undefined
4343
const path = navigable && workspaceId ? simLinkPath(workspaceId, kind, id) : null
4444

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface MentionStorage {
2525

2626
declare module '@tiptap/core' {
2727
interface Storage {
28-
mention: MentionStorage
28+
mentionMenu: MentionStorage
2929
}
3030
}
3131

@@ -35,10 +35,10 @@ declare module '@tiptap/core' {
3535
* entity inserts it as a portable `sim:<kind>/<id>` markdown link (same wire format as the chat
3636
* composer's `chip-clipboard-codec`), so it round-trips natively through the editor's link + markdown
3737
* machinery. The plugin's `items` is an empty gate; the real list is sourced reactively from the store
38-
* inside {@link MentionList}, populated by the host via the extension's `mention` storage.
38+
* inside {@link MentionList}, populated by the host via the extension's `mentionMenu` storage.
3939
*/
4040
export const Mention = Extension.create<Record<string, never>, MentionStorage>({
41-
name: 'mention',
41+
name: 'mentionMenu',
4242

4343
addStorage() {
4444
return { store: createMentionStore(), onOpen: null, enabled: true, navigable: false }
@@ -53,7 +53,7 @@ export const Mention = Extension.create<Record<string, never>, MentionStorage>({
5353
allowSpaces: false,
5454
startOfLine: false,
5555
allow: ({ editor, range }) => {
56-
if (!editor.storage.mention.enabled) return false
56+
if (!editor.storage.mentionMenu.enabled) return false
5757
if (editor.isActive('codeBlock') || editor.isActive('link') || editor.isActive('code')) {
5858
return false
5959
}
@@ -78,10 +78,10 @@ export const Mention = Extension.create<Record<string, never>, MentionStorage>({
7878
mapProps: (props) => ({
7979
query: props.query,
8080
command: props.command,
81-
store: props.editor.storage.mention.store,
81+
store: props.editor.storage.mentionMenu.store,
8282
editor: props.editor,
8383
}),
84-
onOpen: (props) => props.editor.storage.mention?.onOpen?.(),
84+
onOpen: (props) => props.editor.storage.mentionMenu?.onOpen?.(),
8585
}),
8686
}),
8787
]

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/use-editor-mentions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ export function useEditorMentions(
2727
useEffect(() => {
2828
if (!editor) return
2929
const taggingOn = Boolean(workspaceId) && !disableTagging
30-
editor.storage.mention.enabled = taggingOn
31-
editor.storage.mention.navigable = navigable
32-
editor.storage.mention.onOpen = taggingOn ? () => setActive(true) : null
30+
editor.storage.mentionMenu.enabled = taggingOn
31+
editor.storage.mentionMenu.navigable = navigable
32+
editor.storage.mentionMenu.onOpen = taggingOn ? () => setActive(true) : null
3333
return () => {
34-
editor.storage.mention.onOpen = null
34+
editor.storage.mentionMenu.onOpen = null
3535
}
3636
}, [editor, workspaceId, navigable, disableTagging])
3737

3838
useEffect(() => {
39-
editor?.storage.mention.store.set(items)
39+
editor?.storage.mentionMenu.store.set(items)
4040
}, [editor, items])
4141
}

0 commit comments

Comments
 (0)