LNPrivacyTextView.swift 1003 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // LNPrivacyTextView.swift
  3. // Lanu
  4. //
  5. // Created by OneeChan on 2025/11/14.
  6. //
  7. import Foundation
  8. import UIKit
  9. class LNPrivacyTextView: LNAutoSizeTextView {
  10. override init(frame: CGRect, textContainer: NSTextContainer?) {
  11. super.init(frame: frame, textContainer: textContainer)
  12. delegate = self
  13. isEditable = false
  14. showsVerticalScrollIndicator = false
  15. showsHorizontalScrollIndicator = false
  16. }
  17. required init?(coder: NSCoder) {
  18. fatalError("init(coder:) has not been implemented")
  19. }
  20. }
  21. extension LNPrivacyTextView: UITextViewDelegate {
  22. func textView(_ textView: UITextView, shouldInteractWith URL: URL,
  23. in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
  24. pushToWebView(LNJumpWebViewConfig.normalConfig(url: URL.absoluteString))
  25. return false
  26. }
  27. func textViewDidChangeSelection(_ textView: UITextView) {
  28. textView.selectedTextRange = nil
  29. }
  30. }