Skip to content

Commit 9f0780b

Browse files
committed
Add and remove new line in order to redraw a heading removed
1 parent 10680e6 commit 9f0780b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/formatting/BlockFormatter.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ class BlockFormatter(editor: AztecText,
165165

166166
if (span != null) {
167167
removeBlockStyle(span.textFormat)
168-
editableText.insert(selectionEnd, "\n")
169-
editableText.delete(selectionEnd, selectionEnd+1)
170168
}
171169

172170
removeBlockStyle(AztecTextFormat.FORMAT_PREFORMAT)
@@ -433,6 +431,11 @@ class BlockFormatter(editor: AztecText,
433431
IAztecNestable.pullUp(editableText, editableText.getSpanStart(span), editableText.getSpanEnd(span), span.nestingLevel)
434432

435433
editableText.removeSpan(span)
434+
435+
if (span is AztecHeadingSpan) {
436+
editableText.insert(spanEnd, "\n")
437+
editableText.delete(spanEnd, spanEnd+1)
438+
}
436439
}
437440
}
438441
}
@@ -751,8 +754,7 @@ class BlockFormatter(editor: AztecText,
751754
// no similar blocks before us so, don't expand
752755
} else if (spansOnPreviousLine.nestingLevel != nestingLevel) {
753756
// other block is at a different nesting level so, don't expand
754-
} else if (spansOnPreviousLine is AztecHeadingSpan
755-
&& spansOnPreviousLine.heading != (spanToApply as AztecHeadingSpan).heading) {
757+
} else if (spansOnPreviousLine is AztecHeadingSpan && spanToApply is AztecHeadingSpan) {
756758
// Heading span is of different style so, don't expand
757759
} else if (!isWithinList) {
758760
// expand the start
@@ -773,8 +775,7 @@ class BlockFormatter(editor: AztecText,
773775
// no similar blocks after us so, don't expand
774776
} else if (spanOnNextLine.nestingLevel != nestingLevel) {
775777
// other block is at a different nesting level so, don't expand
776-
} else if (spanOnNextLine is AztecHeadingSpan
777-
&& spanOnNextLine.heading != (spanToApply as AztecHeadingSpan).heading) {
778+
} else if (spanOnNextLine is AztecHeadingSpan && spanToApply is AztecHeadingSpan) {
778779
// Heading span is of different style so, don't expand
779780
} else if (!isWithinList) {
780781
// expand the end

0 commit comments

Comments
 (0)