fix advanced editor in description #7372
1 changed files with 8 additions and 2 deletions
|
@ -18,11 +18,17 @@ function PublishDescription(props: Props) {
|
||||||
setAdvancedEditor(!advancedEditor);
|
setAdvancedEditor(!advancedEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleCommentChange(event) {
|
||||||
|
let descriptionValue = advancedEditor ? event : event.target.value;
|
||||||
|
|
||||||
|
updatePublishForm({ description: descriptionValue });
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
actions={
|
actions={
|
||||||
<FormField
|
<FormField
|
||||||
type={'textarea'}
|
type={advancedEditor ? 'markdown' : 'textarea'}
|
||||||
name="content_description"
|
name="content_description"
|
||||||
label={__('Description')}
|
label={__('Description')}
|
||||||
placeholder={__(
|
placeholder={__(
|
||||||
|
@ -30,7 +36,7 @@ function PublishDescription(props: Props) {
|
||||||
)}
|
)}
|
||||||
value={description}
|
value={description}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onChange={(value) => updatePublishForm({ description: advancedEditor ? value : value.target.value })}
|
onChange={handleCommentChange}
|
||||||
quickActionLabel={advancedEditor ? __('Simple Editor') : __('Advanced Editor')}
|
quickActionLabel={advancedEditor ? __('Simple Editor') : __('Advanced Editor')}
|
||||||
quickActionHandler={toggleMarkdown}
|
quickActionHandler={toggleMarkdown}
|
||||||
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
|
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
|
||||||
|
|
Loading…
Add table
Reference in a new issue