@@ -329,6 +329,11 @@ object Format {
329329 text.setSpan(EndOfParagraphMarker (), spanEnd, spanEnd + 1 , Spannable .SPAN_EXCLUSIVE_EXCLUSIVE )
330330 }
331331 }
332+
333+ // we don't need paragraph spans in calypso at this point
334+ text.getSpans(0 ,text.length, ParagraphSpan ::class .java).forEach {
335+ text.removeSpan(it)
336+ }
332337 }
333338 }
334339
@@ -343,14 +348,15 @@ object Format {
343348 val spanStart = text.getSpanStart(it)
344349 val spanEnd = text.getSpanEnd(it)
345350
346- if (text[spanStart] == ' \n ' && text.getSpans(spanEnd, spanEnd + 1 , AztecParagraphStyle ::class .java).filter { it !is ParagraphSpan }.isEmpty()) {
351+ if (text[spanStart] == ' \n ' && text.getSpans(spanEnd, spanEnd + 1 , AztecParagraphStyle ::class .java)
352+ .filter { it !is ParagraphSpan && text.getSpanStart(it) == spanEnd }.isEmpty()) {
347353 text.insert(spanEnd, " \n " )
348354 }
349355
350- if (text.getSpans(spanStart, spanEnd, AztecQuoteSpan ::class .java).isEmpty()) {
356+ if (text.getSpans(spanStart, spanEnd, AztecQuoteSpan ::class .java)
357+ .filter { text.getSpanEnd(it) == spanEnd }.isEmpty()) {
351358 text.getSpans(spanStart, spanEnd, AztecVisualLinebreak ::class .java).forEach { text.removeSpan(it) }
352359 }
353-
354360 }
355361
356362 // we don't care about actual ParagraphSpan in calypso - paragraphs are made from double newline
0 commit comments