Kaldari has uploaded a new change for review.

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

Change subject: Make sure mobile VisualEditor is only loaded when appropriate
......................................................................

Make sure mobile VisualEditor is only loaded when appropriate

On wikis that are VE opt-in, show the wikitext editor by default.
On wikis that are VE opt-out, show the VisualEditor by default.

Also make sure we are only showing for appropriate namespaces and
not for pages that are the output of the Page Translation feature.

Also make sure the switcher bar displays above the VE toolbar
elements.

Bug: 64681
Change-Id: Id801ae13206e8d927d06997b146c201f869758f3
---
M javascripts/modules/editor/editor.js
M less/modules/editor/editor.less
2 files changed, 20 insertions(+), 4 deletions(-)


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

diff --git a/javascripts/modules/editor/editor.js 
b/javascripts/modules/editor/editor.js
index 01a0e9c..ad62b2e 100644
--- a/javascripts/modules/editor/editor.js
+++ b/javascripts/modules/editor/editor.js
@@ -62,10 +62,24 @@
                        loadingOverlay.show();
                        sectionId = page.isWikiText() ? parseInt( sectionId, 10 
) : null;
 
-                       // Pages that contain JavaScript and CSS are not 
suitable for VisualEditor so
-                       // check if wikitext. Also don't load VisualEditor if 
user's preferred editor
-                       // is the SourceEditor (set by the editor switcher).
-                       if ( page.isWikiText() && isVisualEditorEnabled && 
preferredEditor !== 'SourceEditor' ) {
+                       // Check whether VisualEditor should be loaded
+                       if ( isVisualEditorEnabled &&
+
+                               // Only for pages with a wikitext content model
+                               page.isWikiText() &&
+
+                               // Only in enabled namespaces
+                               $.inArray( mw.config.get( 'wgNamespaceNumber' 
), mw.config.get( 'wgVisualEditorConfig' ).namespaces ) > -1 &&
+
+                               // Not on pages which are outputs of the Page 
Translation feature
+                               mw.config.get( 'wgTranslatePageTranslation' ) 
!== 'translation' &&
+
+                               // If the user prefers the VisualEditor or the 
user has no preference and
+                               // the VisualEditor is the default editor for 
this wiki
+                               ( preferredEditor === 'VisualEditor' ||
+                                       ( preferredEditor === null && 
mw.config.get( 'wgVisualEditorConfig' ).defaultUserOptions.enable )
+                               )
+                       ) {
                                mw.loader.using( 'mobile.editor.ve', function 
() {
                                        var VisualEditorOverlay = M.require( 
'modules/editor/VisualEditorOverlay' );
 
diff --git a/less/modules/editor/editor.less b/less/modules/editor/editor.less
index c98a944..326c66d 100644
--- a/less/modules/editor/editor.less
+++ b/less/modules/editor/editor.less
@@ -51,6 +51,8 @@
                        display: none;
                        position: absolute;
                        top: @headerHeight;
+                       // Needs to float above any elements in the toolbar
+                       z-index: 1;
                        // FIXME: Negative margin is needed in Chrome and 
Safari to match our negative
                        // margins on the buttons, but this breaks the layout 
in Firefox and IE :(
                        // Spent a very long time trying to find a CSS solution 
that worked in all

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id801ae13206e8d927d06997b146c201f869758f3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Kaldari <rkald...@wikimedia.org>

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

Reply via email to