Giter Site home page Giter Site logo

yueqianzhang / blocksuite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from toeverything/blocksuite

0.0 0.0 0.0 20.3 MB

๐Ÿงฉ BlockSuite is a framework for building collaborative editors and applications.

Home Page: https://blocksuite.io

License: Mozilla Public License 2.0

Shell 0.04% JavaScript 0.11% TypeScript 99.60% CSS 0.13% HTML 0.11% Vue 0.02%

blocksuite's Introduction

BlockSuite

BlockSuite logo and name

Checks Status Issues Closed NPM Latest Release NPM Nightly Release Open in StackBlitz Join Discord


Overview

BlockSuite is a toolkit for building collaborative editors and applications. It embraces the document-centric approach to facilitate the development of more flexible, diverse, and scalable editable interfaces.

In developing modern collaborative editing applications, the challenge lies not only in the internal implementation of the editor but also in the complex state management across many UI components. This means that the overall data flow of such applications should be consistently modeled and reused on a larger scale, reducing the interoperability cost between editor and non-editor components. This is why BlockSuite completely separates the document model of collaborative content from the editor. This allows any UI component, whether part of an editor or not, to simply attach to the same block tree document, composing a more flexible editing experience.

showcase-doc-edgeless-editors

For an understanding of the design philosophy advocated by BlockSuite, welcome to read our Document-Centric, CRDT-Native post.

Based on this concept, BlockSuite starts with a foundational block-based document model and independently implements a series of collaborative editing infrastructures, including editors. This means that with BlockSuite, you can choose to:

  • Build a new editor from scratch based on the BlockSuite framework.
  • Or, reuse multiple first-party editors based on BlockSuite right out of the box:
    • DocEditor: Built entirely from scratch, DocEditor is a comprehensive block-based document editor, offering extensive customization and flexibility.
    • EdgelessEditor: Featuring canvas-based graphics rendering at its core with sophisticated rich-text features, EdgelessEditor offers unique functionalities and decent performance in whiteboard editing.

The BlockSuite project is structured around key packages that are categorized into two groups: a headless framework and prebuilt editing components.

Headless Framework
@blocksuite/store Data layer for modeling collaborative document states. It is natively built on the CRDT library Yjs, powering all BlockSuite documents with built-in real-time collaboration and time-travel capabilities.
@blocksuite/inline Minimal rich text components for inline editing. BlockSuite allows spliting rich text content in different block nodes into different inline editors, making complex content conveniently composable. This significantly reduces the complexity required to implement traditional rich text editing features.
@blocksuite/block-std Framework-agnostic library for modeling editable blocks. Its capabilities cover the structure of block fields, events, selection, clipboard support, etc.
@blocksuite/lit Intermediate layer for adapting the block tree to the lit framework component tree UI. BlockSuite uses lit as the default framework because lit components are native web components, avoiding synchronization issues between the component tree and DOM tree during complex editing.
Prebuilt Components
@blocksuite/blocks Default block implementations for composing preset editors, including widgets belonging to each block.
@blocksuite/presets Plug-and-play editable components including editors (DocEditor / EdgelessEditor) and auxiliary UI components named fragments (CopilotPanel, DocTitle...).

This can be illustrated as the diagram below:

package-overview.png

In addition to extending custom blocks, here are what you can also conveniently achieve with BlockSuite:

  • Writing type-safe complex editing logic based on the command mechanism, similar to react hooks designed for document editing.
  • Persistence of documents and compatibility with various third-party formats (such as markdown and HTML) based on block snapshot and transformer.
  • Incremental updates, real-time collaboration, local-first state management, and even decentralized data synchronization based on the document streaming mechanism of the document.
  • State scheduling across multiple documents and reusing one document in multiple editors.

๐Ÿšง BlockSuite is currently in its early stage, with some extension capabilities still under refinement. Hope you can stay tuned, try it out, or share your feedback!

Getting Started

To try out BlockSuite, refer to the Quick Start document and start with the preset editors in @blocksuite/presets.

Resources

Building

See BUILDING.md for instructions on how to build BlockSuite from source code.

Contributing

BlockSuite accepts pull requests on GitHub. Before you start contributing, please make sure you have read and accepted our Contributor License Agreement. To indicate your agreement, simply edit this file and submit a pull request.

License

MPL 2.0

blocksuite's People

Contributors

doodlewind avatar lawvs avatar himself65 avatar flrande avatar zqran avatar saul-mirone avatar regischen avatar donteatfriedrice avatar zuoxiaodong0815 avatar fourdim avatar fundon avatar zzj3720 avatar qishaoxuan avatar doouding avatar thorseraq avatar saikasakura avatar alt1o avatar devlzl avatar ayushagrawal-a2 avatar diamondthree avatar jimmfly avatar darkskygit avatar pengx17 avatar innei avatar yukiniro avatar rajeevdash007 avatar catsjuice avatar pionxzh avatar perfectpan avatar fi3ework avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.