Don't preserveHtmlAttributes on transclusion nodes

Bug: T207325
Change-Id: I9c92f18c58c044e7f2257aa6993db227896a1468
This commit is contained in:
Ed Sanders 2019-01-02 17:09:38 +00:00
parent 00ed8b7d98
commit 48db45df76
4 changed files with 7 additions and 4 deletions

View file

@ -38,8 +38,6 @@ OO.mixinClass( ve.ce.MWTransclusionNode, ve.ce.FocusableNode );
ve.ce.MWTransclusionNode.static.name = 'mwTransclusion';
ve.ce.MWTransclusionNode.static.renderHtmlAttributes = false;
ve.ce.MWTransclusionNode.static.primaryCommandName = 'transclusion';
ve.ce.MWTransclusionNode.static.iconWhenInvisible = 'puzzle';

View file

@ -60,6 +60,9 @@ ve.dm.MWTransclusionNode.static.matchFunction = function () {
ve.dm.MWTransclusionNode.static.enableAboutGrouping = true;
// We handle rendering ourselves, no need to render attributes from originalDomElements (T207325)
ve.dm.MWTransclusionNode.static.preserveHtmlAttributes = false;
ve.dm.MWTransclusionNode.static.getHashObject = function ( dataElement ) {
return {
type: dataElement.type,

View file

@ -1173,7 +1173,7 @@ ve.dm.mwExample.domToDataCases = {
modify: function ( model ) {
model.data.data[ 0 ].attributes.mw.parts[ 0 ].template.params[ '1' ].wt = 'Hello, globe!';
},
normalizedBody: ve.dm.mwExample.MWTransclusion.blockOpenModified,
normalizedBody: ve.dm.mwExample.MWTransclusion.blockOpenModified.replace( /about="#mwt1"/, '' ),
fromDataBody: ve.dm.mwExample.MWTransclusion.blockOpenFromDataModified,
clipboardBody: ve.dm.mwExample.MWTransclusion.blockOpenModifiedClipboard,
previewBody: false
@ -1208,7 +1208,7 @@ ve.dm.mwExample.domToDataCases = {
modify: function ( model ) {
model.data.data[ 1 ].attributes.mw.parts[ 0 ].template.params[ '1' ].wt = '5,678';
},
normalizedBody: ve.dm.mwExample.MWTransclusion.inlineOpenModified + ve.dm.mwExample.MWTransclusion.inlineClose,
normalizedBody: ve.dm.mwExample.MWTransclusion.inlineOpenModified.replace( /about="#mwt1"/, '' ) + ve.dm.mwExample.MWTransclusion.inlineClose,
fromDataBody: ve.dm.mwExample.MWTransclusion.inlineOpenFromDataModified + ve.dm.mwExample.MWTransclusion.inlineClose,
clipboardBody: ve.dm.mwExample.MWTransclusion.inlineOpenModifiedClipboard + ve.dm.mwExample.MWTransclusion.inlineClose,
previewBody: false

View file

@ -19,6 +19,7 @@ QUnit.test( 'Diffing', function ( assert ) {
expected:
'<div class="ve-ui-diffElement-doc-child-change">' +
( ve.dm.mwExample.MWTransclusion.blockOpenModified + ve.dm.mwExample.MWTransclusion.blockContent )
// FIXME: Use DOM modification instead of string replaces
.replace( /#mwt1"/g, '#mwt1" data-diff-action="structural-change" data-diff-id="0"' ) +
'</div>',
expectedDescriptions: [
@ -33,6 +34,7 @@ QUnit.test( 'Diffing', function ( assert ) {
expected:
'<div class="ve-ui-diffElement-doc-child-change">' +
ve.dm.mwExample.MWBlockImage.html
// FIXME: Use DOM modification instead of string replaces
.replace( 'width="1"', 'width="3"' )
.replace( 'href="Foo"', 'href="' + ve.resolveUrl( 'Foo', ve.dm.example.base ) + '" rel="noopener" target="_blank"' )
.replace( 'foobar"', 'foobar" data-diff-action="structural-change" data-diff-id="0"' ) +