Skip to content

fix(wework): preserve multiline pasted text - #1967

Merged
qdaxb merged 1 commit into
mainfrom
fix/wework-multiline-paste
Jul 15, 2026
Merged

qdaxb merged 1 commit into
mainfrom
fix/wework-multiline-paste

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Handle regular text paste through the composer document model so multiline clipboard content is inserted as hard breaks.
  • Normalize CRLF and CR line endings to LF.
  • Support both text/plain and WebKit's text clipboard alias.
  • Add regression coverage and document multiline paste behavior in Chinese and English user guides.

Why

The ProseMirror composer schema contains a single paragraph. Its default clipboard parser converted multiline clipboard content into multiple paragraphs, so only the first line survived schema fitting in Wework.

Impact

Users can paste multiline text into the Wework composer without losing subsequent lines. Existing file and long-text attachment paste handling remains unchanged.

Validation

  • pnpm --filter wework exec vitest run src/components/chat/composer/ComposerProseMirrorEditor.test.tsx
  • Wework pre-push ESLint, TypeScript, and unit test checks
  • Prettier and git diff --check

Summary by CodeRabbit

  • New Features

    • Pasting multiline text into the chat composer now preserves all line breaks.
    • Windows-style line endings are automatically standardized for consistent formatting.
    • Supports multiline clipboard content from common plain-text formats.
  • Documentation

    • Updated English and Chinese user guides with details about multiline paste behavior.
  • Tests

    • Added coverage for multiline paste scenarios and line-ending variations.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f0329851-089d-42db-be29-8048785da65e

📥 Commits

Reviewing files that changed from the base of the PR and between a07aa9c and 44cacba.

📒 Files selected for processing (6)
  • docs/en/user-guide/chat/managing-tasks.md
  • docs/zh/user-guide/chat/managing-tasks.md
  • wework/src/components/chat/composer/ComposerProseMirrorEditor.test.tsx
  • wework/src/components/chat/composer/ComposerProseMirrorEditor.tsx
  • wework/src/components/chat/composer/ComposerTextarea.tsx
  • wework/src/components/chat/composer/composerProseMirrorModel.ts

📝 Walkthrough

Walkthrough

The composer now supports multiline paste by preserving line breaks, normalizing CRLF and CR endings to LF, inserting parsed content into the selection, and documenting and testing the behavior.

Changes

Multiline paste handling

Layer / File(s) Summary
Paste parsing and insertion
wework/src/components/chat/composer/composerProseMirrorModel.ts, wework/src/components/chat/composer/ComposerProseMirrorEditor.tsx, wework/src/components/chat/composer/ComposerTextarea.tsx
Pasted plain text is normalized, parsed into composer content, and inserted into the current selection; the editor key is updated to remount the editor instance.
Paste behavior validation and documentation
wework/src/components/chat/composer/ComposerProseMirrorEditor.test.tsx, docs/en/user-guide/chat/managing-tasks.md, docs/zh/user-guide/chat/managing-tasks.md
Tests cover LF and CRLF text with supported clipboard MIME types, and both guides document multiline paste behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Clipboard
  participant ComposerProseMirrorEditor
  participant createComposerDocument
  participant ProseMirror
  Clipboard->>ComposerProseMirrorEditor: provide pasted plain text
  ComposerProseMirrorEditor->>createComposerDocument: parse and normalize text
  createComposerDocument-->>ComposerProseMirrorEditor: return composer document
  ComposerProseMirrorEditor->>ProseMirror: replace current selection
Loading

Possibly related PRs

  • wecode-ai/Wegent#1905: Introduces createComposerDocument, which this change updates for pasted line-ending normalization.

Suggested reviewers: icycrystal4, ficohu

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wework-multiline-paste

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qdaxb
qdaxb marked this pull request as ready for review July 15, 2026 04:11
@qdaxb
qdaxb merged commit bc168f2 into main Jul 15, 2026
12 of 13 checks passed
@qdaxb
qdaxb deleted the fix/wework-multiline-paste branch July 15, 2026 04:11
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