WordPress / block-development-examples

Practical examples for building WordPress blocks and extending the Editor.
https://wordpress.github.io/block-development-examples/
GNU General Public License v2.0
205 stars 31 forks source link

Create an example of an HOC enhancing a Core Component #109

Closed juanmaguitar closed 5 months ago

juanmaguitar commented 5 months ago

I'd like to create an example to take a core RichText component and enhance it through a Higher Order Component. Some function like withCharLimit that takes a core RichText and return and enhanced version of it that limits the maximum number of characters allowed ( withCharLimit(RichText) )

juanmaguitar commented 5 months ago

This has been done on enhanced-editable-block-1b8c51

See withCharLimit.js in the enhanced-editable-block-1b8c51 block. Props to @ndiego for the original code this implementation is based on.

juanmaguitar commented 5 months ago

This example was added on https://github.com/WordPress/block-development-examples/commit/3714aa1ce6aeebae31ca9daef2f88091ff4a6e63