mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
MWLinkTargetInputWidget: Check title is valid in MediaWiki
Bug: T86709 Change-Id: Ia399d3e8847d520b5d57baa302de8197fdea0787
This commit is contained in:
parent
1a4c821dad
commit
1e8929993d
|
@ -90,7 +90,7 @@ ve.ui.MWLinkTargetInputWidget.prototype.isValid = function () {
|
||||||
valid = this.annotation.getAttribute( 'href' )
|
valid = this.annotation.getAttribute( 'href' )
|
||||||
.match( /(^|\s)((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi );
|
.match( /(^|\s)((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi );
|
||||||
} else {
|
} else {
|
||||||
valid = !!this.getValue();
|
valid = !!mw.Title.newFromText( this.getValue() );
|
||||||
}
|
}
|
||||||
return $.Deferred().resolve( valid ).promise();
|
return $.Deferred().resolve( valid ).promise();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue