@@ -6,12 +6,14 @@ import UIKit
66public class EditorView : UIView {
77 public let htmlTextView : UITextView
88 public let richTextView : TextView
9+ public let htmlStorage : HTMLStorage
910
1011 // MARK: - Encoding / Decoding
1112
1213 static let htmlTextViewKey = " Aztec.EditorView.htmlTextView "
1314 static let richTextViewKey = " Aztec.EditorView.richTextView "
14-
15+ static let htmlStorageKey = " Aztec.EditorView.htmlStorage "
16+
1517 // MARK: - Content Insets
1618
1719 public var contentInset : UIEdgeInsets {
@@ -95,12 +97,14 @@ public class EditorView: UIView {
9597
9698 public required init ? ( coder aDecoder: NSCoder ) {
9799 guard let htmlTextView = aDecoder. decodeObject ( forKey: EditorView . htmlTextViewKey) as? UITextView ,
98- let richTextView = aDecoder. decodeObject ( forKey: EditorView . richTextViewKey) as? TextView else {
100+ let richTextView = aDecoder. decodeObject ( forKey: EditorView . richTextViewKey) as? TextView ,
101+ let htmlStorage = aDecoder. decodeObject ( forKey: EditorView . htmlStorageKey) as? HTMLStorage else {
99102 return nil
100103 }
101104
102105 self . htmlTextView = htmlTextView
103106 self . richTextView = richTextView
107+ self . htmlStorage = htmlStorage
104108
105109 if #available( iOS 11 , * ) {
106110 htmlTextView. smartInsertDeleteType = . no
@@ -117,10 +121,11 @@ public class EditorView: UIView {
117121 let storage = HTMLStorage ( defaultFont: defaultHTMLFont)
118122 let layoutManager = NSLayoutManager ( )
119123 let container = NSTextContainer ( )
120-
124+
121125 storage. addLayoutManager ( layoutManager)
122126 layoutManager. addTextContainer ( container)
123-
127+
128+ self . htmlStorage = storage
124129 self . htmlTextView = UITextView ( frame: . zero, textContainer: container)
125130 self . richTextView = TextView ( defaultFont: defaultFont, defaultParagraphStyle: defaultParagraphStyle, defaultMissingImage: defaultMissingImage)
126131
0 commit comments