Skip to content

Releases: toeverything/blocksuite

v0.8.0

29 Aug 14:46
daadb64
Compare
Choose a tag to compare

🎉 Announcing BlockSuite 0.8.0! This version is bundled in AFFiNE 0.8.0, incorporating over 500 new merged pull requests and 12 new contributors. In the past weeks, we have refactored the selection data flow of the editor, together with multiple new editing functionalities. Highlights:

Selection Manager Refactoring

In 0.8.0, we rewrote the selection manager following the block spec RFC (#3165). All selections could be created, managed and shared by the same data flow now.

selection-manager

The new selection follows the unidirectional data flow. Which means all selections on page will be stored as a piece of selection data called selection model.

  1. The blocks can subscribe to the changes of the selection models and render them as what they want.
  2. Every time users select something else on the page, the selection model will be updated first.
  3. Then, the blocks know the models are updated and they will try to rerender the selections.

An example of selection model:

TextSelection {
  type: 'text',
  group: 'note',
  from: {
    path: ['some-block-parent-id', 'some-block-id'],
    index: 5,
    length: 20,
  },
  to: {
    path: ['some-other-block-parent-id', 'some-other-block-id'],
    index: 0,
    length: 30
  }
}

BlockSelection {
  type: 'block',
  group: 'note',
  path: ['some-block-id'],
}

SurfaceSelection {
  type: 'surface',
  group: 'edgeless',
  path: ['some-block-id'],
  elements: ['shape-circle'],
}

In BlockSuite, this piece of data is stored in the Yjs awareness store to make sure it can be shared between clients to support remote selection. This also makes the support of the undo and redo features work as expected.

Block Schema

The new block-level migration API is introduced, usage:

import { Schema, Workspace } from '@blocksuite/store';

const schema = new Schema();
schema.register(AffineBlocks);

// Migration can run without workspace
schema.upgradePage(oldBlockVersions, oldYDoc);

// create workspace with schema
const workspace = new Workspace({ schema });

See #3826 for the guide writing migrations.

Also, the model proxy now supports defining plain JSON types using NativeWrapper, instead of mapping nested array and objects into their Y-alternatives. See #4020 for the detailed usage.

Block UI Components

In @blocksuite/blocks, the new createLitPortal and createSimplePortal API can be used to create portals in editor (#3830 #4291). The new computePosition option is supported, so as to place the tooltips and popups in proper position.

In @blocksuite/virgo, there are also new APIs:

  • Introduced createVirgoKeyDownHandler, facilitating the development of logic for the keydown event (#4279).
  • Added hooks support, allowing for the injection of default behavior into Virgo (#4386).
  • Introduced isEmbed options that allows treating a text node as a unified entity, which can be selected or removed entirety (#3659).

Doc Editing Functionalities

  • Supported the new affine:attachment block flavour (#2952).
  • Updated the new drag handle (#3695 #3162 #4314).
  • Supported text highlight (#3961).
  • Supported image files in exported HTML and markdown (#3791).

Edgeless Editing Functionalities

  • Supported the new frame element (#3701).
  • Supported full screen presentation mode (#4101).
  • Supported ToC panel for notes (#3138).
  • Supported flowchart auto-complete creation (#3596).
  • Supported moving element using arrow keys (#4143).
  • Adapted to the new selection manager (#3693).
  • Reduced re-rendering (#4276 #3911 #3823).
  • Updated connector and shape toolbar UI (#3714).

Database Editing Functionalities

  • Added the new kanban view (#2401).
  • Added the new header UI (#3868).
  • Supported clipboard operations under custom database selection (#2309).

Playground and Package Infra

  • New local-first playground with multi-player collaboration support (#3589 #3776). This entry is localhost:5173 while the previous entry with different starter templates are located in localhost:5173/starter/.
  • The circular dependencies in the project has been fully cleared (4214).

Detailed Bugfixes

Read more

v0.7.0

17 Jul 15:56
a676391
Compare
Choose a tag to compare

🎉 Announcing BlockSuite 0.7.0! This version is bundled in AFFiNE Client 0.7-beta, incorporating 318 new merged pull requests and an addition of 7 contributors. In the past few weeks, we have significantly enhanced data persistence and whiteboard usability. Feature highlights:

So far, the primary focus of the BlockSuite project has been on feature-richness. However, with the next major release, we plan to make the editing feature more adaptable with a new API surface. Stay tuned!

Detailed Commits

Read more

v0.6.0

06 Jun 13:53
Compare
Choose a tag to compare

🍬 We are excited to announce the release of BlockSuite 0.6.0! This version is shipped in AFFiNE Client 0.6.0, including 351 new pull requests merged and 18 more new contributors. In this version, we mainly focused on improving the usability of doc editing and whiteboard editing. Here are the updates:

Read more

0.5.0

25 Apr 17:01
Compare
Choose a tag to compare

🍬 We're thrilled to announce the release of BlockSuite 0.5.0! This version is shipped in the first AFFiNE Client, including 660 pull requests merged from our vibrant community of developers, with 14 more new contributors. Here are some highlights of what you can expect from this release:

  • 🔮 There is now support for nestable block model fields definitions.
  • 🗄️ A new DatabaseBlock is available to use as a table. The data structure has been redesigned and moved to the block level.
  • 🔎 Cross-page indexing is possible through the SearchIndexer and BacklinkIndexer.
  • 🎨 There are many enhanced edgeless and whiteboard editing capabilities, including a new @blocksuite/connector package that provides pathfinding support for computing shape connectors.
  • 📖 The documentation site is available, including onboarding documents and tutorials. The site can be accessed at blocksuite.affine.pro.

🚀 Features

  • Store (@Saul-Mirone @lawvs @doodlewind)
    • Array proxy (#2088), Y.Map deep proxy (#2111), and support for deep proxied values (#2145).
    • Support DisposableGroup.addFromEvent (#1527).
    • Support role in block schema (#2023).
    • Support Slots on model for blocks (#2067).
    • Indexer (#2091) and normalization of subpage in meta (#2167).
  • Edgeless (@alt1o @doodlewind)
    • Support for various tools and modes, including drag and drop (#1417), view control panel (#1423), brush tool (#1418, #1458), text tool (#1563), and component toolbar (#1703).
    • Basic hotkeys support (#1750) and pressing the ESC key to return to the default state (#1833).
    • Active state maintenance between clicking frames (#1836) and support for bringToFront and sendToBack (#1945).
    • Connectors can be attached to elements at any position (#1963) and copy-paste support in edgeless clipboard (#1965).
    • Edgeless frame background (#2027), shape fill and stroke color support (#2042), and background grid optimization (#2047).
    • Double-click the blank space to add text (#2163).
    • Additional shapes (#1339) and brush support (#1337).
    • Connector support (#1793) and shape border style support (#2166).
  • Subpage (@lawvs)
    • Addition of subPageIds in pageMeta and related events (#1716).
    • Unification of subpage and slot naming (#1782).
    • Addition of subpage test case (#1832).
    • Refactoring to check subpage reference (#2022).
    • Normalization of subpage in meta (#2167).
    • Subpage meta synchronization (#2190).
  • Database block (@zqran)
    • Rich-text column soft enter support (#1765).
    • Improved handling of placeholders, insertion, and selection (#1785, #1795, #1770).
    • Enhanced database styling (#1831, #1855, #1861) and column operations (#1879, #1884, #1887).
    • Tag color selection (#1917), renaming and deletion (#1891), and copy-paste support (#1908).
    • More actions support (#1916) and drag and drop column width adjustment (#1931).
    • Database conversion (#1941) and column operations with shortcuts (#2019).
    • Title and tag length limits (#2000) and drag and drop row insertion (#2046).
    • Icon and style updates (#2063, #2068) and mobile compatibility (#2187).
    • Virgo integration for number input replacement (#2144) and select tag length limit update (#2230).
  • Virgo (@Flrande)
    • Dynamic attribute schema and renderer (#1462).
    • Handler to take over Virgo input (#1495).
    • Support VEditor.requestUpdate and v-text update (#1523).
    • Support setMarks (#1711).
    • VEditor support for string parameter (#1895).
    • Support setText (#2107).
  • Selection (@fundon)
    • ExtendBlockRange API (#1684) and dragged content preview (#1872).
    • Dragging blocks under block-level selection (#1946) and scroll wheel support to move dragging blocks (#1977).
    • Highlight selected blocks in edgeless (#2024) and triple-click to select all text of block (#2037).

🙌 New Contributors

🐛 Detailed Refactoring and Bugfixes

  • refactor: add text prop in schema (#1281)
  • refactor: migrate SelectedBlock to BlockRange (#1334)
  • refactor: remove redundant cachedSelectedBlocks (#1332)
  • refactor: add side effect in store (#1340)
  • refactor: optimize some code in virgo (#1360)
  • refactor: remove code block button (#1365)
  • refactor: remove depth and parentIndex from BaseBlockModel (#1372)
  • refactor: reorganize range structure (#1366)
  • refactor: detect elements with Node.compareDocumentPosition in block selection (#1356)
  • refactor: simplify test (#1379)
  • refactor: migrate BlockSuiteModelProps to BlockModelProps (#1408)
  • refactor: clearly distinguish lit's state and property (#1428)
  • refactor: remove handlePageEvent timer (#1431)
  • refactor: simplify keyboard behavior (#1438)
  • refactor: Signal -> Slot (#1481)
  • refactor: simplify code block language list logic (#1486)
  • refactor: split basic DefaultSelectionManager modules (#1494)
  • refactor: remove redundant selection manager fields (#1496)
  • refactor: SelectionRect -> DraggingArea (#1500)
  • refactor: extract setSelectedBlocks and slot effects (#1502)
  • refactor: remove resetSelectedBlockByRect (#1503)
  • refactor: switch to selection.viewport (#1506)
  • refactor: remove redundant selection manager fields (#1507)
  • refactor: switch to page.readonly (#1511)
  • refactor: add selection.state.draggingArea (#1512)
  • refactor: extract block hub templates (#1521)
  • refactor: move codeBlockOption to code block (#1519)
  • refactor: Slot.disposableListener -> Slot.fromEvent (#1526)
  • refactor: code option use viewport element (#1565)
  • refactor: remove the deprecated addBlock api (#1613)
  • refactor: add async query for dom mutation scenario (#1621)
  • refactor: replace getRichTextByModel with getVirgoByModel (#1626)
  • refactor: strict text attributes check (#1731)
  • refactor: migrate nativeKeydown to hotkey (#1751)
  • refactor: replace input tag with VEditor in database block (#1746)
  • refactor: extract getPopperPosition function (#1816)
  • refactor: add getRichTextBoundingBox test action (#1819)
  • refactor: improve stability of inline suggestion (#1817)
  • refactor: split handleLineStartBackspace (#1910)
  • refactor: check subpage reference (#2022)
  • refactor: clean short key (#2051)
  • refactor: extract keydown observer (#2062)
  • refactor: remove redundant slot (#2140)
  • refactor: remove @blocksuite/react package (#2179)
  • refactor: subpage meta sync (#2190)
  • refactor: use @toeverything/y-indexeddb (#2207)
  • refactor: use virgo element as the ref node when obtaining the vRange (#2239)
  • refactor: subpage update (#2264)
  • refactor(blocks): replace textarea in title with virgo (#1168)
  • refactor(blocks): replace quill with virgo (#1433)
  • refactor(blocks): improve code-block highlight performance (#1682)
  • refactor(blocks): add cache for highlight in code-block (#1762)
  • refactor(blocks): builtInSchemas -> AffineSchemas (#1763)
  • refactor(blocks): prevent auto scroll in edgeless mode (#1830)
  • refactor(code): replace setTimeout with ResizeObserver (#1680)
  • refactor(database): tag -> column (#1739)
  • refactor(database): optimize column related naming (#1913)
  • refactor(database): remove mode in crdt model (#1918)
  • refactor(database): flatten internalProperty and property (#1919)
  • refactor(database): add DatabaseManager and page.db entity (#1922)
  • refactor(database): columns -> cells (#1925)
  • refactor(database): columnSchema -> column (#1934)
  • refactor(database): split column header component file (#1957)
  • refactor(database): columnSchema -> column (#1960)
  • refactor(database): column header (#1987)
  • refactor(database): toolbar and row container (#1989)
  • refactor(database): separate title (#1997)
  • refactor(database): separate select type column (#1998)
  • refactor(edgeless): split toolbar modules (#1348)
  • refactor(edgeless): hotkeys (#1835)
  • refactor(edgeless): add frame and update selection (#1834)
  • refactor(editor): move content parser out of editor lifecycle (#1748)
  • refactor(global): move global database types into blocks (#2278)
  • refactor(phasor): switch to getElementsBound (#1445)
  • refactor(phasor): move edgeless viewport to surface.viewport (#1477)
  • refactor(selection): switch to document.elementsFromPoint (#1530)
  • refactor(selection): keep setSelectedBlocks logic simple (#1706)
  • refactor(store): remove redundant type param (#1756)
  • refactor(store): support synchronous createPage (#1760)
  • refactor(store): addBlockByFlavour -> addBlock (#1764)
  • refactor(store): remove redundant moveBlocksToParent (#1787)
  • refactor(store): remove deleteBlockById and updateBlockById (#1923)
  • refactor(store): set doc.guid to workspace id (#1958)
  • refactor(store): init internal props should respect ext in schema (#2025)
  • refactor(store): move cell and column to database props and add database model (#2053)
  • refactor(store): use map proxy for object props (#2128)
  • refactor(virgo): switch to rootElement (#1454)
  • refactor(virgo): use tuple (#...
Read more