Skip to content

Multiple toolbars on a page #945

Answered by sepsol
jasonmng asked this question in Q&A
Aug 18, 2021 · 3 comments · 3 replies
Discussion options

You must be logged in to vote

I had the exact same issue. I managed to solve it by creating a ToolbarButtonHelper.jsx and ToolbarButtons.jsx components. I then import the later one into any component I want and pass it the editorRef which can be obtained by calling the useStoreEditorRef() hook and passing it the id you passed to the plate component.

// ToolbarButtonsHelper.jsx

import { Children, cloneElement, isValidElement } from 'react';
import {
  ToolbarElement,
  ToolbarMark,
  ToolbarLink,
  getPlatePluginType,
  ToolbarList,
  useStoreEditorState,
  useEventEditorId,
  someNode,
  isMarkActive,
} from '@udecode/plate';

export function Button({ editor: passedEditor, children }) {
  const focusedEditor = useSto…

Replies: 3 comments 3 replies

Comment options

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

Comment options

You must be logged in to vote
2 replies
@jasonmng
Comment options

@bishoymelek
Comment options

Answer selected by zbeyens
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
4 participants