Skip to content

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.

fix(web): minor bug fixes (#9696)

Olege3fac97b9bb7
diff --git a/blocksuite/affine/shared/src/consts/bracket-pairs.ts b/blocksuite/affine/shared/src/consts/bracket-pairs.ts
index 1ff9bde2f5..0456231fc6 100644
--- a/blocksuite/affine/shared/src/consts/bracket-pairs.ts
+++ b/blocksuite/affine/shared/src/consts/bracket-pairs.ts
@@ -30,11 +30,6 @@ export const BRACKET_PAIRS: BracketPair[] = [
left: '"',
right: '"',
},
- {
- name: 'angle bracket',
- left: '<',
- right: '>',
- },
{
name: 'fullwidth single quote',
left: '‘',
diff --git a/blocksuite/blocks/src/_common/transformers/zip.ts b/blocksuite/blocks/src/_common/transformers/zip.ts
index e44549a68d..97a1f24043 100644
--- a/blocksuite/blocks/src/_common/transformers/zip.ts
+++ b/blocksuite/blocks/src/_common/transformers/zip.ts
@@ -26,7 +26,7 @@ async function exportDocs(collection: Workspace, docs: Store[]) {
snapshots
.filter((snapshot): snapshot is DocSnapshot => !!snapshot)
.map(async snapshot => {
- const snapshotName = `${snapshot.meta.id}.snapshot.json`;
+ const snapshotName = `${snapshot.meta.title || 'untitled'}.snapshot.json`;
await zip.file(snapshotName, JSON.stringify(snapshot, null, 2));
})
);
diff --git a/packages/frontend/core/src/components/doc-properties/menu/edit-doc-property.tsx b/packages/frontend/core/src/components/doc-properties/menu/edit-doc-property.tsx
index ad062c6c9b..a2a4a471d0 100644
--- a/packages/frontend/core/src/components/doc-properties/menu/edit-doc-property.tsx
+++ b/packages/frontend/core/src/components/doc-properties/menu/edit-doc-property.tsx
@@ -153,6 +153,8 @@ export const EditDocPropertyMenuItems = ({
onChange={handleNameChange}
placeholder={t['unnamed']()}
onKeyDown={onKeyDown}
+ size="large"
+ style={{ borderRadius: 4 }}
/>
)}
</div>
diff --git a/tests/affine-local/e2e/blocksuite/code/crud.spec.ts b/tests/affine-local/e2e/blocksuite/code/crud.spec.ts
new file mode 100644
index 0000000000..f6b65a5025
--- /dev/null
+++ b/tests/affine-local/e2e/blocksuite/code/crud.spec.ts
@@ -0,0 +1,14 @@
+import { test } from '@affine-test/kit/playwright';
+import { expect } from '@playwright/test';
+
+import { initCodeBlockByOneStep } from './utils';
+
+test.describe('Code Block Autocomplete Operations', () => {
+ test('angle brackets are not supported', async ({ page }) => {
+ // open the home page and insert the code block
+ await initCodeBlockByOneStep(page);
+ await page.keyboard.type('<');
+ const codeUnit = page.locator('affine-code-unit');
+ await expect(codeUnit).toHaveText('<');
+ });
+});
diff --git a/tests/affine-local/e2e/blocksuite/code/utils.ts b/tests/affine-local/e2e/blocksuite/code/utils.ts
new file mode 100644
index 0000000000..c069f440af
--- /dev/null
+++ b/tests/affine-local/e2e/blocksuite/code/utils.ts
@@ -0,0 +1,23 @@
+import { openHomePage } from '@affine-test/kit/utils/load-page';
+import {
+ addCodeBlock,
+ clickNewPageButton,
+ waitForEditorLoad,
+} from '@affine-test/kit/utils/page-logic';
+import type { Page } from '@playwright/test';
+
+export const gotoContentFromTitle = async (page: Page) => {
+ await page.keyboard.press('Enter');
+};
+
+export const createNewPage = async (page: Page) => {
+ await clickNewPageButton(page);
+};
+
+export const initCodeBlockByOneStep = async (page: Page) => {
+ await openHomePage(page);
+ await createNewPage(page);
+ await waitForEditorLoad(page);
+ await gotoContentFromTitle(page);
+ await addCodeBlock(page);
+};
diff --git a/tests/kit/src/utils/page-logic.ts b/tests/kit/src/utils/page-logic.ts
index 879cb5f1fd..baab2d12d5 100644
--- a/tests/kit/src/utils/page-logic.ts
+++ b/tests/kit/src/utils/page-logic.ts
@@ -230,6 +230,13 @@ export const addDatabase = async (page: Page, title?: string) => {
}
};
+export const addCodeBlock = async (page: Page) => {
+ await page.keyboard.press('/');
+ await expect(page.locator('affine-slash-menu .slash-menu')).toBeVisible();
+ await page.keyboard.type('code');
+ await page.getByTestId('Code Block').click();
+};
+
export const addDatabaseRow = async (page: Page, databaseTitle: string) => {
const db = page.locator(`affine-database-table`, {
has: page.locator(`affine-database-title:has-text("${databaseTitle}")`),