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
6.2k stars 420 forks source link

Column Layout Request #350

Open jiawei686 opened 11 months ago

jiawei686 commented 11 months ago

Is your feature request related to a problem? Please describe. We think Blocknote is amazing and about to use blocknote to build some part of project. Is it possible for us to add a column layout in blocknote.

image
matthewlipski commented 11 months ago

Hmm, depending on how you want the columns to work this can be either very easy or very difficult.

If you just want each block to be displayed as e.g. 2 columns, you can just do this:

const editor = useBlockNote({
    domAttributes: {
      blockContent: {
        style: "columns: 2",
      },
    },
  });

Instead of style you can add a CSS class, and use different selectors to only apply the column styling to the blocks you want (e.g. paragraphs).

Alternatively, you can create a custom block (see https://www.blocknotejs.org/docs/block-types#custom-block-types) which has the column styling baked in.

If you want the whole editor to have columns, meaning blocks can be side-by-side, I don't think that's possible atm since it will likely break things like drag and drop.

jiawei686 commented 11 months ago

Our product needs notion-like column layout, which means I have to implement side-by-side blocks. This is blowing my mind. I'm figuring out is it possible to implement this by using custom blocks.

image image
charanjit-singh commented 7 months ago

@jiawei686 did you manage to implement it?

rakesh-eltropy commented 4 months ago

@jiawei686 did you manage to implement it? @YousefED Any plan to add this in the core editor?

YousefED commented 4 months ago

Thanks for showing your interest! Unfortunately, this will be quite a significant feature to add and at the moment, it's not a high prio issue for ourselves. We'd love to add it eventually, but it would require either some community members to pick this up or a dedicated sponsor / bounties to be able to allocate time for this.

To implement this properly, we probably need to revisit the core architecture of the block schema (how to we store columns?) and some core concepts such as dragging / dropping blocks.