Merge "Replace $wgVisualEditorSupportedSkins with a check for required elements"

This commit is contained in:
jenkins-bot 2017-03-29 23:14:53 +00:00 committed by Gerrit Code Review
commit da05545faf
3 changed files with 14 additions and 12 deletions

View file

@ -592,7 +592,6 @@ class VisualEditorHooks {
'requirements' => [ 'requirements' => [
'javascript' => true, 'javascript' => true,
'blacklist' => $veConfig->get( 'VisualEditorBrowserBlacklist' ), 'blacklist' => $veConfig->get( 'VisualEditorBrowserBlacklist' ),
'skins' => $veConfig->get( 'VisualEditorSupportedSkins' ),
] ]
]; ];
@ -610,7 +609,6 @@ class VisualEditorHooks {
'requirements' => [ 'requirements' => [
'javascript' => true, 'javascript' => true,
'blacklist' => $veConfig->get( 'VisualEditorBrowserBlacklist' ), 'blacklist' => $veConfig->get( 'VisualEditorBrowserBlacklist' ),
'skins' => $veConfig->get( 'VisualEditorSupportedSkins' ),
], ],
'exempt-from-auto-enrollment' => true 'exempt-from-auto-enrollment' => true
]; ];
@ -715,7 +713,6 @@ class VisualEditorHooks {
], ],
'galleryOptions' => $coreConfig->get( 'GalleryOptions' ), 'galleryOptions' => $coreConfig->get( 'GalleryOptions' ),
'blacklist' => $veConfig->get( 'VisualEditorBrowserBlacklist' ), 'blacklist' => $veConfig->get( 'VisualEditorBrowserBlacklist' ),
'skins' => $veConfig->get( 'VisualEditorSupportedSkins' ),
'tabPosition' => $veConfig->get( 'VisualEditorTabPosition' ), 'tabPosition' => $veConfig->get( 'VisualEditorTabPosition' ),
'tabMessages' => $veConfig->get( 'VisualEditorTabMessages' ), 'tabMessages' => $veConfig->get( 'VisualEditorTabMessages' ),
'singleEditTab' => $veConfig->get( 'VisualEditorUseSingleEditTab' ), 'singleEditTab' => $veConfig->get( 'VisualEditorUseSingleEditTab' ),

View file

@ -37,13 +37,6 @@
"VisualEditorFeedbackTitle": false, "VisualEditorFeedbackTitle": false,
"VisualEditorSerializationCacheTimeout": 3600, "VisualEditorSerializationCacheTimeout": 3600,
"VisualEditorUseChangeTagging": true, "VisualEditorUseChangeTagging": true,
"VisualEditorSupportedSkins": [
"vector",
"apex",
"monobook",
"minerva",
"blueprint"
],
"VisualEditorParsoidPrefix": "localhost", "VisualEditorParsoidPrefix": "localhost",
"VisualEditorParsoidDomain": "localhost", "VisualEditorParsoidDomain": "localhost",
"VisualEditorDisableForAnons": false, "VisualEditorDisableForAnons": false,

View file

@ -21,7 +21,7 @@
*/ */
( function () { ( function () {
var conf, tabMessages, uri, pageExists, viewUri, veEditUri, veEditSourceUri, isViewPage, isEditPage, var conf, tabMessages, uri, pageExists, viewUri, veEditUri, veEditSourceUri, isViewPage, isEditPage,
pageCanLoadEditor, init, targetPromise, enable, tempdisable, autodisable, pageCanLoadEditor, init, targetPromise, enable, tempdisable, autodisable, requiredSkinElements,
tabPreference, userPrefEnabled, userPrefPreferShow, initialWikitext, oldid, tabPreference, userPrefEnabled, userPrefPreferShow, initialWikitext, oldid,
isLoading, isLoading,
editModes = { editModes = {
@ -755,6 +755,18 @@
veEditUri.extend( { oldid: oldid } ); veEditUri.extend( { oldid: oldid } );
} }
requiredSkinElements =
$( '#content' ).length &&
$( '#mw-content-text' ).length &&
$( '#ca-edit' ).length;
if ( pageCanLoadEditor && !requiredSkinElements ) {
mw.log.warn(
'Your skin is incompatible with VisualEditor. ' +
'See <https://www.mediawiki.org/wiki/VisualEditor/Skin_requirements> for the requirements.'
);
}
// Whether VisualEditor should be available for the current user, page, wiki, mediawiki skin, // Whether VisualEditor should be available for the current user, page, wiki, mediawiki skin,
// browser etc. // browser etc.
init.isAvailable = ( init.isAvailable = (
@ -764,7 +776,7 @@
( ( 'vewhitelist' in uri.query ) || !$.client.test( init.blacklist, null, true ) ) && ( ( 'vewhitelist' in uri.query ) || !$.client.test( init.blacklist, null, true ) ) &&
// Only in supported skins // Only in supported skins
conf.skins.indexOf( mw.config.get( 'skin' ) ) !== -1 && requiredSkinElements &&
// Not on pages which are outputs of the Translate extensions // Not on pages which are outputs of the Translate extensions
// TODO: Allow the Translate extension to do this itself // TODO: Allow the Translate extension to do this itself