Skip to content

Self-hosted AI workspace.

Python

Close notes when opening documents

pewdiepie-archdaemone75e1d038e5b
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 {