Close notes when opening documents

This commit is contained in:
pewdiepie-archdaemon
2026-06-28 12:58:01 +00:00
parent 2cf7f24afc
commit 613a4c059a
2 changed files with 22 additions and 1 deletions
+21
View File
@@ -4192,7 +4192,27 @@ import * as Modals from './modalManager.js';
// ---- Panel open/close ----
function _closeNotesForDocumentOpen() {
try {
if (Modals.isRegistered('notes-panel')) {
Modals.close('notes-panel');
return;
}
} catch (_) {}
if (!document.getElementById('notes-pane') && !document.getElementById('notes-pane-backdrop')) return;
import('./notes.js')
.then(mod => {
const close = mod.closeNotes || mod.closePanel || mod.default?.closeNotes || mod.default?.closePanel;
if (typeof close === 'function') close();
})
.catch(() => {
try { document.getElementById('notes-pane')?.remove(); } catch (_) {}
try { document.getElementById('notes-pane-backdrop')?.remove(); } catch (_) {}
});
}
export function openPanel() {
_closeNotesForDocumentOpen();
if (isOpen) return;
// Clear any pane/divider still sliding out from a just-fired close so we
// don't end up with two #doc-editor-pane nodes (and a stale close stripping
@@ -6522,6 +6542,7 @@ import * as Modals from './modalManager.js';
}
export async function loadDocument(docId) {
_closeNotesForDocumentOpen();
// If already in tabs, just switch
if (docs.has(docId)) {
_ensureDocPaneMounted();
+1 -1
View File
@@ -32015,7 +32015,7 @@ body.doc-find-active mark.doc-find-mark.current {
height: 12px !important;
margin: 0 !important;
position: relative;
top: -2px;
top: 0;
}
.email-attachment-open-label { line-height: 1; }
.email-attachment-chip.is-expanded .email-attachment-open {