BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

New placeholders option doesn't work with multiple editors

Open NicHaley opened this issue 1 year ago • 2 comments

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

  • Blocknote: 0.12.4

NicHaley avatar Apr 14 '24 13:04 NicHaley

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!

YousefED avatar May 01 '24 11:05 YousefED

@YousefED Could you give an example please?

asam3 avatar Aug 29 '24 14:08 asam3