mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
Close [BS-2922](https://linear.app/affine-design/issue/BS-2922/【移动端-ios】文档添加linked-page后,无法删除)
26 lines
698 B
TypeScript
26 lines
698 B
TypeScript
import type { Page } from '@playwright/test';
|
|
|
|
export async function getStringFromRichText(
|
|
page: Page,
|
|
index = 0
|
|
): Promise<string> {
|
|
await page.waitForTimeout(50);
|
|
return page.evaluate(
|
|
([index]) => {
|
|
const editorHost = document.querySelector('editor-host');
|
|
const richTexts = editorHost?.querySelectorAll('rich-text');
|
|
|
|
if (!richTexts) {
|
|
throw new Error('Cannot find rich-text');
|
|
}
|
|
|
|
const editor = (richTexts[index] as any).inlineEditor;
|
|
return editor.yText.toString();
|
|
},
|
|
[index]
|
|
);
|
|
}
|
|
|
|
// Why? we can't import from `@blocksuite/affine/std/inline` because playwright will throw an error
|
|
export const ZERO_WIDTH_SPACE = '\u200C';
|