Insert new item after closed folds
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-10-28 20:56:40 +01:00
parent 3609b5020f
commit 8fd30fdb03

View File

@ -46,12 +46,19 @@ function createCursor(start) {
if (cursor >= store.length()) {
cursor = store.length() - 1
}
cursor = store.firstSameIndented(cursor, item.idented)
cursor = store.firstSameIndented(cursor, item.indented)
},
insertAbove(store, item) {
store.insertBefore(store.currentID(cursor), item)
},
insertBelow(store, item) {
let currentID = store.currentID(cursor)
let currentItem = store.value(currentID)
if (currentItem.fold !== 'open') {
cursor = store.lastHigherIndented(cursor)
item.indented = currentItem.indented
cursor--
}
let id = store.insertAfter(store.currentID(cursor), item)
cursor = store.index(id)
},