mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
refactor: reorganize specs and adapter extensions (#10359)
### TL;DR Refactored `SpecProvider` singleton access pattern and reorganized adapter/extension code structure. ### What changed? - Changed `SpecProvider.getInstance()` to `SpecProvider._` for cleaner singleton access - Moved adapter/extension code from `_common` directory to dedicated `adapters` and `extensions` folders - Consolidated adapter extensions into a single file - Removed unused dependencies from package.json - Deleted unnecessary schema files - Extracted `MobileSpecsPatches` class into the mobile patching code - Updated all references to use the new `SpecProvider._` accessor ### How to test? - Verify all specs are properly registered and accessible via `SpecProvider._` - Test adapter functionality for HTML, Markdown, Notion HTML and plain text - Check mobile-specific features and patches work correctly - Ensure preview functionality works in both page and edgeless modes ### Why make this change? - Improves code organization by properly separating adapters and extensions - Simplifies singleton access pattern - Removes unnecessary dependencies and files - Makes the codebase more maintainable by consolidating related functionality
This commit is contained in:
@@ -5,8 +5,7 @@ import { TestWorkspace } from '@blocksuite/store/test';
|
||||
export function createEmptyDoc() {
|
||||
const schema = new Schema().register(AffineSchemas);
|
||||
const collection = new TestWorkspace({ schema });
|
||||
collection.storeExtensions =
|
||||
SpecProvider.getInstance().getSpec('store').value;
|
||||
collection.storeExtensions = SpecProvider._.getSpec('store').value;
|
||||
collection.meta.initialize();
|
||||
const doc = collection.createDoc();
|
||||
|
||||
|
||||
@@ -56,8 +56,7 @@ export function createStarterDocCollection() {
|
||||
blobSources,
|
||||
};
|
||||
const collection = new TestWorkspace(options);
|
||||
collection.storeExtensions =
|
||||
SpecProvider.getInstance().getSpec('store').value;
|
||||
collection.storeExtensions = SpecProvider._.getSpec('store').value;
|
||||
collection.start();
|
||||
|
||||
// debug info
|
||||
|
||||
Reference in New Issue
Block a user