refactor(editor): cleanup dead code (#9300)

This commit is contained in:
Saul-Mirone
2024-12-25 07:48:00 +00:00
parent 16c59d96d9
commit 7c84545647
17 changed files with 8 additions and 174 deletions

View File

@@ -7,6 +7,7 @@ import { AIChatBlockSpec } from '@affine/core/blocksuite/presets/blocks/ai-chat-
import type { ExtensionType } from '@blocksuite/affine/block-std';
import {
AdapterFactoryExtensions,
AttachmentBlockSpec,
BookmarkBlockSpec,
CodeBlockSpec,
DatabaseBlockSpec,
@@ -28,8 +29,6 @@ import {
RichTextExtensions,
} from '@blocksuite/affine/blocks';
import { CustomAttachmentBlockSpec } from './custom/attachment-block';
const CommonBlockSpecs: ExtensionType[] = [
RefNodeSlotsExtension(),
EditPropsStore,
@@ -47,8 +46,8 @@ const CommonBlockSpecs: ExtensionType[] = [
EmbedHtmlBlockSpec,
EmbedSyncedDocBlockSpec,
EmbedLinkedDocBlockSpec,
AttachmentBlockSpec,
// special
CustomAttachmentBlockSpec,
AdapterFactoryExtensions,
].flat();

View File

@@ -1,50 +0,0 @@
import {
BlockFlavourIdentifier,
BlockServiceIdentifier,
type ExtensionType,
StdIdentifier,
} from '@blocksuite/affine/block-std';
import {
AttachmentBlockService,
AttachmentBlockSpec,
ImageBlockService,
} from '@blocksuite/affine/blocks';
// bytes.parse('2GB')
const MAX_FILE_SIZE = 2147483648;
class CustomAttachmentBlockService extends AttachmentBlockService {
override mounted(): void {
// blocksuite default max file size is 10MB, we override it to 2GB
// but the real place to limit blob size is CloudQuotaModal / LocalQuotaModal
this.maxFileSize = MAX_FILE_SIZE;
super.mounted();
}
}
class CustomImageBlockService extends ImageBlockService {
override mounted(): void {
// blocksuite default max file size is 10MB, we override it to 2GB
// but the real place to limit blob size is CloudQuotaModal / LocalQuotaModal
this.maxFileSize = MAX_FILE_SIZE;
super.mounted();
}
}
export const CustomAttachmentBlockSpec: ExtensionType[] = [
...AttachmentBlockSpec,
{
setup: di => {
di.override(
BlockServiceIdentifier('affine:attachment'),
CustomAttachmentBlockService,
[StdIdentifier, BlockFlavourIdentifier('affine:attachment')]
);
di.override(
BlockServiceIdentifier('affine:image'),
CustomImageBlockService,
[StdIdentifier, BlockFlavourIdentifier('affine:image')]
);
},
},
];