-
Notifications
You must be signed in to change notification settings - Fork 146
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 copy paste #1193
Fix copy paste #1193
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good – tests pass and the code is simple enough.
Tested:
✅ Pastes into Messages as Plain Text.
✅ Pastes into Notes as semi-rich text – headings, bold, italic, underline etc work. Lists don't have bullets or numbers.
✅ Pastes into WP in exactly the same way it was copied.
Works for me, so merging.
@@ -555,7 +555,11 @@ open class TextView: UITextView { | |||
// MARK: - Pasteboard Helpers | |||
|
|||
internal func storeInPasteboard(encoded data: Data, pasteboard: UIPasteboard = UIPasteboard.general) { | |||
pasteboard.setData(data, forPasteboardType: NSAttributedString.pastesboardUTI) | |||
if pasteboard.numberOfItems > 0 { | |||
pasteboard.items[0][NSAttributedString.pastesboardUTI] = data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we're doing this one. Why not use setItems(_:options:) in both cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that, but setItems will reset everything, so unless you first copy what you already have there and add the extra UTI to it.
setItems was overwritting the values already there, unless you copy them
first... and then apply again.
…On Mon, 27 May 2019 at 08:35, Jorge Bernal ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Aztec/Classes/TextKit/TextView.swift
<#1193 (comment)>
:
> @@ -555,7 +555,11 @@ open class TextView: UITextView {
// MARK: - Pasteboard Helpers
internal func storeInPasteboard(encoded data: Data, pasteboard: UIPasteboard = UIPasteboard.general) {
- pasteboard.setData(data, forPasteboardType: NSAttributedString.pastesboardUTI)
+ if pasteboard.numberOfItems > 0 {
+ pasteboard.items[0][NSAttributedString.pastesboardUTI] = data;
I don't understand why we're doing this one. Why not use
setItems(_:options:)
<https://developer.apple.com/documentation/uikit/uipasteboard/1829417-setitems>
in both cases?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1193?email_source=notifications&email_token=AAE7CUNILHIEQPDTAZEMOVDPXOFLJA5CNFSM4HPREMDKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBZXKYOQ#pullrequestreview-242134074>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAE7CUJX4X53RGRVFXZLYY3PXOFLJANCNFSM4HPREMDA>
.
|
Fixes #
This PR brings the fix for copy paste to develop.
To test: