Don't treat ctrl-click as a right-click except on Mac.

This commit is contained in:
Neil Fraser
2015-02-23 16:04:18 -08:00
parent 6d772ae307
commit 0b1efa2eab
4 changed files with 14 additions and 9 deletions

View File

@@ -551,10 +551,10 @@ Blockly.removeAllRanges = function() {
* @private
*/
Blockly.isTargetInput_ = function(e) {
return e.target.type == 'textarea' || e.target.type == 'text'
|| e.target.type == 'number' || e.target.type == 'email'
|| e.target.type == 'password' || e.target.type == 'search'
|| e.target.type == 'tel' || e.target.type == 'url';
return e.target.type == 'textarea' || e.target.type == 'text' ||
e.target.type == 'number' || e.target.type == 'email' ||
e.target.type == 'password' || e.target.type == 'search' ||
e.target.type == 'tel' || e.target.type == 'url';
};
/**

View File

@@ -29,6 +29,7 @@
goog.provide('Blockly.utils');
goog.require('goog.events.BrowserFeature');
goog.require('goog.userAgent');
/**
@@ -324,8 +325,12 @@ Blockly.createSvgElement = function(name, attrs, opt_parent) {
* @return {boolean} True if right-click.
*/
Blockly.isRightButton = function(e) {
// Control-clicking in WebKit on Mac OS X fails to change button to 2.
return e.button == 2 || e.ctrlKey;
if (e.ctrlKey && goog.userAgent.MAC) {
// Control-clicking on Mac OS X is treated as a right-click.
// WebKit on Mac OS X fails to change button to 2 (but Gecko does).
return true;
}
return e.button == 2;
};
/**