Catrope has uploaded a new change for review.

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

Change subject: Don't show Parsoid HTML in textarea while loading VE
......................................................................

Don't show Parsoid HTML in textarea while loading VE

There was always a flash of unparsed content, but 6d6601516
made it worse.

Blank the textarea during editor initialization, before
loading the editor modules. This changes the nesting order
in initializeEditors to call mw.loader.using() for every
editor in a loop, as opposed to calling it once and looping
over editors in the callback; but mw.loader is designed
to handle that.

Bug: T97493
Change-Id: Ie38482909c22afd2651ab024d16bb877b77b1ec4
---
M modules/engine/components/common/flow-component-events.js
1 file changed, 17 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/70/207870/1

diff --git a/modules/engine/components/common/flow-component-events.js 
b/modules/engine/components/common/flow-component-events.js
index a86cb56..27ba1ca 100644
--- a/modules/engine/components/common/flow-component-events.js
+++ b/modules/engine/components/common/flow-component-events.js
@@ -732,25 +732,29 @@
         * @param {jQuery} $container
         */
        function flowEventsMixinInitializeEditors( $container ) {
-               var flowComponent = this, $form;
+               var flowComponent = this;
 
-               mw.loader.using( 'ext.flow.editor', function() {
-                       var $editors = $container.find( '.flow-editor 
textarea:not(.flow-input-compressed)' );
+               $container
+                       .find( '.flow-editor 
textarea:not(.flow-input-compressed)' )
+                       .each( function () {
+                               var $editor = $( this ),
+                                       $form = $editor.closest( 'form' ),
+                                       content = $editor.val();
 
-                       $editors.each( function() {
-                               var $editor = $( this );
+                               // Blank editor while loading
+                               $editor.val( '' );
 
-                               $form = $editor.closest( 'form' );
-                               mw.flow.editor.load( $editor, $editor.val() );
+                               mw.loader.using( 'ext.flow.editor', function() {
+                                       mw.flow.editor.load( $editor, content );
 
-                               // Kill editor instance when the form it's in 
is cancelled
-                               flowComponent.emitWithReturn( 
'addFormCancelCallback', $form, function() {
-                                       if ( mw.flow.editor.exists( $editor ) ) 
{
-                                               mw.flow.editor.destroy( $editor 
);
-                                       }
+                                       // Kill editor instance when the form 
it's in is cancelled
+                                       flowComponent.emitWithReturn( 
'addFormCancelCallback', $form, function() {
+                                               if ( mw.flow.editor.exists( 
$editor ) ) {
+                                                       mw.flow.editor.destroy( 
$editor );
+                                               }
+                                       } );
                                } );
                        } );
-               } );
        }
        FlowComponentEventsMixin.eventHandlers.initializeEditors = 
flowEventsMixinInitializeEditors;
 

-- 
To view, visit https://gerrit.wikimedia.org/r/207870
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie38482909c22afd2651ab024d16bb877b77b1ec4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to