Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
v0.9.9: copy/paste (external + cross-deck), help overlay + tooltips, speaker diagnostics
nyblnetf1cf88be7595
diff --git a/CLAUDE.md b/CLAUDE.mdindex 6c15c23a..01b52b9e 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -33,6 +33,16 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.cross-reload-recover, by design.- `src/render.ts` — single model→DOM renderer shared by editor canvas, thumbnails, andReveal sections. Elements carry `data-el-id` (editing) and `data-flip-id` (morph).+- `src/editor/clipboard.ts` (v0.9.9) — system-clipboard copy/paste. Bento content+ is written as JSON tagged `__bento:"clip"` (kind elements|slides) with referenced+ assets/fonts embedded, so it round-trips across decks/tabs; asset-key collisions+ remap. Editor: ⌘C copies selected elements, or the current slide when nothing is+ selected (→ `navigator.clipboard.writeText`); a document `paste` listener handles+ external images (embed as data-URI image element), plain text (→ text element),+ and Bento payloads (insert elements on the current slide / slides after it, fresh+ ids). Pasted slides drop `stateOf`. Guarded to skip when a text field is focused.+ Also v0.9.9: a `?` help overlay (editor.openHelp — shortcuts + tips, topbar ?+ button) and richer toolbar tooltips.- `src/anim.ts` — in-house animation engine (no GSAP): to/fromTo tweens withchannels opacity/y/scale/color/strokeDashoffset/attr{}/motionPath, delay/repeat/yoyo/ease, per-channel overwrite, killTweensOf/getTweensOf, manualdiff --git a/slides/package.json b/slides/package.jsonindex 80a08c8b..761eeedc 100644--- a/slides/package.json+++ b/slides/package.json@@ -1,7 +1,7 @@{"name": "bento-slides","private": true,- "version": "0.9.8",+ "version": "0.9.9","type": "module","scripts": {"dev": "vite",diff --git a/slides/src/editor/clipboard.ts b/slides/src/editor/clipboard.tsnew file mode 100644index 00000000..7a1c63fb--- /dev/null+++ b/slides/src/editor/clipboard.ts@@ -0,0 +1,115 @@+// System-clipboard copy/paste: external objects (images, text) onto the canvas,+// and Bento elements or whole slides between decks (across tabs/windows).+//+// Bento content is written to the clipboard as JSON tagged with `__bento:"clip"`+// (plain text, so it survives the OS clipboard). Referenced assets (image data,+// fonts) travel inside the payload, so pasting into another deck brings the+// pixels and typefaces along; asset-key collisions with different content are+// remapped so nothing clobbers the target deck.++import type { BentoDoc, Slide, SlideElement } from '../model'+import { uid } from '../model'++export interface ClipPayload {+ __bento: 'clip'+ kind: 'elements' | 'slides'+ elements?: SlideElement[]+ slides?: Slide[]+ assets?: Record<string, string>+ fonts?: BentoDoc['fonts']+}++function assetKeysOf(els: SlideElement[]): Set<string> {+ const keys = new Set<string>()+ for (const el of els) {+ if (el.type === 'image' && typeof el.src === 'string' && el.src.startsWith('asset:')) keys.add(el.src.slice(6))+ const a = (el as { asset?: string }).asset+ if (typeof a === 'string') keys.add(a) // svg elements reference an asset key+ }+ return keys+}++function collectAssets(els: SlideElement[], doc: BentoDoc): Record<string, string> {+ const out: Record<string, string> = {}+ for (const k of assetKeysOf(els)) if (doc.assets?.[k] != null) out[k] = doc.assets[k]+ return out+}++export function serializeElements(els: SlideElement[], doc: BentoDoc): string {+ const payload: ClipPayload = {+ __bento: 'clip', kind: 'elements',+ elements: JSON.parse(JSON.stringify(els)),+ assets: collectAssets(els, doc),+ }+ return JSON.stringify(payload)+}++export function serializeSlides(slides: Slide[], doc: BentoDoc): string {+ const els = slides.flatMap((s) => s.elements)+ const payload: ClipPayload = {+ __bento: 'clip', kind: 'slides',+ slides: JSON.parse(JSON.stringify(slides)),+ assets: collectAssets(els, doc),+ fonts: doc.fonts, // carry typefaces so pasted slides keep their look+ }+ return JSON.stringify(payload)+}++export function parseClip(text: string): ClipPayload | null {+ if (!text || text.length > 40_000_000) return null+ try { const p = JSON.parse(text); return p && p.__bento === 'clip' ? p as ClipPayload : null } catch { return null }+}++/** Merge payload assets into doc; on same-key-different-value, remap to a fresh key. */+function mergeAssets(payload: ClipPayload, doc: BentoDoc): Map<string, string> {+ const remap = new Map<string, string>()+ if (!payload.assets) return remap+ doc.assets = doc.assets ?? {}+ for (const [k, v] of Object.entries(payload.assets)) {+ if (doc.assets[k] === undefined) doc.assets[k] = v+ else if (doc.assets[k] !== v) { const nk = `${k}-${uid('a')}`; doc.assets[nk] = v; remap.set(k, nk) }+ }+ return remap+}++function rewriteRefs(els: SlideElement[], remap: Map<string, string>) {+ if (!remap.size) return+ for (const el of els) {+ if (el.type === 'image' && typeof el.src === 'string' && el.src.startsWith('asset:')) {+ const k = el.src.slice(6); if (remap.has(k)) el.src = 'asset:' + remap.get(k)+ }+ const a = (el as { asset?: string }).asset+ if (typeof a === 'string' && remap.has(a)) (el as { asset?: string }).asset = remap.get(a)+ }+}++/** Insert pasted elements onto a slide with fresh ids, nudged so they're visible. */+export function insertElements(payload: ClipPayload, doc: BentoDoc, slide: Slide): SlideElement[] {+ const remap = mergeAssets(payload, doc)+ const els: SlideElement[] = (payload.elements ?? []).map((e) => ({+ ...(JSON.parse(JSON.stringify(e)) as SlideElement),+ id: uid(e.type[0]),+ x: (e.x ?? 0) + 20, y: (e.y ?? 0) + 20,+ }))+ rewriteRefs(els, remap)+ slide.elements.push(...els)+ return els+}++/** Insert pasted slides at `at` with fresh slide ids; merge assets + fonts. */+export function insertSlides(payload: ClipPayload, doc: BentoDoc, at: number): Slide[] {+ const remap = mergeAssets(payload, doc)+ if (payload.fonts?.length) {+ doc.fonts = doc.fonts ?? []+ for (const f of payload.fonts) if (!doc.fonts.some((g) => g.family === f.family)) doc.fonts.push(f)+ }+ const slides: Slide[] = (payload.slides ?? []).map((s) => {+ const copy = JSON.parse(JSON.stringify(s)) as Slide+ copy.id = uid('slide')+ if (copy.stateOf) delete copy.stateOf // a pasted state becomes a normal slide+ rewriteRefs(copy.elements, remap)+ return copy+ })+ doc.slides.splice(at, 0, ...slides)+ return slides+}diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.tsindex f3993397..aa2182ed 100644--- a/slides/src/editor/editor.ts+++ b/slides/src/editor/editor.ts@@ -16,6 +16,7 @@ import { PropsPanel } from './panels'import { startPresentation } from '../present'import { hasFileHandle, isEncryptionActive, saveFile, serializeAuto, serializeFile, setEncryptionPassword, writeUpdatedFile, writeUpdatedFileAs } from '../save'import { addVersion, clearRecovery, docContentKey, getRecovery, listVersions, pruneOld, putRecovery, type Snapshot } from '../autosave'+import { insertElements, insertSlides, parseClip, serializeElements, serializeSlides } from './clipboard'import { ICONS } from '../icons'import { t, setLocale, locale, LOCALE_CHOICES } from '../i18n'import { disconnectOnline, joinFromDoc, mintCollab, onlineTransport, rotateKeys, sharingOn, startSharing, stopSharing } from '../sync/online'@@ -37,7 +38,6 @@ export class Editor {private props!: HTMLElementprivate dirtyDot!: HTMLElementprivate thumbTimer = 0- private clipboard: SlideElement[] = []private presenting = falseprivate updatesB!: HTMLElementprivate avatarsBox!: HTMLElement@@ -65,6 +65,7 @@ export class Editor {if (store.dirty) ev.preventDefault()})this.wireAutosave()+ this.wirePaste()store.on('doc', () => this.syncLinkedCharts())document.addEventListener('bento:apply-layout', ((ev: CustomEvent) => {this.openLayoutPicker(ev.detail.anchor as HTMLElement, { kind: 'apply' })@@ -185,11 +186,15 @@ export class Editor {const insert = div('ed-group')insert.append(- btn(ICONS.text, t('Text'), () => this.canvas.insert(defaultText({ y: 120 + Math.random() * 200 }), true)),+ btn(ICONS.text, t('Text'), () => this.canvas.insert(defaultText({ y: 120 + Math.random() * 200 }), true),+ t('Add a text box — double-click it to edit; **bold**, *italic*, `code` and “- ” bullets format as you type')),this.shapeDropdown(),- btn(ICONS.image, t('Image'), () => this.pickImage()),- btn(ICONS.table, t('Table'), () => this.canvas.insert(defaultTable())),- btn(ICONS.chart, t('Chart'), () => this.canvas.insert(defaultChart(applyChartPalette(CHART_PRESETS.bar(), this.store.doc.theme)))),+ btn(ICONS.image, t('Image'), () => this.pickImage(),+ t('Add an image — or just paste one (⌘V) straight onto the slide')),+ btn(ICONS.table, t('Table'), () => this.canvas.insert(defaultTable()),+ t('Add a table — edit cells inline; turn it into a live chart from the panel')),+ btn(ICONS.chart, t('Chart'), () => this.canvas.insert(defaultChart(applyChartPalette(CHART_PRESETS.bar(), this.store.doc.theme))),+ t('Add a chart — edit it visually or link it to a table so it updates live')),)const commentB = btn(ICONS.comment, t('Comment'), () => this.canvas.toggleCommentMode(),t('Comment (C) — click an element or a spot on the slide'))@@ -219,7 +224,9 @@ export class Editor {const redoB = btn(ICONS.redo, '', () => this.store.redo(), t('Redo (⇧⌘Z)'))const saveB = btn(ICONS.save, t('Save'), () => this.save(false), t('Save — rewrite this file in place (⌘S)'))const pdfB = btn(ICONS.pdf, '', () => this.exportPdf(), t('Export PDF (print)'))- actions.append(undoB, redoB, pdfB, this.shareDropdown(), saveB, this.saveDropdown())+ const helpB = btn('<b class="ed-help-q">?</b>', '', () => this.openHelp(), t('Shortcuts & tips (?)'))+ helpB.classList.add('ed-btn-help')+ actions.append(helpB, undoB, redoB, pdfB, this.shareDropdown(), saveB, this.saveDropdown())this.avatarsBox = div('ed-avatars')bar.append(logo, this.updatesB, title, this.dirtyDot, this.avatarsBox, insert, actions)@@ -993,6 +1000,77 @@ export class Editor {}, { fullscreen })}+ // --- paste: external objects + cross-deck elements/slides ---------------------++ private wirePaste() {+ document.addEventListener('paste', (ev: ClipboardEvent) => {+ if (this.presenting) return+ const a = document.activeElement as HTMLElement | null+ if (a && (a.tagName === 'INPUT' || a.tagName === 'TEXTAREA' || a.isContentEditable)) return // text edit owns it+ const dt = ev.clipboardData+ if (!dt) return+ // 1) an image from the OS clipboard (screenshot, copied picture…)+ const imgItem = [...dt.items].find((it) => it.kind === 'file' && it.type.startsWith('image/'))+ if (imgItem) {+ const file = imgItem.getAsFile()+ if (file) { ev.preventDefault(); this.pasteImageFile(file); return }+ }+ const text = dt.getData('text/plain')+ // 2) Bento elements / slides copied from this or another deck+ const clip = parseClip(text)+ if (clip?.kind === 'elements') {+ ev.preventDefault()+ let added: SlideElement[] = []+ this.store.commit(() => { added = insertElements(clip, this.store.doc, this.store.slide) })+ this.store.select(added.map((e) => e.id))+ this.toast(added.length === 1 ? t('Pasted 1 item') : t('Pasted {n} items', { n: added.length }))+ return+ }+ if (clip?.kind === 'slides') {+ ev.preventDefault()+ const at = this.store.currentIndex + 1+ let made: Slide[] = []+ this.store.commit(() => { made = insertSlides(clip, this.store.doc, at) }, 'slides')+ this.rebuildSidebar()+ this.store.goTo(at)+ this.toast(made.length === 1 ? t('Pasted 1 slide') : t('Pasted {n} slides', { n: made.length }))+ return+ }+ // 3) plain text → a text element+ if (text && text.trim()) {+ ev.preventDefault()+ const esc = text.trim().slice(0, 4000).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br>')+ const { width } = this.store.doc.size+ const el = defaultText({ html: esc, x: Math.round(width / 2 - 300), y: 260, w: 600 })+ this.store.commit(() => this.store.slide.elements.push(el))+ this.store.select([el.id])+ this.toast(t('Text pasted'))+ }+ })+ }++ private pasteImageFile(file: File) {+ const reader = new FileReader()+ reader.onload = () => {+ const src = String(reader.result)+ const place = (w: number, h: number) => {+ const { width, height } = this.store.doc.size+ const el = defaultImage(src, { x: Math.round((width - w) / 2), y: Math.round((height - h) / 2), w, h, fit: 'contain' })+ this.store.commit(() => this.store.slide.elements.push(el))+ this.store.select([el.id])+ this.toast(t('Image pasted'))+ }+ const img = new Image()+ img.onload = () => {+ let w = img.naturalWidth || 400, h = img.naturalHeight || 300+ const sc = Math.min(1, 640 / w, 480 / h); place(Math.round(w * sc), Math.round(h * sc))+ }+ img.onerror = () => place(400, 300)+ img.src = src+ }+ reader.readAsDataURL(file)+ }+// --- live table→chart binding -------------------------------------------------private tableSig = ''@@ -1134,6 +1212,61 @@ export class Editor {document.body.appendChild(overlay)}+ /** Shortcuts + tips overlay (press ? or the topbar help button). */+ private openHelp() {+ document.querySelector('.ed-about-overlay')?.remove()+ const overlay = div('ed-about-overlay')+ const box = div('ed-about ed-help-box')+ const h = document.createElement('h2')+ h.textContent = t('Shortcuts & tips')+ box.appendChild(h)+ const mod = navigator.platform.includes('Mac') ? '⌘' : 'Ctrl'+ const section = (title: string, rows: Array<[string, string]>) => {+ const sec = div('ed-help-sec')+ const st = document.createElement('h3'); st.textContent = title; sec.appendChild(st)+ for (const [k, d] of rows) {+ const r = div('ed-help-row')+ r.innerHTML = `<kbd></kbd><span></span>`+ r.querySelector('kbd')!.textContent = k+ r.querySelector('span')!.textContent = d+ sec.appendChild(r)+ }+ box.appendChild(sec)+ }+ section(t('Editing'), [+ [`${mod}S`, t('Save')],+ [`${mod}Z · ${mod}⇧Z`, t('Undo · redo')],+ [`${mod}C · ${mod}V`, t('Copy · paste — elements, or the whole slide when nothing is selected')],+ [`${mod}D`, t('Duplicate selection')],+ [`${mod}G · ${mod}⇧G`, t('Group · ungroup')],+ ['C', t('Comment mode')],+ ['?', t('This help')],+ ])+ section(t('Presenting'), [+ ['F5', t('Present')],+ ['F', t('Toggle fullscreen while presenting')],+ ['S', t('Speaker view — notes on a second screen if you have one')],+ ['← · →', t('Previous · next slide')],+ ['Esc', t('End the show')],+ ])+ const tips = div('ed-help-sec')+ const tt = document.createElement('h3'); tt.textContent = t('Good to know'); tips.appendChild(tt)+ const ul = document.createElement('ul'); ul.className = 'ed-help-tips'+ for (const tip of [+ t('Paste an image or text straight onto the canvas with ⌘V.'),+ t('Copy a slide (⌘C with nothing selected) and paste it into another Bento deck.'),+ t('Make a chart from a table and it stays linked — edit the table, the chart updates.'),+ t('Your work auto-saves; restore earlier versions from About → Version history.'),+ ]) { const li = document.createElement('li'); li.textContent = tip; ul.appendChild(li) }+ tips.appendChild(ul); box.appendChild(tips)+ overlay.appendChild(box)+ const close = () => { overlay.remove(); document.removeEventListener('keydown', onKey, true) }+ const onKey = (ev: KeyboardEvent) => { if (ev.key === 'Escape') { ev.stopPropagation(); close() } }+ overlay.addEventListener('click', (ev) => { if (ev.target === overlay) close() })+ document.addEventListener('keydown', onKey, true)+ document.body.appendChild(overlay)+ }+private savedTimer = 0private flashSaved() {let tag = document.querySelector<HTMLElement>('.ed-autosaved')@@ -1206,6 +1339,11 @@ export class Editor {}if (inField) return+ if (!mod && (ev.key === '?' || (ev.key === '/' && ev.shiftKey))) {+ ev.preventDefault()+ this.openHelp()+ return+ }if (!mod && ev.key.toLowerCase() === 'c') {ev.preventDefault()this.canvas.toggleCommentMode()@@ -1234,19 +1372,19 @@ export class Editor {return}if (mod && ev.key.toLowerCase() === 'c') {+ // Copy to BOTH the in-app clipboard (fast, same session) and the system+ // clipboard as a Bento payload (works across decks/tabs). Elements when+ // any are selected; otherwise the current slide.if (this.store.selection.length) {- this.clipboard = JSON.parse(JSON.stringify(this.store.selectedElements))- }- return- }- if (mod && ev.key.toLowerCase() === 'v') {- if (this.clipboard.length) {- const clones = this.clipboard.map((el) => cloneElement(el))- this.store.commit(() => this.store.slide.elements.push(...clones))- this.store.select(clones.map((c) => c.id))+ void navigator.clipboard?.writeText?.(serializeElements(this.store.selectedElements, this.store.doc)).catch(() => {})+ } else {+ void navigator.clipboard?.writeText?.(serializeSlides([this.store.slide], this.store.doc)).catch(() => {})+ this.toast(t('Slide copied — ⌘V in any deck to paste it'))}return}+ // ⌘V is handled by the document 'paste' listener (wirePaste) so it can+ // also receive images and cross-deck payloads.if (ev.key === 'Delete' || ev.key === 'Backspace') {if (this.store.selection.length) {ev.preventDefault()diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.tsindex 4e8a50b3..8da56a7f 100644--- a/slides/src/i18n/de.ts+++ b/slides/src/i18n/de.ts@@ -386,4 +386,33 @@ export const de: Catalog = {"Restore an earlier auto-saved version of this deck (kept locally in this browser).": "Eine frühere automatisch gespeicherte Version dieses Decks wiederherstellen (lokal in diesem Browser).","Motion path — drag points · double-click path to insert · double-click point to remove · scroll a point to change its speed": "Bewegungspfad — Punkte ziehen · Doppelklick auf den Pfad zum Einfügen · Doppelklick auf einen Punkt zum Entfernen · Punkt scrollen für die Geschwindigkeit","Done": "Fertig",+ "Add a text box — double-click it to edit; **bold**, *italic*, `code` and “- ” bullets format as you type": "Textfeld hinzufügen — Doppelklick zum Bearbeiten; **fett**, *kursiv*, `Code` und „- “-Aufzählungen formatieren beim Tippen",+ "Add an image — or just paste one (⌘V) straight onto the slide": "Bild hinzufügen — oder einfach eines direkt auf die Folie einfügen (⌘V)",+ "Add a table — edit cells inline; turn it into a live chart from the panel": "Tabelle hinzufügen — Zellen direkt bearbeiten; im Panel in ein Live-Diagramm verwandeln",+ "Add a chart — edit it visually or link it to a table so it updates live": "Diagramm hinzufügen — visuell bearbeiten oder mit einer Tabelle verknüpfen, damit es live aktualisiert",+ "Shortcuts & tips (?)": "Tastenkürzel & Tipps (?)",+ "Pasted 1 item": "1 Element eingefügt",+ "Pasted {n} items": "{n} Elemente eingefügt",+ "Pasted 1 slide": "1 Folie eingefügt",+ "Pasted {n} slides": "{n} Folien eingefügt",+ "Text pasted": "Text eingefügt",+ "Image pasted": "Bild eingefügt",+ "Shortcuts & tips": "Tastenkürzel & Tipps",+ "Editing": "Bearbeiten",+ "Undo · redo": "Rückgängig · Wiederholen",+ "Copy · paste — elements, or the whole slide when nothing is selected": "Kopieren · Einfügen — Elemente oder die ganze Folie, wenn nichts ausgewählt ist",+ "Duplicate selection": "Auswahl duplizieren",+ "Group · ungroup": "Gruppieren · Gruppierung aufheben",+ "Comment mode": "Kommentarmodus",+ "This help": "Diese Hilfe",+ "Toggle fullscreen while presenting": "Vollbild während der Präsentation umschalten",+ "Speaker view — notes on a second screen if you have one": "Referentenansicht — Notizen auf einem zweiten Bildschirm, falls vorhanden",+ "Previous · next slide": "Vorherige · nächste Folie",+ "End the show": "Präsentation beenden",+ "Good to know": "Gut zu wissen",+ "Paste an image or text straight onto the canvas with ⌘V.": "Ein Bild oder Text mit ⌘V direkt auf die Arbeitsfläche einfügen.",+ "Copy a slide (⌘C with nothing selected) and paste it into another Bento deck.": "Eine Folie kopieren (⌘C ohne Auswahl) und in eine andere Bento-Präsentation einfügen.",+ "Make a chart from a table and it stays linked — edit the table, the chart updates.": "Aus einer Tabelle ein Diagramm erstellen — es bleibt verknüpft: Tabelle bearbeiten, Diagramm aktualisiert sich.",+ "Your work auto-saves; restore earlier versions from About → Version history.": "Deine Arbeit wird automatisch gespeichert; frühere Versionen unter Über → Versionsverlauf wiederherstellen.",+ "Slide copied — ⌘V in any deck to paste it": "Folie kopiert — ⌘V in einer beliebigen Präsentation zum Einfügen",}diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.tsindex f307a837..e0a55baa 100644--- a/slides/src/i18n/es.ts+++ b/slides/src/i18n/es.ts@@ -386,4 +386,33 @@ export const es: Catalog = {"Restore an earlier auto-saved version of this deck (kept locally in this browser).": "Restaura una versión anterior autoguardada de esta presentación (guardada localmente en este navegador).","Motion path — drag points · double-click path to insert · double-click point to remove · scroll a point to change its speed": "Trayectoria — arrastra puntos · doble clic en la trayectoria para insertar · doble clic en un punto para quitar · desplaza un punto para su velocidad","Done": "Listo",+ "Add a text box — double-click it to edit; **bold**, *italic*, `code` and “- ” bullets format as you type": "Añadir un cuadro de texto — doble clic para editar; **negrita**, *cursiva*, `código` y viñetas “- ” se formatean al escribir",+ "Add an image — or just paste one (⌘V) straight onto the slide": "Añadir una imagen — o simplemente pega una directamente en la diapositiva (⌘V)",+ "Add a table — edit cells inline; turn it into a live chart from the panel": "Añadir una tabla — edita las celdas en línea; conviértela en un gráfico en vivo desde el panel",+ "Add a chart — edit it visually or link it to a table so it updates live": "Añadir un gráfico — edítalo visualmente o vincúlalo a una tabla para que se actualice en vivo",+ "Shortcuts & tips (?)": "Atajos y consejos (?)",+ "Pasted 1 item": "1 elemento pegado",+ "Pasted {n} items": "{n} elementos pegados",+ "Pasted 1 slide": "1 diapositiva pegada",+ "Pasted {n} slides": "{n} diapositivas pegadas",+ "Text pasted": "Texto pegado",+ "Image pasted": "Imagen pegada",+ "Shortcuts & tips": "Atajos y consejos",+ "Editing": "Edición",+ "Undo · redo": "Deshacer · rehacer",+ "Copy · paste — elements, or the whole slide when nothing is selected": "Copiar · pegar — elementos, o toda la diapositiva cuando no hay nada seleccionado",+ "Duplicate selection": "Duplicar selección",+ "Group · ungroup": "Agrupar · desagrupar",+ "Comment mode": "Modo comentario",+ "This help": "Esta ayuda",+ "Toggle fullscreen while presenting": "Alternar pantalla completa durante la presentación",+ "Speaker view — notes on a second screen if you have one": "Vista del ponente — notas en una segunda pantalla si tienes una",+ "Previous · next slide": "Diapositiva anterior · siguiente",+ "End the show": "Terminar la presentación",+ "Good to know": "Bueno saber",+ "Paste an image or text straight onto the canvas with ⌘V.": "Pega una imagen o texto directamente en el lienzo con ⌘V.",+ "Copy a slide (⌘C with nothing selected) and paste it into another Bento deck.": "Copia una diapositiva (⌘C sin nada seleccionado) y pégala en otra presentación de Bento.",+ "Make a chart from a table and it stays linked — edit the table, the chart updates.": "Crea un gráfico a partir de una tabla y queda vinculado — edita la tabla y el gráfico se actualiza.",+ "Your work auto-saves; restore earlier versions from About → Version history.": "Tu trabajo se guarda automáticamente; restaura versiones anteriores en Acerca de → Historial de versiones.",+ "Slide copied — ⌘V in any deck to paste it": "Diapositiva copiada — ⌘V en cualquier presentación para pegarla",}diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.tsindex 23407f9c..cce55a76 100644--- a/slides/src/i18n/fr.ts+++ b/slides/src/i18n/fr.ts@@ -386,4 +386,33 @@ export const fr: Catalog = {"Restore an earlier auto-saved version of this deck (kept locally in this browser).": "Restaurer une version antérieure enregistrée automatiquement de ce deck (conservée localement dans ce navigateur).","Motion path — drag points · double-click path to insert · double-click point to remove · scroll a point to change its speed": "Trajectoire — glissez les points · double-clic sur la trajectoire pour insérer · double-clic sur un point pour retirer · faites défiler un point pour sa vitesse","Done": "Terminé",+ "Add a text box — double-click it to edit; **bold**, *italic*, `code` and “- ” bullets format as you type": "Ajouter une zone de texte — double-clic pour modifier ; **gras**, *italique*, `code` et puces « - » se formatent en tapant",+ "Add an image — or just paste one (⌘V) straight onto the slide": "Ajouter une image — ou collez-en une directement sur la diapositive (⌘V)",+ "Add a table — edit cells inline; turn it into a live chart from the panel": "Ajouter un tableau — modifiez les cellules directement ; transformez-le en graphique en direct depuis le panneau",+ "Add a chart — edit it visually or link it to a table so it updates live": "Ajouter un graphique — modifiez-le visuellement ou liez-le à un tableau pour qu’il se mette à jour en direct",+ "Shortcuts & tips (?)": "Raccourcis et astuces (?)",+ "Pasted 1 item": "1 élément collé",+ "Pasted {n} items": "{n} éléments collés",+ "Pasted 1 slide": "1 diapositive collée",+ "Pasted {n} slides": "{n} diapositives collées",+ "Text pasted": "Texte collé",+ "Image pasted": "Image collée",+ "Shortcuts & tips": "Raccourcis et astuces",+ "Editing": "Édition",+ "Undo · redo": "Annuler · rétablir",+ "Copy · paste — elements, or the whole slide when nothing is selected": "Copier · coller — des éléments, ou toute la diapositive si rien n’est sélectionné",+ "Duplicate selection": "Dupliquer la sélection",+ "Group · ungroup": "Grouper · dissocier",+ "Comment mode": "Mode commentaire",+ "This help": "Cette aide",+ "Toggle fullscreen while presenting": "Basculer en plein écran pendant la présentation",+ "Speaker view — notes on a second screen if you have one": "Mode présentateur — notes sur un second écran si vous en avez un",+ "Previous · next slide": "Diapositive précédente · suivante",+ "End the show": "Terminer la présentation",+ "Good to know": "Bon à savoir",+ "Paste an image or text straight onto the canvas with ⌘V.": "Collez une image ou du texte directement sur le canevas avec ⌘V.",+ "Copy a slide (⌘C with nothing selected) and paste it into another Bento deck.": "Copiez une diapositive (⌘C sans rien sélectionner) et collez-la dans un autre deck Bento.",+ "Make a chart from a table and it stays linked — edit the table, the chart updates.": "Créez un graphique à partir d’un tableau : il reste lié — modifiez le tableau, le graphique se met à jour.",+ "Your work auto-saves; restore earlier versions from About → Version history.": "Votre travail est enregistré automatiquement ; restaurez d’anciennes versions dans À propos → Historique des versions.",+ "Slide copied — ⌘V in any deck to paste it": "Diapositive copiée — ⌘V dans n’importe quel deck pour la coller",}diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.tsindex 0adf198f..532c63c0 100644--- a/slides/src/i18n/it.ts+++ b/slides/src/i18n/it.ts@@ -386,4 +386,33 @@ export const it: Catalog = {"Restore an earlier auto-saved version of this deck (kept locally in this browser).": "Ripristina una versione precedente salvata automaticamente di questo deck (conservata localmente in questo browser).","Motion path — drag points · double-click path to insert · double-click point to remove · scroll a point to change its speed": "Traiettoria — trascina i punti · doppio clic sulla traiettoria per inserire · doppio clic su un punto per rimuovere · scorri un punto per la velocità","Done": "Fatto",+ "Add a text box — double-click it to edit; **bold**, *italic*, `code` and “- ” bullets format as you type": "Aggiungi una casella di testo — doppio clic per modificare; **grassetto**, *corsivo*, `codice` ed elenchi “- ” si formattano mentre digiti",+ "Add an image — or just paste one (⌘V) straight onto the slide": "Aggiungi un'immagine — o incollane una direttamente sulla diapositiva (⌘V)",+ "Add a table — edit cells inline; turn it into a live chart from the panel": "Aggiungi una tabella — modifica le celle inline; trasformala in un grafico dal vivo dal pannello",+ "Add a chart — edit it visually or link it to a table so it updates live": "Aggiungi un grafico — modificalo visivamente o collegalo a una tabella così si aggiorna dal vivo",+ "Shortcuts & tips (?)": "Scorciatoie e suggerimenti (?)",+ "Pasted 1 item": "1 elemento incollato",+ "Pasted {n} items": "{n} elementi incollati",+ "Pasted 1 slide": "1 diapositiva incollata",+ "Pasted {n} slides": "{n} diapositive incollate",+ "Text pasted": "Testo incollato",+ "Image pasted": "Immagine incollata",+ "Shortcuts & tips": "Scorciatoie e suggerimenti",+ "Editing": "Modifica",+ "Undo · redo": "Annulla · ripeti",+ "Copy · paste — elements, or the whole slide when nothing is selected": "Copia · incolla — elementi, o l'intera diapositiva quando non è selezionato nulla",+ "Duplicate selection": "Duplica selezione",+ "Group · ungroup": "Raggruppa · separa",+ "Comment mode": "Modalità commento",+ "This help": "Questa guida",+ "Toggle fullscreen while presenting": "Attiva/disattiva schermo intero durante la presentazione",+ "Speaker view — notes on a second screen if you have one": "Vista relatore — note su un secondo schermo se disponibile",+ "Previous · next slide": "Diapositiva precedente · successiva",+ "End the show": "Termina la presentazione",+ "Good to know": "Buono a sapersi",+ "Paste an image or text straight onto the canvas with ⌘V.": "Incolla un'immagine o del testo direttamente sulla tela con ⌘V.",+ "Copy a slide (⌘C with nothing selected) and paste it into another Bento deck.": "Copia una diapositiva (⌘C senza selezione) e incollala in un altro deck Bento.",+ "Make a chart from a table and it stays linked — edit the table, the chart updates.": "Crea un grafico da una tabella e resta collegato — modifichi la tabella, il grafico si aggiorna.",+ "Your work auto-saves; restore earlier versions from About → Version history.": "Il tuo lavoro si salva automaticamente; ripristina versioni precedenti da Informazioni → Cronologia versioni.",+ "Slide copied — ⌘V in any deck to paste it": "Diapositiva copiata — ⌘V in qualsiasi deck per incollarla",}diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.tsindex dfc61cb4..7759ea4a 100644--- a/slides/src/i18n/ja.ts+++ b/slides/src/i18n/ja.ts@@ -386,4 +386,33 @@ export const ja: Catalog = {"Restore an earlier auto-saved version of this deck (kept locally in this browser).": "このデッキの以前の自動保存バージョンを復元します(このブラウザーにローカル保存)。","Motion path — drag points · double-click path to insert · double-click point to remove · scroll a point to change its speed": "モーションパス — 点をドラッグ・パスをダブルクリックで挿入・点をダブルクリックで削除・点をスクロールで速度変更","Done": "完了",+ "Add a text box — double-click it to edit; **bold**, *italic*, `code` and “- ” bullets format as you type": "テキストボックスを追加 — ダブルクリックで編集。**太字**、*斜体*、`コード`、「- 」の箇条書きは入力時に整形されます",+ "Add an image — or just paste one (⌘V) straight onto the slide": "画像を追加 — または ⌘V でスライドに直接貼り付け",+ "Add a table — edit cells inline; turn it into a live chart from the panel": "表を追加 — セルを直接編集。パネルからライブグラフに変換できます",+ "Add a chart — edit it visually or link it to a table so it updates live": "グラフを追加 — 視覚的に編集、または表とリンクしてライブ更新",+ "Shortcuts & tips (?)": "ショートカットとヒント(?)",+ "Pasted 1 item": "1 個の項目を貼り付けました",+ "Pasted {n} items": "{n} 個の項目を貼り付けました",+ "Pasted 1 slide": "1 枚のスライドを貼り付けました",+ "Pasted {n} slides": "{n} 枚のスライドを貼り付けました",+ "Text pasted": "テキストを貼り付けました",+ "Image pasted": "画像を貼り付けました",+ "Shortcuts & tips": "ショートカットとヒント",+ "Editing": "編集",+ "Undo · redo": "元に戻す・やり直し",+ "Copy · paste — elements, or the whole slide when nothing is selected": "コピー・貼り付け — 要素、または何も選択していないときはスライド全体",+ "Duplicate selection": "選択を複製",+ "Group · ungroup": "グループ化・解除",+ "Comment mode": "コメントモード",+ "This help": "このヘルプ",+ "Toggle fullscreen while presenting": "プレゼン中に全画面を切り替え",+ "Speaker view — notes on a second screen if you have one": "発表者ビュー — 2 台目の画面があればそこにノートを表示",+ "Previous · next slide": "前・次のスライド",+ "End the show": "ショーを終了",+ "Good to know": "知っておくと便利",+ "Paste an image or text straight onto the canvas with ⌘V.": "⌘V で画像やテキストをキャンバスに直接貼り付けられます。",+ "Copy a slide (⌘C with nothing selected) and paste it into another Bento deck.": "スライドをコピー(何も選択せずに ⌘C)して、別の Bento デッキに貼り付けられます。",+ "Make a chart from a table and it stays linked — edit the table, the chart updates.": "表からグラフを作ると連携が保たれ、表を編集するとグラフも更新されます。",+ "Your work auto-saves; restore earlier versions from About → Version history.": "作業は自動保存されます。以前のバージョンは「情報」→「バージョン履歴」から復元できます。",+ "Slide copied — ⌘V in any deck to paste it": "スライドをコピーしました — 任意のデッキで ⌘V で貼り付け",}diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.tsindex 9a4cb2ae..364808c0 100644--- a/slides/src/i18n/zh-Hans.ts+++ b/slides/src/i18n/zh-Hans.ts@@ -386,4 +386,33 @@ export const zhHans: Catalog = {"Restore an earlier auto-saved version of this deck (kept locally in this browser).": "恢复此演示文稿较早的自动保存版本(本地保存在此浏览器中)。","Motion path — drag points · double-click path to insert · double-click point to remove · scroll a point to change its speed": "运动路径 — 拖动点 · 双击路径以插入 · 双击点以删除 · 滚动某点以改变其速度","Done": "完成",+ "Add a text box — double-click it to edit; **bold**, *italic*, `code` and “- ” bullets format as you type": "添加文本框 — 双击编辑;**粗体**、*斜体*、`代码` 和 “- ” 列表会在输入时自动排版",+ "Add an image — or just paste one (⌘V) straight onto the slide": "添加图片 — 或直接将图片粘贴到幻灯片上(⌘V)",+ "Add a table — edit cells inline; turn it into a live chart from the panel": "添加表格 — 就地编辑单元格;可从面板将其转换为实时图表",+ "Add a chart — edit it visually or link it to a table so it updates live": "添加图表 — 可视化编辑,或链接到表格以实时更新",+ "Shortcuts & tips (?)": "快捷键与提示(?)",+ "Pasted 1 item": "已粘贴 1 个项目",+ "Pasted {n} items": "已粘贴 {n} 个项目",+ "Pasted 1 slide": "已粘贴 1 张幻灯片",+ "Pasted {n} slides": "已粘贴 {n} 张幻灯片",+ "Text pasted": "已粘贴文本",+ "Image pasted": "已粘贴图片",+ "Shortcuts & tips": "快捷键与提示",+ "Editing": "编辑",+ "Undo · redo": "撤销 · 重做",+ "Copy · paste — elements, or the whole slide when nothing is selected": "复制 · 粘贴 — 元素,或在未选中任何内容时复制整张幻灯片",+ "Duplicate selection": "复制所选",+ "Group · ungroup": "成组 · 取消成组",+ "Comment mode": "评论模式",+ "This help": "此帮助",+ "Toggle fullscreen while presenting": "演示时切换全屏",+ "Speaker view — notes on a second screen if you have one": "演讲者视图 — 如有第二块屏幕则在其上显示备注",+ "Previous · next slide": "上一张 · 下一张幻灯片",+ "End the show": "结束演示",+ "Good to know": "小贴士",+ "Paste an image or text straight onto the canvas with ⌘V.": "用 ⌘V 直接把图片或文本粘贴到画布上。",+ "Copy a slide (⌘C with nothing selected) and paste it into another Bento deck.": "复制一张幻灯片(未选中任何内容时按 ⌘C),粘贴到另一个 Bento 演示中。",+ "Make a chart from a table and it stays linked — edit the table, the chart updates.": "从表格生成图表后会保持关联 — 编辑表格,图表随之更新。",+ "Your work auto-saves; restore earlier versions from About → Version history.": "你的工作会自动保存;可从“关于 → 版本历史”恢复较早的版本。",+ "Slide copied — ⌘V in any deck to paste it": "已复制幻灯片 — 在任意演示中按 ⌘V 粘贴",}diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.tsindex 2ce101ef..c4d64684 100644--- a/slides/src/i18n/zh-Hant.ts+++ b/slides/src/i18n/zh-Hant.ts@@ -386,4 +386,33 @@ export const zhHant: Catalog = {"Restore an earlier auto-saved version of this deck (kept locally in this browser).": "還原此簡報較早的自動儲存版本(本機儲存在此瀏覽器中)。","Motion path — drag points · double-click path to insert · double-click point to remove · scroll a point to change its speed": "運動路徑 — 拖曳點 · 雙擊路徑以插入 · 雙擊點以刪除 · 捲動某點以改變其速度","Done": "完成",+ "Add a text box — double-click it to edit; **bold**, *italic*, `code` and “- ” bullets format as you type": "新增文字方塊 — 雙擊編輯;**粗體**、*斜體*、`程式碼` 和 「- 」清單會在輸入時自動排版",+ "Add an image — or just paste one (⌘V) straight onto the slide": "新增圖片 — 或直接將圖片貼到投影片上(⌘V)",+ "Add a table — edit cells inline; turn it into a live chart from the panel": "新增表格 — 就地編輯儲存格;可從面板將其轉換為即時圖表",+ "Add a chart — edit it visually or link it to a table so it updates live": "新增圖表 — 視覺化編輯,或連結到表格以即時更新",+ "Shortcuts & tips (?)": "快速鍵與提示(?)",+ "Pasted 1 item": "已貼上 1 個項目",+ "Pasted {n} items": "已貼上 {n} 個項目",+ "Pasted 1 slide": "已貼上 1 張投影片",+ "Pasted {n} slides": "已貼上 {n} 張投影片",+ "Text pasted": "已貼上文字",+ "Image pasted": "已貼上圖片",+ "Shortcuts & tips": "快速鍵與提示",+ "Editing": "編輯",+ "Undo · redo": "復原 · 重做",+ "Copy · paste — elements, or the whole slide when nothing is selected": "複製 · 貼上 — 元素,或在未選取任何內容時複製整張投影片",+ "Duplicate selection": "複製所選",+ "Group · ungroup": "群組 · 取消群組",+ "Comment mode": "評論模式",+ "This help": "此說明",+ "Toggle fullscreen while presenting": "演示時切換全螢幕",+ "Speaker view — notes on a second screen if you have one": "演講者檢視 — 如有第二個螢幕則在其上顯示備註",+ "Previous · next slide": "上一張 · 下一張投影片",+ "End the show": "結束演示",+ "Good to know": "小提示",+ "Paste an image or text straight onto the canvas with ⌘V.": "用 ⌘V 直接把圖片或文字貼到畫布上。",+ "Copy a slide (⌘C with nothing selected) and paste it into another Bento deck.": "複製一張投影片(未選取任何內容時按 ⌘C),貼到另一個 Bento 簡報中。",+ "Make a chart from a table and it stays linked — edit the table, the chart updates.": "從表格產生圖表後會保持關聯 — 編輯表格,圖表隨之更新。",+ "Your work auto-saves; restore earlier versions from About → Version history.": "你的工作會自動儲存;可從「關於 → 版本歷程」還原較早的版本。",+ "Slide copied — ⌘V in any deck to paste it": "已複製投影片 — 在任意簡報中按 ⌘V 貼上",}diff --git a/slides/src/present.ts b/slides/src/present.tsindex 506a4eeb..5ad3a3cd 100644--- a/slides/src/present.ts+++ b/slides/src/present.ts@@ -218,44 +218,53 @@ export function startPresentation(if (clock) clock.textContent = new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}, 1000)updateSpeaker()- // Try TRUE dual-screen: notes window on a second display, slides fullscreen- // on the primary. The popup was opened synchronously above (keeps the click- // gesture, avoids a popup-block); we now query screens async and reposition.+ // Re-enter fullscreen SYNCHRONOUSLY here, still inside the S-key gesture, so+ // the request isn't rejected for lost user-activation (the #1 macOS failure).+ // Opening the popup drops us out of fullscreen; this puts the slides back on+ // the presenter's screen. Then async-move the notes to a second display.+ if (wasFullscreen) {+ overlay.requestFullscreen?.({ navigationUI: 'hide' }).catch((e: any) =>+ console.warn('[bento-speaker] sync re-fullscreen rejected:', e?.name, e?.message))+ }void placeSpeaker(wasFullscreen)}/**- * With the Window Management permission and ≥2 displays, move the speaker- * popup to a second screen and fullscreen the slides on the presenter's- * screen. Everything degrades gracefully: single screen / denied permission /- * unsupported API → the popup stays put and the slides re-enter fullscreen on- * the current screen (so the show never ends — Escape is the only exit).+ * Move the notes popup to a second display (Window Management permission).+ * Heavily instrumented: with no two-monitor rig to test on, the console log is+ * how we diagnose. Degrades gracefully — single screen / denied / unsupported+ * keeps the notes visible on the current display. Slides fullscreen is handled+ * synchronously in openSpeaker above (activation-safe).*/const placeSpeaker = async (wasFullscreen: boolean) => {- let targetScreen: unknown = null+ const log = (...a: unknown[]) => console.info('[bento-speaker]', ...a)try {+ let perm = 'unknown'+ try { perm = (await (navigator as any).permissions?.query?.({ name: 'window-management' }))?.state ?? 'no-api' } catch { perm = 'query-failed' }const getScreenDetails = (window as unknown as { getScreenDetails?: () => Promise<any> }).getScreenDetails- if (getScreenDetails && speaker) {- const details = await getScreenDetails.call(window)- const screens: any[] = details.screens ?? []- if (screens.length > 1) {- const other = screens.find((s) => s !== details.currentScreen)- ?? screens.find((s) => !s.isPrimary) ?? screens[1]- try { speaker.moveTo(other.availLeft, other.availTop); speaker.resizeTo(other.availWidth, other.availHeight) } catch { /* clamped without permission */ }- targetScreen = details.currentScreen // fullscreen the slides here- }+ log('permission:', perm, '· getScreenDetails:', !!getScreenDetails, '· wasFullscreen:', wasFullscreen)+ if (!getScreenDetails) {+ log('Window Management API unavailable — notes stay on this screen')+ return}- } catch { /* permission denied / unsupported — fall back below */ }-- if (wasFullscreen || targetScreen) {- window.focus()- try {- const opts: FullscreenOptions & { screen?: unknown } = { navigationUI: 'hide' }- if (targetScreen) opts.screen = targetScreen- await overlay.requestFullscreen?.(opts as FullscreenOptions)- } catch { enterFullscreen() }+ const details = await getScreenDetails.call(window)+ const screens: any[] = details.screens ?? []+ log('screens:', screens.length, screens.map((s: any) => ({ label: s.label, primary: s.isPrimary, current: s === details.currentScreen, x: s.availLeft, y: s.availTop, w: s.availWidth, h: s.availHeight })))+ if (screens.length > 1 && speaker) {+ const other = screens.find((s) => s !== details.currentScreen) ?? screens.find((s) => !s.isPrimary) ?? screens[1]+ try {+ speaker.moveTo(other.availLeft, other.availTop)+ speaker.resizeTo(Math.min(other.availWidth, 1400), Math.min(other.availHeight, 900))+ log('moved notes → screen:', other.label, 'at', other.availLeft, other.availTop)+ } catch (e: any) { console.warn('[bento-speaker] moveTo/resizeTo failed:', e?.message) }+ } else {+ log('single display — press F to fullscreen slides; drag the notes window where you want it')+ }+ } catch (e: any) {+ console.warn('[bento-speaker] getScreenDetails denied/failed:', e?.name, e?.message, '— grant "window management" for this site to place notes on a 2nd screen')+ } finally {+ window.setTimeout(() => { openingSpeaker = false }, 500)}- window.setTimeout(() => { openingSpeaker = false }, 400)}// Real fullscreen (F toggles; Present enters it by default). The overlaydiff --git a/slides/src/styles.css b/slides/src/styles.cssindex 3c640351..2e83e1b5 100644--- a/slides/src/styles.css+++ b/slides/src/styles.css@@ -582,6 +582,23 @@ html, body {}.ed-chart-json.ed-invalid { border-color: #c9302c; outline: 1px solid #c9302c; }+/* --- help overlay + help button ------------------------------------------- */+.ed-btn-help .ed-help-q { font-size: 15px; font-weight: 800; line-height: 1; }+.ed-help-box { max-width: 480px; }+.ed-help-sec { margin: 10px 0; }+.ed-help-sec h3 {+ font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;+ color: var(--muted, #8a94a4); margin: 0 0 6px;+}+.ed-help-row { display: grid; grid-template-columns: 128px 1fr; gap: 12px; align-items: baseline; padding: 3px 0; font-size: 13px; }+.ed-help-row kbd {+ font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace;+ background: var(--chrome-2, #f4f1ea); border: 1px solid var(--line, #e7e1d2);+ border-radius: 5px; padding: 2px 6px; color: var(--ink, #1e2a3a); white-space: nowrap; justify-self: start;+}+.ed-help-tips { margin: 4px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: var(--ink, #26303e); }+.ed-help-tips li { margin: 3px 0; }+/* --- auto-save: recovery banner, saved tag, version history --------------- */.ed-recover {position: fixed;