mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 21:06:22 +08:00
feat: compatiable with async importMarkdown()
This commit is contained in:
@@ -26,7 +26,7 @@ export const usePropsUpdated: UsePropsUpdated = () => {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
callbackQueue.current = [];
|
callbackQueue.current = [];
|
||||||
editor?.model?.propsUpdated.dispose();
|
editor?.model?.propsUpdated?.dispose();
|
||||||
};
|
};
|
||||||
}, [editor]);
|
}, [editor]);
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,16 @@ const All = () => {
|
|||||||
if (page) {
|
if (page) {
|
||||||
currentWorkspace?.setPageMeta(page.id, { title });
|
currentWorkspace?.setPageMeta(page.id, { title });
|
||||||
if (page && page.root === null) {
|
if (page && page.root === null) {
|
||||||
setTimeout(() => {
|
setTimeout(async () => {
|
||||||
const editor = document.querySelector('editor-container');
|
const editor = document.querySelector('editor-container');
|
||||||
if (editor) {
|
if (editor) {
|
||||||
page.addBlock({ flavour: 'affine:surface' }, null);
|
page.addBlock({ flavour: 'affine:surface' }, null);
|
||||||
const frameId = page.addBlock({ flavour: 'affine:frame' }, pageId);
|
const frameId = page.addBlock({ flavour: 'affine:frame' }, pageId);
|
||||||
// TODO blocksuite should offer a method to import markdown from store
|
// 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();
|
page.resetHistory();
|
||||||
editor.requestUpdate();
|
editor.requestUpdate();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user