Closed KAUSHIKTECHIE closed 3 years ago
+1
Hopefully this helps!:
RE.setHeading = function(heading) {
var sel = document.getSelection().getRangeAt(0).startContainer.parentNode;
document.execCommand('formatBlock', false, sel.tagName === `H${heading}` ? '<p>' : `<h${heading}>`);
};
Note to self: document.execCommand is deprecated, but there's literally no alternative... we'll have to see what happens after finals.
Any ideas where else I can add this besides the heading?
Fixed in ed734f6f9bb2bb2e09efe183764b488d50d3bcf1
How can we make the headers to toggle like the bold,italics meaning how to remove heading when clicked for second time. The header/size buttons should also be a toggle; doesn’t allow to toggle back to default size.