Change the way that headings are applied to elements so that they no longer destroy the parent element by replacing the original tag. #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before if someone attempted to add h1 or h2 a
<blockquote>
or<li>
element, it would wrap the parent element in the selected heading tag. This works fine, until the user attempts to remove the heading, upon which the wrapped element would be replaced with a<p>
tag, and the<h1>
tag was left in place.To replicate the bug:
<blockquote>
or<li>
element.I've fixed it by adding a
toggleFormatHeading(tag)
function. This function attempts to match the chosen headingtag
in the selected elements class names. It removes it if it is found, and adds it if it isn't.I've also added the proper functionality to
reloadMenuState()
to properly check for class names so that the right menu action can be highlighted.You can see the updated functionality by viewing the gh-pages branch from my fork here