The CharacterLimit component is quite neat and usefull. I'm just wondering if it would be event more neat if we refactor it to be a wrapper component of the RichText with a possible functional children to accept any other component instead of the RichText.
It would simplify greatly the edit files with an usage like this:
<TextWithLimit // The name is just an idea, it could be RichTextWithLimit or anything else
allowedFormats={[]}
className="supt-component__title
limit={148}
onChange={(title) => setAttributes({ title })}
tagName="h2"
value={title}
/>
And when we need another control than RichText, we could do somthing like this
The
CharacterLimit
component is quite neat and usefull. I'm just wondering if it would be event more neat if we refactor it to be a wrapper component of theRichText
with a possible functional children to accept any other component instead of theRichText
.It would simplify greatly the edit files with an usage like this:
And when we need another control than
RichText
, we could do somthing like this