refactor(editor): add attachments (#11842)

Closes: [BS-3256](https://linear.app/affine-design/issue/BS-3256/重构-add-attachments-方法)
This commit is contained in:
fundon
2025-04-21 09:07:02 +00:00
parent 61ce1123ae
commit e60d5483ad
4 changed files with 83 additions and 107 deletions

View File

@@ -45,7 +45,6 @@ import {
getTextSelectionCommand,
} from '@blocksuite/affine-shared/commands';
import { REFERENCE_NODE } from '@blocksuite/affine-shared/consts';
import { FileSizeLimitService } from '@blocksuite/affine-shared/services';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import {
createDefaultDoc,
@@ -415,9 +414,7 @@ const contentMediaToolGroup: KeyboardToolPanelGroup = {
const file = await openFileOrFiles();
if (!file) return;
const maxFileSize = std.store.get(FileSizeLimitService).maxFileSize;
await addSiblingAttachmentBlocks(std.host, [file], maxFileSize, model);
await addSiblingAttachmentBlocks(std, [file], model);
if (model.text?.length === 0) {
std.store.deleteBlock(model);
}
@@ -1015,9 +1012,7 @@ export const defaultKeyboardToolbarConfig: KeyboardToolbarConfig = {
const file = await openFileOrFiles();
if (!file) return;
const maxFileSize = std.store.get(FileSizeLimitService).maxFileSize;
await addSiblingAttachmentBlocks(std.host, [file], maxFileSize, model);
await addSiblingAttachmentBlocks(std, [file], model);
if (model.text?.length === 0) {
std.store.deleteBlock(model);
}