Skip to content

Commit

Permalink
feat: show error on change not on submit, fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandru Medesan authored and Alexandru Medesan committed Mar 1, 2023
1 parent 9bfffd9 commit fb844f5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/NextCloud/NextCloudVideoEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ class Edit extends Component {
* @returns {undefined}
*/
onSubmitUrl() {
this.props.onChangeBlock(this.props.block, {
...this.props.data,
url: this.state.url,
});
if (this.isValidUrl(this.state.url)) {
this.props.onChangeBlock(this.props.block, {
...this.props.data,
url: this.state.url,
});
}
}

resetSubmitUrl = () => {
Expand Down Expand Up @@ -218,11 +220,11 @@ class Edit extends Component {
</Button>
</Button.Group>
</div>
{data.url && !this.isValidUrl(data.url) && (
{this.state.url && !this.isValidUrl(this.state.url) && (
<Message
error
content={`${this.props.intl.formatMessage(
messages.VideoBlockInputPlaceholder,
messages.VideoBlockInputError,
)} ${this.allowedDomainList.join(', ')}`}
/>
)}
Expand Down

0 comments on commit fb844f5

Please sign in to comment.