fix: apply state.xxx pattern and exports to regenerated modules
This commit is contained in:
+17
-17
@@ -1,10 +1,10 @@
|
||||
/* ObsiGate — Auto-extracted module */
|
||||
import { state } from './state.js';
|
||||
import { state } from './state.js';;
|
||||
// ---------------------------------------------------------------------------
|
||||
// Right Sidebar Manager
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const RightSidebarManager = {
|
||||
export const RightSidebarManager = {
|
||||
init() {
|
||||
this.loadState();
|
||||
this.initToggle();
|
||||
@@ -16,11 +16,11 @@ const RightSidebarManager = {
|
||||
const savedWidth = localStorage.getItem("obsigate-right-sidebar-width");
|
||||
|
||||
if (savedVisible !== null) {
|
||||
rightSidebarVisible = savedVisible === "true";
|
||||
state.rightSidebarVisible = savedVisible === "true";
|
||||
}
|
||||
|
||||
if (savedWidth) {
|
||||
rightSidebarWidth = parseInt(savedWidth) || 280;
|
||||
state.rightSidebarWidth = parseInt(savedWidth) || 280;
|
||||
}
|
||||
|
||||
this.applyState();
|
||||
@@ -34,9 +34,9 @@ const RightSidebarManager = {
|
||||
|
||||
if (!sidebar) return;
|
||||
|
||||
if (rightSidebarVisible) {
|
||||
if (state.rightSidebarVisible) {
|
||||
sidebar.classList.remove("hidden");
|
||||
sidebar.style.width = `${rightSidebarWidth}px`;
|
||||
sidebar.style.width = `${state.rightSidebarWidth}px`;
|
||||
if (handle) handle.classList.remove("hidden");
|
||||
if (tocBtn) {
|
||||
tocBtn.classList.add("active");
|
||||
@@ -64,8 +64,8 @@ const RightSidebarManager = {
|
||||
},
|
||||
|
||||
toggle() {
|
||||
rightSidebarVisible = !rightSidebarVisible;
|
||||
localStorage.setItem("obsigate-right-sidebar-visible", rightSidebarVisible);
|
||||
state.rightSidebarVisible = !state.rightSidebarVisible;
|
||||
localStorage.setItem("obsigate-right-sidebar-visible", state.rightSidebarVisible);
|
||||
this.applyState();
|
||||
},
|
||||
|
||||
@@ -105,7 +105,7 @@ const RightSidebarManager = {
|
||||
newWidth = Math.max(200, Math.min(400, newWidth));
|
||||
|
||||
sidebar.style.width = `${newWidth}px`;
|
||||
rightSidebarWidth = newWidth;
|
||||
state.rightSidebarWidth = newWidth;
|
||||
};
|
||||
|
||||
const onMouseUp = () => {
|
||||
@@ -116,7 +116,7 @@ const RightSidebarManager = {
|
||||
document.body.style.cursor = "";
|
||||
document.body.style.userSelect = "";
|
||||
|
||||
localStorage.setItem("obsigate-right-sidebar-width", rightSidebarWidth);
|
||||
localStorage.setItem("obsigate-right-sidebar-width", state.rightSidebarWidth);
|
||||
};
|
||||
|
||||
handle.addEventListener("mousedown", onMouseDown);
|
||||
@@ -741,12 +741,12 @@ function buildFrontmatterCard(frontmatter) {
|
||||
const nextPath = result.new_path;
|
||||
await refreshSidebarTreePreservingState();
|
||||
|
||||
if (type === 'file' && currentVault === vault && currentPath === path) {
|
||||
if (type === 'file' && state.currentVault === vault && state.currentPath === path) {
|
||||
await openFile(vault, nextPath);
|
||||
} else if (type === 'directory' && currentVault === vault && currentPath && (currentPath === path || currentPath.startsWith(`${path}/`))) {
|
||||
const suffix = currentPath === path ? '' : currentPath.slice(path.length);
|
||||
currentPath = `${nextPath}${suffix}`;
|
||||
await focusPathInSidebar(vault, currentPath, { alignToTop: false });
|
||||
} else if (type === 'directory' && state.currentVault === vault && currentPath && (state.currentPath === path || state.currentPath.startsWith(`${path}/`))) {
|
||||
const suffix = state.currentPath === path ? '' : state.currentPath.slice(path.length);
|
||||
state.currentPath = `${nextPath}${suffix}`;
|
||||
await focusPathInSidebar(vault, state.currentPath, { alignToTop: false });
|
||||
}
|
||||
|
||||
showToast(type === 'directory' ? 'Dossier renommé' : 'Fichier renommé', 'success');
|
||||
@@ -830,7 +830,7 @@ function buildFrontmatterCard(frontmatter) {
|
||||
this._closeModal(overlay);
|
||||
await refreshSidebarTreePreservingState();
|
||||
|
||||
if (currentVault === vault && currentPath && currentPath.startsWith(path)) {
|
||||
if (state.currentVault === vault && currentPath && state.currentPath.startsWith(path)) {
|
||||
showWelcome();
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -892,7 +892,7 @@ function buildFrontmatterCard(frontmatter) {
|
||||
this._closeModal(overlay);
|
||||
await refreshSidebarTreePreservingState();
|
||||
|
||||
if (currentVault === vault && currentPath === path) {
|
||||
if (state.currentVault === vault && state.currentPath === path) {
|
||||
showWelcome();
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user