I have nearly completed the development of a basic text editor. Users are able to write in an iframe and customize their text by making it bold, italic, etc. However, I am struggling to apply the same customization options to headings.
My goal is to enable users to click on a button and switch from italic/bold formatting to heading styles (h1, h2, h3, h4, etc).
Here is what I have attempted so far:
window.addEventListener("load", function (){
var editor = wysiwyg.document;
editor.designMode = "on";
boldButton.addEventListener("click", function (){ editor.execCommand("Bold");}, false)
italicButton.addEventListener("click", function (){ editor.execCommand("Italic");}, false)}, false);
Currently, when the user clicks the bold button, the text becomes bold. How can I achieve a similar functionality where clicking the button changes the text to a heading style like h1 or h2?