Pass EditorState to getAttrs callback of rule builders #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/rule-builders-callback-editor-state"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
I would like to have an input rule for headings that automatically uses the attributes of the first heading in the document (for example font-size and color). I figured the easiest solution would be to search for the first heading node in the
getAttrscallback and return the attributes of that node. This PR will add a second state parameter to thegetAttrscallback.Would it not be reasonable to write this rule using the
InputRuleconstructor, rather thanwrappingInputRule? The use case seems a bit too specific to extend the API for.Yes, that's definitely possible. Probably the right call than to not extend the API. Thanks for the feedback!
Pull request closed