diff --git a/modules/rgov/mod.ts b/modules/rgov/mod.ts index 8320c08..47bdd51 100644 --- a/modules/rgov/mod.ts +++ b/modules/rgov/mod.ts @@ -8,6 +8,7 @@ */ import { Hono } from "hono"; +import { resolve } from "path"; import { renderShell } from "../../server/shell"; import { getModuleInfoList } from "../../shared/module"; import type { RSpaceModule } from "../../shared/module"; @@ -16,10 +17,53 @@ import { addShapes, getDocumentData } from "../../server/community-store"; const routes = new Hono(); -// ── Module page (within a space) ── +// ── Canvas content loader (same approach as rspace module) ── -routes.get("/", (c) => { +const DIST_DIR = resolve(import.meta.dir, "../../dist"); +let canvasCache: { body: string; styles: string; scripts: string } | null = null; + +function extractCanvasContent(html: string) { + const bodyMatch = html.match(/
]*>([\s\S]*?)<\/body>/i); + const styleMatches = [...html.matchAll(/