Skip to content

Commit

Permalink
Added ability to disable object browser button from AddLinkForm
Browse files Browse the repository at this point in the history
- When using the LinkEditor Widget from ImageWidget we already
  have the button to choose an image as such within the "Use an url"
  button we give the ability only to type or paste a link
  • Loading branch information
ichim-david committed Jun 16, 2024
1 parent e617d73 commit e5dd823
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class AddLinkForm extends Component {
<Icon name={clearSVG} size="24px" />
</Button>
</Button.Group>
) : (
) : this.props.objectBrowserPickerType === 'link' ? (
<Button.Group>
<Button
basic
Expand All @@ -297,7 +297,7 @@ class AddLinkForm extends Component {
e.preventDefault();
e.stopPropagation();
this.props.openObjectBrowser({
mode: this.props.objectBrowserPickerType || 'link',
mode: this.props.objectBrowserPickerType,
overlay: true,
onSelectItem: (url) => {
this.onChange(url);
Expand All @@ -309,7 +309,8 @@ class AddLinkForm extends Component {
<Icon name={navTreeSVG} size="24px" />
</Button>
</Button.Group>
)}
) : null}

<Button.Group>
<Button
basic
Expand Down
3 changes: 1 addition & 2 deletions packages/volto/src/components/manage/Widgets/ImageWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const UnconnectedImageInput = (props) => {
restrictFileUpload = false,
objectBrowserPickerType = 'image',
description,
placeholderLinkInput = '',
} = props;

const intl = useIntl();
Expand Down Expand Up @@ -265,6 +264,7 @@ const UnconnectedImageInput = (props) => {
{linkEditor.anchorNode && (
<linkEditor.LinkEditor
value={value}
placeholder={intl.formatMessage(messages.linkAnImage)}
objectBrowserPickerType={objectBrowserPickerType}
onChange={(_, e) =>
onChange(
Expand All @@ -273,7 +273,6 @@ const UnconnectedImageInput = (props) => {
{},
)
}
placeholder={placeholderLinkInput}
id={id}
/>
)}
Expand Down

0 comments on commit e5dd823

Please sign in to comment.