plate icon indicating copy to clipboard operation
plate copied to clipboard

feat: add useToggleCodeBlockButton hook to code-block package

Open vodkaslime opened this issue 1 year ago • 6 comments

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.

vodkaslime avatar Feb 21 '24 14:02 vodkaslime

🦋 Changeset detected

Latest commit: f6a54ff4f0d53339d8a413345c67c6b85c156796

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

changeset-bot[bot] avatar Feb 21 '24 14:02 changeset-bot[bot]

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

vercel[bot] avatar Feb 21 '24 14:02 vercel[bot]

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

vodkaslime avatar Feb 21 '24 14:02 vodkaslime

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?

vodkaslime avatar Feb 21 '24 14:02 vodkaslime

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

zbeyens avatar Feb 21 '24 14:02 zbeyens

@

@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

vodkaslime avatar Feb 21 '24 14:02 vodkaslime