Dashibase / lotion

An open-source Notion UI built with Vue 3
GNU General Public License v3.0
2.79k stars 132 forks source link

[WIP] Refactor HeadingBlock using tiptap #39

Open holazz opened 2 years ago

holazz commented 2 years ago

Currently, TextBlock and QuoteBlock are implemented by the EditorContent component of tiptap, and HeadingBlock and DividerBlock are not implemented by tiptap. In some cases, we have to deal with the two types of blocks separately. In this PR I want to refactor all blocks by tiptap.

holazz commented 2 years ago

I have refactored the H1 block by tiptap, after that I will refactor H2, H3 and Placeholder. What do you think? @greentfrapp If you don't recommend this, I will close this PR.

greentfrapp commented 2 years ago

Thanks for looking into this @holazz! I was also thinking about it as well but on second thought, I feel like the benefits might not warrant the effort, so I'm inclined not to recommend this for now. But I'd like to leave this PR here for future reference.

What did you mean by refactoring the Placeholder though? Would that be for the Divider block?

holazz commented 2 years ago

@greentfrapp Thanks for your response! I mean the placeholder style of HeadingBlock and TextBlock can be refactored by tiptap placeholder extension.

Divider and Quote can also be implemented by tiptap: https://tiptap.dev/api/nodes/horizontal-rule https://tiptap.dev/api/nodes/blockquote

However, this PR is just a preliminary refactoring of H1 block, and refactoring all blocks would be huge work. So I respect your opinion, and maybe do it in the future when needed.