mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Remove extra new line before list items and useless paragraph style
This commit is contained in:
committed by
Stefan Ceriu
parent
f33d29b7e9
commit
a1038f0ffe
@@ -207,9 +207,6 @@ struct AttributedStringBuilderV2: AttributedStringBuilderProtocol {
|
||||
case "ul", "ol":
|
||||
var listIndex = 1
|
||||
content = attributedString(element: childElement, documentBody: documentBody, preserveFormatting: preserveFormatting, listTag: tag, listIndex: &listIndex, indentLevel: indentLevel + 1)
|
||||
if listTag == nil { // If not within another list
|
||||
content.insert(NSAttributedString(string: "\n"), at: 0)
|
||||
}
|
||||
|
||||
case "li":
|
||||
var bullet = ""
|
||||
@@ -224,11 +221,6 @@ struct AttributedStringBuilderV2: AttributedStringBuilderProtocol {
|
||||
content.insert(NSAttributedString(string: bullet), at: 0)
|
||||
content.append(NSAttributedString(string: "\n"))
|
||||
|
||||
let paragraphStyle = NSMutableParagraphStyle()
|
||||
paragraphStyle.headIndent = CGFloat(indentLevel) * 20
|
||||
paragraphStyle.firstLineHeadIndent = CGFloat(indentLevel) * 20
|
||||
content.addAttribute(.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: content.length))
|
||||
|
||||
case "img":
|
||||
if let alt = try? childElement.attr("alt"), !alt.isEmpty {
|
||||
content = NSMutableAttributedString(string: "[img: \(alt)]")
|
||||
|
||||
Reference in New Issue
Block a user