fix advanced editor in description #7372

Merged
jessopb merged 1 commit from fix-advancedDescription into master 2021-12-29 21:58:56 +01:00

View file

@ -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}