From cd85381fdc7ef7842593a014c3cb6f75448a70e2 Mon Sep 17 00:00:00 2001 From: Jeffrey Zutt Date: Thu, 26 May 2016 10:23:06 +0200 Subject: [PATCH 1/2] Check if closest LI-element is within editor. --- table.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/table.js b/table.js index 1c91a4f..ca200fd 100755 --- a/table.js +++ b/table.js @@ -207,7 +207,8 @@ this.buffer.set(); var current = this.selection.current(); - if ($(current).closest('li').length !== 0) + var $closestLi = $(current).closest('li'); + if ($closestLi.length !== 0 && this.$editor.has($closestLi).length !== 0) { $(current).closest('ul, ol').first().after(html); } From 609bdfe14adb7bde58efb7008336fdeef6a56dc5 Mon Sep 17 00:00:00 2001 From: Jeffrey Zutt Date: Thu, 26 May 2016 10:59:10 +0200 Subject: [PATCH 2/2] More efficient way of checking LI element is within editor --- table.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/table.js b/table.js index ca200fd..81d973c 100755 --- a/table.js +++ b/table.js @@ -207,8 +207,7 @@ this.buffer.set(); var current = this.selection.current(); - var $closestLi = $(current).closest('li'); - if ($closestLi.length !== 0 && this.$editor.has($closestLi).length !== 0) + if ($(current).closest('li', this.core.editor().get(0)).length !== 0) { $(current).closest('ul, ol').first().after(html); }