fix: rebuild ui.js, search.js, viewer.js from app.js with shell script (no truncation)
This commit is contained in:
+28
-20
@@ -1,5 +1,6 @@
|
||||
/* ObsiGate — Auto-extracted module */
|
||||
import { state } from './state.js';;
|
||||
/* ObsiGate — Viewer module */
|
||||
import { state } from './state.js';
|
||||
import { escapeHtml, safeCreateIcons, safeHighlight, getFileIcon } from './utils.js';
|
||||
// ---------------------------------------------------------------------------
|
||||
// Outline/TOC Manager
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -183,6 +184,7 @@ const OutlineManager = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Scroll Spy Manager
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -240,6 +242,7 @@ const ScrollSpyManager = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Reading Progress Manager
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -305,6 +308,7 @@ const ReadingProgressManager = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// File viewer
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -435,12 +439,12 @@ function renderFile(data) {
|
||||
copyBtn.addEventListener("click", async () => {
|
||||
try {
|
||||
// Fetch raw content if not already cached
|
||||
if (!state.cachedRawSource) {
|
||||
if (!cachedRawSource) {
|
||||
const rawUrl = `/api/file/${encodeURIComponent(data.vault)}/raw?path=${encodeURIComponent(data.path)}`;
|
||||
const rawData = await api(rawUrl);
|
||||
state.cachedRawSource = rawData.raw;
|
||||
}
|
||||
await navigator.clipboard.writeText(state.cachedRawSource);
|
||||
await navigator.clipboard.writeText(cachedRawSource);
|
||||
copyBtn.lastChild.textContent = "Copié !";
|
||||
setTimeout(() => (copyBtn.lastChild.textContent = "Copier"), 1500);
|
||||
} catch (err) {
|
||||
@@ -542,9 +546,9 @@ function renderFile(data) {
|
||||
if (!rendered || !raw) return;
|
||||
|
||||
state.showingSource = !state.showingSource;
|
||||
if (state.showingSource) {
|
||||
if (showingSource) {
|
||||
sourceBtn.classList.add("active");
|
||||
if (!state.cachedRawSource) {
|
||||
if (!cachedRawSource) {
|
||||
const rawUrl = `/api/file/${encodeURIComponent(data.vault)}/raw?path=${encodeURIComponent(data.path)}`;
|
||||
const rawData = await api(rawUrl);
|
||||
state.cachedRawSource = rawData.raw;
|
||||
@@ -594,6 +598,7 @@ function renderFile(data) {
|
||||
OutlineManager.init();
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -725,7 +730,7 @@ function attachTreeItemLongPress(itemEl, getMenuData) {
|
||||
}
|
||||
|
||||
function getVaultIcon(vaultName, size = 16) {
|
||||
const v = state.allVaults.find((val) => val.name === vaultName);
|
||||
const v = allVaults.find((val) => val.name === vaultName);
|
||||
const type = v ? v.type : "VAULT";
|
||||
|
||||
if (type === "DIR") {
|
||||
@@ -948,10 +953,10 @@ function showWelcome() {
|
||||
DashboardConflictsWidget.load();
|
||||
}
|
||||
if (typeof DashboardRecentWidget !== "undefined") {
|
||||
DashboardRecentWidget.load(state.selectedContextVault);
|
||||
DashboardRecentWidget.load(selectedContextVault);
|
||||
}
|
||||
if (typeof DashboardBookmarkWidget !== "undefined") {
|
||||
DashboardBookmarkWidget.load(state.selectedContextVault);
|
||||
DashboardBookmarkWidget.load(selectedContextVault);
|
||||
}
|
||||
if (typeof DashboardSharedWidget !== "undefined") {
|
||||
DashboardSharedWidget.load();
|
||||
@@ -1002,9 +1007,9 @@ async function loadSavedSearches() {
|
||||
// Apply the saved search
|
||||
const input = document.getElementById("search-input");
|
||||
if (input) input.value = s.query;
|
||||
state.searchCaseSensitive = s.case_sensitive || false;
|
||||
state.searchWholeWord = s.whole_word || false;
|
||||
state.searchRegex = s.regex || false;
|
||||
searchCaseSensitive = s.case_sensitive || false;
|
||||
searchWholeWord = s.whole_word || false;
|
||||
searchRegex = s.regex || false;
|
||||
if (typeof _updateToggleUI === "function") _updateToggleUI();
|
||||
if (s.include_paths) {
|
||||
const incl = document.getElementById("search-include-input");
|
||||
@@ -1019,8 +1024,8 @@ async function loadSavedSearches() {
|
||||
AutocompleteDropdown._suppressNext = true;
|
||||
const vault = s.vault || "all";
|
||||
if (input) { input.dispatchEvent(new Event("input")); }
|
||||
clearTimeout(state.searchTimeout);
|
||||
state.advancedSearchOffset = 0;
|
||||
clearTimeout(searchTimeout);
|
||||
advancedSearchOffset = 0;
|
||||
performAdvancedSearch(s.query, vault, null);
|
||||
});
|
||||
});
|
||||
@@ -1068,6 +1073,7 @@ function goHome() {
|
||||
showWelcome();
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SSE Client — IndexUpdateManager
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1216,15 +1222,15 @@ const IndexUpdateManager = (() => {
|
||||
// Toast removed: silent auto-indexing — no notification needed
|
||||
|
||||
// Refresh sidebar and tags if affected vault matches current context
|
||||
const affectsCurrentVault = state.selectedContextVault === "all" || (data.vaults || []).includes(state.selectedContextVault);
|
||||
const affectsCurrentVault = state.selectedContextVault === "all" || (data.vaults || []).includes(selectedContextVault);
|
||||
if (affectsCurrentVault) {
|
||||
try {
|
||||
await Promise.all([refreshSidebarTreePreservingState(), refreshTagsForContext()]);
|
||||
// Refresh current file if it was updated
|
||||
if (currentVault && state.currentPath) {
|
||||
const changed = (data.changes || []).some((c) => c.vault === currentVault && c.path === state.currentPath);
|
||||
if (currentVault && currentPath) {
|
||||
const changed = (data.changes || []).some((c) => c.vault === currentVault && c.path === currentPath);
|
||||
if (changed) {
|
||||
openFile(state.currentVault, state.currentPath);
|
||||
openFile(currentVault, currentPath);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -1233,7 +1239,7 @@ const IndexUpdateManager = (() => {
|
||||
}
|
||||
|
||||
// Refresh recent tab if it is active
|
||||
if (state.activeSidebarTab === "recent") {
|
||||
if (activeSidebarTab === "recent") {
|
||||
const vaultFilter = document.getElementById("recent-vault-filter");
|
||||
loadRecentFiles(vaultFilter ? vaultFilter.value || null : null);
|
||||
}
|
||||
@@ -1383,4 +1389,6 @@ function _renderSyncPanel(panel) {
|
||||
}
|
||||
|
||||
panel.innerHTML = html;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user