MWLinkAnnotationInspector: Get HtmlDocument in a different way

Get the HtmlDocument in a different way that doesn't involve
ve.init.target.

For page (non-Flow) MW VE, I checked that it yields the same result.

Bug: T103176
Change-Id: I54bdf4f29f6acf4359be45b5b2ddfd23b5835c34
This commit is contained in:
Matthew Flaschen 2015-06-23 23:14:10 -04:00 committed by Roan Kattouw
parent 2e6060e5c7
commit 8112c3ba30

View file

@ -85,14 +85,15 @@ ve.ui.MWLinkAnnotationInspector.prototype.isExternal = function () {
*/
ve.ui.MWLinkAnnotationInspector.prototype.onInternalLinkChange = function ( annotation ) {
var title,
href = annotation ? annotation.getAttribute( 'title' ) : '';
href = annotation ? annotation.getAttribute( 'title' ) : '',
htmlDoc = this.getFragment().getDocument().getHtmlDocument();
if ( ve.init.platform.getExternalLinkUrlProtocolsRegExp().test( href ) ) {
if ( htmlDoc && ve.init.platform.getExternalLinkUrlProtocolsRegExp().test( href ) ) {
// Check if the 'external' link is in fact a page on the same wiki
// e.g. http://en.wikipedia.org/wiki/Target -> Target
title = ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref(
href,
ve.init.target.doc
htmlDoc
).title;
if ( title !== href ) {
this.internalAnnotationInput.text.setValue( title );