fix(editor): improve pdf embed viewer UX (#11641)

Closes: [BS-3101](https://linear.app/affine-design/issue/BS-3101/pdf-embed-模式的选中框选-和点开看详情有比较大的问题)

### What's Changed!

* Fixed disable pointer event in native pdf viewer by dragging
* Disable opening peek view with pdf viewer in readonly and sharing modes
This commit is contained in:
fundon
2025-04-15 08:51:02 +00:00
parent 0df584bd5e
commit 8ca675b2ec
8 changed files with 203 additions and 61 deletions

View File

@@ -0,0 +1,21 @@
import type { Page } from '@playwright/test';
import { Path } from '../playwright';
const fixturesDir = Path.dir(import.meta.url).join('../../../fixtures');
export async function importAttachment(page: Page, file: string) {
await page.evaluate(() => {
// Force fallback to input[type=file] in tests
// See https://github.com/microsoft/playwright/issues/8850
window.showOpenFilePicker = undefined;
});
const fileChooser = page.waitForEvent('filechooser');
// open slash menu
await page.keyboard.type('/attachment', { delay: 50 });
await page.keyboard.press('Enter');
await (await fileChooser).setFiles(fixturesDir.join(file).value);
}