diff --git a/src/App.svelte b/src/App.svelte index df7f20e..21b5768 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -31,14 +31,29 @@ listBox.classList.add('listbox') frontmatter[fm].reverse().forEach((i)=>{ var itemLine = document.createElement('div') - itemLine.classList.add('itemLine') + itemLine.classList.add('itemline') let removeItem = document.createElement('button') let moveUpItem = document.createElement('button') let moveDownItem = document.createElement('button') + removeItem.setAttribute('type', 'button') removeItem.addEventListener('click', (e) => { e.target.parentNode.remove() }) + removeItem.textContent = "×" + moveUpItem.textContent = "⇑" + moveUpItem.setAttribute('type', 'button') + moveUpItem.addEventListener('click', (e) => { + let lb = document.querySelector(".listbox") + lb.insertBefore(e.currentTarget.parentNode, e.currentTarget.parentNode.previousSibling ) + }) + moveDownItem.textContent = "⇓" + moveDownItem.setAttribute('type', 'button') + moveDownItem.addEventListener('click', (e) => { + let lb = document.querySelector(".listbox") + lb.insertBefore(e.currentTarget.parentNode, e.currentTarget.parentNode.nextSibling.nextSibling ) + }) + itemLine.prepend(moveUpItem) itemLine.prepend(moveDownItem) var input = document.createElement('input')