mirror of
https://github.com/google/blockly.git
synced 2026-01-11 02:47:09 +01:00
Don't fire click when editing a field. Issue #336 part 1.
This commit is contained in:
@@ -127,6 +127,11 @@ Blockly.BlockSvg.prototype.initSvg = function() {
|
||||
* Select this block. Highlight it visually.
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.select = function() {
|
||||
if (this.isShadow() && this.getParent()) {
|
||||
// Shadow blocks should not be selected.
|
||||
this.getParent().select();
|
||||
return;
|
||||
}
|
||||
if (Blockly.selected == this) {
|
||||
return;
|
||||
}
|
||||
@@ -563,7 +568,8 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
|
||||
* @private
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.onMouseUp_ = function(e) {
|
||||
if (Blockly.dragMode_ != Blockly.DRAG_FREE) {
|
||||
if (Blockly.dragMode_ != Blockly.DRAG_FREE &&
|
||||
!Blockly.WidgetDiv.isVisible()) {
|
||||
Blockly.Events.fire(
|
||||
new Blockly.Events.Ui(this, 'click', undefined, undefined));
|
||||
}
|
||||
|
||||
@@ -233,15 +233,12 @@ Blockly.onKeyDown_ = function(e) {
|
||||
Blockly.hideChaff();
|
||||
} else if (e.keyCode == 8 || e.keyCode == 46) {
|
||||
// Delete or backspace.
|
||||
try {
|
||||
if (Blockly.selected && Blockly.selected.isDeletable()) {
|
||||
deleteBlock = true;
|
||||
}
|
||||
} finally {
|
||||
// Stop the browser from going back to the previous page.
|
||||
// Use a finally so that any error in delete code above doesn't disappear
|
||||
// from the console when the page rolls back.
|
||||
e.preventDefault();
|
||||
// Stop the browser from going back to the previous page.
|
||||
// Do this first to prevent an error in the delete code from resulting in
|
||||
// data loss.
|
||||
e.preventDefault();
|
||||
if (Blockly.selected && Blockly.selected.isDeletable()) {
|
||||
deleteBlock = true;
|
||||
}
|
||||
} else if (e.altKey || e.ctrlKey || e.metaKey) {
|
||||
if (Blockly.selected &&
|
||||
|
||||
Reference in New Issue
Block a user