jenkins-bot has submitted this change and it was merged. Change subject: Always render generated content the first time, including errors ......................................................................
Always render generated content the first time, including errors While using an inspector to edit an extension node, the generated content only renders if there is no error, because rendering the errors causes the node to keep changing size, causing the inspector to jump around. It is currently possible to save an extension node with errors. If this has happened, then the error message SHOULD be displayed when visual editor is opened, allowing the user to inspect and correct it. Therefore a check has been added, so that generated content is always rendered the first time, regardless of whether there is an error. Subsequently it only rerenders if there is no error. Bug: T114455 Change-Id: Id16a2ff836a84cd30e15ae9d2fd894896dc46e90 --- M src/ce/nodes/ve.ce.GeneratedContentNode.js 1 file changed, 5 insertions(+), 1 deletion(-) Approvals: Esanders: Looks good to me, approved jenkins-bot: Verified diff --git a/src/ce/nodes/ve.ce.GeneratedContentNode.js b/src/ce/nodes/ve.ce.GeneratedContentNode.js index 60ef806..3bb5cb3 100644 --- a/src/ce/nodes/ve.ce.GeneratedContentNode.js +++ b/src/ce/nodes/ve.ce.GeneratedContentNode.js @@ -16,6 +16,7 @@ // Properties this.generatingPromise = null; this.generatedContentsValid = false; + this.generatedContentsFirstRender = true; // Events this.model.connect( this, { update: 'onGeneratedContentNodeUpdate' } ); @@ -144,7 +145,10 @@ this.emit( 'teardown' ); } $newElements = $( this.getRenderedDomElements( ve.copyDomElements( generatedContents ) ) ); - if ( this.validateGeneratedContents( $( generatedContents ) ) ) { + // Render if this is the first time rendering, regardless of whether there is an error; otherwise only + // render if there is no error + if ( this.generatedContentsFirstRender || this.validateGeneratedContents( $( generatedContents ) ) ) { + this.generatedContentsFirstRender = false; this.generatedContentsValid = true; if ( !this.$element[ 0 ].parentNode ) { // this.$element hasn't been attached yet, so just overwrite it -- To view, visit https://gerrit.wikimedia.org/r/243153 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id16a2ff836a84cd30e15ae9d2fd894896dc46e90 Gerrit-PatchSet: 2 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Tchanders <thalia.e.c...@googlemail.com> Gerrit-Reviewer: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits