diff --git a/src/components/TinyMCEEditor.jsx b/src/components/TinyMCEEditor.jsx index 75ca1fcb..793bdd8e 100644 --- a/src/components/TinyMCEEditor.jsx +++ b/src/components/TinyMCEEditor.jsx @@ -92,7 +92,7 @@ export default function TinyMCEEditor(props) { browser_spellcheck: true, a11y_advanced_options: true, autosave_interval: '1s', - autosave_restore_when_empty: true, + autosave_restore_when_empty: false, plugins: 'autosave codesample link lists image imagetools code emoticons charmap', toolbar: 'undo redo' + ' | formatselect | bold italic underline' diff --git a/src/discussions/comments/comment/CommentEditor.jsx b/src/discussions/comments/comment/CommentEditor.jsx index 0fec7c8a..60b965d4 100644 --- a/src/discussions/comments/comment/CommentEditor.jsx +++ b/src/discussions/comments/comment/CommentEditor.jsx @@ -54,7 +54,12 @@ function CommentEditor({ editReasonCode: comment?.lastEdit?.reasonCode || '', }; - const saveUpdatedComment = async (values) => { + const handleCloseEditor = (resetForm) => { + resetForm({ values: initialValues }); + onCloseEditor(); + }; + + const saveUpdatedComment = async (values, { resetForm }) => { if (comment.id) { const payload = { ...values, @@ -68,7 +73,7 @@ function CommentEditor({ if (editorRef.current) { editorRef.current.plugins.autosave.removeDraft(); } - onCloseEditor(); + handleCloseEditor(resetForm); }; // The editorId is used to autosave contents to localstorage. This format means that the autosave is scoped to // the current comment id, or the current comment parent or the curren thread. @@ -87,6 +92,7 @@ function CommentEditor({ handleSubmit, handleBlur, handleChange, + resetForm, }) => (