From 4442dc983215c50244bfc43bec26b6d7d9806dbe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 11 Jul 2013 16:19:04 +0200 Subject: [PATCH 1/1] Allowing grid toggle event if no node selected --- modules/documentCanvas/canvasManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/documentCanvas/canvasManager.js b/modules/documentCanvas/canvasManager.js index b483937..dbf414b 100644 --- a/modules/documentCanvas/canvasManager.js +++ b/modules/documentCanvas/canvasManager.js @@ -195,8 +195,8 @@ Manager.prototype.command = function(command, params) { var selection = window.getSelection(), element1 = this.canvas.getDocumentElement(selection.anchorNode), element2 = this.canvas.getDocumentElement(selection.focusNode), - parent1 = element1.parent(), - parent2 = element2.parent(); + parent1 = element1 ? element1.parent() : undefined, + parent2 = element2 ? element2.parent() : undefined; if(command === 'unwrap-node') { // this.canvas.nodeUnwrap({node: canvasNode.create(pos.parentNode)}); -- 2.20.1