@@ -1574,13 +1574,22 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
1574
1574
return cursorPosition
1575
1575
}
1576
1576
1577
+ open fun fromSpanned (spannedText : Spanned , isInit : Boolean = true) {
1578
+ processSpannedContent(spannedText, isInit)
1579
+ }
1580
+
1577
1581
open fun fromHtml (source : String , isInit : Boolean = true) {
1578
- val builder = SpannableStringBuilder ()
1579
1582
val parser = AztecParser (alignmentRendering, plugins)
1580
1583
1581
1584
var cleanSource = CleaningUtils .cleanNestedBoldTags(source)
1582
1585
cleanSource = Format .removeSourceEditorFormatting(cleanSource, isInCalypsoMode, isInGutenbergMode)
1583
- builder.append(parser.fromHtml(cleanSource, context, shouldSkipTidying(), shouldIgnoreWhitespace()))
1586
+ val spanned = parser.fromHtml(cleanSource, context, shouldSkipTidying(), shouldIgnoreWhitespace())
1587
+
1588
+ processSpannedContent(spanned)
1589
+ }
1590
+
1591
+ private fun processSpannedContent (spannedText : Spanned , isInit : Boolean = true) {
1592
+ val builder = SpannableStringBuilder (spannedText)
1584
1593
1585
1594
Format .preProcessSpannedText(builder, isInCalypsoMode)
1586
1595
@@ -1600,7 +1609,8 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
1600
1609
setSelection(cursorPosition)
1601
1610
1602
1611
if (isInit) {
1603
- initialEditorContentParsedSHA256 = calculateInitialHTMLSHA(toPlainHtml(false ), initialEditorContentParsedSHA256)
1612
+ initialEditorContentParsedSHA256 =
1613
+ calculateInitialHTMLSHA(toPlainHtml(false ), initialEditorContentParsedSHA256)
1604
1614
}
1605
1615
1606
1616
loadImages()
0 commit comments