mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-14 12:48:03 +00:00
Close notes when opening documents
This commit is contained in:
@@ -4192,7 +4192,27 @@ import * as Modals from './modalManager.js';
|
|||||||
|
|
||||||
// ---- Panel open/close ----
|
// ---- 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() {
|
export function openPanel() {
|
||||||
|
_closeNotesForDocumentOpen();
|
||||||
if (isOpen) return;
|
if (isOpen) return;
|
||||||
// Clear any pane/divider still sliding out from a just-fired close so we
|
// 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
|
// 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) {
|
export async function loadDocument(docId) {
|
||||||
|
_closeNotesForDocumentOpen();
|
||||||
// If already in tabs, just switch
|
// If already in tabs, just switch
|
||||||
if (docs.has(docId)) {
|
if (docs.has(docId)) {
|
||||||
_ensureDocPaneMounted();
|
_ensureDocPaneMounted();
|
||||||
|
|||||||
+1
-1
@@ -32015,7 +32015,7 @@ body.doc-find-active mark.doc-find-mark.current {
|
|||||||
height: 12px !important;
|
height: 12px !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -2px;
|
top: 0;
|
||||||
}
|
}
|
||||||
.email-attachment-open-label { line-height: 1; }
|
.email-attachment-open-label { line-height: 1; }
|
||||||
.email-attachment-chip.is-expanded .email-attachment-open {
|
.email-attachment-chip.is-expanded .email-attachment-open {
|
||||||
|
|||||||
Reference in New Issue
Block a user