Skip to content

feat(core): add bubble menu, smart paste, outline, block drag, export, and CRDT collaboration - #365

Open
Mrshiju wants to merge 1 commit into
floatboatai:mainfrom
Mrshiju:feature-my-update
Open

Mrshiju wants to merge 1 commit into
floatboatai:mainfrom
Mrshiju:feature-my-update

Conversation

@Mrshiju

@Mrshiju Mrshiju commented Sep 22, 2026

Copy link
Copy Markdown

Summary

Introduces high-end editing capabilities to Nexus-Editor, including a floating Bubble Menu, smart HTML-to-Markdown paste, an interactive Outline (TOC) sidebar, Notion-style block drag & reorder, multi-format export (standalone HTML, Word .doc, PDF print), and a new Yjs-based CRDT real-time collaboration plugin.

Motivation

To bridge the gap between raw Markdown editing and modern, Notion/Obsidian-grade editing workflows:

  • Lower the cognitive barrier of remembering Markdown syntax via floating rich-text actions.

  • Eliminate messy HTML artifacts when copying content from web pages, Word, or Excel.

  • Provide document structural awareness and drag-and-drop block reordering.

  • Enable multi-user collaborative editing with presence awareness and scoped undo/redo.

  • Expand document export capabilities to styled HTML, Microsoft Word, and print-to-PDF.

  • Issue:

  • Roadmap (docs/ROADMAP.md): Phase 1 & 2 Editing Experience & Collaboration

  • OpenSpec change:

Changes

packages/core

  • Smart HTML Paste (src/html-to-markdown.ts): Built a zero-dependency DOM-based converter that automatically cleans and converts pasted text/html into clean GFM Markdown (including headings, nested lists, code blocks, and tables). Configurable via EditorConfig.smartPaste.
  • Document Outline (TOC) Sidebar (src/outline-ui.ts): Implemented createOutlineUI providing a hierarchical heading tree, live reading cursor highlight tracking, and smooth scroll-to-heading navigation.
  • Notion-Style Block Drag (src/block-drag.ts): Added blockDragExtension with block boundary detection (paragraphs, headings, code blocks, tables, lists), hoverable ⋮⋮ handle, custom ghost-free mouse drag, and atomic transaction-based block swapping.
  • Multi-Format Export Suite (src/export.ts): Added exportStandaloneHTML (with GitHub-like typography and print styles), exportWord (Word/WPS-compatible XML document format), and print (browser/Electron native PDF print dialog trigger).
  • Core Engine Optimizations (src/editor.ts, src/types.ts): Added onAstChange callback to decouple high-frequency text events from AST processing; wired export APIs into EditorAPI.

packages/plugin-toolbar

  • Floating Bubble Menu (src/bubble-menu.ts): Implemented createBubbleMenuUI which automatically calculates bounding coordinates and floats above non-empty selections, supporting bold, italic, strikethrough, underline, inline code, link, headings (H2/H3), and text/highlight color pickers.
  • Dropdown & Palette Exports (src/toolbar-ui.ts): Exported showColorPicker, pickOverlayMount, and default color palettes for shared use.

packages/plugin-collab (NEW PACKAGE)

  • CRDT Real-Time Collaboration: Created a standalone @floatboat/nexus-plugin-collab package using yjs, y-codemirror.next, and y-protocols/awareness.
  • Remote Presence & Cursors: Renders remote cursors, active selections, and colored username tags.
  • Collaborative Undo: Scoped via Y.UndoManager so Ctrl+Z only reverts local changes without reverting other peers' edits.
  • Local Synchronization: Provided linkDocs for memory linking and LocalBroadcastProvider for zero-server multi-tab/window sync via BroadcastChannel.

packages/plugin-history

  • History Grouping Window: Increased default newGroupDelay from 500ms to 1500ms to group consecutive typing into natural pause intervals; exposed HistoryPluginOptions.

packages/plugin-search

  • Fuzzy Search: Implemented a lightweight inline fuzzyMatch algorithm with run-length continuity scoring, supporting SearchOptions.fuzzy in findSearchMatches.

apps/electron-demo & Workspace

  • Vite Resolve Aliases: Resolved missing aliases for @floatboat/nexus-plugin-math and @floatboat/nexus-plugin-vim.
  • Tooling: Registered @floatboat/nexus-plugin-collab in vitest.config.ts and root package.json build scripts; excluded .kilo from Vitest discovery.

Testing

  • pnpm test passes / All 25 test suites and 391 unit tests pass (100% green).
  • Affected packages build (pnpm build) passes cleanly.
  • New / updated vitest cases:
    • packages/core/test/html-to-markdown.test.ts: HTML element conversions, table formatting, editor smart paste.
    • packages/core/test/outline-ui.test.ts: TOC hierarchy, document change syncing, selection jumping.
    • packages/core/test/block-drag.test.ts: Block boundary detection, handle & indicator initialization.
    • packages/core/test/export.test.ts: Standalone HTML generation, Word document structure, print invocation.
    • packages/plugin-toolbar/test/plugin-toolbar.test.ts: Bubble menu mounting, button rendering, selection actions.
    • packages/plugin-collab/test/plugin-collab.test.ts: Yjs two-way sync, multi-client doc linking, awareness presence, collaborative undo.
    • packages/plugin-search/test/plugin-search.test.ts: Inline fuzzy match scoring and ranked match retrieval.
    • packages/core/test/editor.test.ts: Added onAstChange independent callback test.
  • Manual UI check in electron-demo: Verified Vite dev server startup without package resolution errors.

Compliance

  • CLA signed
  • New dependencies:
    • yjs@^13.6.24 — MIT — CRDT core store for real-time collaboration.
    • y-codemirror.next@^0.3.5 — MIT — Official CodeMirror 6 binding for Yjs.
    • y-protocols@^1.0.6 — MIT — Awareness and presence protocol.
  • No build artifacts committed.
  • No secrets / .env / personal vault data committed.

Checklist

  • Title follows Conventional Commits.
  • Public API changes update package types and interfaces.
  • Did not violate the 12 Table Widget rules in live-preview-table.ts.
  • Change aligns with project scope (GOVERNANCE.md §4).

…RDT collab

本次提交包含以下核心功能与体验优化:
- feat(toolbar): 新增划词富文本悬浮气泡工具栏 (Bubble Menu)
- feat(core): 新增剪贴板智能富文本转 Markdown 粘贴 (Smart HTML Paste)
- feat(core): 新增文档大纲视图导航侧边栏 (createOutlineUI)
- feat(core): 新增 Notion 风格块级悬浮手柄与无残影拖拽重排 (blockDragExtension)
- feat(core): 新增美化 HTML、Word (.doc) 兼容文档及 PDF 打印导出
- feat(collab): 新增基于 Yjs 的独立 CRDT 实时协同插件包 (@floatboat/nexus-plugin-collab)
- perf(core): 优化撤销重做 1500ms 自然打字停顿分组,新增 onAstChange 语法树解耦通知
- feat(search): 新增纯内联 fuzzyMatch 模糊序列匹配与连续性评分
- fix(demo): 修复 Electron Demo 中 plugin-math 与 plugin-vim 的 Vite 别名解析
@CLAassistant

CLAassistant commented Sep 22, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

2 participants