feat: allow thread root post content selectable. ticket: #2875DRC

This commit is contained in:
CMK 2021-07-07 16:41:42 +08:00
parent 0afa408fb2
commit 54ea1e9c0d
4 changed files with 18 additions and 3 deletions

View File

@ -4833,7 +4833,7 @@
repositoryURL = "https://github.com/TwidereProject/MetaTextView.git";
requirement = {
kind = exactVersion;
version = 1.2.5;
version = 1.3.0;
};
};
DB0E2D2C26833FF600865C3C /* XCRemoteSwiftPackageReference "Nuke-FLAnimatedImage-Plugin" */ = {

View File

@ -114,8 +114,8 @@
"repositoryURL": "https://github.com/TwidereProject/MetaTextView.git",
"state": {
"branch": null,
"revision": "9ba4027ed0a88185ce95bb1773620c2ceaa9f3bb",
"version": "1.2.5"
"revision": "e2049e14ef411c6810d53c1baf553b5161c6678f",
"version": "1.3.0"
}
},
{

View File

@ -137,6 +137,9 @@ extension StatusSection {
switch item {
case .root:
// allow select content
cell.statusView.contentMetaText.textView.isSelectable = true
// configure thread meta
StatusSection.configureThreadMeta(cell: cell, status: status)
ManagedObjectObserver.observe(object: status.reblog ?? status)
.receive(on: RunLoop.main)

View File

@ -220,6 +220,7 @@ final class StatusView: UIView {
metaText.textView.textContainer.lineFragmentPadding = 0
metaText.textView.textContainerInset = .zero
metaText.textView.layer.masksToBounds = false
metaText.textView.textDragInteraction?.isEnabled = false // disable drag for link and attachment
let paragraphStyle: NSMutableParagraphStyle = {
let style = NSMutableParagraphStyle()
@ -583,6 +584,17 @@ extension StatusView: MetaTextViewDelegate {
// MARK: - UITextViewDelegate
extension StatusView: UITextViewDelegate {
func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
switch textView {
case contentMetaText.textView:
return false
default:
assertionFailure()
return true
}
}
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
switch textView {
case contentMetaText.textView: