feat(viewer): #90 regroupement fonctionnel des boutons de la barre d'actions + spacers
Ordre: [TOC][pop-out][Bookmark] | [Editer][Source][.md][Forge] | [Copier][PDF][Export] | [Partager] - viewer.js: construction par groupes nav/edit/export/share, spacer .action-sep entre groupes non vides; Pretty ancre au groupe edition - popout.html: meme assemblage groupe, ordre aligne - style.css: regle .file-actions .action-sep (1px, var(--border-md)) - tests: tests/frontend/toolbar-order.test.mjs (9) branche au CI
This commit is contained in:
+22
-6
@@ -879,12 +879,28 @@ export function renderFile(data) {
|
||||
});
|
||||
}
|
||||
|
||||
const fileActions = [copyBtn, sourceBtn];
|
||||
if (!data.is_image) fileActions.push(mdBtn);
|
||||
if (data.is_markdown) fileActions.push(pdfBtn, exportWrap, forgeBtn, tocBtn);
|
||||
if (!data.unsupported) fileActions.push(editBtn);
|
||||
if (prettyBtn) fileActions.push(prettyBtn);
|
||||
fileActions.push(openNewWindowBtn, shareBtn, bookmarkBtn);
|
||||
// Separateur visuel entre les groupes d'actions (#90)
|
||||
const actionSep = () => el("span", { class: "action-sep" });
|
||||
// Ordre des boutons par groupes fonctionnels (#90) :
|
||||
// [TOC][pop-out][Bookmark] | [Editer][Source][.md][Forge] | [Copier][PDF][Export] | [Partager]
|
||||
// Boutons non affiches selon le type de fichier (Pretty, PDF/Export hors
|
||||
// markdown, ...) restent ancres a leur groupe ; spacer de groupe vide retire.
|
||||
const navBtns = [tocBtn, openNewWindowBtn, bookmarkBtn];
|
||||
const editBtns = [];
|
||||
if (!data.unsupported) editBtns.push(editBtn);
|
||||
editBtns.push(sourceBtn);
|
||||
if (!data.is_image) editBtns.push(mdBtn);
|
||||
if (data.is_markdown) editBtns.push(forgeBtn);
|
||||
if (prettyBtn) editBtns.push(prettyBtn);
|
||||
const exportBtns = [copyBtn];
|
||||
if (data.is_markdown) exportBtns.push(pdfBtn, exportWrap);
|
||||
const shareBtns = [shareBtn];
|
||||
const fileActions = [];
|
||||
[navBtns, editBtns, exportBtns, shareBtns].forEach((group) => {
|
||||
if (group.length === 0) return;
|
||||
if (fileActions.length > 0) fileActions.push(actionSep());
|
||||
group.forEach((b) => fileActions.push(b));
|
||||
});
|
||||
|
||||
// Assemble
|
||||
area.innerHTML = "";
|
||||
|
||||
Reference in New Issue
Block a user