todo.txt integration

This commit is contained in:
2026-07-03 11:08:27 +02:00
parent 8c9b448bdc
commit 5e72b073b8
9 changed files with 458 additions and 36 deletions
+8
View File
@@ -16,6 +16,7 @@
var placeholder = null; // marks where to restore it
var prevFocus = null;
var onKeydown = null;
var onCloseCb = null; // opts.onClose of the currently hosted node
function build() {
overlay = document.createElement('div');
@@ -56,6 +57,7 @@
opts = opts || {};
prevFocus = document.activeElement;
onCloseCb = typeof opts.onClose === 'function' ? opts.onClose : null;
hosted = node;
placeholder = document.createComment('overlay-slot');
node.parentNode.insertBefore(placeholder, node);
@@ -96,6 +98,12 @@
if (toRestore && toRestore.focus) {
try { toRestore.focus(); } catch (e) {}
}
// Fires after the node is back in its original spot, so the callback
// sees the final DOM (e.g. the todo rail flushing an autosave).
var cb = onCloseCb;
onCloseCb = null;
if (cb) cb();
}
// Belt-and-suspenders bfcache guard: force the overlay closed (restoring