diff --git a/apps/client/src/features/editor/extensions/emoji-command.ts b/apps/client/src/features/editor/extensions/emoji-command.ts index 85a50f18..e2fc6b90 100644 --- a/apps/client/src/features/editor/extensions/emoji-command.ts +++ b/apps/client/src/features/editor/extensions/emoji-command.ts @@ -15,6 +15,14 @@ const Command = Extension.create({ command: ({ editor, range, props }) => { props.command({ editor, range, props }); }, + allow: ({ state, range }) => { + const $from = state.doc.resolve(range.from); + // Disable emoji menu inside code blocks + if ($from.parent.type.name === "codeBlock") { + return false; + } + return true; + }, } as Partial, }; }, diff --git a/apps/client/src/features/editor/extensions/slash-command.ts b/apps/client/src/features/editor/extensions/slash-command.ts index d11c3ae6..160cb924 100644 --- a/apps/client/src/features/editor/extensions/slash-command.ts +++ b/apps/client/src/features/editor/extensions/slash-command.ts @@ -17,6 +17,14 @@ const Command = Extension.create({ command: ({ editor, range, props }) => { props.command({ editor, range, props }); }, + allow: ({ state, range }) => { + const $from = state.doc.resolve(range.from); + // Disable slash menu inside code blocks + if ($from.parent.type.name === 'codeBlock') { + return false; + } + return true; + }, } as Partial, }; },