jenkins-bot has submitted this change and it was merged. Change subject: Apply DOM changes in onProtectedSetup and onProtectedTeardown instead of constructor ......................................................................
Apply DOM changes in onProtectedSetup and onProtectedTeardown instead of constructor It's important in case of replacing root element ($) of a node, so new element does have CSS class and contenteditable property set. Change-Id: Icf14e2164e89114e6b7c10672b782d02f4c5daac --- M modules/ve-mw/test/ce/ve.ce.ContentBranchNode.test.js M modules/ve/ce/ve.ce.ProtectedNode.js 2 files changed, 12 insertions(+), 8 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ve-mw/test/ce/ve.ce.ContentBranchNode.test.js b/modules/ve-mw/test/ce/ve.ce.ContentBranchNode.test.js index 5d742c7..c8b1bd1 100644 --- a/modules/ve-mw/test/ce/ve.ce.ContentBranchNode.test.js +++ b/modules/ve-mw/test/ce/ve.ce.ContentBranchNode.test.js @@ -37,9 +37,8 @@ ], 'html': 'a<b>b<span typeof="mw:Entity" class="ve-ce-leafNode ' + 've-ce-mwEntityNode" contenteditable="false">c</span>d<span ' + - 'class="ve-ce-leafNode ve-ce-protectedNode ve-ce-generatedContentNode ' + - 've-ce-alienNode ve-ce-alienInlineNode" ' + - 'contenteditable="false"><tt>e</tt></span></b>' + 'class="ve-ce-leafNode ve-ce-generatedContentNode ' + + 've-ce-alienNode ve-ce-alienInlineNode"><tt>e</tt></span></b>' } ]; QUnit.expect( cases.length ); diff --git a/modules/ve/ce/ve.ce.ProtectedNode.js b/modules/ve/ce/ve.ce.ProtectedNode.js index fac7266..30313b3 100644 --- a/modules/ve/ce/ve.ce.ProtectedNode.js +++ b/modules/ve/ce/ve.ce.ProtectedNode.js @@ -26,11 +26,6 @@ 'setup': 'onProtectedSetup', 'teardown': 'onProtectedTeardown' } ); - - // DOM changes - this.$ - .addClass( 've-ce-protectedNode' ) - .prop( 'contentEditable', 'false' ); }; /* Static Properties */ @@ -85,6 +80,11 @@ this.getRoot().getSurface().getSurface() .connect( this, { 'position': 'positionPhantoms' } ); + // DOM changes + this.$ + .addClass( 've-ce-protectedNode' ) + .prop( 'contentEditable', 'false' ); + // Shields this.$.add( this.$.find( '*' ) ).each( function () { var $this = $( this ); @@ -130,6 +130,11 @@ // Phantoms this.clearPhantoms(); + // DOM changes + this.$ + .removeClass( 've-ce-protectedNode' ) + .removeProp( 'contentEditable' ); + this.isSetup = false; }; -- To view, visit https://gerrit.wikimedia.org/r/82943 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icf14e2164e89114e6b7c10672b782d02f4c5daac Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Inez <i...@wikia-inc.com> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Trevor Parscal <tpars...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits