feat: seperate createDoc and createStore (#11182)
This commit is contained in:
@@ -7,19 +7,20 @@ const params = new URLSearchParams(location.search);
|
||||
export const heavy: InitFn = (collection: Workspace, docId: string) => {
|
||||
const count = Number(params.get('count')) || 1000;
|
||||
|
||||
const doc = collection.createDoc({ id: docId });
|
||||
const doc = collection.createDoc(docId);
|
||||
const store = doc.getStore();
|
||||
doc.load(() => {
|
||||
// Add root block and surface block at root level
|
||||
const rootId = doc.addBlock('affine:page', {
|
||||
const rootId = store.addBlock('affine:page', {
|
||||
title: new Text(),
|
||||
});
|
||||
doc.addBlock('affine:surface', {}, rootId);
|
||||
store.addBlock('affine:surface', {}, rootId);
|
||||
|
||||
// Add note block inside root block
|
||||
const noteId = doc.addBlock('affine:note', {}, rootId);
|
||||
const noteId = store.addBlock('affine:note', {}, rootId);
|
||||
for (let i = 0; i < count; i++) {
|
||||
// Add paragraph block inside note block
|
||||
doc.addBlock(
|
||||
store.addBlock(
|
||||
'affine:paragraph',
|
||||
{
|
||||
text: new Text('Hello, world! ' + i),
|
||||
|
||||
Reference in New Issue
Block a user