mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-28 02:00:57 +00:00
Merge "Don't clear target comment highlight when Ctrl-clicking"
This commit is contained in:
commit
e82a4d86f3
|
@ -136,7 +136,7 @@ ReplyLinksController.prototype.isActivationEvent = function ( e ) {
|
|||
// Only handle keypresses on the "Enter" or "Space" keys
|
||||
return false;
|
||||
}
|
||||
if ( e.type === 'click' && ( e.which !== OO.ui.MouseButtons.LEFT || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey ) ) {
|
||||
if ( e.type === 'click' && !utils.isUnmodifiedLeftClick( e ) ) {
|
||||
// Only handle unmodified left clicks
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ function initTopicSubscriptions( $container ) {
|
|||
// Only handle keypresses on the "Enter" or "Space" keys
|
||||
return;
|
||||
}
|
||||
if ( e.type === 'click' && ( e.which !== OO.ui.MouseButtons.LEFT || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey ) ) {
|
||||
if ( e.type === 'click' && !utils.isUnmodifiedLeftClick( e ) ) {
|
||||
// Only handle unmodified left clicks
|
||||
return;
|
||||
}
|
||||
|
@ -889,7 +889,7 @@ function init( $container, state ) {
|
|||
} );
|
||||
// eslint-disable-next-line no-jquery/no-global-selector
|
||||
$( 'body' ).on( 'click', function ( e ) {
|
||||
if ( e.which === OO.ui.MouseButtons.LEFT ) {
|
||||
if ( utils.isUnmodifiedLeftClick( e ) ) {
|
||||
clearHighlightTargetComment( parser );
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -601,6 +601,16 @@ function compareRangesAlmostEqualBoundaries( a, b, boundary ) {
|
|||
return !foundContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a jQuery event represents a plain left click, without any modifiers
|
||||
*
|
||||
* @param {jQuery.Event} e
|
||||
* @return {boolean} Whether it was an unmodified left click
|
||||
*/
|
||||
function isUnmodifiedLeftClick( e ) {
|
||||
return e.which === OO.ui.MouseButtons.LEFT && !( e.shiftKey || e.altKey || e.ctrlKey || e.metaKey );
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NEW_TOPIC_COMMENT_ID: NEW_TOPIC_COMMENT_ID,
|
||||
isBlockElement: isBlockElement,
|
||||
|
@ -619,5 +629,6 @@ module.exports = {
|
|||
getTitleFromUrl: getTitleFromUrl,
|
||||
linearWalk: linearWalk,
|
||||
linearWalkBackwards: linearWalkBackwards,
|
||||
compareRanges: compareRanges
|
||||
compareRanges: compareRanges,
|
||||
isUnmodifiedLeftClick: isUnmodifiedLeftClick
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue