Mobile: search=file palette, commands button, hide top tabs, always full-open files
This commit is contained in:
+4
-4
@@ -1579,13 +1579,13 @@ curl -X POST https://votre-serveur.com/webhook \
|
|||||||
<i data-lucide="folder-open" style="width:20px;height:20px"></i>
|
<i data-lucide="folder-open" style="width:20px;height:20px"></i>
|
||||||
<span class="mt-label">Explorer</span>
|
<span class="mt-label">Explorer</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="mt-btn" id="mt-search" title="Rechercher" aria-label="Rechercher">
|
<button class="mt-btn" id="mt-search" title="Rechercher un fichier" aria-label="Rechercher un fichier">
|
||||||
<i data-lucide="search" style="width:20px;height:20px"></i>
|
<i data-lucide="search" style="width:20px;height:20px"></i>
|
||||||
<span class="mt-label">Recherche</span>
|
<span class="mt-label">Recherche</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="mt-btn mt-btn-primary" id="mt-palette" title="Palette" aria-label="Palette de fichiers">
|
<button class="mt-btn mt-btn-primary" id="mt-palette" title="Commandes" aria-label="Palette de commandes">
|
||||||
<i data-lucide="command" style="width:20px;height:20px"></i>
|
<i data-lucide="terminal" style="width:20px;height:20px"></i>
|
||||||
<span class="mt-label">Palette</span>
|
<span class="mt-label">Commandes</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="mt-btn" id="mt-tabs" title="Onglets" aria-label="Onglets ouverts">
|
<button class="mt-btn" id="mt-tabs" title="Onglets" aria-label="Onglets ouverts">
|
||||||
<i data-lucide="files" style="width:20px;height:20px"></i>
|
<i data-lucide="files" style="width:20px;height:20px"></i>
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
import { state } from './state.js';
|
import { state } from './state.js';
|
||||||
import { TabManager } from './ui.js';
|
import { TabManager } from './ui.js';
|
||||||
|
|
||||||
// ── Open file palette ──
|
// ── Open file palette (search files) ──
|
||||||
function openPalette() {
|
function openFilePalette() {
|
||||||
import('./palette.js').then(m => { m.open(''); });
|
import('./palette.js').then(m => { m.open(''); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Open command palette ──
|
// ── Open command palette ──
|
||||||
function openCommands() {
|
function openCommandPalette() {
|
||||||
import('./palette.js').then(m => { m.open('> '); });
|
import('./palette.js').then(m => { m.open('> '); });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,6 @@ function renderTabList() {
|
|||||||
</div>`;
|
</div>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
// Click handler for switching tabs
|
|
||||||
list.querySelectorAll('.mt-tab-item').forEach(el => {
|
list.querySelectorAll('.mt-tab-item').forEach(el => {
|
||||||
el.addEventListener('click', (e) => {
|
el.addEventListener('click', (e) => {
|
||||||
if (e.target.closest('.mt-tab-item-close')) return;
|
if (e.target.closest('.mt-tab-item-close')) return;
|
||||||
@@ -65,7 +64,6 @@ function renderTabList() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click handler for closing tabs
|
|
||||||
list.querySelectorAll('.mt-tab-item-close').forEach(btn => {
|
list.querySelectorAll('.mt-tab-item-close').forEach(btn => {
|
||||||
btn.addEventListener('click', (e) => {
|
btn.addEventListener('click', (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -78,7 +76,6 @@ function renderTabList() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Update tab count badge ──
|
|
||||||
function updateTabCount() {
|
function updateTabCount() {
|
||||||
const badge = document.getElementById('mt-tab-count');
|
const badge = document.getElementById('mt-tab-count');
|
||||||
if (!badge) return;
|
if (!badge) return;
|
||||||
@@ -93,7 +90,6 @@ function updateTabCount() {
|
|||||||
|
|
||||||
// ── Vault home / sidebar toggle ──
|
// ── Vault home / sidebar toggle ──
|
||||||
function toggleExplorer() {
|
function toggleExplorer() {
|
||||||
// On mobile: toggle sidebar
|
|
||||||
const sidebar = document.getElementById('sidebar');
|
const sidebar = document.getElementById('sidebar');
|
||||||
if (sidebar) {
|
if (sidebar) {
|
||||||
if (sidebar.classList.contains('mobile-open')) {
|
if (sidebar.classList.contains('mobile-open')) {
|
||||||
@@ -102,7 +98,6 @@ function toggleExplorer() {
|
|||||||
sidebar.classList.add('mobile-open');
|
sidebar.classList.add('mobile-open');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Also focus the vault if none selected
|
|
||||||
if (!state.currentVault && state.allVaults && state.allVaults.length > 0) {
|
if (!state.currentVault && state.allVaults && state.allVaults.length > 0) {
|
||||||
import('./sidebar.js').then(m => {
|
import('./sidebar.js').then(m => {
|
||||||
if (m.setSelectedVaultContext) m.setSelectedVaultContext(state.allVaults[0].name);
|
if (m.setSelectedVaultContext) m.setSelectedVaultContext(state.allVaults[0].name);
|
||||||
@@ -110,18 +105,8 @@ function toggleExplorer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Focus search ──
|
|
||||||
function focusSearch() {
|
|
||||||
const searchInput = document.querySelector('.search-input');
|
|
||||||
if (searchInput) {
|
|
||||||
searchInput.focus();
|
|
||||||
searchInput.select();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Init ──
|
// ── Init ──
|
||||||
export function initMobileToolbar() {
|
export function initMobileToolbar() {
|
||||||
// Only relevant on mobile, but attach handlers anyway
|
|
||||||
const explorerBtn = document.getElementById('mt-explorer');
|
const explorerBtn = document.getElementById('mt-explorer');
|
||||||
const searchBtn = document.getElementById('mt-search');
|
const searchBtn = document.getElementById('mt-search');
|
||||||
const paletteBtn = document.getElementById('mt-palette');
|
const paletteBtn = document.getElementById('mt-palette');
|
||||||
@@ -130,33 +115,14 @@ export function initMobileToolbar() {
|
|||||||
const overlay = document.getElementById('mt-overlay');
|
const overlay = document.getElementById('mt-overlay');
|
||||||
|
|
||||||
if (explorerBtn) explorerBtn.addEventListener('click', toggleExplorer);
|
if (explorerBtn) explorerBtn.addEventListener('click', toggleExplorer);
|
||||||
if (searchBtn) searchBtn.addEventListener('click', focusSearch);
|
if (searchBtn) searchBtn.addEventListener('click', openFilePalette);
|
||||||
if (paletteBtn) paletteBtn.addEventListener('click', openPalette);
|
if (paletteBtn) paletteBtn.addEventListener('click', openCommandPalette);
|
||||||
if (tabsBtn) tabsBtn.addEventListener('click', openTabSwitcher);
|
if (tabsBtn) tabsBtn.addEventListener('click', openTabSwitcher);
|
||||||
if (sheetClose) sheetClose.addEventListener('click', closeTabSwitcher);
|
if (sheetClose) sheetClose.addEventListener('click', closeTabSwitcher);
|
||||||
if (overlay) overlay.addEventListener('click', closeTabSwitcher);
|
if (overlay) overlay.addEventListener('click', closeTabSwitcher);
|
||||||
|
|
||||||
// Long-press palette for commands
|
|
||||||
if (paletteBtn) {
|
|
||||||
let pressTimer;
|
|
||||||
paletteBtn.addEventListener('touchstart', () => {
|
|
||||||
pressTimer = setTimeout(() => {
|
|
||||||
openCommands();
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
paletteBtn.addEventListener('touchend', () => clearTimeout(pressTimer));
|
|
||||||
paletteBtn.addEventListener('touchmove', () => clearTimeout(pressTimer));
|
|
||||||
// Click = file palette, right-click / context menu = commands
|
|
||||||
paletteBtn.addEventListener('contextmenu', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
openCommands();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update tab count periodically
|
|
||||||
setInterval(updateTabCount, 2000);
|
setInterval(updateTabCount, 2000);
|
||||||
updateTabCount();
|
updateTabCount();
|
||||||
|
|
||||||
// Also expose tab count update for external triggers
|
|
||||||
window._mtUpdateTabs = updateTabCount;
|
window._mtUpdateTabs = updateTabCount;
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-3
@@ -355,7 +355,11 @@ async function incrementalLoadDirectory(vaultName, dirPath, container) {
|
|||||||
attachTreeItemLongPress(fileItem, () => ({ vault: vaultName, path: item.path, type: "file", isReadonly: false }));
|
attachTreeItemLongPress(fileItem, () => ({ vault: vaultName, path: item.path, type: "file", isReadonly: false }));
|
||||||
fileItem.addEventListener("click", () => {
|
fileItem.addEventListener("click", () => {
|
||||||
scrollTreeItemIntoView(fileItem, false);
|
scrollTreeItemIntoView(fileItem, false);
|
||||||
TabManager.openPreview(vaultName, item.path);
|
if (window.innerWidth <= 768) {
|
||||||
|
TabManager.openPersistent(vaultName, item.path);
|
||||||
|
} else {
|
||||||
|
TabManager.openPreview(vaultName, item.path);
|
||||||
|
}
|
||||||
closeMobileSidebar();
|
closeMobileSidebar();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -646,7 +650,11 @@ async function loadDirectory(vaultName, dirPath, container) {
|
|||||||
attachTreeItemLongPress(fileItem, () => ({ vault: vaultName, path: item.path, type: "file", isReadonly: false }));
|
attachTreeItemLongPress(fileItem, () => ({ vault: vaultName, path: item.path, type: "file", isReadonly: false }));
|
||||||
fileItem.addEventListener("click", () => {
|
fileItem.addEventListener("click", () => {
|
||||||
scrollTreeItemIntoView(fileItem, false);
|
scrollTreeItemIntoView(fileItem, false);
|
||||||
TabManager.openPreview(vaultName, item.path);
|
if (window.innerWidth <= 768) {
|
||||||
|
TabManager.openPersistent(vaultName, item.path);
|
||||||
|
} else {
|
||||||
|
TabManager.openPreview(vaultName, item.path);
|
||||||
|
}
|
||||||
closeMobileSidebar();
|
closeMobileSidebar();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -806,7 +814,11 @@ function renderFilteredSidebarResults(query, results) {
|
|||||||
if (entry.type === "directory") {
|
if (entry.type === "directory") {
|
||||||
await focusPathInSidebar(entry.vault, entry.path, { alignToTop: true, expandTarget: true });
|
await focusPathInSidebar(entry.vault, entry.path, { alignToTop: true, expandTarget: true });
|
||||||
} else {
|
} else {
|
||||||
await TabManager.openPreview(entry.vault, entry.path);
|
if (window.innerWidth <= 768) {
|
||||||
|
await TabManager.openPersistent(entry.vault, entry.path);
|
||||||
|
} else {
|
||||||
|
await TabManager.openPreview(entry.vault, entry.path);
|
||||||
|
}
|
||||||
await focusPathInSidebar(entry.vault, getParentDirectoryPath(entry.path), { alignToTop: true, expandTarget: true });
|
await focusPathInSidebar(entry.vault, getParentDirectoryPath(entry.path), { alignToTop: true, expandTarget: true });
|
||||||
syncActiveFileTreeItem(entry.vault, entry.path);
|
syncActiveFileTreeItem(entry.vault, entry.path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6597,6 +6597,11 @@ body.popup-mode .content-area {
|
|||||||
overscroll-behavior-y: auto;
|
overscroll-behavior-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hide desktop tab bar on mobile (bottom toolbar has its own tab button) */
|
||||||
|
.tab-bar-container {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
.mt-btn {
|
.mt-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
Reference in New Issue
Block a user