Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Fix remove format not handling headers #184

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions RichEditorView/Assets/editor/rich_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ RE.updatePlaceholder = function() {
};

RE.removeFormat = function() {
// https://stackoverflow.com/a/52137754/4514671
// https://stackoverflow.com/questions/14028773/javascript-execcommandremoveformat-doesnt-strip-h2-tag
// fix for body button not formatting headers
// formatting to 'p' because removeFormat cannot deal with headers (h1, h2, ...)
document.execCommand('formatBlock', false, 'p');
document.execCommand('removeFormat', false, null);
};

Expand Down