开始标点优化;

This commit is contained in:
2022-03-25 22:14:32 +08:00
parent 7203f5e7f2
commit e36023b948

View File

@@ -252,13 +252,11 @@
$('#settle-content-mark').click(function () { $('#settle-content-mark').click(function () {
var content = editor.getHtml();
var contentDom = $(content);
var newContentDom = []; var contentDom = editor.getEditableContainer();
contentDom.each(function (index, elem) { $(contentDom).find('.w-e-scroll>div').children().each(function (index, elem) {
var tagName = elem.tagName; var tagName = elem.tagName;
console.log(elem);
var settleTagList = [ var settleTagList = [
'P', 'P',
'H1', 'H1',
@@ -268,7 +266,7 @@
'UL', 'UL',
]; ];
if (settleTagList.indexOf(tagName) < 0) { if (settleTagList.indexOf(tagName) < 0) {
newContentDom.push(elem)
return true; 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('?', ''); 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) $(elem).html(html)
newContentDom.push(elem)
}) })
editor.clear() return false;
newContentDom.forEach(elem => {
var outerHTML = $(elem).prop('outerHTML');
console.log(outerHTML);
editor.dangerouslyInsertHtml(outerHTML)
});
}) })