feat: image widget insert from url should be optional (#5572)

This commit is contained in:
Eduardo Ahumada
2021-07-05 09:01:31 -05:00
committed by GitHub
parent 97353b6778
commit 18724ff991
3 changed files with 17 additions and 10 deletions

View File

@ -291,7 +291,7 @@ export default function withFileControl({ forImage } = {}) {
};
renderSelection = subject => {
const { t } = this.props;
const { t, field } = this.props;
return (
<div>
{forImage ? this.renderImages() : null}
@ -300,9 +300,11 @@ export default function withFileControl({ forImage } = {}) {
<FileWidgetButton onClick={this.handleChange}>
{t(`editor.editorWidgets.${subject}.chooseDifferent`)}
</FileWidgetButton>
<FileWidgetButton onClick={this.handleUrl(subject)}>
{t(`editor.editorWidgets.${subject}.replaceUrl`)}
</FileWidgetButton>
{field.get('choose_url', true) ? (
<FileWidgetButton onClick={this.handleUrl(subject)}>
{t(`editor.editorWidgets.${subject}.replaceUrl`)}
</FileWidgetButton>
) : null}
<FileWidgetButtonRemove onClick={this.handleRemove}>
{t(`editor.editorWidgets.${subject}.remove`)}
</FileWidgetButtonRemove>
@ -312,15 +314,17 @@ export default function withFileControl({ forImage } = {}) {
};
renderNoSelection = subject => {
const { t } = this.props;
const { t, field } = this.props;
return (
<>
<FileWidgetButton onClick={this.handleChange}>
{t(`editor.editorWidgets.${subject}.choose`)}
</FileWidgetButton>
<FileWidgetButton onClick={this.handleUrl(subject)}>
{t(`editor.editorWidgets.${subject}.chooseUrl`)}
</FileWidgetButton>
{field.get('choose_url', true) ? (
<FileWidgetButton onClick={this.handleUrl(subject)}>
{t(`editor.editorWidgets.${subject}.chooseUrl`)}
</FileWidgetButton>
) : null}
</>
);
};