fix(editor): can not move carte at the end of inline element (#11558)

Close [BS-2922](https://linear.app/affine-design/issue/BS-2922/【移动端-ios】文档添加linked-page后,无法删除)
This commit is contained in:
L-Sun
2025-04-09 08:07:02 +00:00
parent 9cf5e034bb
commit 06497773a7
6 changed files with 68 additions and 15 deletions

View File

@@ -5,6 +5,11 @@ import { expect, type Locator, type Page } from '@playwright/test';
declare type _GLOBAL_ = typeof BlocksuiteEffects;
const EDGELESS_TOOLBAR_WIDGET = 'edgeless-toolbar-widget';
export const ZERO_WIDTH_SPACE = '\u200C';
export function inlineEditorInnerTextToString(innerText: string): string {
return innerText.replace(ZERO_WIDTH_SPACE, '').trim();
}
export function locateModeSwitchButton(
page: Page,
@@ -62,6 +67,13 @@ export async function focusDocTitle(page: Page, editorIndex = 0) {
await locateDocTitle(page, editorIndex).locator('.inline-editor').focus();
}
export async function assertTitle(page: Page, text: string) {
const title = locateDocTitle(page);
const inlineEditor = title.locator('.doc-title-container').first();
const vText = inlineEditorInnerTextToString(await inlineEditor.innerText());
expect(vText).toBe(text);
}
export function locateToolbar(page: Page, editorIndex = 0) {
return locateEditorContainer(page, editorIndex).locator(
'affine-toolbar-widget editor-toolbar'