Releases: superdoc-dev/superdoc
v1.27.0
What's New
CDN Bundle Distribution
- Distribute IIFE bundle as
superdoc.min.jswithwindow.SuperDocglobal (replaces UMD format) - Bundle size reduced 44%: 8.8 MB unminified → 4.9 MB minified (1.46 MB gzipped)
- Named exports attach as static properties on SuperDoc constructor (Quill pattern)
- Yjs and Hocuspocus inlined in IIFE; pdfjs-dist stays external for ESM-only use
Math Equation Converters
- Implement OMML-to-MathML converters for radical/sqrt, group character, phantom, n-ary operators, equation arrays, accents, pre-subscripts, and limit operators
- Word mathematical expressions now render as web-standard MathML
- Support all ST_OnOff value variants and spec-compliant defaults per ECMA-376 §22.1.2
Document API Enhancements
doc.extract()returns all document content with stable IDs for RAG workflows — blocks with text, comments with anchored references, tracked changes with excerptscontentControls.create()now acceptsatfield to wrap arbitrary text ranges without dropping to editor internals- Every extracted ID works with
scrollToElement()for citation navigation
Toolbar State and Execute
- Unified toolbar API with
state()andexecute()methods for headless toolbar - Toolbar automatically synchronizes with document-mode changes
Improvements
Text Layout and Selection
- Fix overlapping text in justified paragraphs with first-line/hanging indents; availableWidth now calculated consistently across resolver, painter, selection, and hit-testing
- Fix centered and right-aligned inline images (wpg groups) in indented paragraphs — centering math now accounts for paragraph indents
- Fix hit-testing for multi-block table cells spanning pages with block-local first-line computation
- Fix list marker width adjustments to use consistent measured text width signal
CSS Isolation
- Wrap all bundled SuperDoc CSS in
@layer superdoccascade layer for consistent override behavior - Consumer CSS (unlayered) always wins over SuperDoc styles regardless of import order
Track Changes
- Add word-level diffing for granular text change representation during editing
- Add
pairReplacementsconfig option (default: true) to group insertion+deletion as single paired change
Editing Experience
- Fix table cell redraw when typing inside table in SDT
- Improve table cell block cache invalidation alignment with renderer versioning
- Fix redline bubbles to resync on collaboration undo/redo
Type Safety
- Narrow
exportDocx()default return type — browser consumers getPromise<Blob>, Node headless consumers opt in withexportDocx<Buffer>() - Define
ContextMenuItem,ContextMenuSection,ContextMenuConfigtypes for context menu API - Allow context menu
menuProvidercallback to return null/undefined
Fixes
Collaboration
- Fix documents opened in collaboration becoming corrupted after export
- Fix
settings.xmland custom XML parts not persisting after export on collab sessions - Sync tracked change comments on peer undo/redo replay
Document Rendering
- Fix endnotes handling in round-trip exports
- Fix watermark layout and imported comment metadata handling
- Fix comment bubble text replacement display in tracked changes
- Fix selection rectangles rendering in headers/footers
Test Coverage
- Add unit tests for cdn-entry namespace attachment with Function intrinsic collision handling
- Extend package coverage to 90%+ with new tests for PDF adapter, comments, AI writer, composables, and Whiteboard canvas interactions
- Add Codecov integration for automated coverage reporting
template-builder-v1.5.0
What's New
-
CDN bundle with vanilla JavaScript — Ship SuperDoc via script tag (IIFE format, minified, 1.46 MB gzipped). Includes working vanilla example and jsdelivr/unpkg integration guides.
-
Math equation rendering — Render OMML math with MathML, including fractions, subscripts, superscripts, limits, accents, radicals, delimiters, equation arrays, and n-ary operators. Group character stacking and phantom elements also supported.
-
doc.extract() — Extract all document content with stable IDs for RAG pipelines. Returns blocks with full text, comments with anchored references, and tracked changes with excerpts. Every ID works directly with scrollToElement().
-
scrollToElement(id) — Navigate to any element by its ID (paragraphs, comments, tracked changes). Single unified API for cross-session citation navigation.
-
Headless toolbar API — Control formatting programmatically. New useHeadlessToolbar() hook for React and Vue, plus 5 framework examples (React shadcn, React MUI, Vue Vuetify, Svelte, vanilla). Type-safe execute() and snapshot.
-
contentControls.create with text wrapping — Wrap arbitrary text ranges in content controls via the optional
atfield. No need to drop into editor internals.
Improvements
-
Math rendering precision — Underbars on compound expressions stretch correctly (U+203E overline vs combining marks). Display style and Cambria Math font match Word's rendering exactly.
-
Justified paragraphs with indents — Fixed overlapping text when paragraphs have first-line or hanging indents and justify alignment. Text-indent offset now applied consistently across measurer, painter, selection, and hit-testing.
-
Track changes on collaboration undo/redo — Bubbles resync correctly when peers undo/redo. Tracked change comments no longer misalign during replay.
-
Document export in collaboration — settings.xml, custom XML parts, and endnotes now persist on export from a live collaboration session. Multi-author documents export cleanly without data loss.
-
Form fields in tables — Presentation updates correctly when typing inside table cells with structured content (SDT) fields.
-
Comment and tracked-change rendering — Fixed layout to allow bubbles and balloons to render in the right margin without clipping. Floating comment remeasure logic simplified.
-
Table cell content on paste — Preserve background color, margins, borders, vertical alignment, and header styling when pasting tables from Google Docs via inline HTML styles.
-
Centered images in indented paragraphs — Centering math now accounts for paragraph indents (w:ind). Inline shapeGroups no longer offset from Word's placement.
-
Table of contents rendering — Apply useAppliedOutlineLevel without requiring \o range switch. TOC with \u-only instructions now works.
-
Inline structured content formatting — Inherit run formatting (bold, color, font) when inserting inline SDT elements. Respect pending toolbar formatting.
-
AI agent tooling — MCP server, benchmark suite, and system prompts optimized for multi-turn agent workflows. Markdown insert patterns and mutations batch format documented.
-
TypeScript type safety — exportDocx overloads narrow return type per flag. Command chain returns properly typed. Comment type expanded with full runtime shape. Fixed type regressions from prosemirror and vue package overrides.
Fixes
-
Image resize handles in view mode — No longer appear when document is in viewing mode. Properly cleared when switching modes.
-
Centered inline drawingML — ShapeGroups in indented paragraphs now centered relative to text column, not full page width.
-
Selection rectangles in headers/footers — Fixed position mapping in header/footer editing.
-
Watermark and comment bubble layout — Word art watermarks and comment metadata handling corrected.
-
Tracked change bubble text after undo — Partial undo now renders correct change text in bubble.
-
Replacement text in tracked changes — Tracked-change delete + insert (replacement) now shows correct replacement text. Distinction between deletion-then-insertion and true replacement clarified.
-
Comment activation on click — Clicking inside commented text now activates the comment bubble. elementFromPoint fallback works with pointer capture.
-
RTL text click-to-position — Clicks on right-to-left text map to correct document position. Fixed hidden span handling in line bounds.
-
Document part objects with inline content — Non-TOC gallery types (page numbers, bibliographies, cover pages) normalize inline nodes (bookmarks, comments, permissions) instead of failing.
-
Table cell newlines — Newline characters in structured content now split into separate paragraphs instead of losing content after first newline.
-
SDT hover in view mode — Block and inline structured content no longer highlight on hover in viewing mode.
-
Comment export — Resolved comments export with correct w15:done attribute. commentsExtended.xml included even with threaded comments only.
-
Multi-block text.rewrite — Text replacements spanning multiple paragraphs now split correctly on newlines. Paragraph attributes preserved.
-
Per-script fonts in round-trip — eastAsiaFontFamily and csFontFamily now survive mark encoding/decoding. Zero-edit export stops injecting rFonts into runs.
-
Accept/reject formatting — Rejecting multi-property format suggestions now reverts all properties, not just the last one. Inline keys preserved for imported docs.
-
Run plugin inline keys — Specific keys removed in accept/reject transaction no longer stripped from unrelated inline properties on same run.
-
Collaboration document corruption — Yjs fragment properly cleared during document rebuild. Custom XML parts, settings.xml, and endnotes persist on collab export.
-
Form field visibility in SDT — Fields update correctly when typing inside table cells within structured content.
-
Math cursor positioning — Clicks in overflow areas around inline equations resolve to correct positions.
-
Math paragraph spacing — Display math paragraphs inherit before/after spacing from containing paragraph.
-
SVG image hyperlinks — DrawingML images (a:hlinkClick) now support hyperlinks correctly in edit and view modes.
-
Floating-only documents — Layout handles documents with only floating objects. Paginator state stays in sync when pruning empty pages.
-
Image resizing in web layout — Table cell width constraint applied even in web layout mode. getMaxContentSize check moved before early return.
-
List marker guard consistency — Hit-testing, painter, and mapPmToX use same rendered-marker check based on measured text width.
-
Paragraph split formatting inheritance — Pressing Enter no longer inherits parent paragraph formatting. Clearing with empty storedMarks respected on split.
-
Style equivalence inline keys — Imported docs with explicit w:rPr that become style-equivalent no longer drop keys on export.
-
Negative word-spacing whitespace — Justified lines with manual tabs no longer apply negative word-spacing, preserving whitespace.
-
Document mode changes in template-builder — Mode switches no longer destroy/recreate editor. Queued during init if changed before ready.
-
Field type styling — fieldColors prop now respects partial color maps. Non-hex colors supported via color-mix(). DOM selector fixed to match actual structure.
-
Lock mode in template-builder — Lock mode now threaded through all field insertion and discovery paths. Delete respects lock state feedback from editor.
-
Comment scrolling regression — Fixed scroll behavior after painter refactor.
-
Type augmentation at package boundary — Command type augmentations (comment, formatting, track changes) now reach consumers via /// directives in dist.
-
Ambient type shims — Removed prosemirror, vue, yjs type overrides that broke consumers using those packages directly (e.g., Tiptap users). Added prosemirror as optional peer for re-exported types.
cli-v0.7.0
What's New
- superdoc.min.js CDN bundle — Shipped as minified IIFE (1.46 MB gzipped);
window.SuperDocconstructor exposed directly for script-tag loading. - 10 math equation converters — Added m:m, m:groupChr, m:phant, m:nary, m:acc, m:sPre, m:limLow, m:limUpp, m:rad, m:eqArr per ECMA-376 spec.
- Word-level diffing — Granular text change tracking for collaborative editing.
- doc.extract() — RAG extraction API returns blocks with text, comments with anchored refs, tracked changes with excerpts; all IDs work with scrollToElement() for citation navigation.
- contentControls.create with text range wrapping — Optional
atfield wraps arbitrary ranges without dropping to editor internals. - Toolbar headless API — State and execute methods for programmatic toolbar control.
- CLI collaboration custom params — New
paramsfield forwarded to y-websocket and Hocuspocus provider.
Improvements
- Centered images in indented paragraphs — Fixed centering math to account for w:ind; shapes now position correctly regardless of indentation.
- Selection rectangles in headers/footers — Fixed selection overlay rendering for header/footer shapes.
- Live collaborative table updates — Table cell block cache invalidates correctly during active editing.
- Browser-first export types — exportDocx() defaults to Promise (browser); Node consumers opt in with exportDocx().
- Tracked-change replacement text — Fixed text rendering in change bubbles.
- Justified paragraph first-line indent — Fixed character overlap and selection drift with hanging indent + justify.
- Tracked change undo/redo sync — Comments resync correctly on peer undo/redo replay.
- MCP tool definitions for efficient workflows — Optimized guidance on markdown inserts, mutations batching, and multi-item operations.
- Test coverage: 64% → 90% — Added suites for PDF, comments, composables, canvas; integrated Codecov.
Fixes
- Collaborative export data loss — Fixed endnotes, settings.xml, custom XML not persisting after export in collab sessions.
- Watermark and comment rendering — Fixed watermark layout, comment metadata, bubble placement, header anchor shapes.
- Run key stale state — Narrowed lost-keys preservation; unrelated inline keys no longer inherit state from accept/reject.
- Context menu types — Typed customItems as ContextMenuSection[]; widened callbacks to include full ContextMenuContext.
- Schema validation for additionalProperties — Fixed CLI crash on object schemas missing explicit properties map.