From 6bd23a6778a07846aebd54fe6f74863529f84822 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Sun, 1 Mar 2026 14:55:36 -0800 Subject: [PATCH] fix(rspace): serve canvas through renderShell like all other rapps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rspace module was serving raw canvas.html as a standalone page (bypassing renderShell) because canvas-module.html didn't exist. This meant navigating to rspace caused a full page replacement with no shared shell, tabs, or TabCache support — appearing to open in a "new window." Now extracts body content, styles, and scripts from canvas.html at startup (stripping the duplicate shell chrome) and renders through renderShell like every other module. This makes rspace fully interoperable with the tab system and TabCache. Co-Authored-By: Claude Opus 4.6 --- modules/rspace/mod.ts | 92 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 74 insertions(+), 18 deletions(-) diff --git a/modules/rspace/mod.ts b/modules/rspace/mod.ts index 6020b1e..47d4b4f 100644 --- a/modules/rspace/mod.ts +++ b/modules/rspace/mod.ts @@ -16,34 +16,90 @@ const DIST_DIR = resolve(import.meta.dir, "../../dist"); const routes = new Hono(); +/** + * Extract body content and scripts from the full canvas.html page. + * Strips the shell chrome (header, tab-bar, welcome overlay) that renderShell provides, + * and returns just the canvas-specific DOM + inline styles + module scripts. + */ +function extractCanvasContent(html: string): { body: string; styles: string; scripts: string } { + // Extract inline