mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-06 08:50:50 +08:00
feat: make import button visible
This commit is contained in:
@@ -29,14 +29,21 @@ export const ImportModal = ({ open, onClose }: ImportModalProps) => {
|
|||||||
currentWorkspace?.blocksuiteWorkspace?.setPageMeta(page.id, { title });
|
currentWorkspace?.blocksuiteWorkspace?.setPageMeta(page.id, { title });
|
||||||
if (page && page.root === null) {
|
if (page && page.root === null) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const editor = document.querySelector('editor-container');
|
try {
|
||||||
if (editor) {
|
const editor = document.querySelector('editor-container');
|
||||||
page.addBlock({ flavour: 'affine:surface' }, null);
|
if (editor) {
|
||||||
const frameId = page.addBlock({ flavour: 'affine:frame' }, pageId);
|
page.addBlock({ flavour: 'affine:surface' }, null);
|
||||||
// TODO blocksuite should offer a method to import markdown from store
|
const frameId = page.addBlock(
|
||||||
editor.clipboard.importMarkdown(template.source, `${frameId}`);
|
{ flavour: 'affine:frame' },
|
||||||
page.resetHistory();
|
pageId
|
||||||
editor.requestUpdate();
|
);
|
||||||
|
// TODO blocksuite should offer a method to import markdown from store
|
||||||
|
editor.clipboard.importMarkdown(template.source, `${frameId}`);
|
||||||
|
page.resetHistory();
|
||||||
|
editor.requestUpdate();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
@@ -98,13 +105,13 @@ export const ImportModal = ({ open, onClose }: ImportModalProps) => {
|
|||||||
>
|
>
|
||||||
Markdown
|
Markdown
|
||||||
</Button>
|
</Button>
|
||||||
{/* <Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
_handleAppleTemplateFromFilePicker();
|
_handleAppleTemplateFromFilePicker();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
HTML
|
HTML
|
||||||
</Button> */}
|
</Button>
|
||||||
</StyledButtonWrapper>
|
</StyledButtonWrapper>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user