Skip to content

Commit d94be69

Browse files
authored
Merge pull request #390 from wordpress-mobile/issue/317-fixing-block-elements-selection-range
Issue/317 fixing block elements selection range
2 parents a22b37b + 411e85b commit d94be69

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ class BlockFormatter(editor: AztecText, val listStyle: ListStyle, val quoteStyle
398398
}
399399

400400
applyBlock(spanToApply, startOfBlock, endOfBlock)
401-
editor.onSelectionChanged(startOfLine, endOfLine)
401+
editor.onSelectionChanged(editor.selectionStart, editor.selectionEnd)
402402
}
403403
}
404404

aztec/src/test/kotlin/org/wordpress/aztec/HeadingTest.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -557,12 +557,7 @@ class HeadingTest {
557557

558558
toolbar.onMenuItemClick(menuHeading2)
559559
Assert.assertEquals("<h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3>", editText.toHtml())
560-
// TODO: Correct heading menu selection. This is incorrect. Heading 2 should be selected.
561-
// AztecToolbar.highlightAppliedStyles returns Heading 1, Heading 2, and Heading 3 so then
562-
// AztecToolbar.selectHeaderMenu selects the first format. See this issue for details.
563-
// https://github.com/wordpress-mobile/AztecEditor-Android/issues/317
564-
// Assert.assertEquals(TextFormat.FORMAT_HEADING_2, toolbar.getSelectedHeadingMenuItem())
565-
Assert.assertEquals(TextFormat.FORMAT_HEADING_1, toolbar.getSelectedHeadingMenuItem())
560+
Assert.assertEquals(TextFormat.FORMAT_HEADING_2, toolbar.getSelectedHeadingMenuItem())
566561
}
567562

568563
@Test

0 commit comments

Comments
 (0)