Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Update: keep the file handle after an in-place update picker

nyblnet1074dacdf13f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d428a24..9ed8250b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,14 @@ pre-1.0.
## [Unreleased]
+- **In-place update keeps its handle.** When a deck opened *without* a File
+ System Access handle (e.g. double-clicked from disk) is updated via "Update
+ this file…", Bento now keeps the handle the save-picker grants — so this and
+ every later update rewrite the file in place silently, instead of re-prompting
+ each time. (A double-clicked file gives the browser no handle on open, so the
+ first update still needs you to overwrite the file you have open in the save
+ dialog; after that it's automatic.)
+
- **True bezier curve editing.** Selecting a curve now shows real pen-tool
control handles (in/out tangents) on each anchor — drag a handle to bend the
curve exactly. Smooth anchors mirror the opposite handle; Alt breaks a corner.
diff --git a/slides/src/update.ts b/slides/src/update.ts
index e29cc5be..162cf1b0 100644
--- a/slides/src/update.ts
+++ b/slides/src/update.ts
@@ -181,10 +181,17 @@ export async function applyUpdate(release: ReleaseInfo, doc: BentoDoc): Promise<
export const canUpdateInPlace = hasFileHandle
/**
- * Update the file on disk. With a held handle: download a backup of the
- * current version first, then overwrite in place — a reload then boots the
- * new app with this document. Without one: a save picker lets the user point
- * at the file they have open (or anywhere). Returns false if cancelled.
+ * Update the file on disk, then a reload boots the new app with this document.
+ *
+ * With a held handle: download a backup of the current version first, then
+ * overwrite the file in place silently.
+ *
+ * Without a handle (e.g. the file was double-clicked open — the browser grants
+ * no handle on open): use a save picker AND KEEP the resulting handle, so this
+ * update and every later one can rewrite the file in place. The picker can't
+ * default to the open file's location without a handle, so the caller must tell
+ * the user to overwrite the file they have open; once they do, it is a one-time
+ * grant. Returns false if the picker was cancelled.
*/
export async function applyUpdateInPlace(release: ReleaseInfo, doc: BentoDoc): Promise<boolean> {
const html = await buildUpdatedFile(release, doc)
@@ -194,5 +201,5 @@ export async function applyUpdateInPlace(release: ReleaseInfo, doc: BentoDoc): P
await writeUpdatedFile(html)
return true
}
- return writeUpdatedFileAs(html, doc)
+ return writeUpdatedFileAs(html, doc, { keepHandle: true })
}