Skip to content

fix(super-editor): normalize API tab insertions#2830

Closed
missysuperdoc wants to merge 2 commits intosuperdoc-dev:mainfrom
missysuperdoc:codex/sd-2567-api-tabs-export
Closed

fix(super-editor): normalize API tab insertions#2830
missysuperdoc wants to merge 2 commits intosuperdoc-dev:mainfrom
missysuperdoc:codex/sd-2567-api-tabs-export

Conversation

@missysuperdoc
Copy link
Copy Markdown
Collaborator

@missysuperdoc missysuperdoc commented Apr 15, 2026

What changed

  • normalize API text writes so literal tab characters are materialized as structured inline tab nodes instead of raw text
  • reuse the same inline-content expansion for direct writes, tracked insertions, and text execution in the document API write paths
  • add regression coverage for direct writes, tracked changes, and exported DOCX XML in both direct and tracked adapter flows

Why this changed

API-driven insertions were preserving \t inside text nodes, which exported to raw tab characters inside <w:t> instead of proper <w:tab/> runs.

Impact

API insertions now match the editor's native tab model, and DOCX export emits valid Word tab runs for both direct and tracked document API writes.

Validation

  • pnpm --prefix packages/super-editor exec vitest run src/editors/v1/document-api-adapters/write-adapter.test.ts
  • pnpm --prefix packages/super-editor exec vitest run src/editors/v1/extensions/track-changes/track-changes-extension.test.js
  • pnpm --prefix packages/super-editor exec vitest run src/editors/v1/document-api-adapters/write-tabs-export.integration.test.ts

@missysuperdoc missysuperdoc changed the title [codex] Normalize API tab insertions fix(super-editor): normalize API tab insertions Apr 15, 2026
@caio-pizzol
Copy link
Copy Markdown
Contributor

caio-pizzol commented Apr 21, 2026

closing this in favor of an export-side fix. normalizing at the editor layer is too ambitious for this bug — 10+ call sites still take the raw path, and it introduces new regressions (tracked-changes panel drops tab-only inserts, reads return a different char than what was written, inserts into page-number fields silently drop the tab).

simpler fix: detect \t during docx serialization, emit <w:tab/>. ~20 lines, covers every path. will open that.

thanks for the work here @missysuperdoc 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants