feat(core): unused blob management in settings (#9795)

fix AF-2144, PD-2064, PD-2065, PD-2066
This commit is contained in:
pengx17
2025-01-23 07:12:16 +00:00
parent 8021b89944
commit 6ac6a8d6d6
26 changed files with 846 additions and 30 deletions

View File

@@ -3,7 +3,7 @@ import { CaptionedBlockComponent } from '@blocksuite/affine-components/caption';
import { HoverController } from '@blocksuite/affine-components/hover';
import {
AttachmentIcon16,
getAttachmentFileIcons,
getAttachmentFileIcon,
} from '@blocksuite/affine-components/icons';
import { Peekable } from '@blocksuite/affine-components/peek';
import { toast } from '@blocksuite/affine-components/toast';
@@ -226,7 +226,7 @@ export class AttachmentBlockComponent extends CaptionedBlockComponent<
const infoText = this.error ? 'File loading failed.' : humanFileSize(size);
const fileType = name.split('.').pop() ?? '';
const FileTypeIcon = getAttachmentFileIcons(fileType);
const FileTypeIcon = getAttachmentFileIcon(fileType);
const embedView = this.embedView;

View File

@@ -1,6 +1,6 @@
import { html } from 'lit';
export function getAttachmentFileIcons(filetype: string) {
export function getAttachmentFileIcon(filetype: string) {
switch (filetype) {
case 'img':
return IMGFileIcon;

View File

@@ -7,7 +7,7 @@ import { DualLinkIcon, LinkIcon } from '@blocksuite/icons/lit';
import { css, html, LitElement, type TemplateResult } from 'lit';
import { property } from 'lit/decorators.js';
import { getAttachmentFileIcons } from '../../../../../icons';
import { getAttachmentFileIcon } from '../../../../../icons';
import { RefNodeSlotsProvider } from '../../../../extension/ref-node-slots';
export class FootNotePopup extends WithDisposable(LitElement) {
@@ -34,7 +34,7 @@ export class FootNotePopup extends WithDisposable(LitElement) {
if (!fileType) {
return undefined;
}
return getAttachmentFileIcons(fileType);
return getAttachmentFileIcon(fileType);
}
return undefined;
};

View File

@@ -1,7 +1,7 @@
/* oxlint-disable @typescript-eslint/no-non-null-assertion */
import type { AttachmentBlockModel } from '@blocksuite/affine-model';
import { humanFileSize } from '@blocksuite/affine-shared/utils';
import { getAttachmentFileIcons } from '@blocksuite/blocks';
import { getAttachmentFileIcon } from '@blocksuite/blocks';
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
import {
ArrowDownBigIcon,
@@ -155,7 +155,7 @@ export class AttachmentViewerPanel extends SignalWatcher(
const { name, size } = model;
const fileType = name.split('.').pop() ?? '';
const icon = getAttachmentFileIcons(fileType);
const icon = getAttachmentFileIcon(fileType);
const isPDF = fileType === 'pdf';
this.#fileInfo.value = {