Skip to content
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

Merged
merged 4 commits into from
Feb 23, 2024
Merged

feat: add useToggleCodeBlockButton hook to code-block package #2989

merged 4 commits into from
Feb 23, 2024

Conversation

vodkaslime
Copy link
Contributor

Description
Adding hook useToggleCodeBlockButton, similar to https://github.com/udecode/plate/blob/main/packages/indent/src/hooks/useIndentButton.ts

And 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.

Copy link

changeset-bot bot commented Feb 21, 2024

🦋 Changeset detected

Latest commit: f6a54ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@udecode/plate-code-block Minor
@udecode/plate-basic-elements Minor
@udecode/plate Minor
@udecode/plate-serializer-md Minor

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

Copy link

vercel bot commented Feb 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 21, 2024 3:18pm

@vodkaslime
Copy link
Contributor Author

@12joan @zbeyens Please take a look when you have time, thanks!

@vodkaslime
Copy link
Contributor Author

Btw since we have another whole repo for playground template: https://github.com/udecode/plate-playground-template, how do we keep /templates/plate-playground-template of this repo in sync with that one?

@zbeyens
Copy link
Member

zbeyens commented Feb 21, 2024

@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.

@vodkaslime
Copy link
Contributor Author

@

@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

@zbeyens zbeyens merged commit 100f5cd into udecode:main Feb 23, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants