diff --git a/src/modules/addTask.js b/src/modules/addTask.js index 1df02f9..fa4258a 100644 --- a/src/modules/addTask.js +++ b/src/modules/addTask.js @@ -4,12 +4,14 @@ export const taskarr = JSON.parse(localStorage.getItem('taskarr')) || []; export const addTask = (description, index) => { index = taskarr.length; - const newTask = new TaskObject(description, index); + const newTask = new TaskObject(description, index + 1); taskarr.push(newTask); // this will sort out the user input index - const sortedArr = [...taskarr]; - sortedArr.sort((a, b) => a.index - b.index); + // const sortedArr = [...taskarr]; + // sortedArr.sort((a, b) => a.index - b.index); + + // taskarr.sort((a, b) => a.index - b.index); saveData(taskarr); return taskarr; }; diff --git a/src/modules/displayList.js b/src/modules/displayList.js index 7c601a7..a87f484 100644 --- a/src/modules/displayList.js +++ b/src/modules/displayList.js @@ -37,20 +37,27 @@ export default (task) => { taskDescription.forEach((task, index) => { task.addEventListener('click', (event) => { task.classList.add('edit'); - return event.preventDefault(); + // if (event === false) { + // taskDescription.parentElement.addEventListener('click', () => task.classList.remove('edit')); + // } + return event.preventDefault(task.classList.remove('edit')); }); task.addEventListener('change', (event) => { + event.preventDefault(); task.readOnly = false; task.classList.remove('edit'); - RTCRtpReceiver; + // RTCRtpReceiver; return event.preventDefault(); }); // the trick is with input - task.addEventListener('input', () => { + task.addEventListener('input', (event) => { + event.preventDefault(); taskarr[index].description = task.value; saveData(taskarr); }); }); + + // taskDescription.parentElement.addEventListener('click', () => task.classList.remove('edit')); }; diff --git a/src/styles/sass/main.sass b/src/styles/sass/main.sass index 4573b9d..df0fdb7 100644 --- a/src/styles/sass/main.sass +++ b/src/styles/sass/main.sass @@ -11,7 +11,6 @@ body white-space: pre-wrap word-wrap: break-word padding: 3rem - // height: 100vh img transition: all 0.5s .container @@ -23,7 +22,6 @@ img box-shadow: $box-shadow padding: 10px text-align: left - width: 50% #tasksList @include columnFlex gap: .2rem