Commit 764452eb authored by Neil Fraser's avatar Neil Fraser

Squeltch double-click highlighting on workspace and toolbox.

parent 329fd375
......@@ -291,6 +291,7 @@ Blockly.onMouseDown_ = function(e) {
Blockly.showContextMenu_(e);
} else if ((Blockly.readOnly || isTargetSvg) &&
Blockly.mainWorkspace.scrollbar) {
Blockly.removeAllRanges();
// If the workspace is editable, only allow dragging when gripping empty
// space. Otherwise, allow dragging when gripping anywhere.
Blockly.mainWorkspace.dragMode = true;
......@@ -534,18 +535,15 @@ Blockly.hideChaff = function(opt_allowToolbox) {
* Deselect this text, so that it doesn't mess up any subsequent drag.
*/
Blockly.removeAllRanges = function() {
if (window.getSelection) { // W3
var sel = window.getSelection();
if (sel && sel.removeAllRanges) {
if (getSelection()) {
setTimeout(function() {
try {
window.getSelection().removeAllRanges();
getSelection().removeAllRanges();
} catch (e) {
// MSIE throws 'error 800a025e' here.
}
}, 0);
}
}
};
/**
......
......@@ -299,6 +299,7 @@ Blockly.Toolbox.TreeControl.prototype.createNode = function(opt_html) {
* @override
*/
Blockly.Toolbox.TreeControl.prototype.setSelectedItem = function(node) {
Blockly.removeAllRanges();
if (this.selectedItem_ == node) {
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment