There's a preference which makes the browser go to action=edit when double
clicking on the content. In VE we want to disable this while the editor is
open. With this check in place, we can turn it off by falsifying the value
of the preference (and then restoring the original value when VE closes).
Bug: 53058
Change-Id: I0f6225b25ad279755548361f82b855727758da2b
'dependencies' => array(
'mediawiki.util',
'mediawiki.page.startup',
+ 'user.options',
),
),
'mediawiki.action.view.metadata' => array(
( function ( mw, $ ) {
$( function () {
mw.util.$content.dblclick( function ( e ) {
- e.preventDefault();
- // Trigger native HTMLElement click instead of opening URL (bug 43052)
- $( '#ca-edit a' ).get( 0 ).click();
+ // Recheck preference so extensions can do a hack to disable this code.
+ if ( parseInt( mw.user.options.get( 'editondblclick' ), 10 ) ) {
+ e.preventDefault();
+ // Trigger native HTMLElement click instead of opening URL (bug 43052)
+ $( '#ca-edit a' ).get( 0 ).click();
+ }
} );
} );
}( mediaWiki, jQuery ) );