bug: deleting first child node with siblings loses cursor
[apps/outliner/.git] / src / client.ts
index fe64324556ef4167862ee4c1ad33157195d11e98..12f6b1048631bfe234e07b27d4b902178f61a42f 100644 (file)
@@ -209,13 +209,14 @@ keyboardJS.withContext('navigation', () => {
       cursor.get().parentElement.outerHTML = html;
     }
 
-    if(prevSibling) {
+    if(prevSibling.getAttribute('data-id')) {
       cursor.set(`#id-${prevSibling.getAttribute('data-id')}`);
     }
-    else if(nextSibling) {
+    else if(nextSibling.getAttribute('data-id')) {
       cursor.set(`#id-${nextSibling.getAttribute('data-id')}`);
     }
     else {
+      console.log(res.parentNode.id);
       cursor.set(`#id-${res.parentNode.id}`);
     }