mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 08:10:35 +00:00
Resolve image paths when writing to clipboard
Bug: T111927 Change-Id: Idf3b761481454197eecbc0f6cd5cf6199419ca6c
This commit is contained in:
parent
d67d110d26
commit
036b6c9edf
|
@ -90,7 +90,7 @@ ve.dm.MWExtensionNode.static.toDomElements = function ( dataElement, doc, conver
|
|||
( originalMw && ve.compare( dataElement.attributes.mw, JSON.parse( originalMw ) ) )
|
||||
) {
|
||||
// The object in the store is also used for CE rendering so return a copy
|
||||
return ve.copyDomElements( dataElement.originalDomElements, doc );
|
||||
els = ve.copyDomElements( dataElement.originalDomElements, doc );
|
||||
} else {
|
||||
if ( converter.isForClipboard() && index !== null ) {
|
||||
// For the clipboard use the current DOM contents so the user has something
|
||||
|
@ -102,8 +102,15 @@ ve.dm.MWExtensionNode.static.toDomElements = function ( dataElement, doc, conver
|
|||
el.setAttribute( 'data-mw', JSON.stringify( dataElement.attributes.mw ) );
|
||||
els = [ el ];
|
||||
}
|
||||
return els;
|
||||
}
|
||||
if ( converter.isForClipboard() ) {
|
||||
// Resolve image sources
|
||||
$( els ).find( 'img' ).addBack( 'img' ).each( function () {
|
||||
var $this = $( this );
|
||||
$this.attr( 'src', ve.resolveUrl( $this.attr( 'src' ), doc ) );
|
||||
} );
|
||||
}
|
||||
return els;
|
||||
};
|
||||
|
||||
ve.dm.MWExtensionNode.static.getHashObject = function ( dataElement ) {
|
||||
|
|
|
@ -183,6 +183,12 @@ ve.dm.MWTransclusionNode.static.toDomElements = function ( dataElement, doc, con
|
|||
els[ i ] = wrapTextNode( els[ i ] );
|
||||
els[ i ].setAttribute( 'data-ve-ignore', 'true' );
|
||||
}
|
||||
|
||||
// Resolve image sources
|
||||
$( els ).find( 'img' ).addBack( 'img' ).each( function () {
|
||||
var $this = $( this );
|
||||
$this.attr( 'src', ve.resolveUrl( $this.attr( 'src' ), doc ) );
|
||||
} );
|
||||
}
|
||||
return els;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue