@@ -30,7 +30,7 @@ public class TextDisplayStackView: UIStackView {
3030 var estimatedHeight = CGFloat ( 0 )
3131 weak var parentLongPress : UILongPressGestureRecognizer ?
3232
33- let firstTextView : UILabel
33+ let firstTextView : CoolTextView
3434 let overflow : UIStackView
3535 let links : UIScrollView
3636
@@ -54,7 +54,7 @@ public class TextDisplayStackView: UIStackView {
5454 self . tColor = . black
5555 self . baseFontColor = . white
5656 self . delegate = delegate
57- self . firstTextView = UILabel ( frame: . zero)
57+ self . firstTextView = CoolTextView ( frame: . zero)
5858 self . overflow = UIStackView ( )
5959 self . overflow. isUserInteractionEnabled = true
6060 self . links = TouchUIScrollView ( )
@@ -114,9 +114,8 @@ public class TextDisplayStackView: UIStackView {
114114 self . tColor = color
115115 self . delegate = delegate
116116 self . baseFontColor = baseFontColor
117- self . firstTextView = UILabel ( frame: CGRect . zero) . then ( {
117+ self . firstTextView = CoolTextView ( frame: CGRect . zero) . then ( {
118118 $0. accessibilityIdentifier = " Top title "
119- $0. numberOfLines = 0
120119 $0. setContentCompressionResistancePriority ( UILayoutPriority . required, for: . vertical)
121120 } )
122121 self . links = TouchUIScrollView ( )
@@ -189,7 +188,6 @@ public class TextDisplayStackView: UIStackView {
189188 }
190189
191190 firstTextView. attributedText = string
192- firstTextView. preferredMaxLayoutWidth = estimatedWidth
193191
194192 if !ignoreHeight {
195193// let framesetterB = CTFramesetterCreateWithAttributedString(string)
@@ -256,7 +254,6 @@ public class TextDisplayStackView: UIStackView {
256254 }
257255
258256 firstTextView. attributedText = newTitle
259- firstTextView. preferredMaxLayoutWidth = estimatedWidth
260257
261258 if !ignoreHeight {
262259// let framesetterB = CTFramesetterCreateWithAttributedString(newTitle)
@@ -312,7 +309,6 @@ public class TextDisplayStackView: UIStackView {
312309// firstTextView.linkAttributes = activeLinkAttributes as NSDictionary as? [AnyHashable: Any]
313310
314311 firstTextView. attributedText = newTitle
315- firstTextView. preferredMaxLayoutWidth = estimatedWidth
316312
317313 if !ignoreHeight {
318314// let framesetterB = CTFramesetterCreateWithAttributedString(newTitle)
@@ -423,7 +419,6 @@ public class TextDisplayStackView: UIStackView {
423419 }
424420
425421 firstTextView. attributedText = text
426- firstTextView. preferredMaxLayoutWidth = estimatedWidth
427422
428423 if !ignoreHeight {
429424// let framesetterB = CTFramesetterCreateWithAttributedString(text)
@@ -493,12 +488,10 @@ public class TextDisplayStackView: UIStackView {
493488 if body. isEmpty {
494489 continue
495490 }
496- let label = UILabel ( frame: . zero)
491+ let label = CoolTextView ( frame: . zero)
497492 label. accessibilityIdentifier = " Quote "
498493 let text = createAttributedChunk ( baseHTML: body, accent: tColor, linksCallback: linksCallback, indexCallback: indexCallback)
499494 label. alpha = 0.7
500- label. numberOfLines = 0
501- label. lineBreakMode = . byWordWrapping
502495 // TODOjon:
503496// label.highlightLongPressAction = longTouchLinkAction
504497// label.highlightTapAction = touchLinkAction
@@ -509,7 +502,6 @@ public class TextDisplayStackView: UIStackView {
509502
510503 let size = text. boundingSize ( givenSize: CGSize ( width: estimatedWidth - 12 , height: CGFloat . greatestFiniteMagnitude) )
511504 estimatedHeight += size. height
512- label. preferredMaxLayoutWidth = size. width
513505 label. attributedText = text
514506
515507 baseView. addSubview ( label)
@@ -529,10 +521,8 @@ public class TextDisplayStackView: UIStackView {
529521 continue
530522 }
531523 let text = createAttributedChunk ( baseHTML: block. trimmed ( ) , accent: tColor, linksCallback: linksCallback, indexCallback: indexCallback)
532- let label = UILabel ( frame: CGRect . zero) . then {
524+ let label = CoolTextView ( frame: CGRect . zero) . then {
533525 $0. accessibilityIdentifier = " Paragraph "
534- $0. numberOfLines = 0
535- $0. lineBreakMode = . byWordWrapping
536526 $0. attributedText = text
537527 $0. setContentCompressionResistancePriority ( UILayoutPriority . required, for: . vertical)
538528 }
@@ -541,7 +531,6 @@ public class TextDisplayStackView: UIStackView {
541531// label.highlightTapAction = touchLinkAction
542532
543533 let size = text. boundingSize ( givenSize: CGSize ( width: estimatedWidth, height: CGFloat . greatestFiniteMagnitude) )
544- label. preferredMaxLayoutWidth = size. width
545534
546535 estimatedHeight += size. height
547536
0 commit comments