mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-02 06:39:46 +08:00
93b1d6c729
Related to: [BS-3143](https://linear.app/affine-design/issue/BS-3143/更新-loading-和错误样式) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a unified resource controller for managing image and attachment resources, providing improved loading, error, and state handling. - Added a visual loading indicator overlay to image blocks for better feedback during image loading. - **Improvements** - Simplified and centralized image and attachment state management, reducing redundant properties and manual state tracking. - Updated fallback UI for image blocks with clearer titles, descriptions, and improved layout. - Enhanced batch image block creation and download handling for improved efficiency. - Refined image block accessibility with improved alt text and streamlined rendering logic. - Centralized target model selection for image insertion in AI actions. - Reordered CSS declarations without affecting styling. - Improved reactive state tracking for blob upload/download operations in mock server. - **Bug Fixes** - Improved cleanup of object URLs to prevent resource leaks. - Adjusted toolbar logic to more accurately reflect available actions based on image state. - **Tests** - Updated end-to-end tests to match new UI text and behaviors for image loading and error states. - **Chores** - Refactored internal logic and updated comments for clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
151 lines
3.2 KiB
TypeScript
151 lines
3.2 KiB
TypeScript
import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';
|
|
import { css } from 'lit';
|
|
|
|
export const styles = css`
|
|
.affine-attachment-container {
|
|
border-radius: 8px;
|
|
box-sizing: border-box;
|
|
user-select: none;
|
|
overflow: hidden;
|
|
border: 1px solid ${unsafeCSSVarV2('layer/background/tertiary')};
|
|
background: ${unsafeCSSVarV2('layer/background/primary')};
|
|
|
|
&.focused {
|
|
border-color: ${unsafeCSSVarV2('layer/insideBorder/primaryBorder')};
|
|
}
|
|
}
|
|
|
|
.affine-attachment-card {
|
|
display: flex;
|
|
gap: 12px;
|
|
padding: 12px;
|
|
}
|
|
|
|
.affine-attachment-content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 12px;
|
|
flex: 1 0 0;
|
|
min-width: 0;
|
|
}
|
|
|
|
.truncate {
|
|
align-self: stretch;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.affine-attachment-content-title {
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: 8px;
|
|
align-items: center;
|
|
align-self: stretch;
|
|
}
|
|
|
|
.affine-attachment-content-title-icon {
|
|
display: flex;
|
|
width: 16px;
|
|
height: 16px;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--affine-text-primary-color);
|
|
}
|
|
|
|
.affine-attachment-content-title-text {
|
|
color: var(--affine-text-primary-color);
|
|
font-family: var(--affine-font-family);
|
|
font-size: var(--affine-font-sm);
|
|
font-style: normal;
|
|
font-weight: 600;
|
|
line-height: 22px;
|
|
}
|
|
|
|
.affine-attachment-content-description {
|
|
display: flex;
|
|
align-items: center;
|
|
align-self: stretch;
|
|
gap: 8px;
|
|
}
|
|
|
|
.affine-attachment-content-info {
|
|
color: var(--affine-text-secondary-color);
|
|
font-family: var(--affine-font-family);
|
|
font-size: var(--affine-font-xs);
|
|
font-style: normal;
|
|
font-weight: 400;
|
|
line-height: 20px;
|
|
}
|
|
|
|
.affine-attachment-content-button {
|
|
display: flex;
|
|
height: 20px;
|
|
align-items: center;
|
|
align-self: stretch;
|
|
gap: 4px;
|
|
white-space: nowrap;
|
|
padding: 0 4px;
|
|
color: ${unsafeCSSVarV2('button/primary')};
|
|
font-family: var(--affine-font-family);
|
|
font-size: var(--affine-font-xs);
|
|
font-style: normal;
|
|
font-weight: 500;
|
|
line-height: 20px;
|
|
|
|
svg {
|
|
font-size: 16px;
|
|
}
|
|
}
|
|
|
|
.affine-attachment-banner {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.affine-attachment-card.loading {
|
|
.affine-attachment-content-title-text {
|
|
color: var(--affine-placeholder-color);
|
|
}
|
|
}
|
|
|
|
.affine-attachment-card.error {
|
|
.affine-attachment-content-title-icon {
|
|
color: ${unsafeCSSVarV2('status/error')};
|
|
}
|
|
}
|
|
|
|
.affine-attachment-card.loading,
|
|
.affine-attachment-card.error {
|
|
background: ${unsafeCSSVarV2('layer/background/secondary')};
|
|
}
|
|
|
|
.affine-attachment-card.cubeThick {
|
|
flex-direction: column-reverse;
|
|
|
|
.affine-attachment-content {
|
|
width: 100%;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.affine-attachment-banner {
|
|
justify-content: space-between;
|
|
}
|
|
}
|
|
|
|
.affine-attachment-embed-container {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.affine-attachment-embed-event-mask {
|
|
position: absolute;
|
|
inset: 0;
|
|
}
|
|
`;
|