always use markdown editor for text posts

This commit is contained in:
Sean Yesmunt 2020-08-04 11:12:57 -04:00
parent 036aedd88d
commit 42e989d0cc

View file

@ -1,9 +1,7 @@
// @flow // @flow
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { SIMPLE_SITE } from 'config';
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field'; import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
import usePersistedState from 'effects/use-persisted-state';
type Props = { type Props = {
uri: ?string, uri: ?string,
@ -40,14 +38,9 @@ function PostEditor(props: Props) {
const [ready, setReady] = React.useState(!editing); const [ready, setReady] = React.useState(!editing);
const [loading, setLoading] = React.useState(false); const [loading, setLoading] = React.useState(false);
const [advancedEditor, setAdvancedEditor] = usePersistedState('publish-form-post-mode', false);
function toggleMarkdown() {
setAdvancedEditor(!advancedEditor);
}
useEffect(() => { useEffect(() => {
if (editing) { if (editing && uri) {
fetchStreamingUrl(uri); fetchStreamingUrl(uri);
} }
}, [uri, editing]); }, [uri, editing]);
@ -114,9 +107,7 @@ function PostEditor(props: Props) {
placeholder={__('My content for this post...')} placeholder={__('My content for this post...')}
value={ready ? fileText : __('Loading...')} value={ready ? fileText : __('Loading...')}
disabled={!ready || disabled} disabled={!ready || disabled}
onChange={value => updatePublishForm({ fileText: advancedEditor ? value : value.target.value })} onChange={value => updatePublishForm({ fileText: value })}
quickActionLabel={!SIMPLE_SITE && (advancedEditor ? __('Simple Editor') : __('Advanced Editor'))}
quickActionHandler={toggleMarkdown}
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION} textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
/> />
); );