mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 09:21:24 +08:00
refactor(editor): remove attachment and image block service (#9909)
This commit is contained in:
@@ -45,6 +45,7 @@ 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,
|
||||
@@ -436,9 +437,7 @@ const contentMediaToolGroup: KeyboardToolPanelGroup = {
|
||||
const file = await openFileOrFiles();
|
||||
if (!file) return;
|
||||
|
||||
const attachmentService = std.getService('affine:attachment');
|
||||
if (!attachmentService) return;
|
||||
const maxFileSize = attachmentService.maxFileSize;
|
||||
const maxFileSize = std.store.get(FileSizeLimitService).maxFileSize;
|
||||
|
||||
await addSiblingAttachmentBlocks(std.host, [file], maxFileSize, model);
|
||||
if (model.text?.length === 0) {
|
||||
@@ -994,9 +993,7 @@ export const defaultKeyboardToolbarConfig: KeyboardToolbarConfig = {
|
||||
const file = await openFileOrFiles();
|
||||
if (!file) return;
|
||||
|
||||
const attachmentService = std.getService('affine:attachment');
|
||||
if (!attachmentService) return;
|
||||
const maxFileSize = attachmentService.maxFileSize;
|
||||
const maxFileSize = std.store.get(FileSizeLimitService).maxFileSize;
|
||||
|
||||
await addSiblingAttachmentBlocks(std.host, [file], maxFileSize, model);
|
||||
if (model.text?.length === 0) {
|
||||
|
||||
@@ -51,6 +51,7 @@ import {
|
||||
import { REFERENCE_NODE } from '@blocksuite/affine-shared/consts';
|
||||
import {
|
||||
FeatureFlagService,
|
||||
FileSizeLimitService,
|
||||
TelemetryProvider,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import {
|
||||
@@ -324,10 +325,8 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
|
||||
const file = await openFileOrFiles();
|
||||
if (!file) return;
|
||||
|
||||
const attachmentService =
|
||||
rootComponent.std.getService('affine:attachment');
|
||||
if (!attachmentService) return;
|
||||
const maxFileSize = attachmentService.maxFileSize;
|
||||
const maxFileSize =
|
||||
rootComponent.std.store.get(FileSizeLimitService).maxFileSize;
|
||||
|
||||
await addSiblingAttachmentBlocks(
|
||||
rootComponent.host,
|
||||
|
||||
Reference in New Issue
Block a user