From 16f2175356c8ffa0349d40dde6b42b771c0e6755 Mon Sep 17 00:00:00 2001 From: Mehdi Yeganeh Date: Wed, 5 Dec 2018 00:53:22 +0330 Subject: [PATCH 1/2] #1848 Fixed throw console warning when deleting workspace comments --- core/workspace_comment_render_svg.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/workspace_comment_render_svg.js b/core/workspace_comment_render_svg.js index 8c41ff2be..62e7f9dd6 100644 --- a/core/workspace_comment_render_svg.js +++ b/core/workspace_comment_render_svg.js @@ -425,6 +425,7 @@ Blockly.WorkspaceCommentSvg.prototype.disposeInternal_ = function() { this.foreignObject_ = null; this.svgRectTarget_ = null; this.svgHandleTarget_ = null; + this.disposed_ = true; }; /** @@ -436,6 +437,8 @@ Blockly.WorkspaceCommentSvg.prototype.setFocus = function() { this.focused_ = true; // Defer CSS changes. setTimeout(function() { + if(comment.disposed_) + return; comment.textarea_.focus(); comment.addFocus(); Blockly.utils.addClass( @@ -454,6 +457,8 @@ Blockly.WorkspaceCommentSvg.prototype.blurFocus = function() { this.focused_ = false; // Defer CSS changes. setTimeout(function() { + if(comment.disposed_) + return; comment.textarea_.blur(); comment.removeFocus(); Blockly.utils.removeClass( From a20af7e413caa7a72d92c25a94f81df205750a1a Mon Sep 17 00:00:00 2001 From: Mehdi Yeganeh Date: Wed, 5 Dec 2018 13:25:52 +0330 Subject: [PATCH 2/2] #1848 Fixed eslint errors --- core/workspace_comment_render_svg.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/workspace_comment_render_svg.js b/core/workspace_comment_render_svg.js index 62e7f9dd6..51fb738bb 100644 --- a/core/workspace_comment_render_svg.js +++ b/core/workspace_comment_render_svg.js @@ -437,8 +437,9 @@ Blockly.WorkspaceCommentSvg.prototype.setFocus = function() { this.focused_ = true; // Defer CSS changes. setTimeout(function() { - if(comment.disposed_) + if (comment.disposed_) { return; + } comment.textarea_.focus(); comment.addFocus(); Blockly.utils.addClass( @@ -457,8 +458,10 @@ Blockly.WorkspaceCommentSvg.prototype.blurFocus = function() { this.focused_ = false; // Defer CSS changes. setTimeout(function() { - if(comment.disposed_) + if (comment.disposed_) { return; + } + comment.textarea_.blur(); comment.removeFocus(); Blockly.utils.removeClass(