Jdlrobson has uploaded a new change for review.

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


Change subject: Allow switching from edit preview to editor
......................................................................

Allow switching from edit preview to editor

Bug: 59166
Change-Id: If6e4da42f74e6e05f426d7c557a9591edced4df8
---
M javascripts/modules/editor/EditorOverlay.js
1 file changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/javascripts/modules/editor/EditorOverlay.js 
b/javascripts/modules/editor/EditorOverlay.js
index efaf5bf..bf2aebb 100644
--- a/javascripts/modules/editor/EditorOverlay.js
+++ b/javascripts/modules/editor/EditorOverlay.js
@@ -99,7 +99,10 @@
 
                hide: function() {
                        var confirmMessage = mw.msg( 
'mobile-frontend-editor-cancel-confirm' );
-                       if ( !this.api.hasChanged || this.canHide || 
window.confirm( confirmMessage ) ) {
+                       if ( this.inPreviewMode ) {
+                               this._hidePreview();
+                               return false;
+                       } else if ( !this.api.hasChanged || this.canHide || 
window.confirm( confirmMessage ) ) {
                                return this._super();
                        } else {
                                return false;
@@ -107,6 +110,7 @@
                },
 
                _showPreview: function() {
+                       this.inPreviewMode = true;
                        var self = this, params = {
                                action: 'parse',
                                // Enable section preview mode to avoid errors 
(bug 49218)
@@ -173,6 +177,7 @@
                },
 
                _hidePreview: function() {
+                       this.inPreviewMode = false;
                        this.$preview.hide();
                        this.$content.show();
                        window.scrollTo( 0, this.scrollTop );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If6e4da42f74e6e05f426d7c557a9591edced4df8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to