Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken paste in iOS 13 #3480

Merged
merged 7 commits into from
Sep 24, 2019
Merged

Fix broken paste in iOS 13 #3480

merged 7 commits into from
Sep 24, 2019

Conversation

msamsel
Copy link
Contributor

@msamsel msamsel commented Sep 23, 2019

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

What is the proposed changelog entry for this pull request?

*[#3354](/~https://github.com/ckeditor/ckeditor4/issues/3354) Fix: Broken paste in iOS 13.

What changes did you make?

Mark current iOS Safari version as supported for custom copy/cut and mark it as trusted browsers. This flags generally change the way how we treat pasted and copied data:

if ( !this.isCustomCopyCutSupported ) {
// Edge < 16 does not support custom copy/cut, but it has some useful data in the clipboardData (https://dev.ckeditor.com/ticket/13755).
return new this.dataTransfer( ( CKEDITOR.env.edge && evt && evt.data.$ && evt.data.$.clipboardData ) || null, sourceEditor );
} else if ( evt && evt.data && evt.data.$ ) {
var clipboardData = evt.data.$.clipboardData,
dataTransfer = new this.dataTransfer( clipboardData, sourceEditor );
// Set dataTransfer.id only for 'copy'/'cut' events (so for events initializing dataTransfer inside editor) (#962).
if ( evt.name === 'copy' || evt.name === 'cut' ) {
dataTransfer.storeId();
}
if ( this.copyCutData && dataTransfer.id == this.copyCutData.id ) {
dataTransfer = this.copyCutData;
dataTransfer.$ = clipboardData;
} else {
this.copyCutData = dataTransfer;
}
return dataTransfer;
} else {
return new this.dataTransfer( null, sourceEditor );
}

It looks like a bug which is reported here: https://bugs.webkit.org/show_bug.cgi?id=19893#c34 no longer occur in iOS Safari.
The current version of Safari supports custom data types applied in data transfer.

As tests were already there covering those features I just simple activate them. I also re-activate manual tests.

Closes #3354

@msamsel msamsel marked this pull request as ready for review September 24, 2019 08:41
@f1ames f1ames self-requested a review September 24, 2019 12:42
@f1ames f1ames self-assigned this Sep 24, 2019
@f1ames
Copy link
Contributor

f1ames commented Sep 24, 2019

Rebased onto latest major.

Copy link
Contributor

@f1ames f1ames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Good job 🎉

@f1ames f1ames merged commit 48cf0c8 into major Sep 24, 2019
@CKEditorBot CKEditorBot deleted the t/3354 branch September 24, 2019 12:50
@AnnaTomanek AnnaTomanek modified the milestone: 4.13.0 Sep 24, 2019
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.

Pasting, among other things, broken with iOS 13 (beta)
3 participants