mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
23 lines
696 B
TypeScript
23 lines
696 B
TypeScript
import { TestWorkspace } from '@blocksuite/affine/store/test';
|
|
import { getTestStoreManager } from '@blocksuite/integration-test/store';
|
|
|
|
export function createEmptyDoc() {
|
|
const collection = new TestWorkspace();
|
|
collection.storeExtensions = getTestStoreManager().get('store');
|
|
collection.meta.initialize();
|
|
const doc = collection.createDoc();
|
|
const store = doc.getStore();
|
|
|
|
return {
|
|
doc,
|
|
init() {
|
|
doc.load();
|
|
const rootId = store.addBlock('affine:page', {});
|
|
store.addBlock('affine:surface', {}, rootId);
|
|
const noteId = store.addBlock('affine:note', {}, rootId);
|
|
store.addBlock('affine:paragraph', {}, noteId);
|
|
return store;
|
|
},
|
|
};
|
|
}
|