Skip to content

feat(editor): wire host to plugin SDK v0.1 - #61

Merged
yexiyue merged 1 commit into
developfrom
feat/plugin-sdk-v0.1-host
May 13, 2026
Merged

feat(editor): wire host to plugin SDK v0.1#61
yexiyue merged 1 commit into
developfrom
feat/plugin-sdk-v0.1-host

Conversation

@yexiyue

@yexiyue yexiyue commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wire SwarmNote desktop host to @swarmnote/editor-core v0.1 plugin SDK:

  • Adopt the plugin SDK surface (commands / cmExtensions / markdownRenderer)
  • Pass host: EditorHostCapabilities instead of legacy top-level imageResolver / uploadFile
  • Opt into built-in plugins (math / table / mermaid / codeBlock / blockImage etc.) explicitly via plugins: []
  • Drop deprecated EditorFeatureToggles flags now superseded by plugin opt-in

Depends on sibling PR swarm-apps/swarmnote-editor#2 (feat/plugin-sdk-v0.1).

Commits

  • 0dfa1e8 — feat(editor): wire host to plugin SDK v0.1

Cross-repo refs

  • Sibling editor-core change: swarm-apps/swarmnote-editor#2 (commit 37db01c)

Merge order

  1. Sibling swarm-apps/swarmnote-editor#2 → sibling main
  2. this PR → develop
  3. Then feat/use-editor-react (depends on this) → develop

Test plan

  • pnpm build (Vite) passes
  • pnpm lint:ci passes
  • reviewer verify built-in plugins still opt-in correctly

Adopt `@swarmnote/editor-core` v0.1 plugin SDK in the SwarmNote host:

- `NoteEditor.tsx` constructs `plugins[]` from preferences snapshot
  (`buildEditorPlugins`); `host` object replaces deprecated top-level
  `imageResolver` / `uploadFile`
- `refreshBlockImagesEffect` now imported from
  `@swarmnote/editor-core/plugins/blockImage` subpath (main entry no
  longer re-exports it)

Preferences:
- `preferencesStore` adds `enabledPlugins: EditorPluginId[]` (defaults
  to all 8 enabled) and `codeBlockMode`. `migrateLegacyFeatures`
  defensively translates v0.0.x `features.*` keys and clears them
  (idempotent)
- New "编辑器插件" section in `routes/settings/general.tsx` lists
  per-plugin Switch + codeBlock mode Select

i18n: 21 new English strings backfilled in `src/locales/en/messages.po`.

Documentation:
- `dev-notes/plans/editor-plugin-architecture.md` marked as implemented;
  v0.1 BREAKING change summary appended as release-notes / PR
  description source
- `dev-notes/knowledge/editor.md` gains a Plugin SDK section with the
  key constraints (subpath imports, host capabilities, boot-time freeze)

BREAKING CHANGE: Editor `features` 7 fields removed upstream in
`@swarmnote/editor-core` v0.1; capability enablement now lives in
`plugins[]`. v0.0.x preferences containing `features.*` keys are
auto-migrated via `migrateLegacyFeatures`.

Refs: OpenSpec change `add-editor-plugin-sdk-v01`; pairs with sibling
commit 37db01c.
@yexiyue
yexiyue merged commit 64ecfbc into develop May 13, 2026
3 of 4 checks passed
@yexiyue
yexiyue deleted the feat/plugin-sdk-v0.1-host branch May 13, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant