You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/js/kindeditor/plugins/clearstyle/clearstyle.js

18 lines
642 B
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

KindEditor.plugin('clearstyle', function(K) {
var self = this, name = 'clearstyle';
self.clickToolbar(name, function() {
var $kecontent=$("iframe.ke-edit-iframe").contents().find(".ke-content");
$kecontent.find('span').removeAttr('style');
$kecontent.find('strong,span,h2,em').each(function() {
var texts=$(this).text(); //其他标签如div、li、p等不能用text()得用html()
texts=texts.replace(/\ +/g,"");//去掉空格
texts=texts.replace(/[ ]/g,"");//去掉空格
texts=texts.replace(/[\r\n]/g,"");//去掉回车换行
if (texts=='') {
$(this).remove();
};
});
alert('清除完毕');
});
});