From 8844b71aab2c72fb2aa5c5ea4ccd960c399a5f0b Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 8 Mar 2015 07:42:55 +0300 Subject: [PATCH] Edit style: fix goto next/prev section after deleting one --- edit.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/edit.js b/edit.js index 0ad4fbbf..7aefa068 100644 --- a/edit.js +++ b/edit.js @@ -177,7 +177,12 @@ function removeAppliesTo(event) { } function removeSection(event) { - event.target.parentNode.parentNode.removeChild(event.target.parentNode); + var section = event.target.parentNode; + var cm = section.querySelector(".CodeMirror-wrap"); + if (cm && editors.indexOf(cm.CodeMirror) >= 0) { + editors.splice(editors.indexOf(cm.CodeMirror), 1); + } + section.parentNode.removeChild(section); makeDirty(); }