mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
feat(editor): adjust attachment block UI (#11763)
Closes: [BS-3143](https://linear.app/affine-design/issue/BS-3143/更新-attachment-错误样式) Closes: [BS-3341](https://linear.app/affine-design/issue/BS-3341/attachment-select状态ui调整) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved attachment block with unified reactive state handling for loading, errors, and downloads. - Enhanced card layouts with modular rendering and dynamic buttons based on state. - **Bug Fixes** - Fixed UI state for "Embed view" action, now correctly disabled when not embedded. - Resolved attachment card styling issues and text overflow with new utility classes. - **Refactor** - Streamlined attachment block rendering and state management for better performance and maintainability. - Updated toolbar configuration for consistent parameter naming. - Simplified embedded and open methods for improved clarity. - Made internal functions private to reduce exported API surface. - **Chores** - Removed unused icon export and legacy upload tracking functions. - Updated attachment utilities to use reactive state, added data refresh, and improved error handling. - Refined image dimension handling for consistent resizing behavior. - Improved test selectors to target focused attachment containers for better reliability. - Refactored CSS to separate container and card styling and adopt theme-based colors consistently. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -306,7 +306,9 @@ test('should enable pointer event in pdf viewer', async ({ page }) => {
|
||||
const attachment = page.locator('affine-attachment');
|
||||
await attachment.click();
|
||||
|
||||
const attachmentSelection = attachment.locator('affine-block-selection');
|
||||
const attachmentSelection = attachment.locator(
|
||||
'.affine-attachment-container.focused'
|
||||
);
|
||||
|
||||
const toolbar = locateToolbar(page);
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ test(`support dragging attachment block directly`, async ({
|
||||
await page.mouse.move(rect.x + 40, rect.y + rect.height + 80, { steps: 20 });
|
||||
await page.mouse.up();
|
||||
|
||||
const rects = page.locator('affine-block-selection').locator('visible=true');
|
||||
const rects = page.locator('.affine-attachment-container.focused');
|
||||
await expect(rects).toHaveCount(1);
|
||||
expect(await getPageSnapshot(page, true)).toMatchSnapshot(
|
||||
`${testInfo.title}_3.json`
|
||||
|
||||
Reference in New Issue
Block a user