refac
This commit is contained in:
1 parent
743b9fd3ce
commit
001775d8e8
1 file changed
+13
@@ -150,6 +150,7 @@
|
|||||||
import Typography from '@tiptap/extension-typography';
|
import Typography from '@tiptap/extension-typography';
|
||||||
import Highlight from '@tiptap/extension-highlight';
|
import Highlight from '@tiptap/extension-highlight';
|
||||||
import Code from '@tiptap/extension-code';
|
import Code from '@tiptap/extension-code';
|
||||||
|
import Italic from '@tiptap/extension-italic';
|
||||||
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight';
|
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight';
|
||||||
|
|
||||||
// WORKAROUND: TipTap's default Code mark input rule regex captures the
|
// 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 Mention from '@tiptap/extension-mention';
|
||||||
import FormattingButtons from './RichTextInput/FormattingButtons.svelte';
|
import FormattingButtons from './RichTextInput/FormattingButtons.svelte';
|
||||||
|
|
||||||
@@ -748,6 +759,7 @@
|
|||||||
StarterKit.configure({
|
StarterKit.configure({
|
||||||
link: link,
|
link: link,
|
||||||
code: false, // Disabled in favor of FixedCode (see workaround above)
|
code: false, // Disabled in favor of FixedCode (see workaround above)
|
||||||
|
...(messageInput ? { italic: false } : {}),
|
||||||
// When rich text is on, ListKit + CodeBlockLowlight provide these.
|
// When rich text is on, ListKit + CodeBlockLowlight provide these.
|
||||||
// Disable StarterKit's equivalents to avoid duplicate extension names.
|
// Disable StarterKit's equivalents to avoid duplicate extension names.
|
||||||
...(richText
|
...(richText
|
||||||
@@ -766,6 +778,7 @@
|
|||||||
...(richText ? {} : { strike: false })
|
...(richText ? {} : { strike: false })
|
||||||
}),
|
}),
|
||||||
FixedCode,
|
FixedCode,
|
||||||
|
...(messageInput ? [PromptItalic] : []),
|
||||||
...(dragHandle ? [ListItemDragHandle] : []),
|
...(dragHandle ? [ListItemDragHandle] : []),
|
||||||
Placeholder.configure({ placeholder: () => _placeholder, showOnlyWhenEditable: false }),
|
Placeholder.configure({ placeholder: () => _placeholder, showOnlyWhenEditable: false }),
|
||||||
SelectionDecoration,
|
SelectionDecoration,
|
||||||
|
|||||||
Reference in new issue
Block a user