mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 03:26:47 +08:00
feat(editor): improve api for store, and add docs (#10941)
This commit is contained in:
@@ -21,7 +21,7 @@ export function useReferenceLinkHelper(docCollection: Workspace) {
|
||||
},
|
||||
},
|
||||
] as DeltaInsert<AffineTextAttributes>[]);
|
||||
const [frame] = page.getBlockByFlavour('affine:note');
|
||||
const [frame] = page.getModelsByFlavour('affine:note');
|
||||
|
||||
frame && page.addBlock('affine:paragraph', { text }, frame.id);
|
||||
},
|
||||
|
||||
+3
-3
@@ -44,12 +44,12 @@ describe('useBlockSuitePagePreview', () => {
|
||||
{
|
||||
text: new Text('Hello, world!'),
|
||||
},
|
||||
page.getBlockByFlavour('affine:note')[0].id
|
||||
page.getModelsByFlavour('affine:note')[0].id
|
||||
);
|
||||
const hook = renderHook(() => useAtomValue(useBlockSuitePagePreview(page)));
|
||||
expect(hook.result.current).toBe('Hello, world!');
|
||||
page.transact(() => {
|
||||
page.getBlockById(id)!.text!.insert('Test', 0);
|
||||
page.getModelById(id)!.text!.insert('Test', 0);
|
||||
});
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
hook.rerender();
|
||||
@@ -61,7 +61,7 @@ describe('useBlockSuitePagePreview', () => {
|
||||
{
|
||||
text: new Text('First block!'),
|
||||
},
|
||||
page.getBlockByFlavour('affine:note')[0].id,
|
||||
page.getModelsByFlavour('affine:note')[0].id,
|
||||
0
|
||||
);
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
Reference in New Issue
Block a user