Skip to content

feat(editor): wire @swarmnote/editor-react sibling package - #62

Merged
yexiyue merged 2 commits into
developfrom
feat/use-editor-react
May 13, 2026
Merged

feat(editor): wire @swarmnote/editor-react sibling package#62
yexiyue merged 2 commits into
developfrom
feat/use-editor-react

Conversation

@yexiyue

@yexiyue yexiyue commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wire desktop host to @swarmnote/editor-react from the v0.2 4-package sibling layout:

  • pnpm.overrides adds link:../swarmnote-editor/packages/editor-react
  • src/App.css adds Tailwind 4 @source directive scanning sibling editor-react/dist
  • Update dev-notes/knowledge/editor.md with the four-package layout
  • Update dev-notes/plans/editor-core-host-boundary.md § VI with "已落实(部分)" banner

Scope: host does not migrate its existing EditorContextMenu / TableContextMenu to the sibling package — per OpenSpec D12, sibling editor-react is an independent component library, not a host migration target. Existing host UI stays.

Stacked on top of #61 (host plugin SDK wiring). After #61 lands, this PR's base auto-flips to develop.

Commits

  • cc7bdc8 — feat(editor): wire @swarmnote/editor-react sibling package

Cross-repo refs

  • Sibling v0.2 split: swarm-apps/swarmnote-editor#3 (commits 7acc831 + 4a98e10)
  • RN host adoption: swarm-apps/SwarmNote-RN#feat/use-editor-react-native (commits b7b8bb2 / 0976329 / a9b034e)

Merge order

  1. Sibling swarm-apps/swarmnote-editor#2 → sibling main
  2. Sibling swarm-apps/swarmnote-editor#3 → sibling main
  3. Desktop feat(editor): wire host to plugin SDK v0.1 #61 → develop
  4. this PR → develop (auto-rebases after step 3)
  5. RN swarm-apps/SwarmNote-RN#feat/use-editor-react-native → develop

Test plan

  • pnpm build (Vite) passes
  • pnpm lint:ci passes
  • pnpm tauri dev smoke test — deferred to next host UI change (decision in OpenSpec change)
  • reviewer scan @source placement (must be after all @import lines)

yexiyue added 2 commits May 13, 2026 09:24
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.
Add @swarmnote/editor-react as a linked sibling dependency (alongside
existing @swarmnote/editor-core):

- package.json: pnpm.overrides + dependencies entries for editor-react
- src/App.css: @source directive for sibling editor-react/dist so
  Tailwind 4 scans className literals from cross-package built output
- dev-notes/knowledge/editor.md: document the new 4-package sibling
  architecture (editor-core / editor-web / editor-react / editor-react-native)
- dev-notes/plans/editor-core-host-boundary.md: mark §六 partially
  implemented by OpenSpec change split-editor-react-packages

Desktop host code is unchanged. SwarmNote still uses its own
EditorContextMenu / TableContextMenu — those are business-level UI
orchestration (deeply coupled to host shadcn primitives + uiStore +
Lingui macro) and stay in the host repo per the component-library
design philosophy. editor-react built-ins (EditorView, EditorToolbar,
I18nProvider) are available for opt-in use when needed.

Depends on swarmnote-editor commit 7acc831
@yexiyue
yexiyue changed the base branch from feat/plugin-sdk-v0.1-host to develop May 13, 2026 05:20
@yexiyue
yexiyue merged commit 2edb508 into develop May 13, 2026
@yexiyue
yexiyue deleted the feat/use-editor-react 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