Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: compatiable with async importMarkdown()

x1a0tb1a39fa2e77a
diff --git a/packages/app/src/hooks/use-props-updated.ts b/packages/app/src/hooks/use-props-updated.ts
index ad6fc2525a..f0df6ffd49 100644
--- a/packages/app/src/hooks/use-props-updated.ts
+++ b/packages/app/src/hooks/use-props-updated.ts
@@ -26,7 +26,7 @@ export const usePropsUpdated: UsePropsUpdated = () => {
return () => {
callbackQueue.current = [];
- editor?.model?.propsUpdated.dispose();
+ editor?.model?.propsUpdated?.dispose();
};
}, [editor]);
diff --git a/packages/app/src/pages/playground/templates.tsx b/packages/app/src/pages/playground/templates.tsx
index d32cbaa3f5..a83d25e516 100644
--- a/packages/app/src/pages/playground/templates.tsx
+++ b/packages/app/src/pages/playground/templates.tsx
@@ -43,13 +43,16 @@ const All = () => {
if (page) {
currentWorkspace?.setPageMeta(page.id, { title });
if (page && page.root === null) {
- setTimeout(() => {
+ setTimeout(async () => {
const editor = document.querySelector('editor-container');
if (editor) {
page.addBlock({ flavour: 'affine:surface' }, null);
const frameId = page.addBlock({ flavour: 'affine:frame' }, pageId);
// TODO blocksuite should offer a method to import markdown from store
- editor.clipboard.importMarkdown(template.source, `${frameId}`);
+ await editor.clipboard.importMarkdown(
+ template.source,
+ `${frameId}`
+ );
page.resetHistory();
editor.requestUpdate();
}