-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Support for inserting custom blocks #8418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Custom block-level elements are a feature that allows editors to support the creation of unique block elements with specific styles or functionalities. These elements can include card-style hyperlinks, mind maps, kanban boards, and more. By providing the ability to customize blocks, plugins or extensions can be developed to meet specific user requirements. This enhances the scalability of the editor, allowing it to accommodate a wider range of use cases. The advantage of custom blocks is that they are rendered within the editor itself, making them more lightweight compared to widgets. Widgets, on the other hand, are independent DOM contexts and can be rendered outside the editor, resembling a standalone web page. Custom blocks are typically designed to be used within the editor environment and may not function or render correctly outside of it. By supporting custom blocks, an editor can provide flexibility, extensibility, and consistency to its users, allowing them to create rich and diverse content while maintaining a unified syntax and user experience. |
自定义块可能需要考虑内部插入protyle的场景,比如叶归的白板,就是会在自定义块中渲染protyle。 暂时只是提出这一点,后续我增加全面一点的测试以后,再继续补充 |
Scenario
Through this feature, the editor can support custom block-level elements, such as the card-style hyperlink, mind map, kanban, etc.
Plugins can implement some user requirements through the ability to customize blocks, so that the scalability of the editor will be better, and the consistency of the extended syntax can be guaranteed.
The difference between custom blocks and widgets is that widgets are independent DOM contexts, which allows widgets to be rendered independently even outside the editor, just like a web page. Custom blocks can only be rendered in the editor, which is more "lightweight".
Syntax design
Similar code block syntax:
There are three ways to store raw data:
If the amount of data is large, it is recommended to use 3 to avoid affecting the performance of the editor.
Implementation
NodeCustomBlock
The text was updated successfully, but these errors were encountered: