mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Fixes #4683 - Add support for nested lists
This commit is contained in:
committed by
Stefan Ceriu
parent
cbe0cfe129
commit
14f8e9c1df
@@ -236,19 +236,25 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
}
|
||||
|
||||
content = attributedString(element: childElement, documentBody: documentBody, preserveFormatting: preserveFormatting, listTag: tag, listIndex: &listIndex, indentLevel: indentLevel + 1)
|
||||
|
||||
if indentLevel > 0 {
|
||||
content.insert(NSAttributedString("\n"), at: 0)
|
||||
}
|
||||
|
||||
case "li":
|
||||
var bullet = ""
|
||||
var bullet = String(repeating: " ", count: indentLevel)
|
||||
if listTag == "ol" {
|
||||
bullet = "\(listIndex). "
|
||||
bullet += "\(listIndex). "
|
||||
listIndex += 1
|
||||
} else {
|
||||
bullet = "• "
|
||||
bullet += "• "
|
||||
}
|
||||
|
||||
content = attributedString(element: childElement, documentBody: documentBody, preserveFormatting: preserveFormatting, listTag: listTag, listIndex: &childIndex, indentLevel: indentLevel + 1)
|
||||
content.insert(NSAttributedString(string: bullet), at: 0)
|
||||
content.append(NSAttributedString(string: "\n"))
|
||||
if !(content.string.last?.isNewline ?? false) {
|
||||
content.append(NSAttributedString(string: "\n"))
|
||||
}
|
||||
|
||||
case "img":
|
||||
if let alt = try? childElement.attr("alt"), !alt.isEmpty {
|
||||
|
||||
Reference in New Issue
Block a user