Skip to content

Conversation

@adamziel
Copy link
Collaborator

Motivation for the change, related issues

When you edit a Blueprint on a temporary Playground, the URL now stays in sync with your changes. This means you can copy the URL at any point and share it with someone else—they'll see the exact Blueprint you're working on.

The Blueprint is base64-encoded into the URL hash, which keeps it shareable without requiring any server-side storage. The URL only updates when the Blueprint is valid JSON, so you won't accidentally share a broken link mid-edit.

Testing Instructions (or ideally a Blueprint)

  1. Edit a Blueprint on a temporary site
  2. Refresh the page
  3. Confirm your change is visible in the editor

cc @SirLouen

@SirLouen
Copy link
Member

SirLouen commented Nov 28, 2025

Tested

I added some code in a file, (in the theme.json of TT5
Then copy pasted the resulting URL

But the new Playground doesn't preserve the same data

I attach here a demo.

pg2959.mp4

@adamziel
Copy link
Collaborator Author

adamziel commented Nov 28, 2025

@SirLouen This change is for the Blueprints editor, not for the code editor. Was your original intention to preserve the changes made in the code editor?

@SirLouen
Copy link
Member

@SirLouen This change is for the Blueprints editor, not for the code editor. Was your original intention to preserve the changes made in the code editor?

Yes, maybe I explained it wrongly.

@SirLouen
Copy link
Member

SirLouen commented Nov 28, 2025

Now I've tested in the Blueprints editor and its working correctly 👍

But my idea was to preserve the code in the code editor as here is where code-based tests are going to mostly happen.

Anyway editing and saving the URL of a fixed blueprint and future edits is a major step because we won't need to save gists for this purpose.

@adamziel adamziel force-pushed the update-url-hash-when-blueprint-is-edited branch 2 times, most recently from e87afbb to 226c73f Compare December 15, 2025 16:36
@adamziel adamziel force-pushed the update-url-hash-when-blueprint-is-edited branch 2 times, most recently from d1a04ff to 5722703 Compare December 16, 2025 12:06
When editing a temporary Playground's blueprint.json, the URL hash is now
kept in sync with the editor content. This enables users to share their
work-in-progress by simply copying the current URL, without needing to
explicitly click the 'copy link' button.

The feature only works for single-file blueprints. When the bundle contains
additional files (like images or other resources), the URL hash is cleared
and a notice informs the user that bundles can only be shared by downloading
as a zip file.

The update is debounced (500ms) and only triggers when the JSON is valid.
Move the URL hash computation and shareability detection from
BlueprintBundleEditor into a reusable hook. The hook tracks whether
the bundle can be shared via URL (only contains blueprint.json) and
computes the base64-encoded hash when content changes.

The component now uses the hook's output directly, and the share
button is disabled when the bundle isn't shareable.
The character-by-character typing approach was fragile because it triggered
CodeMirror's auto-bracket insertion, requiring manual cleanup of extra brackets.
Using Playwright's fill() method on the contenteditable element is more reliable
because it fills the content directly without triggering auto-completion.

Also added a verification step to confirm the blueprint content was inserted
before clicking the Run Blueprint button.
@adamziel adamziel force-pushed the update-url-hash-when-blueprint-is-edited branch from 5722703 to 3987f20 Compare December 16, 2025 12:26
The test regex expected the URL to be just host/#base64 but the actual
URL includes a path segment (/website-server/), causing the regex to fail.
Updated the regex to allow any characters before the hash.
The button was only using a title attribute, but Playwright's getByRole
with name option matches against the accessible name (aria-label), not
title. Added aria-label to make the button properly accessible and
testable.
@adamziel adamziel merged commit aeb44cb into trunk Dec 16, 2025
33 checks passed
@adamziel adamziel deleted the update-url-hash-when-blueprint-is-edited branch December 16, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants