Move live query and template rendering outside of iframe

This commit is contained in:
Zef Hemel
2023-12-27 13:38:38 +01:00
parent a205178ff0
commit 48e147d0b2
7 changed files with 381 additions and 77 deletions
+6
View File
@@ -4,10 +4,12 @@ import { CodeWidgetCallback } from "$sb/types.ts";
export type CodeWidgetT = {
codeWidget?: string;
renderMode?: "markdown" | "iframe";
};
export class CodeWidgetHook implements Hook<CodeWidgetT> {
codeWidgetCallbacks = new Map<string, CodeWidgetCallback>();
codeWidgetModes = new Map<string, "markdown" | "iframe">();
constructor() {
}
@@ -23,6 +25,10 @@ export class CodeWidgetHook implements Hook<CodeWidgetT> {
if (!functionDef.codeWidget) {
continue;
}
this.codeWidgetModes.set(
functionDef.codeWidget,
functionDef.renderMode || "iframe",
);
this.codeWidgetCallbacks.set(
functionDef.codeWidget,
(bodyText, pageName) => {