diff --git a/Classes/Views/MarkdownStyledTextView.swift b/Classes/Views/MarkdownStyledTextView.swift index caf0b7642..95c15cd1d 100644 --- a/Classes/Views/MarkdownStyledTextView.swift +++ b/Classes/Views/MarkdownStyledTextView.swift @@ -38,14 +38,14 @@ class MarkdownStyledTextView: StyledTextView, StyledTextViewDelegate { // MARK: StyledTextViewDelegate func didTap(view: StyledTextView, attributes: [NSAttributedStringKey : Any], point: CGPoint) { + if let details = attributes[MarkdownAttribute.details] as? String { + showDetailsInMenu(details: details, point: point) + } guard let detected = DetectMarkdownAttribute(attributes: attributes) else { return } tapDelegate?.didTap(cell: self, attribute: detected) } func didLongPress(view: StyledTextView, attributes: [NSAttributedStringKey : Any], point: CGPoint) { - if let details = attributes[MarkdownAttribute.details] as? String { - showDetailsInMenu(details: details, point: point) - } if let urlString = attributes[MarkdownAttribute.url] as? String, let url = URL(string: urlString) { show(url: url) } diff --git a/Classes/Views/ShowMoreDetailsLabel.swift b/Classes/Views/ShowMoreDetailsLabel.swift index bab4999c8..7a77379a6 100644 --- a/Classes/Views/ShowMoreDetailsLabel.swift +++ b/Classes/Views/ShowMoreDetailsLabel.swift @@ -17,11 +17,11 @@ final class ShowMoreDetailsLabel: UILabel { isUserInteractionEnabled = true - let longPress = UILongPressGestureRecognizer( + let tap = UITapGestureRecognizer( target: self, action: #selector(ShowMoreDetailsLabel.showMenu(recognizer:)) ) - addGestureRecognizer(longPress) + addGestureRecognizer(tap) } required init?(coder aDecoder: NSCoder) { @@ -34,8 +34,8 @@ final class ShowMoreDetailsLabel: UILabel { // MARK: Private API - @objc func showMenu(recognizer: UILongPressGestureRecognizer) { - guard recognizer.state == .began, + @objc func showMenu(recognizer: UITapGestureRecognizer) { + guard recognizer.state == .recognized, !detailText.isEmpty else { return } becomeFirstResponder()