@@ -30,7 +30,7 @@ public class TextDisplayStackView: UIStackView {
30
30
var estimatedHeight = CGFloat ( 0 )
31
31
weak var parentLongPress : UILongPressGestureRecognizer ?
32
32
33
- let firstTextView : UILabel
33
+ let firstTextView : CoolTextView
34
34
let overflow : UIStackView
35
35
let links : UIScrollView
36
36
@@ -54,7 +54,7 @@ public class TextDisplayStackView: UIStackView {
54
54
self . tColor = . black
55
55
self . baseFontColor = . white
56
56
self . delegate = delegate
57
- self . firstTextView = UILabel ( frame: . zero)
57
+ self . firstTextView = CoolTextView ( frame: . zero)
58
58
self . overflow = UIStackView ( )
59
59
self . overflow. isUserInteractionEnabled = true
60
60
self . links = TouchUIScrollView ( )
@@ -114,9 +114,8 @@ public class TextDisplayStackView: UIStackView {
114
114
self . tColor = color
115
115
self . delegate = delegate
116
116
self . baseFontColor = baseFontColor
117
- self . firstTextView = UILabel ( frame: CGRect . zero) . then ( {
117
+ self . firstTextView = CoolTextView ( frame: CGRect . zero) . then ( {
118
118
$0. accessibilityIdentifier = " Top title "
119
- $0. numberOfLines = 0
120
119
$0. setContentCompressionResistancePriority ( UILayoutPriority . required, for: . vertical)
121
120
} )
122
121
self . links = TouchUIScrollView ( )
@@ -189,7 +188,6 @@ public class TextDisplayStackView: UIStackView {
189
188
}
190
189
191
190
firstTextView. attributedText = string
192
- firstTextView. preferredMaxLayoutWidth = estimatedWidth
193
191
194
192
if !ignoreHeight {
195
193
// let framesetterB = CTFramesetterCreateWithAttributedString(string)
@@ -256,7 +254,6 @@ public class TextDisplayStackView: UIStackView {
256
254
}
257
255
258
256
firstTextView. attributedText = newTitle
259
- firstTextView. preferredMaxLayoutWidth = estimatedWidth
260
257
261
258
if !ignoreHeight {
262
259
// let framesetterB = CTFramesetterCreateWithAttributedString(newTitle)
@@ -312,7 +309,6 @@ public class TextDisplayStackView: UIStackView {
312
309
// firstTextView.linkAttributes = activeLinkAttributes as NSDictionary as? [AnyHashable: Any]
313
310
314
311
firstTextView. attributedText = newTitle
315
- firstTextView. preferredMaxLayoutWidth = estimatedWidth
316
312
317
313
if !ignoreHeight {
318
314
// let framesetterB = CTFramesetterCreateWithAttributedString(newTitle)
@@ -423,7 +419,6 @@ public class TextDisplayStackView: UIStackView {
423
419
}
424
420
425
421
firstTextView. attributedText = text
426
- firstTextView. preferredMaxLayoutWidth = estimatedWidth
427
422
428
423
if !ignoreHeight {
429
424
// let framesetterB = CTFramesetterCreateWithAttributedString(text)
@@ -493,12 +488,10 @@ public class TextDisplayStackView: UIStackView {
493
488
if body. isEmpty {
494
489
continue
495
490
}
496
- let label = UILabel ( frame: . zero)
491
+ let label = CoolTextView ( frame: . zero)
497
492
label. accessibilityIdentifier = " Quote "
498
493
let text = createAttributedChunk ( baseHTML: body, accent: tColor, linksCallback: linksCallback, indexCallback: indexCallback)
499
494
label. alpha = 0.7
500
- label. numberOfLines = 0
501
- label. lineBreakMode = . byWordWrapping
502
495
// TODOjon:
503
496
// label.highlightLongPressAction = longTouchLinkAction
504
497
// label.highlightTapAction = touchLinkAction
@@ -509,7 +502,6 @@ public class TextDisplayStackView: UIStackView {
509
502
510
503
let size = text. boundingSize ( givenSize: CGSize ( width: estimatedWidth - 12 , height: CGFloat . greatestFiniteMagnitude) )
511
504
estimatedHeight += size. height
512
- label. preferredMaxLayoutWidth = size. width
513
505
label. attributedText = text
514
506
515
507
baseView. addSubview ( label)
@@ -529,10 +521,8 @@ public class TextDisplayStackView: UIStackView {
529
521
continue
530
522
}
531
523
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 {
533
525
$0. accessibilityIdentifier = " Paragraph "
534
- $0. numberOfLines = 0
535
- $0. lineBreakMode = . byWordWrapping
536
526
$0. attributedText = text
537
527
$0. setContentCompressionResistancePriority ( UILayoutPriority . required, for: . vertical)
538
528
}
@@ -541,7 +531,6 @@ public class TextDisplayStackView: UIStackView {
541
531
// label.highlightTapAction = touchLinkAction
542
532
543
533
let size = text. boundingSize ( givenSize: CGSize ( width: estimatedWidth, height: CGFloat . greatestFiniteMagnitude) )
544
- label. preferredMaxLayoutWidth = size. width
545
534
546
535
estimatedHeight += size. height
547
536
0 commit comments