From 7addd445ba78ba047cfa6745c665b400a61a148d Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 9 Oct 2018 21:44:51 +0300 Subject: [PATCH] formatting to 'p' because removeFormat cannot deal with headers (h1, h2, ...) --- RichEditorView/Assets/editor/rich_editor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RichEditorView/Assets/editor/rich_editor.js b/RichEditorView/Assets/editor/rich_editor.js index 6fc55d4e..ccd21918 100644 --- a/RichEditorView/Assets/editor/rich_editor.js +++ b/RichEditorView/Assets/editor/rich_editor.js @@ -130,6 +130,10 @@ RE.updatePlaceholder = function() { }; RE.removeFormat = function() { + // https://stackoverflow.com/a/52137754/4514671 + // https://stackoverflow.com/questions/14028773/javascript-execcommandremoveformat-doesnt-strip-h2-tag + // formatting to 'p' because removeFormat cannot deal with headers (h1, h2, ...) + document.execCommand('formatBlock', false, 'p'); document.execCommand('removeFormat', false, null); };