jenkins-bot has submitted this change and it was merged.
Change subject: Add general errorHandling to VisualEditorOverlay
......................................................................
Add general errorHandling to VisualEditorOverlay
Change-Id: I6635e5048145699907ca763eaa4d268d8175d971
---
M javascripts/modules/editor/VisualEditorOverlay.js
1 file changed, 40 insertions(+), 1 deletion(-)
Approvals:
JGonera: Looks good to me, approved
jenkins-bot: Verified
diff --git a/javascripts/modules/editor/VisualEditorOverlay.js
b/javascripts/modules/editor/VisualEditorOverlay.js
index f78a81c..ccd8f66 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( {
@@ -23,7 +24,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: Expand on save errors by having a
method for each
+ saveErrorSpamBlacklist: 'onSaveError',
+ saveErrorAbuseFilter: 'onSaveError',
+ saveErrorBlocked: 'onSaveError',
+ saveErrorNewUser: 'onSaveError',
+ saveErrorCaptcha: 'onSaveError',
+ saveErrorUnknown: 'onSaveError',
+ surfaceReady: 'onSurfaceReady',
+ loadError: 'onLoadError',
+ conflictError: 'onConflictError',
+ showChangesError: 'onShowChangesError',
+ serializeError: 'onSerializeError'
+ } );
},
postRender: function( options ) {
// Save button
@@ -57,8 +75,14 @@
this.$( '.surface, .summary-area' ).hide();
this.target.save( this.docToSave, { 'summary': summary
} );
},
+ showSpinner: function () {
+ this.$spinner.show();
+ },
clearSpinner: function() {
this.$spinner.hide();
+ },
+ reportError: function ( msg ) {
+ popup.show( msg, 'toast error' );
},
onSave: function() {
var title = mw.config.get( 'wgTitle' );
@@ -77,6 +101,21 @@
this.hasChanged = true;
this.$continueBtn.prop( 'disabled', false );
},
+ onLoadError: function () {
+ this.reportError( mw.msg(
'mobile-frontend-editor-error-loading' ) );
+ },
+ onSerializeError: function ( jqXHR, status ) {
+ this.reportError( mw.msg(
'visualeditor-serializeerror', status ) );
+ },
+ onConflictError: function () {
+ this.reportError( mw.msg(
'mobile-frontend-editor-error-conflict' ) );
+ },
+ onShowChangesError: function () {
+ this.reportError( mw.msg( 'visualeditor-differror' ) );
+ },
+ onSaveError: function () {
+ this.reportError( mw.msg(
'mobile-frontend-editor-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: merged
Gerrit-Change-Id: I6635e5048145699907ca763eaa4d268d8175d971
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Robmoen <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Robmoen <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits