mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 03:56:23 +08:00
Merge pull request #678 from toeverything/0106/surface
feat: compat with surface block structure
This commit is contained in:
@@ -22,14 +22,14 @@ export const EditorHeader = () => {
|
||||
|
||||
useEffect(() => {
|
||||
onPropsUpdated(editor => {
|
||||
setTitle(editor.model?.title || 'Untitled');
|
||||
setTitle(editor.pageBlockModel?.title || 'Untitled');
|
||||
});
|
||||
}, [onPropsUpdated]);
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
// If first time in, need to wait for editor to be inserted into DOM
|
||||
setTitle(editor?.model?.title || 'Untitled');
|
||||
setTitle(editor?.pageBlockModel?.title || 'Untitled');
|
||||
}, 300);
|
||||
}, [editor]);
|
||||
|
||||
|
||||
@@ -31,9 +31,10 @@ export const ImportModal = ({ open, onClose }: ImportModalProps) => {
|
||||
setTimeout(() => {
|
||||
const editor = document.querySelector('editor-container');
|
||||
if (editor) {
|
||||
const groupId = page.addBlock({ flavour: 'affine:group' }, pageId);
|
||||
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, `${groupId}`);
|
||||
editor.clipboard.importMarkdown(template.source, `${frameId}`);
|
||||
page.resetHistory();
|
||||
editor.requestUpdate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user