-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[lexical-playground][file] Feature: Playground link sharing #6028
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@zurfyx any thoughts on this before I finish up the UI and tests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant, thank you for putting this together!
this is pretty cool - I'm not sure how useful it will be for real-life debugging, but I might be wrong and there's certainly no harm. Curious if you had particular use cases/debugging friction points in mind. Another area of exploration might be the test generator - I think it's defunct and never worked super-well, but the idea was to be able to start "recording mode" and it would generate an e2e test for you as you interacted with the playground editor. |
@acywatson I picked it off the roadmap 🤷♂️ Thinking about debugging use cases I think it is actually pretty useful because you can make a link to the playground from an issue with the state required to repro an issue (so long as history isn't involved in the bug). You can also use it to demonstrate a playground state that shows off a new node or feature. It's also in just about every other playground site. |
Makes sense!
I suspect most issues actually involve a sequence of interactions against a particular initial state, but at least it gets us that initial state. Once again, no objections to this at all, more just thinking about what could be a next step to making it even easier to create shareable repros and further reduce triage/maintenance overhead. |
Description
Adds a share button to the playground's ActionToolbar which will create a #doc= URL that includes a compressed and serialized document. The plugin also has an effect that will set the editor state from this document and clear history on initial load. It changes the URL when the share button is clicked as well, I just copied the typescript playground UX for this, I think it's done as a fallback for if the clipboard.writeText fails.
I added the following new exports to @lexical/file to support this feature:
Here's an example link with #doc= in the preview
Test plan
#doc=...
hash, the URL to be on the clipboard, and the "URL copied to clipboard" flash message to showThere's some unit tests that ensure round-trip of the doc<->hash and an e2e test that runs the above test plan