-
Notifications
You must be signed in to change notification settings - Fork 377
[Website] Blueprint Editor: Update the URL when typing #2959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tested I added some code in a file, (in the But the new Playground doesn't preserve the same data I attach here a demo. pg2959.mp4 |
|
@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. |
|
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. |
e87afbb to
226c73f
Compare
d1a04ff to
5722703
Compare
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.
5722703 to
3987f20
Compare
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.
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)
cc @SirLouen