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: move image proxy middleware and adapter extensions #10345

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

Moved image proxy middleware and adapter extensions to their respective packages and introduced a new spec provider for adapter registration.

What changed?

  • Relocated defaultImageProxyMiddleware from blocks to @blocksuite/affine-block-image
  • Moved PresentTool from fragment-frame-panel to block-frame
  • Created new adapter extension specs for HTML, Markdown, and Notion HTML
  • Introduced a spec provider pattern for adapter registration
  • Removed direct transformer references from RootService
  • Updated imports across affected files to use new locations

How to test?

  1. Verify image proxy functionality works in exports and imports
  2. Test HTML, Markdown, and Notion HTML adapters still function correctly
  3. Confirm presentation mode works with the relocated PresentTool
  4. Check that all file import/export operations continue to work as expected

Why make this change?

This reorganization improves code modularity by placing features in their logical packages and introduces a more maintainable pattern for adapter registration. The spec provider pattern makes it easier to manage and extend adapter functionality while reducing coupling between components.

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.

@github-actions github-actions bot added the test Related to test cases label Feb 21, 2025
@Saul-Mirone Saul-Mirone changed the title refactor(editor): add adapter spec refactor: move image proxy middleware and adapter extensions Feb 21, 2025
@Saul-Mirone Saul-Mirone marked this pull request as ready for review February 21, 2025 07:57
@Saul-Mirone Saul-Mirone requested a review from a team as a code owner February 21, 2025 07:57
@graphite-app graphite-app bot requested review from a team February 21, 2025 07:57
@Saul-Mirone Saul-Mirone force-pushed the 02-21-refactor_editor_add_adapter_spec branch from 7940b83 to a7237f3 Compare February 21, 2025 08:01
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 35.61644% with 47 lines in your changes missing coverage. Please review.

Project coverage is 54.40%. Comparing base (296d88f) to head (22e4bd8).
Report is 1 commits behind head on canary.

Files with missing lines Patch % Lines
...affine/shared/src/adapters/middlewares/doc-link.ts 42.10% 11 Missing ⚠️
...ite/blocks/src/root-block/transformers/markdown.ts 0.00% 9 Missing ⚠️
...ffine/shared/src/adapters/middlewares/file-name.ts 11.11% 8 Missing ⚠️
...cksuite/blocks/src/root-block/transformers/html.ts 0.00% 8 Missing ⚠️
.../blocks/src/root-block/transformers/notion-html.ts 0.00% 6 Missing ⚠️
...te/affine/shared/src/adapters/middlewares/title.ts 60.00% 2 Missing ⚠️
...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 ⚠️
...ksuite/affine/block-surface-ref/src/portal/note.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #10345      +/-   ##
==========================================
- Coverage   54.42%   54.40%   -0.03%     
==========================================
  Files        2330     2334       +4     
  Lines      107958   107954       -4     
  Branches    17827    17825       -2     
==========================================
- Hits        58759    58735      -24     
- Misses      47872    47882      +10     
- Partials     1327     1337      +10     
Flag Coverage Δ
server-test 78.71% <ø> (+<0.01%) ⬆️
unittest 31.31% <24.65%> (-0.03%) ⬇️

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.

@Saul-Mirone Saul-Mirone force-pushed the 02-21-refactor_editor_add_adapter_spec branch 2 times, most recently from 4498f2a to 509d0d2 Compare February 21, 2025 08:34
@Saul-Mirone Saul-Mirone force-pushed the 02-21-refactor_editor_add_adapter_spec branch 2 times, most recently from f2beb63 to eb3cb67 Compare February 21, 2025 08:46
Copy link

graphite-app bot commented Feb 21, 2025

Merge activity

### TL;DR
Moved image proxy middleware and adapter extensions to their respective packages and introduced a new spec provider for adapter registration.

### What changed?
- Relocated `defaultImageProxyMiddleware` from blocks to `@blocksuite/affine-block-image`
- Moved `PresentTool` from fragment-frame-panel to block-frame
- Created new adapter extension specs for HTML, Markdown, and Notion HTML
- Introduced a spec provider pattern for adapter registration
- Removed direct transformer references from RootService
- Updated imports across affected files to use new locations

### How to test?
1. Verify image proxy functionality works in exports and imports
2. Test HTML, Markdown, and Notion HTML adapters still function correctly
3. Confirm presentation mode works with the relocated PresentTool
4. Check that all file import/export operations continue to work as expected

### Why make this change?
This reorganization improves code modularity by placing features in their logical packages and introduces a more maintainable pattern for adapter registration. The spec provider pattern makes it easier to manage and extend adapter functionality while reducing coupling between components.
@graphite-app graphite-app bot force-pushed the 02-21-refactor_editor_add_adapter_spec branch from eb3cb67 to 22e4bd8 Compare February 21, 2025 09:02
@graphite-app graphite-app bot merged commit 22e4bd8 into canary Feb 21, 2025
66 checks passed
@graphite-app graphite-app bot deleted the 02-21-refactor_editor_add_adapter_spec branch February 21, 2025 09:15
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