Merge "Check that we really want VE before loading it for section edits"

This commit is contained in:
jenkins-bot 2015-12-11 23:40:10 +00:00 committed by Gerrit Code Review
commit 8e4f888274

View file

@ -680,7 +680,7 @@
}
$( function () {
var key;
var key, loadVEInPage;
if ( uri.query.action === 'edit' && $( '#wpTextbox1' ).length ) {
initialWikitext = $( '#wpTextbox1' ).val();
}
@ -761,17 +761,20 @@
mw.user.options.get( 'visualeditor-tabs' ) !== 'multi-tab' &&
userPrefEnabled
) {
// Handle section edit link clicks
$( '.mw-editsection a' ).on( 'click', init.onEditSectionLinkClick );
// Allow instant switching to edit mode, without refresh
$( '#ca-edit' ).on( 'click', function ( e ) {
if (
mw.user.options.get( 'visualeditor-tabs' ) === 'prefer-ve' ||
loadVEInPage = mw.user.options.get( 'visualeditor-tabs' ) === 'prefer-ve' ||
(
getLastEditor() !== 'wikitext' &&
mw.user.options.get( 'visualeditor-tabs' ) !== 'prefer-wt'
)
) {
);
// Handle section edit link clicks
$( '.mw-editsection a' ).on( 'click', function ( e ) {
if ( loadVEInPage ) {
init.onEditSectionLinkClick( e );
}
} );
// Allow instant switching to edit mode, without refresh
$( '#ca-edit' ).on( 'click', function ( e ) {
if ( loadVEInPage ) {
trackActivateStart( { type: 'page', mechanism: 'click' } );
activateTarget();
e.preventDefault();