Use ve.targetLinksToNewWindow

Depends-On: I3088e8b95d9032b8e8fd5bff58a8b97ffaa15f98
Change-Id: I07ec10841b62ed1e8c3b3cf82b42653327618cb0
This commit is contained in:
Ed Sanders 2017-03-24 18:34:12 +00:00 committed by Jforrester
parent e996d44e72
commit b756199dc7

View file

@ -376,7 +376,7 @@ ve.init.mw.ArticleTarget.prototype.loadSuccess = function ( response ) {
} }
if ( $label ) { if ( $label ) {
title = $label.attr( 'title' ); title = $label.attr( 'title' );
$label.find( 'a' ).attr( 'target', '_blank' ); ve.targetLinksToNewWindow( $label[ 0 ] );
} }
checkbox = new OO.ui.CheckboxInputWidget( { checkbox = new OO.ui.CheckboxInputWidget( {
value: $this.attr( 'value' ), value: $this.attr( 'value' ),
@ -1116,10 +1116,7 @@ ve.init.mw.ArticleTarget.prototype.onSaveDialogPreview = function () {
document.adoptNode( body ); document.adoptNode( body );
// TODO: This code is very similar to ve.ui.PreviewElement // TODO: This code is very similar to ve.ui.PreviewElement
ve.resolveAttributes( body, doc, ve.dm.Converter.static.computedAttributes ); ve.resolveAttributes( body, doc, ve.dm.Converter.static.computedAttributes );
// Make all links open in a new window (sync view) ve.targetLinksToNewWindow( body );
Array.prototype.forEach.call( body.querySelectorAll( 'a[href]' ), function ( el ) {
el.setAttribute( 'target', '_blank' );
} );
target.saveDialog.showPreview( $( body ).contents() ); target.saveDialog.showPreview( $( body ).contents() );
} else { } else {
target.saveDialog.showPreview( $( '<em>' ).text( target.saveDialog.showPreview( $( '<em>' ).text(