mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 03:26:47 +08:00
fix(editor): callout delete merge and slash menu (#13597)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Press Enter inside a callout splits the paragraph at the cursor into a new focused paragraph. - Clicking an empty callout inserts and focuses a new paragraph; emoji menu behavior unchanged. - New command to convert a callout paragraph to callout/selection flow for Backspace handling. - New native API: ShareableContent.isUsingMicrophone(processId). - Bug Fixes - Backspace inside callout paragraphs now merges or deletes text predictably and selects the callout when appropriate. - Style - Callout layout refined: top-aligned content and adjusted emoji spacing. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
pressArrowUp,
|
||||
pressBackspace,
|
||||
pressEnter,
|
||||
undoByKeyboard,
|
||||
} from '@affine-test/kit/utils/keyboard';
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import {
|
||||
@@ -30,7 +29,7 @@ test('add callout block using slash menu and change emoji', async ({
|
||||
await expect(emoji).toContainText('😀');
|
||||
|
||||
const paragraph = page.locator('affine-callout affine-paragraph');
|
||||
await expect(paragraph).toHaveCount(1);
|
||||
await expect(paragraph).toHaveCount(2);
|
||||
|
||||
const vLine = page.locator('affine-callout v-line');
|
||||
await expect(vLine).toHaveCount(2);
|
||||
@@ -50,22 +49,6 @@ test('add callout block using slash menu and change emoji', async ({
|
||||
await expect(emoji).toContainText('😆');
|
||||
});
|
||||
|
||||
test('disable slash menu in callout block', async ({ page }) => {
|
||||
await type(page, '/callout\n');
|
||||
const callout = page.locator('affine-callout');
|
||||
const emoji = page.locator('affine-callout .affine-callout-emoji');
|
||||
await expect(callout).toBeVisible();
|
||||
await expect(emoji).toContainText('😀');
|
||||
|
||||
await type(page, '/');
|
||||
const slashMenu = page.locator('.slash-menu');
|
||||
await expect(slashMenu).not.toBeVisible();
|
||||
await undoByKeyboard(page);
|
||||
await undoByKeyboard(page);
|
||||
await type(page, '/');
|
||||
await expect(slashMenu).toBeVisible();
|
||||
});
|
||||
|
||||
test('press backspace after callout block', async ({ page }) => {
|
||||
await pressEnter(page);
|
||||
await pressArrowUp(page);
|
||||
@@ -96,7 +79,7 @@ test('press backspace in callout block', async ({ page }) => {
|
||||
expect(await callout.count()).toBe(1);
|
||||
|
||||
await pressBackspace(page);
|
||||
await expect(paragraph).toHaveCount(2);
|
||||
await expect(paragraph).toHaveCount(1);
|
||||
await expect(callout).toHaveCount(1);
|
||||
|
||||
await pressBackspace(page);
|
||||
|
||||
Reference in New Issue
Block a user