From 6c0e3ace1f430c711ea6355d95c37009fe523fd6 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 23 Jul 2020 20:25:00 +0900 Subject: [PATCH] Fix #1361 always add at least one

tag --- modules/editor/skins/simpleeditor/js/simpleeditor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/editor/skins/simpleeditor/js/simpleeditor.js b/modules/editor/skins/simpleeditor/js/simpleeditor.js index 2cfda25b5..8c064d9e3 100644 --- a/modules/editor/skins/simpleeditor/js/simpleeditor.js +++ b/modules/editor/skins/simpleeditor/js/simpleeditor.js @@ -46,6 +46,9 @@ str = str.replace(/<\/?(\?xml|meta|link|font|span|style|script|noscript|frame|noframes|(?:st1|o):[a-z0-9]+)\b[^>]*?>/ig, ''); str = str.replace(/(id|class|style|on(?:[a-z0-9]+)|Mso(?:[a-z0-9]+))="[^"]*"/ig, ''); str = str.replace(/(<\/?)div(\W)/g, '$1p$2'); + if (!str.match(/<\/?p>/)) { + str = '

' + str + '

'; + } return str; };