mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
chore: bump version (#1618)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { ContentParser } from '@blocksuite/blocks/content-parser';
|
||||
import type {
|
||||
GetStaticPaths,
|
||||
GetStaticProps,
|
||||
@@ -61,22 +62,16 @@ const PreviewPage: NextPage<PreviewPageProps> = ({
|
||||
pageId="preview"
|
||||
onInit={(page, editor) => {
|
||||
blockSuiteWorkspace.setPageMeta(page.id, { title });
|
||||
const pageBlockId = page.addBlockByFlavour('affine:page', {
|
||||
const pageBlockId = page.addBlock('affine:page', {
|
||||
title: new page.Text(title),
|
||||
});
|
||||
page.addBlockByFlavour('affine:surface', {}, null);
|
||||
const frameId = page.addBlockByFlavour(
|
||||
'affine:frame',
|
||||
{},
|
||||
pageBlockId
|
||||
);
|
||||
page.addBlockByFlavour('affine:paragraph', {}, frameId);
|
||||
setTimeout(() => {
|
||||
// hotfix: contentParser.importMarkdown is not working in the first render
|
||||
editor.contentParser.importMarkdown(text, frameId).then(() => {
|
||||
page.resetHistory();
|
||||
});
|
||||
}, 0);
|
||||
page.addBlock('affine:surface', {}, null);
|
||||
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
|
||||
page.addBlock('affine:paragraph', {}, frameId);
|
||||
const contentParser = new ContentParser(page);
|
||||
contentParser.importMarkdown(text, frameId).then(() => {
|
||||
page.resetHistory();
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<StyledToolWrapper>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useTranslation } from '@affine/i18n';
|
||||
import { FolderIcon } from '@blocksuite/icons';
|
||||
import { assertExists, nanoid } from '@blocksuite/store';
|
||||
import { assertEquals, assertExists, nanoid } from '@blocksuite/store';
|
||||
import Head from 'next/head';
|
||||
import { useRouter } from 'next/router';
|
||||
import React, { useCallback, useEffect } from 'react';
|
||||
@@ -44,14 +44,12 @@ const AllPage: NextPageWithLayout = () => {
|
||||
if (currentWorkspace.blockSuiteWorkspace.isEmpty) {
|
||||
// this is a new workspace, so we should redirect to the new page
|
||||
const pageId = nanoid();
|
||||
currentWorkspace.blockSuiteWorkspace.slots.pageAdded.once(id => {
|
||||
currentWorkspace.blockSuiteWorkspace.setPageMeta(id, {
|
||||
init: true,
|
||||
});
|
||||
assertExists(pageId, id);
|
||||
jumpToPage(currentWorkspace.id, pageId);
|
||||
const page = currentWorkspace.blockSuiteWorkspace.createPage(pageId);
|
||||
assertEquals(page.id, pageId);
|
||||
currentWorkspace.blockSuiteWorkspace.setPageMeta(page.id, {
|
||||
init: true,
|
||||
});
|
||||
currentWorkspace.blockSuiteWorkspace.createPage(pageId);
|
||||
jumpToPage(currentWorkspace.id, pageId);
|
||||
}
|
||||
};
|
||||
provider.callbacks.add(callback);
|
||||
|
||||
Reference in New Issue
Block a user