A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix(Editor): Enhancing the robust of setting editor values
haitaoo481901efd7ad
diff --git a/ui/src/components/Editor/Editor.tsx b/ui/src/components/Editor/Editor.tsxindex 520a5ac6..a1ac16a9 100644--- a/ui/src/components/Editor/Editor.tsx+++ b/ui/src/components/Editor/Editor.tsx@@ -94,7 +94,7 @@ const Editor = ({return;}if (editor.getValue() !== value) {- editor.setValue(value);+ editor.setValue(value || '');}}, [editor, value]);diff --git a/ui/src/pages/Questions/Ask/index.tsx b/ui/src/pages/Questions/Ask/index.tsxindex 6f12a519..533b59f7 100644--- a/ui/src/pages/Questions/Ask/index.tsx+++ b/ui/src/pages/Questions/Ask/index.tsx@@ -302,7 +302,7 @@ const Ask = () => {const handleSelectedRevision = (e) => {const index = e.target.value;const revision = revisions[index];- formData.content.value = revision.content.content;+ formData.content.value = revision.content?.content || '';setImmData({ ...formData });setFormData({ ...formData });};