Merge pull request #168 from Kaworru/patch-1

Add window scope for getSelection.
This commit is contained in:
Neil Fraser
2015-08-25 15:01:24 +01:00

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();
}