fix: openEditor, openShareDialog, clipboard fallback — boutons Copier/Éditer/Partager
This commit is contained in:
parent
3ad484001a
commit
0befd161e3
@ -805,7 +805,7 @@ function renderSharesUI(shares) {
|
||||
}
|
||||
|
||||
// ── Share Dialog (professional) ──
|
||||
async function openShareDialog(vault, path) {
|
||||
export async function openShareDialog(vault, path) {
|
||||
// First check if already shared
|
||||
let existingShare = null;
|
||||
try {
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
/* ObsiGate — Viewer module */
|
||||
import { api } from './auth.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 { syncActiveFileTreeItem, searchByTag, TagFilterService } from './sidebar.js';
|
||||
import { AutocompleteDropdown, performAdvancedSearch } from './search.js';
|
||||
import { initDashboardTabs } from './sync.js';
|
||||
import { DashboardStatsWidget, DashboardRecentWidget, DashboardBookmarkWidget, DashboardSharedWidget, DashboardConflictsWidget } from './dashboard.js';
|
||||
import { openShareDialog } from './config.js';
|
||||
// ---------------------------------------------------------------------------
|
||||
// Outline/TOC Manager
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -450,7 +451,17 @@ export function renderFile(data) {
|
||||
const rawData = await api(rawUrl);
|
||||
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é !";
|
||||
setTimeout(() => (copyBtn.lastChild.textContent = "Copier"), 1500);
|
||||
} catch (err) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user