Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

slides: custom fonts load after Replace from JSON (#516)

Rahul Ravikumar1e4447aac870
diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.ts
index 86c32856..9e44787a 100644
--- a/slides/src/editor/editor.ts
+++ b/slides/src/editor/editor.ts
@@ -135,6 +135,7 @@ export class Editor {
store.on('doc', () => this.syncLinkedCharts())
store.on('doc', () => this.syncConnectors())
store.on('doc', () => this.syncThemeRefs())
+ store.on('doc', () => this.syncFonts())
document.addEventListener('bento:apply-layout', ((ev: CustomEvent) => {
this.openLayoutPicker(ev.detail.anchor as HTMLElement, { kind: 'apply' })
}) as EventListener)
@@ -2468,6 +2469,13 @@ export class Editor {
}
}
+ /**
+ * Re-inject custom font bundles when applicable.
+ */
+ private syncFonts() {
+ if (this.store.doc.fonts?.length) injectFonts(this.store.doc)
+ }
+
// --- live table→chart binding -------------------------------------------------
private tableSig = ''