From e36023b94809df5f3bf0625f888f4bb8b86bfe77 Mon Sep 17 00:00:00 2001 From: augushong Date: Fri, 25 Mar 2022 22:14:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E6=A0=87=E7=82=B9=E4=BC=98?= =?UTF-8?q?=E5=8C=96;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/admin/post/edit_content.html | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/view/admin/post/edit_content.html b/view/admin/post/edit_content.html index 752bddb..3fa4a11 100644 --- a/view/admin/post/edit_content.html +++ b/view/admin/post/edit_content.html @@ -252,13 +252,11 @@ $('#settle-content-mark').click(function () { - var content = editor.getHtml(); - var contentDom = $(content); - var newContentDom = []; - contentDom.each(function (index, elem) { + var contentDom = editor.getEditableContainer(); + $(contentDom).find('.w-e-scroll>div').children().each(function (index, elem) { var tagName = elem.tagName; - + console.log(elem); var settleTagList = [ 'P', 'H1', @@ -268,7 +266,7 @@ 'UL', ]; if (settleTagList.indexOf(tagName) < 0) { - newContentDom.push(elem) + return true; } @@ -276,27 +274,19 @@ html = html.replaceAll(',', ','); html = html.replaceAll('.', '。'); html = html.replaceAll('!', '!'); - html = html.replaceAll(':', ';'); + html = html.replaceAll(';', ';'); html = html.replaceAll(':', ':'); html = html.replaceAll('?', '?'); // html = html.replaceAll('<', '《'); // html = html.replaceAll('>', '》'); - html = html.replaceAll('/', '、'); - + // html = html.replaceAll('/', '、'); + console.log(elem); $(elem).html(html) - newContentDom.push(elem) - - }) - editor.clear() - - newContentDom.forEach(elem => { - var outerHTML = $(elem).prop('outerHTML'); - console.log(outerHTML); - editor.dangerouslyInsertHtml(outerHTML) - }); + return false; + })