Robmoen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/99172
Change subject: Add general errorHandling to VisualEditorOverlay
......................................................................
Add general errorHandling to VisualEditorOverlay
Change-Id: I6635e5048145699907ca763eaa4d268d8175d971
---
M javascripts/modules/editor/VisualEditorOverlay.js
1 file changed, 38 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/72/99172/1
diff --git a/javascripts/modules/editor/VisualEditorOverlay.js
b/javascripts/modules/editor/VisualEditorOverlay.js
index 474bebb..b8a6086 100644
--- a/javascripts/modules/editor/VisualEditorOverlay.js
+++ b/javascripts/modules/editor/VisualEditorOverlay.js
@@ -1,6 +1,7 @@
( function( M, $, ve ) {
var OverlayNew = M.require( 'OverlayNew' ),
Page = M.require( 'Page' ),
+ popup = M.require( 'notifications' ),
VisualEditorOverlay;
VisualEditorOverlay = OverlayNew.extend( {
@@ -27,7 +28,24 @@
this.target = new ve.init.mw.MobileViewTarget( this.$(
'.surface' ), options.sectionId );
this.target.activating = true;
this.target.load();
- this.target.connect( this, { 'save': 'onSave',
'surfaceReady': 'onSurfaceReady' } );
+ this.target.connect( this, {
+ 'save': 'onSave',
+ 'saveAsyncBegin': 'showSpinner',
+ 'saveAsyncComplete': 'clearSpinner',
+ 'saveErrorEmpty': 'onSaveError',
+ // FIXME: Better handling of save errors needed
+ 'saveErrorSpamBlacklist': 'onSaveError',
+ 'saveErrorAbuseFilter': 'onSaveError',
+ 'saveErrorBlocked': 'onSaveError',
+ 'saveErrorNewUser': 'onSaveError',
+ 'saveErrorCaptcha': 'onSaveError',
+ 'saveErrorUnknown': 'onSaveError',
+ 'surfaceReady': 'onSurfaceReady',
+ 'loadError': 'onLoadError',
+ 'conflictError': 'onConflictError',
+ 'showChangesError': 'onShowChangesError',
+ 'serializeError': 'onSerializeError'
+ } );
// Save button
this.$( '.continue' ).on( 'click', $.proxy( this,
'prepareForSave' ) );
this.$( '.submit' ).on( 'click', $.proxy( this, 'save'
) );
@@ -50,6 +68,9 @@
{ 'summary': summary }
);
},
+ showSpinner: function () {
+ this.$spinner.show();
+ },
clearSpinner: function() {
this.$spinner.hide();
},
@@ -70,6 +91,22 @@
this.hasChanged = true;
this.$continueBtn.prop( 'disabled', false );
},
+ onLoadError: function () {
+ popup.show( mw.msg(
'mobile-frontend-editor-error-loading' ), 'toast error' );
+ },
+ onSerializeError: function ( jqXHR, status ) {
+ popup.show( mw.msg( 'visualeditor-serializeerror',
status ), 'toast error' );
+ },
+ onConflictError: function () {
+ popup.show( mw.msg(
'mobile-frontend-editor-error-conflict' ), 'toast error' );
+ },
+ onShowChangesError: function () {
+ // TODO: need MobileFrontEnd messages?
+ popup.show( mw.msg( 'visualeditor-differror' ), 'toast
error' );
+ },
+ onSaveError: function () {
+ popup.show( mw.msg( 'mobile-frontend-editor-error' ),
'toast error' );
+ },
// FIXME: Code duplication with EditorOverlay.js, Needs
abstraction
hide: function() {
var confirmMessage = mw.msg(
'mobile-frontend-editor-cancel-confirm' );
--
To view, visit https://gerrit.wikimedia.org/r/99172
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6635e5048145699907ca763eaa4d268d8175d971
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits