Wire admin studio SSR and search infrastructure
This commit is contained in:
@@ -238,6 +238,8 @@ export default function RichTextEditor({
|
||||
const editor = useEditor({
|
||||
extensions: [
|
||||
StarterKit.configure({
|
||||
link: false,
|
||||
underline: false,
|
||||
heading: { levels: [2, 3] },
|
||||
codeBlock: {
|
||||
HTMLAttributes: { class: 'forum-code-block' },
|
||||
@@ -262,6 +264,7 @@ export default function RichTextEditor({
|
||||
suggestion: mentionSuggestion,
|
||||
}),
|
||||
],
|
||||
immediatelyRender: false,
|
||||
content,
|
||||
autofocus,
|
||||
editorProps: {
|
||||
@@ -291,6 +294,10 @@ export default function RichTextEditor({
|
||||
useEffect(() => {
|
||||
if (editor && content && !editor.getHTML().includes(content.slice(0, 30))) {
|
||||
editor.commands.setContent(content, false)
|
||||
// Keep the parent form state in sync with what we just rendered.
|
||||
// setContent with emitUpdate=false silently resets TipTap without
|
||||
// calling onUpdate, so form.data.content would lag behind the editor.
|
||||
onChange?.(content)
|
||||
}
|
||||
}, [content]) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
|
||||
Reference in New Issue
Block a user