Kaldari has uploaded a new change for review.

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

Change subject: If error occurs while loading VE, load source editor instead
......................................................................

If error occurs while loading VE, load source editor instead

If VisualEditor ever throws an exception, this means that the
editor is inaccessible unless you resize the window and refresh.

When an error occurs, the source editor should be loaded instead.

Bug: 66678
Change-Id: I52a0b0512f6940075974e124ca288679e146d7d5
---
M javascripts/modules/editor/editor.js
1 file changed, 15 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/97/143797/1

diff --git a/javascripts/modules/editor/editor.js 
b/javascripts/modules/editor/editor.js
index 709068b..0e984dd 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -85,7 +85,8 @@
                                        oldId: M.query.oldid,
                                        funnel: funnel || 'article'
                                },
-                               visualEditorNamespaces = veConfig && 
veConfig.namespaces;
+                               visualEditorNamespaces = veConfig && 
veConfig.namespaces,
+                               loadSourceEditor = true;
                        loadingOverlay.show();
                        editorOptions.sectionId = page.isWikiText() ? parseInt( 
sectionId, 10 ) : null;
 
@@ -105,13 +106,20 @@
                                // the VisualEditor is the default editor for 
this wiki
                                preferredEditor === 'VisualEditor'
                        ) {
-                               mw.loader.using( 'mobile.editor.ve', function 
() {
-                                       var VisualEditorOverlay = M.require( 
'modules/editor/VisualEditorOverlay' );
+                               loadSourceEditor = false;
+                               try {
+                                       mw.loader.using( 'mobile.editor.ve', 
function () {
+                                               var VisualEditorOverlay = 
M.require( 'modules/editor/VisualEditorOverlay' );
 
-                                       loadingOverlay.hide();
-                                       result.resolve( new 
VisualEditorOverlay( editorOptions ) );
-                               } );
-                       } else {
+                                               loadingOverlay.hide();
+                                               result.resolve( new 
VisualEditorOverlay( editorOptions ) );
+                                       } );
+                               } catch ( e ) {
+                                       loadSourceEditor = true;
+                               }
+                       }
+
+                       if ( loadSourceEditor ) {
                                mw.loader.using( 'mobile.editor.overlay', 
function() {
                                        var EditorOverlay = M.require( 
'modules/editor/EditorOverlay' );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52a0b0512f6940075974e124ca288679e146d7d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>

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

Reply via email to