chore: merge blocksuite source code (#9213)

This commit is contained in:
Mirone
2024-12-20 15:38:06 +08:00
committed by GitHub
parent 2c9ef916f4
commit 30200ff86d
2031 changed files with 238888 additions and 229 deletions

View File

@@ -0,0 +1,35 @@
import { type DocCollection, Text } from '@blocksuite/store';
import type { InitFn } from './utils.js';
const params = new URLSearchParams(location.search);
export const heavy: InitFn = (collection: DocCollection, docId: string) => {
const count = Number(params.get('count')) || 1000;
const doc = collection.createDoc({ id: docId });
doc.load(() => {
// Add root block and surface block at root level
const rootId = doc.addBlock('affine:page', {
title: new Text(),
});
doc.addBlock('affine:surface', {}, rootId);
// Add note block inside root block
const noteId = doc.addBlock('affine:note', {}, rootId);
for (let i = 0; i < count; i++) {
// Add paragraph block inside note block
doc.addBlock(
'affine:paragraph',
{
text: new Text('Hello, world! ' + i),
},
noteId
);
}
});
};
heavy.id = 'heavy';
heavy.displayName = 'Heavy Example';
heavy.description = 'Heavy example on thousands of paragraph blocks';