diff --git a/packages/neos-ui-editors/src/Library/LinkInput.js b/packages/neos-ui-editors/src/Library/LinkInput.js index af590598d6..18d5c2a58a 100644 --- a/packages/neos-ui-editors/src/Library/LinkInput.js +++ b/packages/neos-ui-editors/src/Library/LinkInput.js @@ -149,6 +149,12 @@ export default class LinkInput extends PureComponent { } handleSearchTermChange = searchTerm => { + // trim leading whitespace as it can cause issues + // with the further processing + if (typeof searchTerm === 'string') { + searchTerm = searchTerm.trimStart(); + } + this.setState({searchTerm}); if (isUriOrInternalLink(searchTerm)) { @@ -269,9 +275,16 @@ export default class LinkInput extends PureComponent { } handleManualSetLink = () => { - this.props.onLinkChange(this.state.searchTerm); + let {searchTerm} = this.state; + // trim tailing whitespace as it can cause issues + if (typeof searchTerm === 'string') { + searchTerm = searchTerm.trim(); + this.setState({searchTerm}); + } + + this.props.onLinkChange(searchTerm); this.setState({ - isEditMode: !this.state.searchTerm + isEditMode: !searchTerm }); }