From 001775d8e868ce44f125e0d683dd50363f0e8318 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 16 Jul 2026 22:53:31 -0400 Subject: [PATCH] refac --- src/lib/components/common/RichTextInput.svelte | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/components/common/RichTextInput.svelte b/src/lib/components/common/RichTextInput.svelte index f40b2f3cad..3edb39da55 100644 --- a/src/lib/components/common/RichTextInput.svelte +++ b/src/lib/components/common/RichTextInput.svelte @@ -150,6 +150,7 @@ import Typography from '@tiptap/extension-typography'; import Highlight from '@tiptap/extension-highlight'; import Code from '@tiptap/extension-code'; + import Italic from '@tiptap/extension-italic'; import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'; // WORKAROUND: TipTap's default Code mark input rule regex captures the @@ -169,6 +170,16 @@ } }); + // Prompt inputs need literal asterisks preserved, while toolbar-applied italic should still work. + const PromptItalic = Italic.extend({ + addInputRules() { + return []; + }, + addPasteRules() { + return []; + } + }); + import Mention from '@tiptap/extension-mention'; import FormattingButtons from './RichTextInput/FormattingButtons.svelte'; @@ -748,6 +759,7 @@ StarterKit.configure({ link: link, code: false, // Disabled in favor of FixedCode (see workaround above) + ...(messageInput ? { italic: false } : {}), // When rich text is on, ListKit + CodeBlockLowlight provide these. // Disable StarterKit's equivalents to avoid duplicate extension names. ...(richText @@ -766,6 +778,7 @@ ...(richText ? {} : { strike: false }) }), FixedCode, + ...(messageInput ? [PromptItalic] : []), ...(dragHandle ? [ListItemDragHandle] : []), Placeholder.configure({ placeholder: () => _placeholder, showOnlyWhenEditable: false }), SelectionDecoration,