Merge branch 'canary' into stable

This commit is contained in:
李华桥
2023-12-12 16:45:47 +08:00
20 changed files with 230 additions and 198 deletions
@@ -464,6 +464,9 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
workspaceId: string,
guid: string,
doc: Doc,
// we always delay the snapshot update to avoid db overload,
// so the value of `updatedAt` will not be accurate to user's real action time
updatedAt: Date,
initialSeq?: number
) {
return this.lockSnapshotForUpsert(workspaceId, guid, async () => {
@@ -502,6 +505,7 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
data: {
blob,
state,
updatedAt,
},
});
@@ -521,6 +525,8 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
blob,
state,
seq: initialSeq,
createdAt: updatedAt,
updatedAt,
},
});
@@ -565,7 +571,13 @@ export class DocManager implements OnModuleInit, OnModuleDestroy {
...updates.map(u => u.blob)
);
const done = await this.upsert(workspaceId, id, doc, last.seq);
const done = await this.upsert(
workspaceId,
id,
doc,
last.createdAt,
last.seq
);
if (done) {
if (snapshot) {
+2 -2
View File
@@ -3,8 +3,8 @@
"private": true,
"type": "module",
"devDependencies": {
"@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/global": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/store": "0.11.0-nightly-202312120309-2b3d2ba",
"react": "18.2.0",
"react-dom": "18.2.0",
"vitest": "0.34.6",
+5 -5
View File
@@ -57,9 +57,9 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/sdk": "workspace:*",
"@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/blocks": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/global": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/store": "0.11.0-nightly-202312120309-2b3d2ba",
"jotai": "^2.5.1",
"jotai-effect": "^0.2.3",
"tinykeys": "^2.1.0",
@@ -68,8 +68,8 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/lit": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/lit": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/presets": "0.11.0-nightly-202312120309-2b3d2ba",
"@testing-library/react": "^14.0.0",
"async-call-rpc": "^6.3.1",
"electron": "link:../../frontend/electron/node_modules/electron",
+5 -5
View File
@@ -22,11 +22,11 @@
"dist"
],
"dependencies": {
"@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/presets": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/block-std": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/blocks": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/global": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/presets": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/store": "0.11.0-nightly-202312120309-2b3d2ba",
"jotai": "^2.5.1",
"zod": "^3.22.4"
},
+2 -2
View File
@@ -37,8 +37,8 @@
"y-provider": "workspace:*"
},
"devDependencies": {
"@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/blocks": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/store": "0.11.0-nightly-202312120309-2b3d2ba",
"fake-indexeddb": "^5.0.0",
"vite": "^5.0.6",
"vite-plugin-dts": "3.6.0",
+1 -1
View File
@@ -24,7 +24,7 @@
"build": "vite build"
},
"devDependencies": {
"@blocksuite/store": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/store": "0.11.0-nightly-202312120309-2b3d2ba",
"vite": "^5.0.6",
"vite-plugin-dts": "3.6.0",
"vitest": "0.34.6",
+5 -5
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",
@@ -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;
}
@@ -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();
+7 -7
View File
@@ -25,14 +25,14 @@
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@affine/workspace": "workspace:*",
"@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/block-std": "0.11.0-nightly-202312120309-2b3d2ba",
"@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/virgo": "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",
"@blocksuite/virgo": "0.11.0-nightly-202312120309-2b3d2ba",
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^8.0.0",
"@emotion/cache": "^11.11.0",
+4 -4
View File
@@ -32,10 +32,10 @@
"@affine/sdk": "workspace:*",
"@affine/templates": "workspace:*",
"@affine/vue-hello-world-plugin": "workspace:*",
"@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47",
"@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/blocks": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/lit": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/presets": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/store": "0.11.0-nightly-202312120309-2b3d2ba",
"@electron-forge/cli": "^7.2.0",
"@electron-forge/core": "^7.2.0",
"@electron-forge/core-utils": "^7.2.0",
+6 -6
View File
@@ -20,12 +20,12 @@
"devDependencies": {
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@blocksuite/block-std": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/blocks": "0.11.0-nightly-202312070955-2b5bb47",
"@blocksuite/global": "0.11.0-nightly-202312070955-2b5bb47",
"@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/block-std": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/blocks": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/global": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/lit": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/presets": "0.11.0-nightly-202312120309-2b3d2ba",
"@blocksuite/store": "0.11.0-nightly-202312120309-2b3d2ba",
"@testing-library/react": "^14.0.0",
"@toeverything/infra": "workspace:*",
"@types/image-blob-reduce": "^4.1.3",