diff --git a/ui/component/comment/view.jsx b/ui/component/comment/view.jsx index e8c6153c6..268a3dbf1 100644 --- a/ui/component/comment/view.jsx +++ b/ui/component/comment/view.jsx @@ -12,6 +12,7 @@ import * as ICONS from 'constants/icons'; import { FormField, Form } from 'component/common/form'; import CommentCreate from 'component/commentCreate'; import classnames from 'classnames'; +import usePersistedState from 'effects/use-persisted-state'; type Props = { uri: string, @@ -64,6 +65,8 @@ function Comment(props: Props) { // used for controlling visibility of reply comment component const [isReplying, setReplying] = useState(false); + const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false); + // to debounce subsequent requests const shouldFetch = channel === undefined || @@ -99,7 +102,7 @@ function Comment(props: Props) { } function handleEditMessageChanged(event) { - setCommentValue(event.target.value); + setCommentValue(advancedEditor ? event : event.target.value); } function handleSubmit() { @@ -124,6 +127,10 @@ function Comment(props: Props) { setMouseHover(false); } + function toggleEditorMode() { + setAdvancedEditor(!advancedEditor); + } + return (