Skip to content

Commit e2bf437

Browse files
committed
Check if it’s a paragraph separator.
1 parent e0ce665 commit e2bf437

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Aztec/Classes/NSAttributedString/Conversions/HTMLConverter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class HTMLConverter {
7070
func replaceLastEmptyLine(in attributedString: NSAttributedString, with replacement: Character) -> NSAttributedString {
7171
var result = attributedString
7272
let string = attributedString.string
73-
if string.isEmptyLineAtEndOfFile(at: string.count), !string.isEmpty, let location = string.location(before: attributedString.length) {
73+
if !string.isEmpty, string.isEmptyLineAtEndOfFile(at: string.count), string.hasSuffix(String(.paragraphSeparator)), let location = string.location(before: attributedString.length) {
7474
let mutableString = NSMutableAttributedString(attributedString: attributedString)
7575
let attributes = mutableString.attributes(at: location, effectiveRange: nil)
7676
mutableString.replaceCharacters(in: NSRange(location: location, length: attributedString.length-location), with: NSAttributedString(string: String(replacement), attributes: attributes))

0 commit comments

Comments
 (0)