Skip to content

Commit 35cf2f0

Browse files
committed
Allow configuration of notification for non-user changes.
1 parent 236fcf9 commit 35cf2f0

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Aztec/Classes/Extensions/UITextView+Delegate.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ extension UITextView {
66
/// Notifies the delegate of a text change.
77
///
88
final func notifyTextViewDidChange() {
9+
if let textView = self as? TextView, !textView.shouldNotifyOfNonUserChanges {
10+
return
11+
}
912
delegate?.textViewDidChange?(self)
1013
NotificationCenter.default.post(name: UITextView.textDidChangeNotification, object: self)
1114
}

Aztec/Classes/TextKit/TextView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ open class TextView: UITextView {
173173
///
174174
open var pasteboardDelegate: TextViewPasteboardDelegate = AztecTextViewPasteboardDelegate()
175175

176+
177+
/// If this is true the text view will notify is delegate and notification system when changes happen by calls to methods like setHTML
178+
///
179+
open var shouldNotifyOfNonUserChanges = false
180+
176181
// MARK: - Customizable Input VC
177182

178183
private var customInputViewController: UIInputViewController?

0 commit comments

Comments
 (0)