There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat: set the correct mode when loading the page (#1069)
zqran8ee5d422cbd3
diff --git a/.github/CLA.md b/.github/CLA.mdindex 49d32b31d4..98c6d5d557 100644--- a/.github/CLA.md+++ b/.github/CLA.md@@ -47,3 +47,4 @@ Example:- Dark Sky, @darkskygit, 2022/07/22- Lin Onetwo, @linonetwo, 2022/02/14+- zqran, @zqran, 2023/02/17diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsxindex b190324294..25968ee52a 100644--- a/apps/web/src/components/editor/index.tsx+++ b/apps/web/src/components/editor/index.tsx@@ -39,6 +39,7 @@ export const Editor = ({const editor = new EditorContainer();editor.page = page;+ editor.mode = page.meta.mode as typeof editor.mode;editorContainer.current?.appendChild(editor);if (page.isEmpty) {diff --git a/apps/web/src/hooks/use-page-helper.ts b/apps/web/src/hooks/use-page-helper.tsindex 51b2338b8f..b5a364d23a 100644--- a/apps/web/src/hooks/use-page-helper.ts+++ b/apps/web/src/hooks/use-page-helper.ts@@ -62,6 +62,7 @@ export const usePageHelper = (): EditorHandlers => {addedPageId => {currentWorkspace.blocksuiteWorkspace?.setPageMeta(addedPageId, {title,+ mode: 'page',});resolve(addedPageId);}diff --git a/tests/quick-search.spec.ts b/tests/quick-search.spec.tsindex 03f16d68a4..fbb7c78159 100644--- a/tests/quick-search.spec.ts+++ b/tests/quick-search.spec.ts@@ -10,18 +10,24 @@ const openQuickSearchByShortcut = async (page: Page) =>await withCtrlOrMeta(page, () => page.keyboard.press('k', { delay: 50 }));async function assertTitle(page: Page, text: string) {- const locator = page.locator('.affine-default-page-block-title').nth(0);- const actual = await locator.inputValue();- expect(actual).toBe(text);+ const edgeless = page.locator('affine-edgeless-page');+ if (!edgeless) {+ const locator = page.locator('.affine-default-page-block-title').nth(0);+ const actual = await locator.inputValue();+ expect(actual).toBe(text);+ }}async function assertResultList(page: Page, texts: string[]) {const actual = await page.locator('[cmdk-item]').allInnerTexts();expect(actual).toEqual(texts);}async function titleIsFocused(page: Page) {- const title = page.locator('.affine-default-page-block-title');- await expect(title).toBeVisible();- await expect(title).toBeFocused();+ const edgeless = page.locator('affine-edgeless-page');+ if (!edgeless) {+ const title = page.locator('.affine-default-page-block-title');+ await expect(title).toBeVisible();+ await expect(title).toBeFocused();+ }}test.describe('Open quick search', () => {