Tchanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/243153

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/53/243153/1

diff --git a/src/ce/nodes/ve.ce.GeneratedContentNode.js 
b/src/ce/nodes/ve.ce.GeneratedContentNode.js
index 60ef806..aeed8e5 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 is 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: newchange
Gerrit-Change-Id: Id16a2ff836a84cd30e15ae9d2fd894896dc46e90
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Tchanders <thalia.e.c...@googlemail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to