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:
Saul-Mirone
2025-02-21 14:25:35 +00:00
parent 72b751943c
commit 2cf9a8f286
49 changed files with 224 additions and 320 deletions
+2 -27
View File
@@ -47,28 +47,7 @@
"@blocksuite/global": "workspace:*",
"@blocksuite/icons": "^2.2.1",
"@blocksuite/inline": "workspace:*",
"@blocksuite/store": "workspace:*",
"@floating-ui/dom": "^1.6.10",
"@lit/context": "^1.1.2",
"@preact/signals-core": "^1.8.0",
"@toeverything/theme": "^1.1.11",
"@vanilla-extract/css": "^1.17.0",
"date-fns": "^4.0.0",
"dompurify": "^3.2.4",
"fflate": "^0.8.2",
"file-type": "^20.0.0",
"fractional-indexing": "^3.2.0",
"html2canvas": "^1.4.1",
"katex": "^0.16.11",
"lit": "^3.2.0",
"lodash-es": "^4.17.21",
"lz-string": "^1.5.0",
"minimatch": "^10.0.1",
"nanoid": "^5.0.7",
"shiki": "^2.0.0",
"simple-xml-to-json": "^1.2.2",
"yjs": "^13.6.21",
"zod": "^3.23.8"
"@blocksuite/store": "workspace:*"
},
"exports": {
".": "./src/index.ts",
@@ -79,13 +58,9 @@
"src",
"dist",
"!src/__tests__",
"!dist/__tests__",
"schemas.d.ts",
"schemas.js"
"!dist/__tests__"
],
"devDependencies": {
"@types/katex": "^0.16.7",
"@types/lodash-es": "^4.17.12",
"@vanilla-extract/vite-plugin": "^5.0.0",
"vitest": "3.0.6"
}