feat: compatiable with async importMarkdown()

This commit is contained in:
x1a0t 2023-01-06 15:03:42 +08:00
parent cc13bf8265
commit b1a39fa2e7
2 changed files with 6 additions and 3 deletions

View File

@ -26,7 +26,7 @@ export const usePropsUpdated: UsePropsUpdated = () => {
return () => {
callbackQueue.current = [];
editor?.model?.propsUpdated.dispose();
editor?.model?.propsUpdated?.dispose();
};
}, [editor]);

View File

@ -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();
}