Let the dashboard follow the presenter
The live marker in the slide list stayed on the last known slide when the presenter moved on in another window or with a clicker. The dashboard now polls a cheap version fingerprint (admin:live) and reloads the lists when it changes, but never under an open dialog, a pending request or a drag. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c6a19f0de
commit
8c7818ee40
7 files changed
+104
-1
No files matched your search
@@ -2654,6 +2654,36 @@
|
||||
});
|
||||
}
|
||||
|
||||
// The presenter (other window, clicker) moves the live marker: poll a cheap fingerprint
|
||||
// and reload the lists when it changes. Own actions already refresh, so they skip one round.
|
||||
var liveRoot = document.querySelector('[data-dashboard-live]');
|
||||
var liveVersion = null;
|
||||
if (liveRoot) {
|
||||
poll(function () {
|
||||
if ((dialog && dialog.open) || document.querySelector('[data-live] [aria-busy], .slide-item--dragging')) {
|
||||
return null; // never replace the DOM under a dialog, a pending request or a drag
|
||||
}
|
||||
return getJson(liveRoot.getAttribute('data-dashboard-live')).then(function (state) {
|
||||
var previous = liveVersion;
|
||||
liveVersion = state.version;
|
||||
if (previous === null || previous === state.version) {
|
||||
return null;
|
||||
}
|
||||
var active = document.activeElement;
|
||||
var item = active && active.closest ? active.closest('[data-slide-id]') : null;
|
||||
var form = active && active.closest ? active.closest('form') : null;
|
||||
var next = item ? item.nextElementSibling : null;
|
||||
var target = item ? {
|
||||
id: item.getAttribute('data-slide-id'),
|
||||
action: form ? form.getAttribute('action') : null,
|
||||
nextId: next ? next.getAttribute('data-slide-id') : null
|
||||
} : null;
|
||||
|
||||
return refreshList().then(function () { restoreFocus(target); });
|
||||
});
|
||||
}, Math.max(4000, parseInt(liveRoot.getAttribute('data-interval'), 10) * 2 || 4000));
|
||||
}
|
||||
|
||||
function openModal(doc) {
|
||||
var content = doc.querySelector('[data-modal-content]');
|
||||
var flash = doc.querySelector('[data-refresh="flash"]');
|
||||
@@ -2690,6 +2720,7 @@
|
||||
return wasOpen ? null : refreshList();
|
||||
}
|
||||
Fragments.apply(doc);
|
||||
liveVersion = null; // the next poll only takes the new fingerprint
|
||||
if (dialog && dialog.open) {
|
||||
dirty = false;
|
||||
dialog.close();
|
||||
|
||||
Reference in new issue
Block a user