diff --git a/richeditor/src/main/assets/rich_editor.js b/richeditor/src/main/assets/rich_editor.js index cf45620..6a71732 100644 --- a/richeditor/src/main/assets/rich_editor.js +++ b/richeditor/src/main/assets/rich_editor.js @@ -153,7 +153,8 @@ RE.setFontSize = function(fontSize){ } RE.setHeading = function(heading) { - document.execCommand('formatBlock', false, ''); + var sel = document.getSelection().getRangeAt(0).startContainer.parentNode; + document.execCommand('formatBlock', false, sel.tagName === `H${heading}` ? '

' : ``); } RE.setIndent = function() {