Skip to content

Commit 528a036

Browse files
committed
Fix empty spaces in articles
1 parent 0954522 commit 528a036

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

ForPDA/Sources/Modules/Article/ArticleBuilder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ final class ArticleBuilder {
3333
if newText.contains("<!--more-->") { newText = newText.replacingOccurrences(of: "<!--more-->", with: "") }
3434
if newText.contains("<br>") { newText = newText.replacingOccurrences(of: "<br>", with: "") }
3535
if newText.contains("&nbsp;") { newText = newText.replacingOccurrences(of: "&nbsp;", with: " ") }
36+
if newText.contains("<span></span>") { newText = newText.replacingOccurrences(of: "<span></span>", with: "")}
3637
newText = newText.trimmingCharacters(in: .whitespacesAndNewlines)
3738

3839
if newText.count == 0 { return nil }

ForPDA/Sources/Modules/Article/ArticleView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ final class ArticleView: UIView {
6666
private(set) var stackView: UIStackView = {
6767
let stackView = UIStackView()
6868
stackView.axis = .vertical
69-
stackView.distribution = .fill
69+
stackView.distribution = .fillProportionally
7070
stackView.spacing = 16
7171
return stackView
7272
}()

ForPDA/Sources/Views/ImageViews/PDAResizingImageViewWithText.swift

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
import UIKit
99

10-
final class PDAResizingImageViewWithText: UIView {
10+
final class PDAResizingImageViewWithText: UIStackView {
1111

12-
let imageView = PDAResizingImageView()
12+
private(set) var imageView = PDAResizingImageView()
1313

14-
let textLabel: UILabel = {
14+
private let textLabel: UILabel = {
1515
let label = UILabel()
1616
label.textColor = .systemGray
1717
label.font = UIFont.systemFont(ofSize: 15)
@@ -22,26 +22,22 @@ final class PDAResizingImageViewWithText: UIView {
2222

2323
init(_ text: String) {
2424
super.init(frame: .zero)
25-
setupView()
25+
26+
distribution = .fillProportionally
27+
axis = .vertical
28+
spacing = 4
29+
2630
textLabel.text = text
27-
}
28-
29-
required init?(coder: NSCoder) {
30-
fatalError("init(coder:) has not been implemented")
31-
}
32-
33-
private func setupView() {
34-
addSubview(imageView)
35-
addSubview(textLabel)
3631

37-
imageView.snp.makeConstraints { make in
38-
make.top.leading.trailing.equalToSuperview()
39-
}
32+
addArrangedSubview(imageView)
33+
addArrangedSubview(textLabel)
4034

4135
textLabel.snp.makeConstraints { make in
42-
make.leading.trailing.equalToSuperview().inset(16)
43-
make.top.equalTo(imageView.snp.bottom).offset(4)
44-
make.bottom.equalToSuperview()
36+
make.horizontalEdges.equalToSuperview().inset(16)
4537
}
4638
}
39+
40+
required init(coder: NSCoder) {
41+
fatalError("init(coder:) has not been implemented")
42+
}
4743
}

0 commit comments

Comments
 (0)