mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Strip RESTBase IDs from historical diffs
Change-Id: I911d529204a97003ed233464709737b018918634
This commit is contained in:
parent
1809344c8a
commit
405afdce70
|
@ -27,9 +27,16 @@
|
|||
getModelFromResponse: function ( response ) {
|
||||
var doc,
|
||||
targetClass = ve.init.mw.DesktopArticleTarget,
|
||||
metadataIdRegExp = ve.init.platform.getMetadataIdRegExp(),
|
||||
data = response ? ( response.visualeditor || response.visualeditoredit ) : null;
|
||||
if ( data && typeof data.content === 'string' ) {
|
||||
doc = targetClass.static.parseDocument( data.content, 'visual' );
|
||||
// Strip RESTBase IDs
|
||||
Array.prototype.forEach.call( doc.querySelectorAll( '[id^="mw"]' ), function ( element ) {
|
||||
if ( element.id.match( metadataIdRegExp ) ) {
|
||||
element.removeAttribute( 'id' );
|
||||
}
|
||||
} );
|
||||
return targetClass.static.createModelFromDom( doc, 'visual' );
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue