text-overflow ellipses; set cursor position on nav
Hunter
Saturday, August 3rd, 2024 at 11:57 PM
71 width: calc(100% - 30px);
72 margin-left: 5px;
73 padding: 5px;
- color: var(--text)
74 + color: var(--text);
75 + overflow: hidden;
76 + text-overflow: ellipsis;
77 + white-space: nowrap;
78 }
79 input[type="text"]:focus {
80 outline: none;
274 taskInput.type = 'text';
275 taskInput.value = task.text;
276
277 + taskInput.addEventListener('mousedown', function(e) {
278 + e.stopPropagation();
279 + });
280 +
281 const keydownHandler = function(e) {
282 if (e.key === 'Backspace') {
283 if (keyHandler.backspace.blocked) {
501 e.preventDefault();
502 if (!keyHandler.shiftLeft.pressed) {
503 keyHandler.shiftLeft.pressed = true;
504 + placeCursorAtBeginning(e.target);
505 navigateToParentTask();
506 }
507 }
550 const taskInput = document.querySelector(`.task-container[data-id="${task.id}"] input[type="text"]`);
551 if (taskInput) {
552 taskInput.focus();
553 + taskInput.setSelectionRange(taskInput.value.length, taskInput.value.length);
554 setActiveTask(taskInput, task);
555 }
556 }
557
558 + function placeCursorAtBeginning(taskInput) {
559 + taskInput.setSelectionRange(0, 0);
560 + }
561 +
562 function deleteSubtask(subtask) {
563 const parentTask = taskPath[taskPath.length - 1];
564 const index = parentTask.subtasks.findIndex(t => t.id === subtask.id);
624 const currentContainer = currentElement.closest('.task-container');
625 const currentIndex = Array.from(appContainer.querySelectorAll('.task-container')).indexOf(currentContainer);
626
627 + placeCursorAtBeginning(currentElement);
628 +
629 if (direction === 'up') {
630 if (currentIndex > 0) {
631 const prevTask = currentIndex === 1 ? currentTask : tasks[currentIndex - 2];