feat: bump blocksuite (#5267)

Change history: 2b5bb47...2b3d2ba
This commit is contained in:
Flrande
2023-12-12 06:18:29 +00:00
parent bf97a07d1f
commit 9aa33d0228
19 changed files with 217 additions and 197 deletions

View File

@@ -71,12 +71,12 @@
"uuid": "^9.0.1"
},
"devDependencies": {
"@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/blocks": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/global": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/icons": "2.1.36",
"@blocksuite/lit": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/lit": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/presets": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/store": "0.11.0-nightly-202312120309-2b3d2ba",
"@storybook/addon-actions": "^7.5.3",
"@storybook/addon-essentials": "^7.5.3",
"@storybook/addon-interactions": "^7.5.3",

View File

@@ -19,7 +19,7 @@ import {
blockSuiteEditorHeaderStyle,
blockSuiteEditorStyle,
} from './index.css';
import { editorPresets } from './preset';
import { editorSpecs } from './specs';
interface BlockElement extends Element {
path: string[];
@@ -83,7 +83,7 @@ export class NoPageRootError extends Error {
super('Page root not found when render editor!');
// Log info to let sentry collect more message
const hasExpectSpace = Array.from(page.doc.spaces.values()).some(
const hasExpectSpace = Array.from(page.rootDoc.spaces.values()).some(
doc => page.spaceDoc.guid === doc.guid
);
const blocks = page.spaceDoc.getMap('blocks') as YMap<YMap<any>>;
@@ -162,8 +162,8 @@ const BlockSuiteEditorImpl = ({
if (editor.page !== page) {
editor.page = page;
editor.pagePreset = editorPresets.pageModePreset;
editor.edgelessPreset = editorPresets.edgelessModePreset;
editor.docSpecs = editorSpecs.docModeSpecs;
editor.edgelessSpecs = editorSpecs.edgelessModeSpecs;
}
useLayoutEffect(() => {
@@ -211,7 +211,7 @@ const BlockSuiteEditorImpl = ({
block: 'center',
inline: 'center',
});
const selectManager = editor.root.value?.selection;
const selectManager = editor.root?.selection;
if (!blockElement.path.length || !selectManager) {
return;
}

View File

@@ -1,7 +1,7 @@
import {
AttachmentService,
EdgelessPreset,
PagePreset,
DocEditorBlockSpecs,
EdgelessEditorBlockSpecs,
} from '@blocksuite/blocks';
import bytes from 'bytes';
@@ -17,30 +17,30 @@ class CustomAttachmentService extends AttachmentService {
}
}
function getPresets() {
const pageModePreset = PagePreset.map(preset => {
if (preset.schema.model.flavour === 'affine:attachment') {
function getSpecs() {
const docModeSpecs = DocEditorBlockSpecs.map(spec => {
if (spec.schema.model.flavour === 'affine:attachment') {
return {
...preset,
...spec,
service: CustomAttachmentService,
};
}
return preset;
return spec;
});
const edgelessModePreset = EdgelessPreset.map(preset => {
if (preset.schema.model.flavour === 'affine:attachment') {
const edgelessModeSpecs = EdgelessEditorBlockSpecs.map(spec => {
if (spec.schema.model.flavour === 'affine:attachment') {
return {
...preset,
...spec,
service: CustomAttachmentService,
};
}
return preset;
return spec;
});
return {
pageModePreset,
edgelessModePreset,
docModeSpecs,
edgelessModeSpecs,
};
}
export const editorPresets = getPresets();
export const editorSpecs = getSpecs();