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.89k stars 381 forks source link

styling help pls #848

Closed sijirama closed 2 weeks ago

sijirama commented 2 weeks ago

I'm encountering an issue with the .bn-editor class in my application. When inspecting the element, I've identified that it has an inline padding of approximately 54px, which I'm unable to override using CSS. This padding is causing an unwanted space where the side menu is located, particularly impacting the appearance on mobile devices.

I'm using the editor to render block content by setting editable to false. However, this spacing issue persists, making the layout less optimal for mobile views.

Could anyone advise on how to effectively remove or override this inline padding within the .bn-editor class to improve the layout on mobile devices?

Thank you for your assistance!

image

image

matthewlipski commented 2 weeks ago

If you can't add a CSS rule, you can add the following to your useCreateBlockNote options:

const editor = useCreateBlockNote({
  domAttributes: {
    editor: {
      style: "padding-inline: 0px;",
    },
  },
});

If you can use CSS though, you just need to make sure the selector you use is more specific than the one which sets the padding (which is just .bn-editor), so you can do something like this:

.bn-container > .bn-editor {
    padding-inline: 0px;
}
sijirama commented 2 weeks ago

ah yes, thank you sooo much, this works.