fix: openEditor, openShareDialog, clipboard fallback — boutons Copier/Éditer/Partager
This commit is contained in:
@@ -805,7 +805,7 @@ function renderSharesUI(shares) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ── Share Dialog (professional) ──
|
// ── Share Dialog (professional) ──
|
||||||
async function openShareDialog(vault, path) {
|
export async function openShareDialog(vault, path) {
|
||||||
// First check if already shared
|
// First check if already shared
|
||||||
let existingShare = null;
|
let existingShare = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
+13
-2
@@ -1,12 +1,13 @@
|
|||||||
/* ObsiGate — Viewer module */
|
/* ObsiGate — Viewer module */
|
||||||
import { api } from './auth.js';
|
import { api } from './auth.js';
|
||||||
import { state } from './state.js';
|
import { state } from './state.js';
|
||||||
import { escapeHtml, safeCreateIcons, safeHighlight, getFileIcon } from './utils.js';
|
import { escapeHtml, safeCreateIcons, safeHighlight, getFileIcon, openEditor } from './utils.js';
|
||||||
import { TabManager, closeMobileSidebar, ContextMenuManager, RightSidebarManager, showToast, buildFrontmatterCard } from './ui.js';
|
import { TabManager, closeMobileSidebar, ContextMenuManager, RightSidebarManager, showToast, buildFrontmatterCard } from './ui.js';
|
||||||
import { syncActiveFileTreeItem, searchByTag, TagFilterService } from './sidebar.js';
|
import { syncActiveFileTreeItem, searchByTag, TagFilterService } from './sidebar.js';
|
||||||
import { AutocompleteDropdown, performAdvancedSearch } from './search.js';
|
import { AutocompleteDropdown, performAdvancedSearch } from './search.js';
|
||||||
import { initDashboardTabs } from './sync.js';
|
import { initDashboardTabs } from './sync.js';
|
||||||
import { DashboardStatsWidget, DashboardRecentWidget, DashboardBookmarkWidget, DashboardSharedWidget, DashboardConflictsWidget } from './dashboard.js';
|
import { DashboardStatsWidget, DashboardRecentWidget, DashboardBookmarkWidget, DashboardSharedWidget, DashboardConflictsWidget } from './dashboard.js';
|
||||||
|
import { openShareDialog } from './config.js';
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Outline/TOC Manager
|
// Outline/TOC Manager
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -450,7 +451,17 @@ export function renderFile(data) {
|
|||||||
const rawData = await api(rawUrl);
|
const rawData = await api(rawUrl);
|
||||||
state.cachedRawSource = rawData.raw;
|
state.cachedRawSource = rawData.raw;
|
||||||
}
|
}
|
||||||
await navigator.clipboard.writeText(state.cachedRawSource);
|
if (navigator.clipboard) {
|
||||||
|
await navigator.clipboard.writeText(state.cachedRawSource);
|
||||||
|
} else {
|
||||||
|
// Fallback for non-secure contexts
|
||||||
|
const ta = document.createElement("textarea");
|
||||||
|
ta.value = state.cachedRawSource;
|
||||||
|
ta.style.position = "fixed"; ta.style.opacity = "0";
|
||||||
|
document.body.appendChild(ta); ta.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(ta);
|
||||||
|
}
|
||||||
copyBtn.lastChild.textContent = "Copié !";
|
copyBtn.lastChild.textContent = "Copié !";
|
||||||
setTimeout(() => (copyBtn.lastChild.textContent = "Copier"), 1500);
|
setTimeout(() => (copyBtn.lastChild.textContent = "Copier"), 1500);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user