feat(ui): breadcrumb (Space › parent › page) + export menu (md/txt/html/pdf) on pages & spaces
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,8 @@ import { api } from '../api.js';
|
||||
import { el, mount } from '../dom.js';
|
||||
import { markdownEditor } from '../components/markdown_editor.js';
|
||||
import { backButton } from '../components/backbtn.js';
|
||||
import { breadcrumb } from '../components/breadcrumb.js';
|
||||
import { exportMenu } from '../components/export_menu.js';
|
||||
|
||||
export async function render(main, ctx) {
|
||||
const id = ctx.params.id;
|
||||
@@ -29,7 +31,10 @@ export async function render(main, ctx) {
|
||||
);
|
||||
|
||||
mount(main,
|
||||
backButton(),
|
||||
el('div', { class: 'doc-head' },
|
||||
el('div', { class: 'doc-head-left' }, backButton(), breadcrumb(page)),
|
||||
exportMenu({ filenameBase: page.slug, getContent: async () => ({ title: page.title, md: page.body_md || '' }) })
|
||||
),
|
||||
el('h1', { class: 'view-h1' }, page.title),
|
||||
el('p', { class: 'view-sub muted' }, '/' + page.slug),
|
||||
editor,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// pages & references table below (all pages; refs up to the API max).
|
||||
import { api } from '../api.js';
|
||||
import { el, mount } from '../dom.js';
|
||||
import { exportMenu } from '../components/export_menu.js';
|
||||
|
||||
function projItem(p) {
|
||||
return el('li', {},
|
||||
@@ -51,7 +52,17 @@ export async function render(main, ctx) {
|
||||
];
|
||||
|
||||
mount(main,
|
||||
el('h1', { class: 'view-h1' }, space.name),
|
||||
el('div', { class: 'doc-head' },
|
||||
el('h1', { class: 'view-h1', style: { margin: '0' } }, space.name),
|
||||
exportMenu({
|
||||
filenameBase: 'space-' + (space.slug || space.name),
|
||||
getContent: async () => {
|
||||
const full = await Promise.all(pages.map(p => api.get('/api/pages/' + p.id).catch(() => null)));
|
||||
const md = full.filter(Boolean).map(p => `# ${p.title}\n\n${p.body_md || ''}`).join('\n\n---\n\n');
|
||||
return { title: space.name, md };
|
||||
}
|
||||
})
|
||||
),
|
||||
el('p', { class: 'view-sub' }, space.description || el('span', { class: 'muted' }, 'No description.')),
|
||||
|
||||
// Top: Projects + Open tasks, side by side.
|
||||
|
||||
Reference in New Issue
Block a user