Robmoen has uploaded a new change for review.

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


Change subject: WIP: Prototype ve editing on mobile.
......................................................................

WIP: Prototype ve editing on mobile.

Requirements:
Visualeditor and Parsoid

VE patch:
https://gerrit.wikimedia.org/r/#/c/93914/1

Core patch:

Change-Id: I09037c1ef289f8e871bc99372f2e2e810a250af4
---
M javascripts/modules/editor/editor.js
1 file changed, 30 insertions(+), 18 deletions(-)


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

diff --git a/javascripts/modules/editor/editor.js 
b/javascripts/modules/editor/editor.js
index 0d59b5f..f2f63a3 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -1,10 +1,11 @@
 ( function( M, $ ) {
-
        var LoadingOverlay = M.require( 'LoadingOverlay' ),
                popup = M.require( 'notifications' ),
                // FIXME: Disable on IE < 10 for time being
                blacklisted = /MSIE \d\./.test( navigator.userAgent ),
                isEditingSupported = M.router.isSupported() && !blacklisted,
+               veConf = mw.config.get( 'wgVisualEditorConfig' ),
+               isVisualEditorEnabled = mw.user.options.get( 
'visualeditor-enable', veConf.defaultUserOptions.enable ),
                CtaDrawer = M.require( 'CtaDrawer' ),
                drawer = new CtaDrawer( {
                        queryParams: {
@@ -52,24 +53,35 @@
                        window.alert( mw.msg( 
'mobile-frontend-editor-undo-unsupported' ) );
                }
                M.router.route( /^editor\/(\d+)$/, function( sectionId ) {
-                       var loadingOverlay = new LoadingOverlay();
-                       loadingOverlay.show();
-
-                       mw.loader.using( 'mobile.editor', function() {
-                               var EditorOverlay = M.require( 
'modules/editor/EditorOverlay' ),
-                                       title = page ? page.title : 
mw.config.get( 'wgTitle' ),
-                                       // Note in current implementation Page 
title is prefixed with namespace
-                                       ns = page ? '' : mw.config.get( 
'wgCanonicalNamespace' );
-
+                       var loadingOverlay = new LoadingOverlay(),
+                               title = page ? page.title : mw.config.get( 
'wgTitle' ),
+                               // Note in current implementation Page title is 
prefixed with namespace
+                               ns = page ? '' : mw.config.get( 
'wgCanonicalNamespace' );
                                sectionId = parseInt( sectionId, 10 );
-                               loadingOverlay.hide();
-                               new EditorOverlay( {
-                                       title: ns ? ns + ':' + title : title,
-                                       isNew: isNew,
-                                       isNewEditor: mw.config.get( 
'wgUserEditCount' ) === '0',
-                                       sectionId: mw.config.get( 
'wgPageContentModel' ) === 'wikitext' ? sectionId : null
-                               } ).show();
-                       } );
+                       loadingOverlay.show();
+                       if ( isVisualEditorEnabled ) {
+                               // Load VE init module
+                               mw.loader.using( 
'ext.visualEditor.mobileViewTarget.init', function () {
+                                       var VeOverlay = M.require( 'Overlay' );
+                                       M.setupVisualEditor( sectionId, 
function () {
+                                               var ve = new VeOverlay();
+                                               loadingOverlay.hide();
+                                               ve.closeOnBack = true;
+                                               ve.show();
+                                       } );
+                               } );
+                       } else {
+                               mw.loader.using( 'mobile.editor', function() {
+                                       var EditorOverlay = M.require( 
'modules/editor/EditorOverlay' );
+                                       loadingOverlay.hide();
+                                       new EditorOverlay( {
+                                               title: ns ? ns + ':' + title : 
title,
+                                               isNew: isNew,
+                                               isNewEditor: mw.config.get( 
'wgUserEditCount' ) === '0',
+                                               sectionId: mw.config.get( 
'wgPageContentModel' ) === 'wikitext' ? sectionId : null
+                                       } ).show();
+                               } );
+                       }
                } );
                $( '#ca-edit' ).addClass( 'enabled' );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09037c1ef289f8e871bc99372f2e2e810a250af4
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

Reply via email to