Skip to content

Anyway I can have one toolbar and multiple fields on page? #2846

Answered by zbeyens
azankorejo asked this question in Q&A
Discussion options

You must be logged in to vote

You can either create multiple controlled editors or use id parameter in editor hooks like useEditorRef or useEditorSelector. Most toolbar components do not support id prop so you'd need to fork hooks like these

export const useMarkToolbarButtonState = ({
nodeType,
clear,
}: {
nodeType: string;
clear?: string | string[];
}) => {
const pressed = useEditorSelector(
(editor) => isMarkActive(editor, nodeType),
[nodeType]
);
return {
pressed,
nodeType,
clear,
};
};
export const useMarkToolbarButton = (
state

Replies: 1 comment 1 reply

Comment options

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

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