From a8c82902e26987e12b6dcb8e2a0b1b8eec59381d Mon Sep 17 00:00:00 2001 From: cecilialam Date: Mon, 24 Mar 2014 12:57:36 -0400 Subject: [PATCH] Update dom.js remove formatting of Heading tags and PRE tag leave the text content with no tag. The code changes will wrap the text content with p tags. --- src/lib/util/dom.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/util/dom.js b/src/lib/util/dom.js index 46a44a86c2..7565733d3e 100755 --- a/src/lib/util/dom.js +++ b/src/lib/util/dom.js @@ -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('

'); + } } else { // obj has no children, so just remove it jQuery(rangeTree[i].domobj).remove();