fix(editor): ignore Esc while a blocking operation owns the screen
The discard-confirm opened underneath the busy overlay, which sits at z-index 200 - blurred and half-clickable. Worse than the display: it let the user arbitrate closing the editor while a sync or a rotation was writing to the same entry.
This commit is contained in:
@@ -5971,6 +5971,13 @@ function updateBusy(text) {
|
||||
function hideBusy() {
|
||||
const o = $('#busyOverlay'); if (o) o.classList.add('is-hidden');
|
||||
}
|
||||
// True while a blocking operation owns the screen. Anything that would open a
|
||||
// dialog has to check this: the overlay is above every modal, so a dialog
|
||||
// raised now is invisible under it.
|
||||
function isBusy() {
|
||||
const o = $('#busyOverlay');
|
||||
return !!o && !o.classList.contains('is-hidden');
|
||||
}
|
||||
|
||||
function closeConfirm(value) {
|
||||
$('#confirmModal').classList.add('is-hidden');
|
||||
@@ -7378,6 +7385,11 @@ async function init() {
|
||||
if (e.key !== 'Escape') return;
|
||||
if (!$('#slideover').classList.contains('is-open')) return;
|
||||
if (document.querySelector('.modal:not(.is-hidden)')) return;
|
||||
// A long operation is running (sync, export, rotation…). The busy
|
||||
// overlay sits above everything at z-index 200, so a discard-confirm
|
||||
// opened now would render blurred underneath it — and answering it
|
||||
// would race whatever the operation is doing to the same entry.
|
||||
if (isBusy()) return;
|
||||
// Command palette is .cmd-palette, not .modal — it sits on top of
|
||||
// the editor, so its Esc must close IT (bubble handler), not pop
|
||||
// the editor's discard-confirm underneath.
|
||||
|
||||
Reference in New Issue
Block a user