diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index c86a9ccd3..a8c17345b 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -249,7 +249,7 @@ K.options = { themeType : 'default', langType : 'zh_CN', urlType : '', - newlineTag : 'br', + newlineTag : 'p', resizeType : 1, syncType : 'form', pasteType : 2, diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3828b981b..aec0af070 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1316,17 +1316,12 @@ function pop_up_box(value,tWidth,tTop,tLeft){ } } - //yk 自动识别URL 并加上链接 -//var strRegex = '((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?'; - function autoUrl(id){ if ($("#"+id).children().length > 0 ){ $("#"+id+" p,#"+ id +" span,#"+id+" em,#"+id+" h1,#"+id+" h2,#"+id+" h3,#"+id+" h4,#"+id+" strong,#"+id+" b,#"+id+" font,#"+id+" i").each(function(){ if ($(this).children().length == 0){ - var html = $(this).text(); //.replace(/(^\s*)|(\s*$)/g, "") - console.log("html="+html); -// var re=new RegExp(strRegex,"g"); + var html = $(this).text(); html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { //没有://的都加上http:// var reStr = full; @@ -1337,7 +1332,6 @@ function autoUrl(id){ else{ reStr = ""+full+""; } - console.log("reStr="+reStr); } return reStr ; }); @@ -1346,11 +1340,9 @@ function autoUrl(id){ }); } else{ - var html = $("#"+id).text(); //.replace(/(^\s*)|(\s*$)/g, "") - console.log("!!!!html="+html); -// var re=new RegExp(strRegex,"g"); + var html = $("#"+id).text(); html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{3}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { - //没有://的都加上http:// + //没有://的都加上http:// var reStr = full; if (full.length > 0){ if (full.indexOf("://") >= 0){ @@ -1359,7 +1351,6 @@ function autoUrl(id){ else{ reStr = ""+full+""; } - console.log("reStr="+reStr); } return reStr ; });