Changeset 0.18.1 (#80)

This commit is contained in:
2026-02-28 19:41:59 +00:00
parent e4a943b03e
commit a591b810a9
13 changed files with 1415 additions and 197 deletions

View File

@@ -12,14 +12,12 @@ var _noteEditor = null; // CM6 noteEditor instance
// ── Notes ─────────────────────────────────────
async function openNotes() {
const panel = document.getElementById('sidePanel');
const notesTab = document.getElementById('sidePanelNotes');
// If notes panel is already open and showing, close it
if (panel?.classList.contains('open') && notesTab?.style.display !== 'none') {
closeSidePanel();
// Toggle: if notes is active, close it; otherwise open it
if (PanelRegistry.isOpen('notes')) {
PanelRegistry.close('notes');
return;
}
openSidePanel('notes');
PanelRegistry.open('notes');
_exitSelectMode();
await loadNotesList();
await loadNoteFolders();
@@ -745,6 +743,38 @@ function _showSaveToNoteModal(opts) {
// ── Notes Listeners (extracted from initListeners) ──
function _registerNotesPanel() {
const el = document.getElementById('sidePanelNotes');
if (!el) return;
PanelRegistry.register('notes', {
element: el,
label: 'Notes',
onOpen() {
// Loading is handled by openNotes() which calls loadNotesList
},
saveState() {
const listView = document.getElementById('notesListView');
const editorView = document.getElementById('notesEditorView');
const graphView = document.getElementById('notesGraphView');
let viewMode = 'list';
if (editorView && editorView.style.display !== 'none') viewMode = 'editor';
if (graphView && graphView.style.display !== 'none') viewMode = 'graph';
return {
scrollTop: listView?.scrollTop || 0,
editingNoteId: _editingNoteId,
viewMode,
};
},
restoreState(state) {
if (state.scrollTop) {
const listView = document.getElementById('notesListView');
if (listView) listView.scrollTop = state.scrollTop;
}
},
});
}
function _initNotesListeners() {
document.getElementById('notesBtn')?.addEventListener('click', openNotes);
document.getElementById('notesNewBtn')?.addEventListener('click', () => openNoteEditor(null));