always use markdown editor for text posts
This commit is contained in:
parent
036aedd88d
commit
42e989d0cc
1 changed files with 2 additions and 11 deletions
|
@ -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}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue