File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -957,7 +957,16 @@ + (NSString *)parseToHtmlFromRange:(NSRange)range
957957 inCheckboxList = NO ;
958958 }
959959 } else {
960- [result appendString: @" \n <br>" ];
960+ NSString *cssStyleString =
961+ [self prepareCssStyleString: currentRange.location
962+ isOpeningTag: YES
963+ host: host];
964+ if (cssStyleString.length > 0 ) {
965+ [result appendString: [NSString stringWithFormat: @" \n <p%@ ></p>" ,
966+ cssStyleString]];
967+ } else {
968+ [result appendString: @" \n <br>" ];
969+ }
961970 }
962971 } else {
963972 // newline finishes a paragraph and all style tags need to be closed
@@ -1456,7 +1465,7 @@ + (NSString *)prepareCssStyleString:(NSInteger)location
14561465}
14571466
14581467+ (void )checkForAlignments : (NSArray *)tagData
1459- plainText : (NSString *)plainText
1468+ plainText : (NSMutableString *)plainText
14601469 foundAlignments : (NSMutableArray <AlignmentEntry *> *)foundAlignments
14611470 precedingImageCount : (NSInteger )precedingImageCount {
14621471 if (tagData == nil ) {
@@ -1474,6 +1483,12 @@ + (void)checkForAlignments:(NSArray *)tagData
14741483 NSInteger actualStart = startLoc + precedingImageCount;
14751484 NSInteger length = plainText.length - startLoc;
14761485
1486+ // Empty aligned paragraphs have no characters to attach alignment to.
1487+ if (length == 0 ) {
1488+ [plainText appendString: @" \u200B " ];
1489+ length = 1 ;
1490+ }
1491+
14771492 if (length > 0 ) {
14781493 AlignmentEntry *entry = [[AlignmentEntry alloc ] init ];
14791494 entry.alignment = align;
You can’t perform that action at this time.
0 commit comments