Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: reorganize specs and adapter extensions #10359

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

Saul-Mirone
Copy link
Contributor

@Saul-Mirone Saul-Mirone commented Feb 21, 2025

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

Copy link
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Saul-Mirone Saul-Mirone changed the title refactor(editor): reorg blocks refactor: reorganize specs and adapter extensions Feb 21, 2025
@github-actions github-actions bot added test Related to test cases app:core labels Feb 21, 2025
@Saul-Mirone Saul-Mirone marked this pull request as ready for review February 21, 2025 14:10
@Saul-Mirone Saul-Mirone requested a review from a team as a code owner February 21, 2025 14:10
@graphite-app graphite-app bot requested review from a team February 21, 2025 14:10
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 59.09091% with 9 lines in your changes missing coverage. Please review.

Project coverage is 54.42%. Comparing base (72b7519) to head (2cf9a8f).
Report is 1 commits behind head on canary.

Files with missing lines Patch % Lines
...affine/block-embed/src/common/render-linked-doc.ts 0.00% 1 Missing ⚠️
...c/embed-synced-doc-block/embed-synced-doc-block.ts 0.00% 1 Missing ⚠️
...oot/src/edgeless/components/frame/frame-preview.ts 0.00% 1 Missing ⚠️
...cksuite/affine/block-root/src/transformers/html.ts 0.00% 1 Missing ⚠️
...ite/affine/block-root/src/transformers/markdown.ts 0.00% 1 Missing ⚠️
.../affine/block-root/src/transformers/notion-html.ts 0.00% 1 Missing ⚠️
...ksuite/affine/block-surface-ref/src/portal/note.ts 0.00% 1 Missing ⚠️
...e/widget-drag-handle/src/helpers/preview-helper.ts 0.00% 1 Missing ⚠️
...s/frontend/core/src/modules/workspace/impls/doc.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           canary   #10359   +/-   ##
=======================================
  Coverage   54.41%   54.42%           
=======================================
  Files        2335     2332    -3     
  Lines      107921   107901   -20     
  Branches    17817    17815    -2     
=======================================
- Hits        58728    58727    -1     
+ Misses      47857    47848    -9     
+ Partials     1336     1326   -10     
Flag Coverage Δ
server-test 78.72% <ø> (+<0.01%) ⬆️
unittest 31.33% <59.09%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@doodlewind doodlewind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally SpecProvider.$ might be aesthetically better :)

Copy link

graphite-app bot commented Feb 21, 2025

Merge activity

### 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
@graphite-app graphite-app bot force-pushed the 02-21-refactor_editor_reorg_blocks branch from 8a389ee to 2cf9a8f Compare February 21, 2025 14:25
@graphite-app graphite-app bot merged commit 2cf9a8f into canary Feb 21, 2025
65 checks passed
@graphite-app graphite-app bot deleted the 02-21-refactor_editor_reorg_blocks branch February 21, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:core test Related to test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants