TypeCellOS / BlockNote

A React Rich Text Editor that's block-based (Notion style) and extensible. Built on top of Prosemirror and Tiptap.
https://www.blocknotejs.org/
Mozilla Public License 2.0
5.91k stars 386 forks source link

New placeholders option doesn't work with multiple editors #703

Open NicHaley opened 2 months ago

NicHaley commented 2 months ago

Describe the bug The new placeholders option has a bug where when using more than one editor, the placeholder will be overwritten by the last editor instance.

For additional context on my use-case, I have multiple editors to support a different editing experience between "Title" and "Content" sections of a page (similar to notion).

To Reproduce Create two editors. Ex.

const titleEditor = useCreateBlockNote({
    placeholders: {
      default: "Untitled",
    },
  });

const contentEditor = useCreateBlockNote();

The placeholder for both will be the default placeholder text.

Expectation: The title editor should have Untitled for its placeholder

Misc

YousefED commented 2 months ago

Thanks for reporting, I think you're right. The solution for this would be to add a custom classname to each editor and make the css that's inserted by the placeholder plugin is scoped to the specific editor. Would welcome a PR that solves this!