jenkins-bot has submitted this change and it was merged.
Change subject: If error occurs while loading VE, load source editor instead
......................................................................
If error occurs while loading VE, load source editor instead
Do this for both initial load and when trying to switch editors.
Bug: 66678
Change-Id: I52a0b0512f6940075974e124ca288679e146d7d5
---
M javascripts/modules/editor/EditorOverlay.js
M javascripts/modules/editor/editor.js
2 files changed, 25 insertions(+), 13 deletions(-)
Approvals:
JGonera: Looks good to me, approved
jenkins-bot: Verified
diff --git a/javascripts/modules/editor/EditorOverlay.js
b/javascripts/modules/editor/EditorOverlay.js
index 1331b58..8372b14 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -179,11 +179,20 @@
// Load the VisualEditor and replace the SourceEditor
overlay with it
this.showSpinner();
this.$content.hide();
- mw.loader.using( 'mobile.editor.ve', function() {
- var VisualEditorOverlay = M.require(
'modules/editor/VisualEditorOverlay' );
- self.clearSpinner();
- M.overlayManager.replaceCurrent( new
VisualEditorOverlay( options ) );
- } );
+ mw.loader.using(
+ 'mobile.editor.ve',
+ function() {
+ var VisualEditorOverlay = M.require(
'modules/editor/VisualEditorOverlay' );
+ self.clearSpinner();
+ M.overlayManager.replaceCurrent( new
VisualEditorOverlay( options ) );
+ },
+ function() {
+ self.clearSpinner();
+ self.$content.show();
+ // FIXME: We should show an error
notification, but right now toast
+ // notifications are not dismissible
when shown within the editor.
+ }
+ );
},
_updateEditCount: function() {
diff --git a/javascripts/modules/editor/editor.js
b/javascripts/modules/editor/editor.js
index 709068b..7334de3 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -86,6 +86,15 @@
funnel: funnel || 'article'
},
visualEditorNamespaces = veConfig &&
veConfig.namespaces;
+
+ function loadSourceEditor() {
+ mw.loader.using( 'mobile.editor.overlay',
function() {
+ var EditorOverlay = M.require(
'modules/editor/EditorOverlay' );
+ loadingOverlay.hide();
+ result.resolve( new EditorOverlay(
editorOptions ) );
+ } );
+ }
+
loadingOverlay.show();
editorOptions.sectionId = page.isWikiText() ? parseInt(
sectionId, 10 ) : null;
@@ -107,17 +116,11 @@
) {
mw.loader.using( 'mobile.editor.ve', function
() {
var VisualEditorOverlay = M.require(
'modules/editor/VisualEditorOverlay' );
-
loadingOverlay.hide();
result.resolve( new
VisualEditorOverlay( editorOptions ) );
- } );
+ }, loadSourceEditor );
} else {
- mw.loader.using( 'mobile.editor.overlay',
function() {
- var EditorOverlay = M.require(
'modules/editor/EditorOverlay' );
-
- loadingOverlay.hide();
- result.resolve( new EditorOverlay(
editorOptions ) );
- } );
+ loadSourceEditor();
}
return result;
--
To view, visit https://gerrit.wikimedia.org/r/143797
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I52a0b0512f6940075974e124ca288679e146d7d5
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits