Skip to content

How to inject additional/custom props on Plate? #3637

Closed Answered by abhi-bc
bahrijar asked this question in Q&A
Discussion options

You must be logged in to vote

@bahrijar One way to do it is via PlatePlugin. See docs here https://platejs.org/docs/plugin-context#getOption

You can define a plugin, and setOption as whatever you want and then access it easily like this

const MyComponent = () => {
  const { editor, plugin, useOption, type } = useEditorPlugin(MyPlugin);
  
  return <div>{useOption('myOption')}</div>;
};

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@bahrijar
Comment options

@bahrijar
Comment options

@bahrijar
Comment options

Comment options

You must be logged in to vote
1 reply
@bahrijar
Comment options

Answer selected by bahrijar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants