From c236b90b6f7a50c3d5dda72b2b280b3f23d66100 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Fri, 13 Sep 2024 15:39:11 +0700 Subject: [PATCH] UBERF-8079 Disable slash menu in codeblock (#6548) Signed-off-by: Alexander Onnikov --- .../src/components/extension/inlineCommands.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/text-editor-resources/src/components/extension/inlineCommands.ts b/plugins/text-editor-resources/src/components/extension/inlineCommands.ts index 8e02544e7a..0ff6cd7692 100644 --- a/plugins/text-editor-resources/src/components/extension/inlineCommands.ts +++ b/plugins/text-editor-resources/src/components/extension/inlineCommands.ts @@ -14,8 +14,8 @@ // import { Extension } from '@tiptap/core' -import Suggestion, { type SuggestionOptions } from './suggestion' import { PluginKey } from '@tiptap/pm/state' +import Suggestion, { type SuggestionOptions } from './suggestion' export interface InlineCommandsOptions { suggestion: Omit @@ -31,7 +31,11 @@ export const InlineCommandsExtension = Extension.create({ return { suggestion: { char: '/', - startOfLine: true + allow: ({ state }) => { + const { $anchor } = state.selection + const parent = $anchor.parent + return parent.type.name === 'paragraph' + } } } },