readme hinzugefügt
This commit is contained in:
1 parent
fa169b880c
commit
42660a1f9c
2 files changed
+130
-5
No files matched your search
+35
-5
@@ -121,9 +121,30 @@ class App {
|
||||
promoteOption.style.display = 'none';
|
||||
}
|
||||
|
||||
contextMenu.style.left = e.pageX + 'px';
|
||||
contextMenu.style.top = e.pageY + 'px';
|
||||
// Use clientX/clientY for fixed positioning (viewport-relative)
|
||||
let x = e.clientX;
|
||||
let y = e.clientY;
|
||||
|
||||
// Temporarily show offscreen to measure dimensions
|
||||
contextMenu.style.left = '-9999px';
|
||||
contextMenu.style.top = '-9999px';
|
||||
contextMenu.classList.add('show');
|
||||
|
||||
const menuWidth = contextMenu.offsetWidth;
|
||||
const menuHeight = contextMenu.offsetHeight;
|
||||
|
||||
// Clamp to viewport boundaries
|
||||
if (x + menuWidth > window.innerWidth) {
|
||||
x = window.innerWidth - menuWidth - 5;
|
||||
}
|
||||
if (y + menuHeight > window.innerHeight) {
|
||||
y = window.innerHeight - menuHeight - 5;
|
||||
}
|
||||
if (x < 0) x = 5;
|
||||
if (y < 0) y = 5;
|
||||
|
||||
contextMenu.style.left = x + 'px';
|
||||
contextMenu.style.top = y + 'px';
|
||||
}
|
||||
|
||||
hideContextMenu() {
|
||||
@@ -546,10 +567,19 @@ class App {
|
||||
${task.completed ? 'Undo' : 'Complete'}
|
||||
</button>
|
||||
</div>
|
||||
${task.subtasks.length > 0 ? this.renderSubtasks(task) : ''}
|
||||
<div class="drop-zone">Drop tasks here to add as subtasks</div>
|
||||
`;
|
||||
|
||||
// Append subtasks as DOM nodes to preserve event listeners
|
||||
if (task.subtasks.length > 0) {
|
||||
card.appendChild(this.renderSubtasks(task));
|
||||
}
|
||||
|
||||
// Add drop zone
|
||||
const dropZone = document.createElement('div');
|
||||
dropZone.className = 'drop-zone';
|
||||
dropZone.textContent = 'Drop tasks here to add as subtasks';
|
||||
card.appendChild(dropZone);
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
@@ -623,7 +653,7 @@ class App {
|
||||
container.appendChild(div);
|
||||
});
|
||||
|
||||
return container.outerHTML;
|
||||
return container;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Reference in new issue
Block a user