-
Notifications
You must be signed in to change notification settings - Fork 784
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
feat: add useToggleCodeBlockButton hook to code-block package #2989
Conversation
🦋 Changeset detectedLatest commit: f6a54ff The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Btw since we have another whole repo for playground template: https://github.com/udecode/plate-playground-template, how do we keep |
@vodkaslime Thanks for the PR! We need to wait for a release before updating the templates. Could you undo these changes for this PR? We have an auto-sync from this repo. |
@
Sure removing all template changes and post only hook changes, right? Will do now |
Description
Adding hook
useToggleCodeBlockButton
, similar to https://github.com/udecode/plate/blob/main/packages/indent/src/hooks/useIndentButton.tsAnd adding toggle code block button to playground.
Why
From playing around with playground, I found that we could only make a code block with ```, and delete it by deleting all its contents. We don't have a button toggle to really control code block on/off in toolbar, making code block a "secret recipe" feature.
Users definitely would want a intuitive button to wrap and unwrap a code block with given content. Therefore I made this PR, adding this hook + button. I believe this not only improves our playground, but also helps other plate users, since they don't need to implement this handy hook in their own code space now.