fix: disable drag and link preview for text editor in compose scene

This commit is contained in:
CMK 2021-06-29 19:27:08 +08:00
parent 71cb19ccae
commit 66643e1058
2 changed files with 17 additions and 0 deletions

View File

@ -767,6 +767,22 @@ extension ComposeViewController: UITextViewDelegate {
return autoCompleteInfo
}
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
if textView === textEditorView()?.textView {
return false
}
return true
}
func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
if textView === textEditorView()?.textView {
return false
}
return true
}
}
// MARK: - TextEditorViewTextAttributesDelegate

View File

@ -27,6 +27,7 @@ final class ComposeStatusContentTableViewCell: UITableViewCell {
metaText.textView.backgroundColor = .clear
metaText.textView.isScrollEnabled = false
metaText.textView.keyboardType = .twitter
metaText.textView.textDragInteraction?.isEnabled = false // disable drag for link and attachment
metaText.textView.textContainer.lineFragmentPadding = 10 // leading inset
metaText.textView.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .regular))
metaText.textView.attributedPlaceholder = {