v0.8.0
版本发布时间: 2023-08-29 22:46:56
toeverything/blocksuite最新发布版本:v0.9.0(2023-10-18 20:24:04)
🎉 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.
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.
- The blocks can subscribe to the changes of the selection models and render them as what they want.
- Every time users select something else on the page, the selection model will be updated first.
- 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 inlocalhost:5173/starter/
. - The circular dependencies in the project has been fully cleared (4214).
Bugfixes
- fix: missing img inside figure element @fourdim (#3591)
- fix: unable to paste within the codeblock @fourdim (#3624)
- fix: typo @lzlme (#3633)
- fix: cursor position based on triggered location @lzlme (#3638)
- fix: copy as PNG format error on windows @zuoxiaodong0815 (#3667)
- fix: cannot read properties of undefined (reading schema) @zhe-he (#3668)
- fix: remove focus after paste @fourdim (#3762)
- fix: meta should not write to crdt when initializing @Saul-Mirone (#3774)
- fix: surface block version should be 4 @Flrande (#3792)
- fix: add polyfill for Intl.Segmenter @fourdim (#3795)
- fix: import ext @himself65 (#3807)
- fix: playground not working on firefox @pengx17 (#3824)
- fix: range controller regression @Saul-Mirone (#3833)
- fix: edgeless selection won't be cleaned up when switching mode @Saul-Mirone (#3859)
- fix: headings should not match the space hotkey @fourdim (#3875)
- fix: clean custom trigger key in widgets @lawvs (#3878)
- fix: use the set on
AffineFormatBarWidget
@himself65 (#3880) - fix: range sometimes blink when dragging @Saul-Mirone (#3895)
- fix: scrollbar style pollution global @lawvs (#3894)
- fix: use old arrow navigation @Saul-Mirone (#3900)
- fix: container offset cause wrong range @Saul-Mirone (#3901)
- fix: block hub style @Garfield550 (#3919)
- fix: click to select block element @lawvs (#3933)
- fix: align arrow icon in page info @RajeevDash007 (#3905)
- fix: added base UI font family to the Menu of edgeless @RajeevDash007 (#3910)
- fix: typo @Flrande (#3944)
- fix: remain editing state when drag and drop in edgeless mode @donteatfriedrice (#3947)
- fix: remove box-shadow when exporting png @zuoxiaodong0815 (#3951)
- fix: unique guid for crossing workspace @himself65 (#3960)
- fix: clear mock selection when link not confirm @wiirhan (#3956)
- fix: updated font family of toolbar and more button @RajeevDash007 (#3954)
- fix: remove box-shadow when exporting png @zuoxiaodong0815 (#3983)
- fix: cut event for page title @Saul-Mirone (#3985)
- fix: fix bugs and enable tests related to format-bar @Flrande (#3990)
- fix: updated the UI of the buttons of Import Dialog Box @RajeevDash007 (#3995)
- fix: image caption selection issue @Saul-Mirone (#4000)
- fix: backlink icon color @lawvs (#4002)
- fix: no scrollbar for tags when creating many tags @zzj3720 (#4039)
- fix: attachment z index @lawvs (#4049)
- fix: fix
getSelectedBlockElementsByRange
@Flrande (#4053) - fix: select all in cell @Saul-Mirone (#4071)
- fix: selection on db click when container has offset @pengx17 (#4083)
- fix:
rangeManager.value
should be null when no range @Flrande (#4078) - fix: clipboard test cases @zuoxiaodong0815 (#4098)
- fix: can not fully show bookmark menu in tiny screen @QiShaoXuan (#4096)
- fix: docs build @doodlewind (#4110)
- fix: added border radius to page tag selector @RajeevDash007 (#4111)
- fix: shift click range after input @Saul-Mirone (#4122)
- fix: ime in edgeless @Saul-Mirone (#4127)
- fix: unable to copy and paste under multi lines of text selection @zuoxiaodong0815 (#4123)
- fix: format-bar position not follow edgeless viewport @Flrande (#4149)
- fix: aligned arrow icon to the center of the font size container @RajeevDash007 (#4095)
- fix: typography when multiple line in list @lawvs (#4152)
- fix: turn into code block cause error @Saul-Mirone (#4189)
- fix: missing table view after importing database @zuoxiaodong0815 (#4130)
- fix: optimize hasChanged for block element @lawvs (#4187)
- fix: support importing highlighted text from Notion @zuoxiaodong0815 (#4197)
- fix: should open the right page after importing notion @zuoxiaodong0815 (#4203)
- fix: the page should be created when which is needed @zuoxiaodong0815 (#4207)
- fix: node import @Saul-Mirone (#4218)
- fix: typography styles @lawvs (#4231)
- fix: arrow breaks IME input @Saul-Mirone (#4234)
- fix: the missing page reference in the first row @fourdim (#4237)
- fix: can not run blocksuite's toast function when not open a page in affine @zuoxiaodong0815 (#4236)
- fix: title column error when importing notion database @zuoxiaodong0815 (#4246)
- fix: can not import when just only csv file @zuoxiaodong0815 (#4256)
- fix: copy title @fourdim (#4262)
- fix: cannot read properties of undefined (reading 'insert') in yjs @fourdim (#4267)
- fix: correct misspelled words @dengquan (#4274)
- fix: tsconfig 'module' must be set to 'NodeNext' when 'moduleResolution' is set to 'NodeNext @fourdim (#4265)
- fix: search might not work @himself65 (#4295)
- fix: transform database title into doublelink when importing notion markdown @zuoxiaodong0815 (#4283)
- fix: editor doesn't use block presets from property @Vija02 (#4288)
- fix: should not sync range to text-selection when it is out of note @Flrande (#4317)
- fix: pen line width display error @LittleSound (#4319)
- fix: nested list items are lost on pasting @zuoxiaodong0815 (#4316)
- fix: legacy import snapshot for edgeless @Saul-Mirone (#4334)
- fix: the image type is wrong inexported file @zuoxiaodong0815 (#4342)
- fix: use delta instead of text when importing db @fourdim (#4357)
- fix: select all for rich text @Saul-Mirone (#4360)
- fix: remove hardcode element tag name in lit @Saul-Mirone (#4380)
- fix: unchecked todo icon color @lzlme (#4405)
- fix: incorrect type of meta-data for page @zzj3720 (#4415)
- fix(block-std): avoid parent blocks to be called multiple times in dispatcher @Saul-Mirone (#3722)
- fix(blocks): html clipboard data containing code element should be parsed as html @youhua (#3561)
- fix(database): title column cannot trigger row selection @zqran (#3769)
- fix(database): title columns selection wrong @zzj3720 (#3778)
- fix(database): can not enter editing mode after reconnect component @zzj3720 (#3857)
- fix(database): cannot find view when closing select popup @zqran (#3864)
- fix(database): wrong selection height when editing @zqran (#3892)
- fix(database): donot throw error when no cell is selected @zqran (#3929)
- fix(database): dragging from outside cannot select database block @zqran (#3938)
- fix(database): rich-text error when importing snapshot @zqran (#3992)
- fix(database): kanban card dragging preview position wrong after page scrolling @zzj3720 (#4016)
- fix(database): detail panel selection not work @zzj3720 (#4017)
- fix(database): delete view error @zzj3720 (#4030)
- fix(database): block selected style @zzj3720 (#4035)
- fix(database): some database UI issues @zzj3720 (#4041)
- fix(database): delete view button not work @zzj3720 (#4051)
- fix(database):
New Record
UI @zqran (#4067) - fix(database): wrong scroll behavior when add new column @zzj3720 (#4106)
- fix(database):
IME
input overlaps with database title placeholder @zzj3720 (#4107) - fix(database): execute the browser default behavior when the title column is copied or pasted @zqran (#4109)
- fix(database): new record style @doodlewind (#4112)
- fix(database): typo in popup @doodlewind (#4148)
- fix(database): adjust icon style of the title cell @zzj3720 (#4199)
- fix(database): ui issues when editing database row properties @zqran (#4208)
- fix(database): auto identify reference @fourdim (#4210)
- fix(database): table view data structure @zzj3720 (#4212)
- fix(database): preserve column order when copying @zqran (#4240)
- fix(database): backspace deletes the contents outside the block @zzj3720 (#4242)
- fix(database): selection styles are not updated in a timely manner @zzj3720 (#4241)
- fix(database): title column should not be able to change column type @zzj3720 (#4243)
- fix(database): vscode lit plugin typecheck error @zzj3720 (#4252)
- fix(database): style of convert into database modal @zzj3720 (#4290)
- fix(database): link text overflow @zzj3720 (#4306)
- fix(database): virgo is not unmounted when disconnecting component of title cell and rich-text cell @zzj3720 (#4277)
- fix(database): exit the editing state when copying @zqran (#4322)
- fix(database): transform page link in title cell @zzj3720 (#4353)
- fix(edgeless): the newly created block should retain its formatting @doouding (#3599)
- fix(edgeless): correctly display shape resizing cursor @Yukiniro (#3657)
- fix(edgeless): resize incorrectly after rotating multiple shapes @zhengjitf (#3665)
- fix(edgeless): add checking when transforming to canvas @zuoxiaodong0815 (#3690)
- fix(edgeless): fix incorrect selected rects for multi-selection @Yukiniro (#3698)
- fix(edgeless): fix test 'frame' -> 'note' @regischen (#3711)
- fix(edgeless): ensure presence of note block @doouding (#3736)
- fix(edgeless): undo not work after resizing note block width @zhengjitf (#3754)
- fix(edgeless): default entry playground should use multi-user compatible generator @doouding (#3776)
- fix(edgeless): fix incorrect note size @Yukiniro (#3805)
- fix(edgeless): frame title blur unmount @regischen (#3812)
- fix(edgeless): fix alt drag element not work @regischen (#3819)
- fix(edgeless): rotate text incorrectly after resizing @zhengjitf (#3784)
- fix(edgeless): tweak toolbar ui @DiamondThree (#3863)
- fix(edgeless): add some missing key binding @Flrande (#3888)
- fix(edgeless): fix wrong connector handle position @regischen (#3937)
- fix(edgeless): fix toolbar style @regischen (#3979)
- fix(edgeless): note index doesn't move with viewport @tomoyukiy (#3982)
- fix(edgeless): presentation ui @regischen (#4027)
- fix(edgeless): toc style & affine intergration support @doouding (#3987)
- fix(edgeless): after delete auto complete overlay still exists @regischen (#4064)
- fix(edgeless): fix wrong drag auto complete connector position @regischen (#4066)
- fix(edgeless): fix presentation tooltip @regischen (#4091)
- fix(edgeless): fix short cut adding frame when editing @regischen (#4097)
- fix(edgeless): should make sure drag handle is not null @donteatfriedrice (#4133)
- fix(edgeless): content shifts when move window to different screen @doouding (#4099)
- fix(edgeless): align shape component toolbar with UI design @donteatfriedrice (#4139)
- fix(edgeless): remote selection does not follow new position @doouding (#4155)
- fix(edgeless): fix cononector not show after refresh on playground @regischen (#4175)
- fix(edgeless): fix auto complete text inheritance @regischen (#4177)
- fix(edgeless): make note submenu consistent with other submenu @donteatfriedrice (#4194)
- fix(edgeless): use correct icon @regischen (#4226)
- fix(edgeless): fix font @regischen (#4229)
- fix(edgeless): slicer position @doouding (#4220)
- fix(edgeless): _edgelessLayerWillChange should be decorated with @state @doouding (#4224)
- fix(edgeless): image jitters on resizing in edgeless mode @zhengjitf (#4014)
- fix(edgeless): toc reordering bug && custom padding support @doouding (#4232)
- fix(edgeless): height of note collapse @doouding (#4244)
- fix(edgeless): failed to execute 'exitFullscreen' on 'Document' @dengquan (#4259)
- fix(edgeless): toast message when trying to use the presentation feat… @regischen (#4270)
- fix(edgeless): fix a bug where the _shiftKey field wasn't being update correctly @regischen (#4272)
- fix(edgeless): fix typo in EdgelessToolbar tooltip on presentation button @regischen (#4275)
- fix(edgeless): canvas text layout shifts when panning to viewport edge @LittleSound (#4281)
- fix(edgeless): add condition to prevent moving elements when in editng mode @regischen (#4303)
- fix(edgeless): fix connector stroke color assignment @regischen (#4310)
- fix(edgeless): rebuild connector path and relation after paste or undo operation @doouding (#4320)
- fix(edgeless): refactor yContainer events handling for SurfaceManager @regischen (#4324)
- fix(edgeless): correctly display hover style on moving with arrow key @luke358 (#4330)
- fix(edgeless): change icon @regischen (#4341)
- fix(edgeless): image menu state on canvas text editing @BangKk (#4346)
- fix(edgeless): refactor change note button and component toolbar @regischen (#4349)
- fix(edgeless): fix edgeless page block component and add zoom clamping @regischen (#4350)
- fix(edgeless): style update hover effects in EdgelessAutoComplete @regischen (#4359)
- fix(edgeless): typo in component naming @lawvs (#4362)
- fix(edgeless): edgeless selection update error after undo @doouding (#4363)
- fix(edgeless): draw rectangle should not with radius @donteatfriedrice (#4367)
- fix(edgeless): note slicer ux/ui problem @doouding (#4411)
- fix(edgeless): note overlay should show border and text color correctly @donteatfriedrice (#4414)
- fix(edgeless): hide overlay when pointer move on toolbar @donteatfriedrice (#4416)
- fix(page): possible redos on mime type @fourdim (#3593)
- fix(page): fix the typo and the branch logic @fourdim (#3603)
- fix(page): paste in image caption @youhua (#3617)
- fix(page): keep the figcaption when pasting @youhua (#3621)
- fix(page): fix copy and paste on parent blocks @fourdim (#3610)
- fix(page): missing space and new line in the code block pasting @fourdim (#3623)
- fix(page): insert block to page and select it make page not scroll properly @zhengjitf (#3660)
- fix(page): maintain the children block structure when pasting @fourdim (#3679)
- fix(page): cursor & selection after pasting image @youhua (#3655)
- fix(page): paste using the code block option @fourdim (#3712)
- fix(page): clear selection state in exported PDF @zuoxiaodong0815 (#3732)
- fix(page): add selection indicator for embed block @lawvs (#3741)
- fix(page):
getSelectedBlocks
not work in one block @Flrande (#3761) - fix(page): image selection spacing @lawvs (#3765)
- fix(page): code block lang will lost on paste @zhengjitf (#3773)
- fix(page): remove the newline charactor when importing from markdown @fourdim (#3785)
- fix(page): code wrap issue on plain text @fourdim (#3796)
- fix(page): update search icon style @DiamondThree (#3814)
- fix(page): disabled button not work @lawvs (#3831)
- fix(page): click on block should focus on text @donteatfriedrice (#3834)
- fix(page): import dialog style @DiamondThree (#3835)
- fix(page): importing notion db to version 3 database block @fourdim (#3848)
- fix(page): base code font size @fourdim (#3890)
- fix(page): drag handle incorrect position @donteatfriedrice (#3899)
- fix(page): enable and fix some tests @Flrande (#3897)
- fix(page): format bar render error when switch to other page @Flrande (#3909)
- fix(page): database-convert can not be closed @Flrande (#3914)
- fix(page): reduce the validation strength of
pointToRange
@Flrande (#3927) - fix(page): style under edit mode and exported HTML are different… @water-in-stone (#3893)
- fix(page): should autoscroll when drag blocks @donteatfriedrice (#3928)
- fix(page): format-bar should be automatically updated in edgeless mode @Flrande (#3970)
- fix(page): list convert using format-bar @Flrande (#4011)
- fix(page): drag handle is off-screen for database @donteatfriedrice (#4082)
- fix(page): add fallback to bookmark icon and image @QiShaoXuan (#4081)
- fix(page): text background not work in block selection @Flrande (#4118)
- fix(page): range should not be changed by remote-selection @Flrande (#4126)
- fix(page): incorrect drag handle position with list @donteatfriedrice (#4153)
- fix(page): error using drag handle over database @donteatfriedrice (#4178)
- fix(page): remove border of image @doouding (#4176)
- fix(page): strict check when identity link @lawvs (#4202)
- fix(page): click at blank area should not change note sequence @donteatfriedrice (#4261)
- fix(page): updated UI of tooltips @RajeevDash007 (#4209)
- fix(page): added delete-item hover color @RajeevDash007 (#4299)
- fix(page): right click may trigger native selection @Saul-Mirone (#4336)
- fix(page): keep status between converted images and attachments @LittleSound (#4282)
- fix(page): image format bar overlaps import modal @RajeevDash007 (#4260)
- fix(page): remove portal when reference element removed @lawvs (#4368)
- fix(page): update popover styles @lawvs (#4375)
- fix(page): icon color @lawvs (#4406)
- fix(phasor): text element rendered not as expected when changed align @Flrande (#3632)
- fix(phasor): fix typo in surface @WBbug (#4300)
- fix(playground): undefined function indexedDB.databases in firefox @fourdim (#3738)
- fix(playground): add Intl.Segmenter polyfill for starter @fourdim (#3813)
- fix(playground): make edgeless menu ease of use @fourdim (#3825)
- fix(playground): custom navigation panel layer index @doodlewind (#4117)
- fix(store): add origin when setPageMeta @himself65 (#3640)
- fix(store): issue on removing non-loaded page @pengx17 (#3672)
- fix(store): paste image twice @fourdim (#3739)
- fix(store): force cast blocks to YMap @himself65 (#4296)
- fix(store): should not use get method on doc @Saul-Mirone (#4412)
- fix(virgo): unexpected range when press arrow in the edge of embed @Flrande (#3636)
- fix(virgo): editor break because of embed and ime @Flrande (#3651)
- fix(virgo): fix the style map which is not applied to span element but the parent v-text @fourdim (#3787)
- fix(virgo): code font size in headings @fourdim (#3877)
New Contributors
- @zhe-he made their first contribution in https://github.com/toeverything/blocksuite/pull/3680
- @as-shura made their first contribution in https://github.com/toeverything/blocksuite/pull/3696
- @RajeevDash007 made their first contribution in https://github.com/toeverything/blocksuite/pull/3906
- @Garfield550 made their first contribution in https://github.com/toeverything/blocksuite/pull/3920
- @water-in-stone made their first contribution in https://github.com/toeverything/blocksuite/pull/3893
- @wiirhan made their first contribution in https://github.com/toeverything/blocksuite/pull/3959
- @tomoyukiy made their first contribution in https://github.com/toeverything/blocksuite/pull/3986
- @WBbug made their first contribution in https://github.com/toeverything/blocksuite/pull/4143
- @dengquan made their first contribution in https://github.com/toeverything/blocksuite/pull/4259
- @Vija02 made their first contribution in https://github.com/toeverything/blocksuite/pull/4288
- @LittleSound made their first contribution in https://github.com/toeverything/blocksuite/pull/4281
- @BangKk made their first contribution in https://github.com/toeverything/blocksuite/pull/4346
Full Changelog: https://github.com/toeverything/blocksuite/compare/v0.7.0...v0.8.0