2021-06-20 18:14:47 +02:00
|
|
|
//
|
|
|
|
// ASMetaEditableTextNode.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by Cirno MainasuK on 2021-6-20.
|
|
|
|
//
|
|
|
|
|
2021-06-22 07:41:40 +02:00
|
|
|
#if ASDK
|
|
|
|
|
2021-06-20 18:14:47 +02:00
|
|
|
import UIKit
|
|
|
|
import AsyncDisplayKit
|
|
|
|
|
|
|
|
protocol ASMetaEditableTextNodeDelegate: AnyObject {
|
|
|
|
func metaEditableTextNode(_ textNode: ASMetaEditableTextNode, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool
|
|
|
|
}
|
|
|
|
|
|
|
|
final class ASMetaEditableTextNode: ASEditableTextNode, UITextViewDelegate {
|
|
|
|
weak var metaEditableTextNodeDelegate: ASMetaEditableTextNodeDelegate?
|
|
|
|
|
|
|
|
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
|
|
|
|
return metaEditableTextNodeDelegate?.metaEditableTextNode(self, shouldInteractWith: URL, in: characterRange, interaction: interaction) ?? false
|
|
|
|
}
|
|
|
|
}
|
2021-06-22 07:41:40 +02:00
|
|
|
|
|
|
|
#endif
|