mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
refactor(editor): move block-specific extensions to their respective modules (#11907)
### TL;DR Refactored extension registration to follow a more modular approach by moving extensions to their respective block packages. ### What changed? - Removed centralized registration of several extensions from `store.ts` in the main package - Moved the following extensions to their respective block packages: - `CodeMarkdownPreprocessorExtension` to the code block package - `LatexMarkdownPreprocessorExtension` to the latex block package - `EmbedIframeConfigExtensions` and `EmbedIframeService` to the embed block package - `ImageStoreSpec` removed from central registration - Cleaned up unused arrays and imports in the main store file - Removed empty `defaultBlockPlainTextAdapterMatchers` array ### How to test? 1. Verify that markdown preprocessing for code and latex blocks still works correctly 2. Check that iframe embeds function properly 3. Ensure image handling continues to work as expected 4. Test import/export functionality for all affected block types ### Why make this change? This change improves code organization by following a more modular architecture where each block package is responsible for registering its own extensions. This approach reduces coupling between packages, makes the codebase more maintainable, and follows the principle that extensions should be registered where they are defined.
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
import { CodeBlockSchemaExtension } from '@blocksuite/affine-model';
|
||||
|
||||
import { CodeBlockAdapterExtensions } from './adapters/extension';
|
||||
import { CodeMarkdownPreprocessorExtension } from './adapters/markdown/preprocessor';
|
||||
|
||||
export class CodeStoreExtension extends StoreExtensionProvider {
|
||||
override name = 'affine-code-block';
|
||||
@@ -13,5 +14,6 @@ export class CodeStoreExtension extends StoreExtensionProvider {
|
||||
super.setup(context);
|
||||
context.register(CodeBlockSchemaExtension);
|
||||
context.register(CodeBlockAdapterExtensions);
|
||||
context.register(CodeMarkdownPreprocessorExtension);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user