Skip to content

Commit

Permalink
InlineFormatter - Prevent picking previous Mark styles if the format …
Browse files Browse the repository at this point in the history
…is no longer active
  • Loading branch information
Gerardo committed Feb 29, 2024
1 parent bdfb20f commit ffdddf3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ class InlineFormatter(editor: AztecText, val codeStyle: CodeStyle, private val h
return
}

// Remove leading Mark formatting styles if the format is not active
if (!editor.selectedStyles.contains(AztecTextFormat.FORMAT_MARK) && newStart >=1 && end > 1) {
val markSpan = editableText.getSpans(newStart - 1, newStart, MarkSpan::class.java);
if (markSpan.isNotEmpty()) {
removeInlineCssStyle(newStart, end)
}
}

editableText.getSpans(newStart, end, IAztecInlineSpan::class.java).forEach {
if (!editor.selectedStyles.contains(spanToTextFormat(it)) || ignoreSelectedStyles || (newStart == 0 && end == 0) ||
(newStart > end && editableText.length > end && editableText[end] == '\n')) {
Expand Down

0 comments on commit ffdddf3

Please sign in to comment.