mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Merge "Check that we really want VE before loading it for section edits"
This commit is contained in:
commit
8e4f888274
|
@ -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
|
||||
) {
|
||||
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', init.onEditSectionLinkClick );
|
||||
$( '.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 (
|
||||
mw.user.options.get( 'visualeditor-tabs' ) === 'prefer-ve' ||
|
||||
(
|
||||
getLastEditor() !== 'wikitext' &&
|
||||
mw.user.options.get( 'visualeditor-tabs' ) !== 'prefer-wt'
|
||||
)
|
||||
) {
|
||||
if ( loadVEInPage ) {
|
||||
trackActivateStart( { type: 'page', mechanism: 'click' } );
|
||||
activateTarget();
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in a new issue