Skip to content

Commit

Permalink
Update List.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmflynn committed Nov 1, 2023
1 parent 7d07d4b commit d4fbc71
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/renderer/src/stories/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ export class List extends LitElement {
this.items.splice(draggedIdx, 1)
this.items.splice(i, 0, movedItem)

const ogMoved = this.#ogValues[draggedIdx]
this.#ogValues.splice(draggedIdx, 1)
this.#ogValues.splice(i, 0, ogMoved)

this.items = [...this.items]
}

Expand All @@ -195,8 +191,6 @@ export class List extends LitElement {
this.items = [...this.items, item]
}

#ogValues = []

#removePlaceholder = () => {
this.#placeholder.removeAttribute('data-idx')
this.#placeholder.remove()
Expand Down Expand Up @@ -239,8 +233,6 @@ export class List extends LitElement {

const isUnordered = !!key

if (!this.#ogValues[i]) this.#ogValues[i] = isUnordered ? resolvedKey : value

if (isUnordered) {

this.setAttribute('unordered', '')
Expand Down Expand Up @@ -302,11 +294,9 @@ export class List extends LitElement {

const deleteListItem = () => this.delete(i);

const ogValue = this.#ogValues[i];

editableElement.addEventListener("blur", () => {
const newKey = editableElement.innerText;
if (newKey === "") editableElement.innerText = ogValue; // Reset to original value
if (newKey === "") this.delete(i); // Delete if empty
else {
const oKey = isUnordered ? resolvedKey : i;
delete this.object[oKey];
Expand Down

0 comments on commit d4fbc71

Please sign in to comment.