Update utils.js

There is no global "getSelection()" function, see:
https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection
This commit is contained in:
Markus Bordihn 2015-08-25 15:39:09 +02:00
parent 218fdc667d
commit d555121a1c

View file

@ -349,10 +349,10 @@ Blockly.createSvgElement = function(name, attrs, parent, opt_workspace) {
* Deselect this text, so that it doesn't mess up any subsequent drag.
*/
Blockly.removeAllRanges = function() {
if (getSelection()) {
if (window.getSelection) {
setTimeout(function() {
try {
var selection = getSelection();
var selection = window.getSelection();
if (!selection.isCollapsed) {
selection.removeAllRanges();
}