将KE的newlineTag:'br' 改为'p',方便识别网址
This commit is contained in:
parent
ded5f8f861
commit
6d7eca487f
|
@ -249,7 +249,7 @@ K.options = {
|
|||
themeType : 'default',
|
||||
langType : 'zh_CN',
|
||||
urlType : '',
|
||||
newlineTag : 'br',
|
||||
newlineTag : 'p',
|
||||
resizeType : 1,
|
||||
syncType : 'form',
|
||||
pasteType : 2,
|
||||
|
|
|
@ -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 = "<a target='_Blank' href="+"'http://"+full+"'"+">"+full+"</a>";
|
||||
}
|
||||
console.log("reStr="+reStr);
|
||||
}
|
||||
return reStr ;
|
||||
});
|
||||
|
@ -1346,9 +1340,7 @@ 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://
|
||||
var reStr = full;
|
||||
|
@ -1359,7 +1351,6 @@ function autoUrl(id){
|
|||
else{
|
||||
reStr = "<a target='_Blank' href="+"'http://"+full+"'"+">"+full+"</a>";
|
||||
}
|
||||
console.log("reStr="+reStr);
|
||||
}
|
||||
return reStr ;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue