How to pass function as param in Plate Plugin and to call within plugin? #3941
-
I had a slate plugin where I passed in functions from my slate editor component like so
Because (redux) dispatch and the userID comes from hooks, I couldn't add those functions directly in the slate plugin and had to pass them as function params. But, Is there anyway to do this in plate? To pass in variables that come from the top level react component, ie hooks, results from hooks such as userID, in a plate plugin? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You can either use plugin options or |
Beta Was this translation helpful? Give feedback.
-
Basically, add default null options to the Note this has to be called inside the editor.normalise function otherwise it won't grab the updated option and use the default value inside. |
Beta Was this translation helpful? Give feedback.
https://platejs.org/docs/editor-methods#setoption