From 6d7eca487f5ef521692267fbacceacc609981665 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 20 May 2016 17:02:43 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=86KE=E7=9A=84newlineTag=EF=BC=9A'br'=20?=
=?UTF-8?q?=E6=94=B9=E4=B8=BA'p',=E6=96=B9=E4=BE=BF=E8=AF=86=E5=88=AB?=
=?UTF-8?q?=E7=BD=91=E5=9D=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/assets/kindeditor/kindeditor.js | 2 +-
public/javascripts/application.js | 15 +++------------
2 files changed, 4 insertions(+), 13 deletions(-)
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 ;
});