add horizontal rule command

This commit is contained in:
Philipp Kühn
2020-11-18 12:26:13 +01:00
parent 45a4562d4a
commit 9a376a66e6
5 changed files with 8 additions and 6 deletions

View File

@@ -30,8 +30,10 @@ const HorizontalRule = Node.create({
/**
* Add a horizontal rule
*/
horizontalRule: (): Command => ({ tr }) => {
tr.replaceSelectionWith(this.type.create())
setHorizontalRule: (): Command => ({ tr, dispatch }) => {
if (dispatch) {
tr.replaceSelectionWith(this.type.create())
}
return true
},