Merge pull request #717 from mastodon/fix-issue-660
Workaround paste crash on iOS 14.x issue
This commit is contained in:
commit
b15ae5e50f
|
@ -13,17 +13,21 @@ extension MetaTextView {
|
||||||
public override func paste(_ sender: Any?) {
|
public override func paste(_ sender: Any?) {
|
||||||
super.paste(sender)
|
super.paste(sender)
|
||||||
|
|
||||||
var nextResponder = self.next;
|
// fix #660
|
||||||
|
// https://github.com/mastodon/mastodon-ios/issues/660
|
||||||
// Force the event to bubble through ALL responders
|
if #available(iOS 15.0, *) {
|
||||||
// This is a workaround as somewhere down the chain the paste event gets eaten
|
var nextResponder = self.next;
|
||||||
while (nextResponder != nil) {
|
|
||||||
if let nextResponder = nextResponder {
|
// Force the event to bubble through ALL responders
|
||||||
if (nextResponder.responds(to: #selector(UIResponderStandardEditActions.paste(_:)))) {
|
// This is a workaround as somewhere down the chain the paste event gets eaten
|
||||||
nextResponder.perform(#selector(UIResponderStandardEditActions.paste(_:)), with: sender)
|
while (nextResponder != nil) {
|
||||||
|
if let nextResponder = nextResponder {
|
||||||
|
if (nextResponder.responds(to: #selector(UIResponderStandardEditActions.paste(_:)))) {
|
||||||
|
nextResponder.perform(#selector(UIResponderStandardEditActions.paste(_:)), with: sender)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
nextResponder = nextResponder?.next;
|
||||||
}
|
}
|
||||||
nextResponder = nextResponder?.next;
|
} // end if
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue