Skip to content

fix: remove pasted text/background colors in Tiptap editor - #3275

Merged
AlexAndBear merged 2 commits into
mainfrom
fix/tiptap-paste-strip-colors
Sep 1, 2026
Merged

AlexAndBear merged 2 commits into
mainfrom
fix/tiptap-paste-strip-colors

Conversation

@AlexAndBear

Copy link
Copy Markdown
Member

Description

When users paste content from websites or emails into Tiptap, inline color / background-color styles can make text unreadable in dark theme (for example black text on dark background).

This change strips pasted text and background colors while preserving other inline styles.

Downsides / trade-offs:

  • Intentional source colors and highlights are not preserved on paste.
  • Legacy HTML color attributes (color, bgcolor) are removed as well, which can reduce visual fidelity for copied legacy content.

Related Issue

  • Fixes <issue_link>

How Has This Been Tested?

  • test environment: local macOS dev environment, pnpm + vitest
  • test case 1: pnpm --config.confirmModulesPurge=false test:unit --run packages/web-pkg/tests/unit/editor/helpers/paste.spec.ts
  • test case 2: pnpm --config.confirmModulesPurge=false test:unit --run packages/web-pkg/tests/unit/editor/composables/useTextEditor.spec.ts
  • test case 3: pnpm --config.confirmModulesPurge=false test:unit --run packages/web-pkg/tests/unit/editor/helpers/paste.spec.ts packages/web-pkg/tests/unit/editor/composables/useTextEditor.spec.ts
  • ...

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@AlexAndBear
AlexAndBear merged commit a8341a9 into main Sep 1, 2026
31 checks passed
@AlexAndBear
AlexAndBear deleted the fix/tiptap-paste-strip-colors branch September 1, 2026 07:06
@github-project-automation github-project-automation Bot moved this from Qualification to Done in OpenCloud Team Board Sep 1, 2026
@openclouders openclouders mentioned this pull request Sep 1, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants