Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

slides: Save as → Import PowerPoint… opens the bento.page importer in a new tab (#574)

nyblnetf154899d3503
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 22a86537..b261392d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2008,6 +2008,10 @@ jobs:
# unknown-role copy arriving in a running editor (dropped, loadDoc) gets
# no write actions and is locked; owner and writer copies keep theirs.
run: node scripts/test-slides-audience-gate-browser.mjs
+ - name: Import PowerPoint link in Chromium
+ # Save as → Import PowerPoint… opens only the bento.page importer, in a
+ # new tab with no opener, and its tooltip says it needs the network.
+ run: node scripts/test-slides-import-link-browser.mjs
spaces-save-browser:
runs-on: ubuntu-latest
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e66eccbc..5a0b0736 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,9 @@ pre-1.0.
could be edited. Both are now locked, the same as when you open them
directly. The live session never accepted their changes; now the editor
agrees.
+- **Save as → Import PowerPoint…** The Save-as menu has an entry next to
+ Replace from JSON that opens that importer (bento.page/import) in a new tab.
+ It needs an internet connection, and the entry's tooltip says so.
## [1.2.5] — 2026-09-28
diff --git a/scripts/test-slides-import-link-browser.mjs b/scripts/test-slides-import-link-browser.mjs
new file mode 100644
index 00000000..978efdd5
--- /dev/null
+++ b/scripts/test-slides-import-link-browser.mjs
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// Save as → Import PowerPoint… opens the importer on bento.page, and says so.
+//
+// npm run build:single --prefix slides && node scripts/test-slides-import-link-browser.mjs
+//
+// WHAT THIS PROVES, in the packaged document:
+// 1. the Save-as menu has "Import PowerPoint…" as ONE line, directly after
+// "Replace from JSON…" (where spaces keeps Import Markdown…);
+// 2. its description is the hover tooltip, and names bento.page, a new tab
+// and the internet connection it needs;
+// 3. clicking it opens exactly the importer URL in a new tab, with no
+// opener (the page cannot reach back into this document), and leaves
+// this document where it was;
+// 4. the entry is translated in every catalog (checked in German).
+// The network is blocked throughout: the click is measured by the tab it
+// asks for, not by the page loading.
+const { chromium } = await import(process.env.PLAYWRIGHT_MODULE || 'playwright')
+
+let checks = 0
+let failures = 0
+function ok(cond, msg) {
+ checks++
+ if (!cond) { failures++; console.log(` FAIL ${msg}`) } else console.log(` ok ${msg}`)
+}
+const URL_EXPECTED = 'https://bento.page/import'
+
+const browser = await chromium.launch({ executablePath: process.env.CHROME_PATH, headless: true })
+try {
+ const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } })
+ // record what navigations ASK for, then refuse them: nothing leaves the rig
+ const asked = []
+ await ctx.route(/^https?:/, (r) => { if (r.request().isNavigationRequest()) asked.push(r.request().url()); return r.abort() })
+ const p = await ctx.newPage()
+ const errors = []
+ p.on('pageerror', (e) => errors.push(e.message))
+ const shell = new URL('../slides/dist-single/Bento_Slides.bento.html', import.meta.url).href
+ await p.goto(shell)
+ await p.waitForFunction(() => window.bento?.doc && document.querySelector('.ed-split-caret'))
+
+ console.log('the entry\n')
+ await p.evaluate(() => document.querySelector('.ed-split-caret').click())
+ const rows = await p.evaluate(() => [...document.querySelectorAll('.ed-save-menu > .ed-btn')].map((b) => ({
+ name: b.getAttribute('aria-label') ?? b.querySelector('span')?.firstChild?.textContent?.trim() ?? b.textContent.trim(),
+ title: b.title, h: Math.round(b.getBoundingClientRect().height),
+ })))
+ const i = rows.findIndex((r) => r.name.startsWith('Import PowerPoint'))
+ ok(i >= 0, `"Import PowerPoint…" is in the Save-as menu (${rows.map((r) => r.name).join(' · ')})`)
+ ok(i > 0 && rows[i - 1].name.startsWith('Replace from JSON'), 'it sits directly after Replace from JSON…, the other import')
+ ok(i >= 0 && rows[i].h <= 32, `one line (${rows[i]?.h}px)`)
+ const tip = rows[i]?.title ?? ''
+ ok(/bento\.page/.test(tip) && /new tab/.test(tip) && /internet/.test(tip), `its tooltip names bento.page, a new tab and the connection ("${tip}")`)
+
+ console.log('\nthe click\n')
+ const [popup] = await Promise.all([
+ ctx.waitForEvent('page', { timeout: 5000 }).catch(() => null),
+ p.evaluate(() => [...document.querySelectorAll('.ed-save-menu > .ed-btn')].find((b) => (b.getAttribute('aria-label') ?? b.textContent).includes('Import PowerPoint')).click()),
+ ])
+ ok(!!popup, 'it opens a new tab')
+ if (popup) {
+ await popup.waitForLoadState('domcontentloaded').catch(() => {})
+ ok(asked.length === 1 && asked[0] === URL_EXPECTED, `the tab asks for the importer, and only it (${asked.join(', ') || 'nothing'})`)
+ ok(await popup.evaluate(() => window.opener === null).catch(() => true), 'the new tab has no opener')
+ await popup.close()
+ }
+ ok(p.url() === shell, 'this document stays where it was')
+ ok(!(await p.evaluate(() => document.querySelector('.ed-save-menu')?.closest('.ed-dropdown')?.classList.contains('open'))), 'the menu closes')
+
+ console.log('\ntranslated\n')
+ await p.evaluate(() => [...document.querySelectorAll('.ed-lang-menu .ed-btn')].find((b) => b.textContent.trim() === 'Deutsch').click())
+ await p.evaluate(() => document.querySelector('.ed-split-caret').click())
+ const de = await p.evaluate(() => [...document.querySelectorAll('.ed-save-menu > .ed-btn')].map((b) => b.textContent.trim()))
+ ok(de.some((x) => x.startsWith('PowerPoint importieren')), 'German shows "PowerPoint importieren…"')
+ await p.evaluate(() => [...document.querySelectorAll('.ed-lang-menu .ed-btn')].find((b) => b.textContent.trim() === 'English').click())
+
+ ok(errors.length === 0, `no page errors${errors.length ? ': ' + errors.join('; ') : ''}`)
+} finally { await browser.close() }
+
+console.log(`\n${checks - failures}/${checks} checks passed`)
+process.exit(failures ? 1 : 0)
diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.ts
index 8280ea51..7469dbb7 100644
--- a/slides/src/editor/editor.ts
+++ b/slides/src/editor/editor.ts
@@ -86,6 +86,15 @@ const SHAPE_MENU: Array<{ kind: ShapeKind; label: string; icon: string; heads?:
{ kind: 'path', label: 'Polygon', icon: ICONS.polygon, draw: 'poly', tip: 'Click to place corners; click the first point (or double-click) to close the shape' },
]
+/**
+ * The PowerPoint importer on the site (bento/convert's page, #589). A LINK,
+ * not a feature of this file: the conversion needs the network, and a saved
+ * deck never loads anything on its own, so the entry opens the page in a new
+ * tab and says so in its tooltip. Slides' release carries the site, so the
+ * entry and the page ship together.
+ */
+export const IMPORT_PPTX_URL = 'https://bento.page/import'
+
/**
* May this copy write? An ALLOWLIST that fails closed: a deck with no live
* session, or one whose role is absent (owner and legacy writer copies) or
@@ -945,6 +954,10 @@ export class Editor {
item(ICONS.code, t('Replace from JSON…'),
t('Paste edited document JSON to replace this deck’s content — ⌘Z undoes.'),
() => this.openReplaceJson())
+ // with the other import, where spaces has Import Markdown…
+ item(ICONS.importDoc, t('Import PowerPoint…'),
+ t('Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.'),
+ () => { window.open(IMPORT_PPTX_URL, '_blank', 'noopener,noreferrer') })
item(ICONS.template, t('Start from scratch…'),
t('Replace every slide with one blank slide. Keeps the deck’s theme, name and live session — ⌘Z undoes.'),
() => this.startFromScratch())
diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.ts
index 92c01cda..7a86a54f 100644
--- a/slides/src/i18n/de.ts
+++ b/slides/src/i18n/de.ts
@@ -604,6 +604,8 @@ export const de: Catalog = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": "{name} entfernen — widerruft den Zugriff dieses Geräts; alle anderen bleiben unberührt",
"Replace from JSON": "Aus JSON ersetzen",
"Replace from JSON…": "Aus JSON ersetzen…",
+ "Import PowerPoint…": "PowerPoint importieren…",
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": "Öffnet den PowerPoint-Import auf bento.page in einem neuen Tab – er macht aus einer .pptx eine Bento-Präsentation. Benötigt eine Internetverbindung.",
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": "Zugriff zurücksetzen? Alle gesendeten Kopien synchronisieren nicht mehr; nur danach gespeicherte können beitreten.",
"Reset access…": "Zugriff zurücksetzen…",
"Save a copy…": "Kopie speichern…",
diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.ts
index 4700b450..cffc91f1 100644
--- a/slides/src/i18n/es.ts
+++ b/slides/src/i18n/es.ts
@@ -604,6 +604,8 @@ export const es: Catalog = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": "Quitar a {name} — revoca el acceso de este dispositivo; nadie más se ve afectado",
"Replace from JSON": "Reemplazar desde JSON",
"Replace from JSON…": "Reemplazar desde JSON…",
+ "Import PowerPoint…": "Importar PowerPoint…",
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": "Abre el importador de PowerPoint de bento.page en una pestaña nueva: convierte un .pptx en una presentación de Bento. Necesita conexión a internet.",
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": "¿Restablecer el acceso? Todas las copias enviadas dejarán de sincronizarse; solo podrán unirse las guardadas después.",
"Reset access…": "Restablecer acceso…",
"Save a copy…": "Guardar una copia…",
diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.ts
index 0ba60f36..6e9a91dc 100644
--- a/slides/src/i18n/fr.ts
+++ b/slides/src/i18n/fr.ts
@@ -604,6 +604,8 @@ export const fr: Catalog = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": "Retirer {name} — révoque l’accès de cet appareil ; personne d’autre n’est affecté",
"Replace from JSON": "Remplacer depuis JSON",
"Replace from JSON…": "Remplacer depuis JSON…",
+ "Import PowerPoint…": "Importer un PowerPoint…",
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": "Ouvre l’importateur PowerPoint de bento.page dans un nouvel onglet : il convertit un .pptx en présentation Bento. Nécessite une connexion Internet.",
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": "Réinitialiser l’accès ? Toutes les copies envoyées cesseront de se synchroniser ; seules celles enregistrées ensuite pourront rejoindre.",
"Reset access…": "Réinitialiser l’accès…",
"Save a copy…": "Enregistrer une copie…",
diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.ts
index 048234e2..02d9ed72 100644
--- a/slides/src/i18n/it.ts
+++ b/slides/src/i18n/it.ts
@@ -604,6 +604,8 @@ export const it: Catalog = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": "Rimuovi {name} — revoca l’accesso di questo dispositivo; nessun altro è toccato",
"Replace from JSON": "Sostituisci da JSON",
"Replace from JSON…": "Sostituisci da JSON…",
+ "Import PowerPoint…": "Importa PowerPoint…",
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": "Apre l’importatore PowerPoint di bento.page in una nuova scheda: trasforma un .pptx in una presentazione Bento. Richiede una connessione a Internet.",
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": "Reimpostare l’accesso? Tutte le copie inviate smetteranno di sincronizzarsi; solo quelle salvate dopo potranno unirsi.",
"Reset access…": "Reimposta accesso…",
"Save a copy…": "Salva una copia…",
diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.ts
index 090992df..e91f28ff 100644
--- a/slides/src/i18n/ja.ts
+++ b/slides/src/i18n/ja.ts
@@ -604,6 +604,8 @@ export const ja: Catalog = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": "{name} を削除 — このデバイスのアクセスを取り消します。他の人には影響しません",
"Replace from JSON": "JSON から置き換え",
"Replace from JSON…": "JSON から置き換え…",
+ "Import PowerPoint…": "PowerPoint を読み込む…",
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": "bento.page の PowerPoint 読み込みページを新しいタブで開きます。.pptx を Bento のデッキに変換します。インターネット接続が必要です。",
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": "アクセスをリセットしますか?送信済みのすべてのコピーが同期を停止し、以後保存したコピーだけが参加できます。",
"Reset access…": "アクセスをリセット…",
"Save a copy…": "コピーを保存…",
diff --git a/slides/src/i18n/packed.ts b/slides/src/i18n/packed.ts
index 6bee08d7..a16e1358 100644
--- a/slides/src/i18n/packed.ts
+++ b/slides/src/i18n/packed.ts
@@ -612,6 +612,8 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": ["{name} を削除 — このデバイスのアクセスを取り消します。他の人には影響しません","移除 {name} — 撤销该设备的访问权限;其他人不受影响","移除 {name} — 撤銷該裝置的存取權限;其他人不受影響","Quitar a {name} — revoca el acceso de este dispositivo; nadie más se ve afectado","Retirer {name} — révoque l’accès de cet appareil ; personne d’autre n’est affecté","{name} entfernen — widerruft den Zugriff dieses Geräts; alle anderen bleiben unberührt","Rimuovi {name} — revoca l’accesso di questo dispositivo; nessun altro è toccato","Remover {name} — revoga o acesso deste dispositivo; ninguém mais é afetado"],
"Replace from JSON": ["JSON から置き換え","从 JSON 替换","從 JSON 取代","Reemplazar desde JSON","Remplacer depuis JSON","Aus JSON ersetzen","Sostituisci da JSON","Substituir a partir de JSON"],
"Replace from JSON…": ["JSON から置き換え…","从 JSON 替换…","從 JSON 取代…","Reemplazar desde JSON…","Remplacer depuis JSON…","Aus JSON ersetzen…","Sostituisci da JSON…","Substituir a partir de JSON…"],
+ "Import PowerPoint…": ["PowerPoint を読み込む…","导入 PowerPoint…","匯入 PowerPoint…","Importar PowerPoint…","Importer un PowerPoint…","PowerPoint importieren…","Importa PowerPoint…","Importar PowerPoint…"],
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": ["bento.page の PowerPoint 読み込みページを新しいタブで開きます。.pptx を Bento のデッキに変換します。インターネット接続が必要です。","在新标签页打开 bento.page 上的 PowerPoint 导入工具,将 .pptx 转换为 Bento 演示文稿。需要联网。","在新分頁開啟 bento.page 上的 PowerPoint 匯入工具,將 .pptx 轉換為 Bento 簡報。需要網路連線。","Abre el importador de PowerPoint de bento.page en una pestaña nueva: convierte un .pptx en una presentación de Bento. Necesita conexión a internet.","Ouvre l’importateur PowerPoint de bento.page dans un nouvel onglet : il convertit un .pptx en présentation Bento. Nécessite une connexion Internet.","Öffnet den PowerPoint-Import auf bento.page in einem neuen Tab – er macht aus einer .pptx eine Bento-Präsentation. Benötigt eine Internetverbindung.","Apre l’importatore PowerPoint di bento.page in una nuova scheda: trasforma un .pptx in una presentazione Bento. Richiede una connessione a Internet.","Abre o importador de PowerPoint do bento.page em uma nova aba: converte um .pptx em uma apresentação Bento. Requer conexão com a internet."],
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": ["アクセスをリセットしますか?送信済みのすべてのコピーが同期を停止し、以後保存したコピーだけが参加できます。","重置访问权限?已发送的所有副本将停止同步;只有此后保存的副本才能加入。","重設存取權限?已傳送的所有副本將停止同步;只有此後儲存的副本才能加入。","¿Restablecer el acceso? Todas las copias enviadas dejarán de sincronizarse; solo podrán unirse las guardadas después.","Réinitialiser l’accès ? Toutes les copies envoyées cesseront de se synchroniser ; seules celles enregistrées ensuite pourront rejoindre.","Zugriff zurücksetzen? Alle gesendeten Kopien synchronisieren nicht mehr; nur danach gespeicherte können beitreten.","Reimpostare l’accesso? Tutte le copie inviate smetteranno di sincronizzarsi; solo quelle salvate dopo potranno unirsi.","Redefinir o acesso? Toda cópia que você enviou para de sincronizar; apenas cópias salvas depois disso podem entrar."],
"Reset access…": ["アクセスをリセット…","重置访问权限…","重設存取權限…","Restablecer acceso…","Réinitialiser l’accès…","Zugriff zurücksetzen…","Reimposta accesso…","Redefinir acesso…"],
"Save a copy…": ["コピーを保存…","保存副本…","儲存副本…","Guardar una copia…","Enregistrer une copie…","Kopie speichern…","Salva una copia…","Salvar uma cópia…"],
diff --git a/slides/src/i18n/pt.ts b/slides/src/i18n/pt.ts
index baa3bfc7..13b8fb4b 100644
--- a/slides/src/i18n/pt.ts
+++ b/slides/src/i18n/pt.ts
@@ -593,6 +593,8 @@ export const pt: Catalog = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": "Remover {name} — revoga o acesso deste dispositivo; ninguém mais é afetado",
"Replace from JSON": "Substituir a partir de JSON",
"Replace from JSON…": "Substituir a partir de JSON…",
+ "Import PowerPoint…": "Importar PowerPoint…",
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": "Abre o importador de PowerPoint do bento.page em uma nova aba: converte um .pptx em uma apresentação Bento. Requer conexão com a internet.",
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": "Redefinir o acesso? Toda cópia que você enviou para de sincronizar; apenas cópias salvas depois disso podem entrar.",
"Reset access…": "Redefinir acesso…",
"Save a copy…": "Salvar uma cópia…",
diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.ts
index 6514fc79..4261e544 100644
--- a/slides/src/i18n/zh-Hans.ts
+++ b/slides/src/i18n/zh-Hans.ts
@@ -604,6 +604,8 @@ export const zhHans: Catalog = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": "移除 {name} — 撤销该设备的访问权限;其他人不受影响",
"Replace from JSON": "从 JSON 替换",
"Replace from JSON…": "从 JSON 替换…",
+ "Import PowerPoint…": "导入 PowerPoint…",
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": "在新标签页打开 bento.page 上的 PowerPoint 导入工具,将 .pptx 转换为 Bento 演示文稿。需要联网。",
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": "重置访问权限?已发送的所有副本将停止同步;只有此后保存的副本才能加入。",
"Reset access…": "重置访问权限…",
"Save a copy…": "保存副本…",
diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.ts
index b1797857..f89f114e 100644
--- a/slides/src/i18n/zh-Hant.ts
+++ b/slides/src/i18n/zh-Hant.ts
@@ -604,6 +604,8 @@ export const zhHant: Catalog = {
"Remove {name} — revokes this device’s access; everyone else is unaffected": "移除 {name} — 撤銷該裝置的存取權限;其他人不受影響",
"Replace from JSON": "從 JSON 取代",
"Replace from JSON…": "從 JSON 取代…",
+ "Import PowerPoint…": "匯入 PowerPoint…",
+ "Opens the PowerPoint importer on bento.page in a new tab — it turns a .pptx into a Bento deck. Needs an internet connection.": "在新分頁開啟 bento.page 上的 PowerPoint 匯入工具,將 .pptx 轉換為 Bento 簡報。需要網路連線。",
"Reset access? Every copy you’ve sent stops syncing; only copies saved after this can join.": "重設存取權限?已傳送的所有副本將停止同步;只有此後儲存的副本才能加入。",
"Reset access…": "重設存取權限…",
"Save a copy…": "儲存副本…",
diff --git a/slides/src/icons.ts b/slides/src/icons.ts
index 1cfdddef..db02b428 100644
--- a/slides/src/icons.ts
+++ b/slides/src/icons.ts
@@ -45,6 +45,7 @@ export const ICONS = {
globe: svg('<circle cx="12" cy="12" r="9"/><path d="M3 12 h18"/><ellipse cx="12" cy="12" rx="4.2" ry="9"/>'),
code: svg('<polyline points="8 6 4 12 8 18"/><polyline points="16 6 20 12 16 18"/>'),
history: svg('<circle cx="12" cy="12" r="8.5"/><polyline points="12 7 12 12 15.5 14"/>'),
+ importDoc: svg('<path d="M5 9V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-4"/><path d="M14 3v5h5"/><path d="M2 12h9"/><path d="m8 9 3 3-3 3"/>'),
share: svg('<circle cx="9" cy="8" r="3.2"/><path d="M3.5 20c.6-3.2 2.8-5 5.5-5s4.9 1.8 5.5 5"/><circle cx="17.5" cy="10.5" r="2.4"/><path d="M15.8 15.6c1.9.3 3.6 1.6 4.4 3.9"/>'),
table: svg('<rect x="3" y="4" width="18" height="16" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="14.5" x2="21" y2="14.5"/><line x1="9" y1="4" x2="9" y2="20"/><line x1="15" y1="4" x2="15" y2="20"/>'),
// shape menu entries