From 613a4c059ad94adfa53bbcb4fd4634433320708d Mon Sep 17 00:00:00 2001 From: pewdiepie-archdaemon Date: Sun, 28 Jun 2026 12:58:01 +0000 Subject: [PATCH] Close notes when opening documents --- static/js/document.js | 21 +++++++++++++++++++++ static/style.css | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/static/js/document.js b/static/js/document.js index 7d7dd7c67..5a28fa32e 100644 --- a/static/js/document.js +++ b/static/js/document.js @@ -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(); diff --git a/static/style.css b/static/style.css index bf4416da2..b5b695201 100644 --- a/static/style.css +++ b/static/style.css @@ -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 {