todo.txt integration
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user