Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dom.js #1140

Open
wants to merge 1 commit 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
6 changes: 6 additions & 0 deletions src/lib/util/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,12 @@ define(['jquery', 'util/class', 'aloha/ecma5shims'], function (jQuery, Class, $_
if (content.length > 0) {
// when the object has children, we unwrap them
content.first().unwrap();
// wrap the children with p tags if they were originally in Heading or PRE tags.
var re = new RegExp(/\b(h[1-6]{1}|pre)\b/i),
exec = re.exec(markup.get(0).nodeName);
if (exec !== null && 0 === exec.index) {
content.first().wrap('<p></p>');
}
} else {
// obj has no children, so just remove it
jQuery(rangeTree[i].domobj).remove();
Expand Down