mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Fix hashes in MW toDomElement functions
Hashes weren't using the new [ object, config ] set up so were never matching the store. Also added a check to see if the originalDomElements actually exists before trying to use them (they may have been removed by a clone operation). Change-Id: I886e369ced9a9d2e0e457ced9c21b2a7a8e55d58
This commit is contained in:
parent
89ae1aa107
commit
2843714834
|
@ -74,7 +74,7 @@ ve.dm.MWExtensionNode.static.toDataElement = function ( domElements, converter )
|
|||
|
||||
ve.dm.MWExtensionNode.static.toDomElements = function ( dataElement, doc, converter ) {
|
||||
var el,
|
||||
index = converter.getStore().indexOfHash( OO.getHash( this.getHashObject( dataElement ) ) ),
|
||||
index = converter.getStore().indexOfHash( OO.getHash( [ this.getHashObject( dataElement ), undefined ] ) ),
|
||||
originalMw = dataElement.attributes.originalMw;
|
||||
|
||||
// If the transclusion is unchanged just send back the
|
||||
|
|
|
@ -90,14 +90,16 @@ ve.dm.MWTransclusionNode.static.toDataElement = function ( domElements, converte
|
|||
|
||||
ve.dm.MWTransclusionNode.static.toDomElements = function ( dataElement, doc, converter ) {
|
||||
var el,
|
||||
index = converter.getStore().indexOfHash( OO.getHash( this.getHashObject( dataElement ) ) ),
|
||||
index = converter.getStore().indexOfHash( OO.getHash( [ this.getHashObject( dataElement ), undefined ] ) ),
|
||||
originalMw = dataElement.attributes.originalMw;
|
||||
|
||||
// If the transclusion is unchanged just send back the
|
||||
// original DOM elements so selser can skip over it
|
||||
if (
|
||||
index === dataElement.attributes.originalIndex ||
|
||||
( originalMw && ve.compare( dataElement.attributes.mw, JSON.parse( originalMw ) ) )
|
||||
dataElement.attributes.originalDomElements && (
|
||||
index === dataElement.attributes.originalIndex ||
|
||||
( 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.attributes.originalDomElements, doc );
|
||||
|
|
Loading…
Reference in a new issue