Commit Graph

43 Commits

Author SHA1 Message Date
Saul-Mirone
b8ecfbdae6 refactor(editor): remove assertExists (#10615) 2025-03-05 00:13:08 +00:00
Saul-Mirone
66d9d576e0 refactor(editor): add gfx entry in bs global package (#10612) 2025-03-04 12:46:50 +00:00
Saul-Mirone
fd6d96a38e refactor(editor): use transformer from store when possible (#10453) 2025-02-26 14:15:04 +00:00
Saul-Mirone
ce87dcf58e feat(editor): schema extension (#10447)
1. **Major Architectural Change: Schema Management**
   - Moved from `workspace.schema` to `store.schema` throughout the codebase
   - Removed schema property from Workspace and Doc interfaces
   - Added `BlockSchemaExtension` pattern across multiple block types

2. **Block Schema Extensions Added**
   - Added new `BlockSchemaExtension` to numerous block types including:
     - DataView, Surface, Attachment, Bookmark, Code
     - Database, Divider, EdgelessText, Embed blocks (Figma, Github, HTML, etc.)
     - Frame, Image, Latex, List, Note, Paragraph
     - Root, Surface Reference, Table blocks

3. **Import/Export System Updates**
   - Updated import functions to accept `schema` parameter:
     - `importHTMLToDoc`
     - `importHTMLZip`
     - `importMarkdownToDoc`
     - `importMarkdownZip`
     - `importNotionZip`
   - Modified export functions to use new schema pattern

4. **Test Infrastructure Updates**
   - Updated test files to use new schema extensions
   - Modified test document creation to include schema extensions
   - Removed direct schema registration in favor of extensions

5. **Service Layer Changes**
   - Updated various services to use `getAFFiNEWorkspaceSchema()`
   - Modified transformer initialization to use document schema
   - Updated collection initialization patterns

6. **Version Management**
   - Removed version-related properties and methods from:
     - `WorkspaceMetaImpl`
     - `TestMeta`
     - `DocImpl`
   - Removed `blockVersions` and `workspaceVersion/pageVersion`

7. **Store and Extension Updates**
   - Added new store extensions and adapters
   - Updated store initialization patterns
   - Added new schema-related functionality in store extension

This PR represents a significant architectural shift in how schemas are managed, moving from a workspace-centric to a store-centric approach, while introducing a more extensible block schema system through `BlockSchemaExtension`. The changes touch multiple layers of the application including core functionality, services, testing infrastructure, and import/export capabilities.
2025-02-26 11:31:29 +00:00
Saul-Mirone
2cf9a8f286 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
2025-02-21 14:25:35 +00:00
Saul-Mirone
f3218ab3bc refactor(editor): rename presets to integration test (#10340) 2025-02-21 06:26:03 +00:00
Saul-Mirone
5ac15f12e6 refactor: replace editor container with editor host (#10328)
### TL;DR
Refactored editor access to use `EditorHost` instead of `AffineEditorContainer` and updated mode access through `DocModeProvider`.

### What changed?
- Changed editor property types from `AffineEditorContainer` to `EditorHost` across multiple components
- Updated mode access to use `DocModeProvider` service instead of direct editor mode access
- Modified editor references to use `editor.host` where appropriate
- Updated scroll and highlight utilities to work with `EditorHost`

### How to test?
1. Open a document in both page and edgeless modes
2. Verify outline panel functionality works as expected
3. Test outline viewer navigation and highlighting
4. Confirm mobile outline menu operates correctly
5. Check that frame panel and TOC features work in all modes

### Why make this change?
This change improves architectural consistency by using `EditorHost` directly and accessing mode through the proper service provider. This makes the code more maintainable and follows better dependency practices by using the correct abstraction levels.
2025-02-20 14:20:32 +00:00
Saul-Mirone
9f4311f654 refactor(editor): remove AbstractEditor type and feature flags in test (#10308) 2025-02-20 07:05:35 +00:00
Saul-Mirone
091ba7bb51 chore: remove createEmptyEditor legacy test misc (#10291) 2025-02-19 21:38:00 +08:00
Saul-Mirone
2f04e3180c refactor: move utils and cleanup test helpers (#10261) 2025-02-18 14:03:51 +00:00
Saul-Mirone
d111f8ac88 feat(editor): add WidgetViewExtension (#10180)
Closes: [BS-2282](https://linear.app/affine-design/issue/BS-2282/replace-widgetviewmapextension-with-widgetextension)
2025-02-14 11:00:01 +00:00
Saul-Mirone
6b78d2dcf2 refactor(editor): reduce getService (#10100) 2025-02-11 12:26:02 +00:00
Saul-Mirone
0553ae72b5 refactor(editor): remove deprecated editor slot (#9908) 2025-02-04 12:56:41 +00:00
Saul-Mirone
9c65c42d64 chore(editor): cleanup dead code (#9904) 2025-01-27 17:06:42 +00:00
Saul-Mirone
d6bfb761fe fix(editor): typecheck for tests and playground (#9897) 2025-01-27 02:00:09 +00:00
L-Sun
829980bace refactor(editor): toc dragging with std.dnd (#9883)
Close [BS-2458](https://linear.app/affine-design/issue/BS-2458/toc-dnd重构)

### What Changes
- Refactor toc note card dnd with `std.dnd`
- Extract note display mode change to command `changeNoteDisplayMode`
  - It will reorder notes when the display mode changed from `EdgelessOnly` to page mode visible (a.k.a `DocOnly` or `Both`)
2025-01-24 13:27:17 +00:00
pengx17
6ac6a8d6d6 feat(core): unused blob management in settings (#9795)
fix AF-2144, PD-2064, PD-2065, PD-2066
2025-01-23 07:12:17 +00:00
zzj3720
95c0f59d96 refactor(editor): remove database-service (#9769)
close: BS-2426
2025-01-18 05:36:15 +00:00
donteatfriedrice
aa2a8fbf9b fix(editor): adapters panel type (#9690) 2025-01-14 11:02:00 +00:00
Brooooooklyn
e72371d15c style: use typescript resolver for eslint import plugin (#9662) 2025-01-13 05:56:29 +00:00
Mirone
446b31b621 refactor(editor): rename job to transformer (#9639) 2025-01-11 12:04:07 +08:00
Yifeng Wang
cac0b7fd66 refactor(editor): remove default entry (#9600) 2025-01-09 14:01:48 +08:00
Yifeng Wang
4f10457815 refactor(editor): remove legacy console formatter (#9599) 2025-01-09 12:00:08 +08:00
doodlewind
e269cce141 refactor(editor): playground doc collection typing migration (#9593) 2025-01-09 03:07:43 +00:00
Saul-Mirone
3683297ccf feat(editor): add feature flag service (#9592) 2025-01-08 15:46:31 +00:00
Saul-Mirone
5842d45ab1 feat(editor): merge store and blocks (#9591) 2025-01-08 13:01:19 +00:00
Saul-Mirone
c773982ced refactor(editor): rename store api (#9518) 2025-01-04 12:51:56 +00:00
Saul-Mirone
51b109ee53 chore(editor): move legacy doc collection to test workspace (#9507) 2025-01-03 09:40:33 +00:00
Saul-Mirone
897c7d4284 refactor(editor): should not rely on doc collection type (#9501) 2025-01-03 06:30:27 +00:00
doouding
cb5d7eaabc feat: add scroll wheel zoom setting (#9476)
### Changed
Add `scroll wheel to zoom` setting option, when the option enables, user can zoom in and out with scroll wheel without pressing the cmd/ctrl key.
2025-01-03 06:09:10 +00:00
Saul-Mirone
0699205721 chore(editor): move helper to playground (#9498) 2025-01-03 04:23:59 +00:00
Saul-Mirone
8b6c81f76d refactor(editor): reduce dependency to doc collection (#9492) 2025-01-03 01:59:25 +00:00
Saul-Mirone
53f7480cb8 refactor(editor): merge docCreated and docAdded slot (#9489) 2025-01-02 11:47:14 +00:00
Saul-Mirone
edb5e1d87a refactor(editor): job should not rely on doc collection directly (#9488) 2025-01-02 10:50:15 +00:00
Saul-Mirone
ad422d2f05 refactor(editor): move crud to doc (#9479) 2025-01-02 07:27:08 +00:00
Saul-Mirone
be387a6f33 refactor(editor): set readonly (#9475) 2025-01-02 04:02:15 +00:00
Saul-Mirone
e3b6841944 refactor(editor): reorg block specs (#9421) 2024-12-30 05:59:25 +00:00
donteatfriedrice
4a3caaf766 refactor(editor): extract notion html adapter to shared (#9341) 2024-12-27 08:00:19 +00:00
Saul-Mirone
2b27d62b0e refactor(editor): cleanup ts-expect-error (#9369) 2024-12-27 05:14:23 +00:00
Saul-Mirone
7c84545647 refactor(editor): cleanup dead code (#9300) 2024-12-25 07:48:00 +00:00
doodlewind
a15009ce84 chore(editor): ignore debug zip snapshots (#9297)
Put snapshot zips in `blocksuite/playground/apps/starter/data/snapshots/`
2024-12-25 02:18:46 +00:00
Saul-Mirone
3a82da0e5b chore: fix eslint in blocksuite (#9232) 2024-12-20 16:48:10 +00:00
Mirone
30200ff86d chore: merge blocksuite source code (#9213) 2024-12-20 15:38:06 +08:00