refac
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user