Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Fix: restore the rendered form when an edit changes nothing
nyblnet59e5cbe84a15
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c86d89cd..f9b28581 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -13,6 +13,11 @@ pre-1.0.## [1.0.11] — 2026-07-27+- **Fix: a formula you opened but didn't change now redraws when you finish.**+ Editing a formula (or a `{{page}}`-style field) shows its raw source; leaving+ without typing anything used to leave that source on the slide until+ something else happened to repaint.+- **LaTeX maths in any text box, rendered as MathML.** Type `$E=mc^2$` and itrenders as a formula — `$$…$$` for a display equation on its own line. Thedocument stores exactly what you typed, so a deck with maths still opens indiff --git a/slides/src/editor/canvas.ts b/slides/src/editor/canvas.tsindex aa767c52..902b2b08 100644--- a/slides/src/editor/canvas.ts+++ b/slides/src/editor/canvas.ts@@ -34,6 +34,9 @@ export class SlideCanvas {private zoom = 1private zoomLabel: HTMLElement | null = nullprivate editing: HTMLElement | null = null+ /** startTextEdit swapped the rendered form for raw source (a field or a+ * formula), so commit must re-render even if the text is unchanged. */+ private editingShowedRaw = false/** when editing a table cell, which cell (else null → text element edit) */private editingCell: { r: number; c: number } | null = null/** a repaint arrived (e.g. a remote collab op) while an inline edit was in@@ -917,8 +920,12 @@ export class SlideCanvas {// fields ({{page}} etc.) and math ($…$) render RESOLVED; while editing,// show the raw source so the author edits the token, not the computed valueconst model = this.store.element(node.dataset.elId ?? '')+ // Remember that we swapped: on commit the resolved view has to be put back+ // even when the text did NOT change, and only a re-render can do that.+ this.editingShowedRaw = falseif (model?.type === 'text' && typeof model.html === 'string' && /\{\{|\$/.test(model.html)) {inner.innerHTML = model.html+ this.editingShowedRaw = true}this.editing = nodenode.classList.add('bento-editing')@@ -989,6 +996,15 @@ export class SlideCanvas {el.html = htmlif (grownH > el.h) el.h = Math.ceil(grownH)})+ } else if (this.editingShowedRaw) {+ // Nothing changed, so there is no commit to re-render off the back of —+ // but startTextEdit replaced the rendered formula (or {{page}} field)+ // with its raw source, and that raw source is still on screen. Editing a+ // formula and changing nothing left `$$x = \\frac{…}$$` sitting on the+ // slide until some unrelated event happened to repaint. Put the resolved+ // view back.+ this.editingShowedRaw = false+ this.render()} else {this.syncTargets()}