diff --git a/core/block_svg.js b/core/block_svg.js index 7bdccb58e..d376a9272 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -529,7 +529,6 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) { e.stopPropagation(); return; } - Blockly.setPageSelectable(false); this.workspace.markFocused(); // Update Blockly's knowledge of its own location. Blockly.svgResize(this.workspace); @@ -574,6 +573,7 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) { } // This event has been handled. No need to bubble up to the document. e.stopPropagation(); + e.preventDefault(); }; /** @@ -589,7 +589,6 @@ Blockly.BlockSvg.prototype.onMouseUp_ = function(e) { Blockly.Events.fire( new Blockly.Events.Ui(this, 'click', undefined, undefined)); } - Blockly.setPageSelectable(true); Blockly.terminateDrag_(); if (Blockly.selected && Blockly.highlightedConnection_) { // Connect two blocks together. @@ -910,6 +909,7 @@ Blockly.BlockSvg.prototype.onMouseMove_ = function(e) { } // This event has been handled. No need to bubble up to the document. e.stopPropagation(); + e.preventDefault(); }; /** diff --git a/core/blockly.js b/core/blockly.js index 0536332d8..beb2d8eb1 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -196,7 +196,6 @@ Blockly.onMouseUp_ = function(e) { var workspace = Blockly.getMainWorkspace(); Blockly.Css.setCursor(Blockly.Css.Cursor.OPEN); workspace.isScrolling = false; - Blockly.setPageSelectable(true); // Unbind the touch event if it exists. if (Blockly.onTouchUpWrapper_) { Blockly.unbindEvent_(Blockly.onTouchUpWrapper_); @@ -239,6 +238,7 @@ Blockly.onMouseMove_ = function(e) { Blockly.longStop_(); } e.stopPropagation(); + e.preventDefault(); } }; diff --git a/core/css.js b/core/css.js index 7e6f8be93..f1cafb0a9 100644 --- a/core/css.js +++ b/core/css.js @@ -143,13 +143,6 @@ Blockly.Css.CONTENT = [ 'z-index: 999;', '}', - '.blocklyNonSelectable {', - 'user-select: none;', - '-moz-user-select: none;', - '-webkit-user-select: none;', - '-ms-user-select: none;', - '}', - '.blocklyTooltipDiv {', 'background-color: #ffffc7;', 'border: 1px solid #ddc;', diff --git a/core/scrollbar.js b/core/scrollbar.js index df01000c6..d2c70d722 100644 --- a/core/scrollbar.js +++ b/core/scrollbar.js @@ -446,6 +446,7 @@ Blockly.Scrollbar.prototype.onMouseDownBar_ = function(e) { this.constrainKnob_(knobValue)); this.onScroll_(); e.stopPropagation(); + e.preventDefault(); }; /** @@ -462,7 +463,6 @@ Blockly.Scrollbar.prototype.onMouseDownKnob_ = function(e) { e.stopPropagation(); return; } - Blockly.setPageSelectable(false); // Look up the current translation and record it. this.startDragKnob = parseFloat( this.svgKnob_.getAttribute(this.horizontal_ ? 'x' : 'y')); @@ -473,6 +473,7 @@ Blockly.Scrollbar.prototype.onMouseDownKnob_ = function(e) { Blockly.Scrollbar.onMouseMoveWrapper_ = Blockly.bindEvent_(document, 'mousemove', this, this.onMouseMoveKnob_); e.stopPropagation(); + e.preventDefault(); }; /** @@ -495,7 +496,6 @@ Blockly.Scrollbar.prototype.onMouseMoveKnob_ = function(e) { * @private */ Blockly.Scrollbar.prototype.onMouseUpKnob_ = function() { - Blockly.setPageSelectable(true); Blockly.hideChaff(true); if (Blockly.Scrollbar.onMouseUpWrapper_) { Blockly.unbindEvent_(Blockly.Scrollbar.onMouseUpWrapper_); diff --git a/core/utils.js b/core/utils.js index 08961e235..1a0fba1b6 100644 --- a/core/utils.js +++ b/core/utils.js @@ -289,19 +289,6 @@ Blockly.createSvgElement = function(name, attrs, parent, opt_workspace) { return e; }; -/** - * Set css classes to allow/disallow the browser from selecting/highlighting - * text, etc. on the page. - * @param {boolean} selectable Whether elements on the page can be selected. - */ -Blockly.setPageSelectable = function(selectable) { - if (selectable) { - Blockly.removeClass_(document.body, 'blocklyNonSelectable'); - } else { - Blockly.addClass_(document.body, 'blocklyNonSelectable'); - } -}; - /** * Is this event a right-click? * @param {!Event} e Mouse event. diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 3c62acac1..294dd7de0 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -564,7 +564,6 @@ Blockly.WorkspaceSvg.prototype.isDeleteArea = function(e) { */ Blockly.WorkspaceSvg.prototype.onMouseDown_ = function(e) { this.markFocused(); - Blockly.setPageSelectable(false); if (Blockly.isTargetInput_(e)) { return; } @@ -607,6 +606,7 @@ Blockly.WorkspaceSvg.prototype.onMouseDown_ = function(e) { } // This event has been handled. No need to bubble up to the document. e.stopPropagation(); + e.preventDefault(); }; /**