mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
#18402493 : 링크가 포함된 문장에서 링크만 보이고 다른 텍스트는 나타나지 않던 문제 수정 + 유닛 테스트 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6897 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
7d690f9acd
commit
e3eaf8de97
2 changed files with 101 additions and 3 deletions
|
|
@ -13,18 +13,21 @@
|
|||
this.extractTargets($('.xe_content'));
|
||||
|
||||
$(this.targets).each(function(){
|
||||
if (!url_regex.test(this.nodeValue)) return true;
|
||||
thisPlugin.cast('AUTOLINK', [this]);
|
||||
});
|
||||
},
|
||||
API_AUTOLINK : function(oSender, params) {
|
||||
var textNode = params[0];
|
||||
var content = textNode.nodeValue;
|
||||
var dummy = $('<span>');
|
||||
|
||||
content = content.replace(/</g, '<').replace(/>/g, '>');
|
||||
content = content.replace(url_regex, '<a href="$1" target="_blank">$1</a>');
|
||||
|
||||
$(textNode).replaceWith(params[0] = $(content));
|
||||
$(textNode).before(dummy);
|
||||
$(textNode).replaceWith(content);
|
||||
params[0] = dummy.next('a');
|
||||
dummy.remove();
|
||||
},
|
||||
extractTargets : function(obj) {
|
||||
var thisPlugin = this;
|
||||
|
|
@ -33,7 +36,7 @@
|
|||
.contents()
|
||||
.each(function(){
|
||||
if (!$(this).is('a,pre,xml,code,script,style,:input')) {
|
||||
if (this.nodeType == 3) { // text node
|
||||
if (this.nodeType == 3 && url_regex.test(this.nodeValue)) { // text node
|
||||
thisPlugin.targets.push(this);
|
||||
} else {
|
||||
thisPlugin.extractTargets(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue