Skip to content

Fix copy-paste between editors losing formatting/content #4432#4582

Merged
gasman merged 1 commit intowagtail:masterfrom
thibaudcolas:bug/copy-paste-between-editors
Jun 14, 2018
Merged

Fix copy-paste between editors losing formatting/content #4432#4582
gasman merged 1 commit intowagtail:masterfrom
thibaudcolas:bug/copy-paste-between-editors

Conversation

@thibaudcolas
Copy link
Member

@thibaudcolas thibaudcolas commented Jun 4, 2018

Fixes #4432. This pull request has been made possible by the backing of my Patreon patrons.

The current copy-paste behavior is a mixture of the browser's default copy behavior, and the Draft.js paste processing.

With this Draftail update, we now override the defaults for both copy and paste between editors:

  • Copy should fill the clipboard with the same markup as before, except with a serialised version of the Draft.js content included, and with less inline styles (can lead to some discrepancies in how word processors receive the pasted content)
  • Paste should work the same in all scenarios, except when the content comes from a Draftail editor. There, it will insert the Draft.js content directly instead of its HTML representation.

draftail-copy-paste-4432

Tested in:

  • Windows 10, IE11 (no support, default "plain text" behavior)
  • Windows 10, Edge 17
  • macOS 10.13, Firefox latest
  • macOS 10.13, Chrome latest
  • macOS 10.13, Safari latest
  • iOS 11.3 Safari
  • Android Chrome 7.1

This fixes quite a few of the known issues with Draft.js (#4274), see the potential diff over at springload/draftail#147 (comment). I'll update the list myself once this PR is merged.

The underlying code changes are:

@thibaudcolas thibaudcolas added type:Bug Defects, errors, broken functionality, regressions, unexpected behavior, crashes status:Needs Review Ready for review by maintainers, awaiting code review, pending feedback component:Rich text Rich text editor, Draftail, HTML rendering, text formatting, embedded content in text labels Jun 4, 2018
@thibaudcolas thibaudcolas added this to the 2.2 milestone Jun 4, 2018
@thibaudcolas thibaudcolas changed the title Upgrade Draftail to latest, fixing copy-paste between editors losing formatting/content. Fixes #4432 Fix copy-paste between editors losing formatting/content #4432 Jun 4, 2018
@gasman gasman merged commit b92847c into wagtail:master Jun 14, 2018
@thibaudcolas
Copy link
Member Author

🎉

@thibaudcolas thibaudcolas deleted the bug/copy-paste-between-editors branch June 14, 2018 17:28
thibaudcolas added a commit to thibaudcolas/wagtail that referenced this pull request Jul 9, 2018
thibaudcolas added a commit that referenced this pull request Jul 9, 2018
@lb- lb- removed the status:Needs Review Ready for review by maintainers, awaiting code review, pending feedback label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:Rich text Rich text editor, Draftail, HTML rendering, text formatting, embedded content in text type:Bug Defects, errors, broken functionality, regressions, unexpected behavior, crashes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

copy paste from rich text editor X to rich text editor Y loses links/hr

3 participants