mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Resolve URLs in show preview against correct base
Bug: T153277 Change-Id: Icaa6de4618de008fb2024d1dd428114688cb1043
This commit is contained in:
parent
c92418e4da
commit
9728d78126
|
@ -1007,12 +1007,18 @@ ve.init.mw.ArticleTarget.prototype.onSaveDialogPreview = function () {
|
|||
wikitext: wikitext,
|
||||
pst: true
|
||||
} ).always( function ( response, details ) {
|
||||
var doc, body;
|
||||
if ( ve.getProp( response, 'visualeditor', 'result' ) === 'success' ) {
|
||||
target.saveDialog.showPreview( response.visualeditor.content );
|
||||
doc = target.parseDocument( response.visualeditor.content, 'visual' );
|
||||
body = doc.body;
|
||||
// Import body to current document, then resolve attributes against original document (parseDocument called #fixBase)
|
||||
document.adoptNode( body );
|
||||
ve.resolveAttributes( body, doc, ve.dm.Converter.static.computedAttributes );
|
||||
target.saveDialog.showPreview( $( body ).contents() );
|
||||
} else {
|
||||
target.saveDialog.showPreview( $( '<em>' ).text(
|
||||
ve.msg( 'visualeditor-loaderror-message', ve.getProp( details, 'error', 'info' ) || 'Failed to connect' )
|
||||
).html() );
|
||||
) );
|
||||
}
|
||||
target.bindSaveDialogClearDiff();
|
||||
} );
|
||||
|
|
|
@ -127,10 +127,10 @@ ve.ui.MWSaveDialog.prototype.setDiffAndReview = function ( content ) {
|
|||
/**
|
||||
* Set preview content and show preview panel.
|
||||
*
|
||||
* @param {string} content Preview HTML
|
||||
* @param {jQuery} content Preview content
|
||||
*/
|
||||
ve.ui.MWSaveDialog.prototype.showPreview = function ( content ) {
|
||||
this.$previewViewer.html( content );
|
||||
this.$previewViewer.empty().append( content );
|
||||
mw.hook( 'wikipage.content' ).fire( this.$previewViewer );
|
||||
this.actions.setAbilities( { approve: true } );
|
||||
this.popPending();
|
||||
|
|
Loading…
Reference in a new issue