Lets be a bit smarter about moving the offset
This commit is contained in:
parent
4a047c39e8
commit
86d4fcb07c
@ -4434,17 +4434,16 @@
|
||||
}
|
||||
range = Linkify.makeRange(node, endNode, index, length);
|
||||
if (link = Linkify.regString.exec(text = range.toString())) {
|
||||
if ((lIndex = link.index) !== index) {
|
||||
range.setStart(node, lIndex);
|
||||
if (lIndex = link.index) {
|
||||
range.setStart(node, lIndex + index);
|
||||
}
|
||||
links.push([range, text]);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (result = Linkify.regString.exec(result[0])) {
|
||||
Linkify.regString.lastIndex = 0;
|
||||
range = Linkify.makeRange(node, node, result.index, result.length);
|
||||
links.push([range, result[0]]);
|
||||
if (link = Linkify.regString.exec(result[0])) {
|
||||
range = Linkify.makeRange(node, node, link.index, link.length);
|
||||
links.push([range, link]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4439,17 +4439,16 @@
|
||||
}
|
||||
range = Linkify.makeRange(node, endNode, index, length);
|
||||
if (link = Linkify.regString.exec(text = range.toString())) {
|
||||
if ((lIndex = link.index) !== index) {
|
||||
range.setStart(node, lIndex);
|
||||
if (lIndex = link.index) {
|
||||
range.setStart(node, lIndex + index);
|
||||
}
|
||||
links.push([range, text]);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (result = Linkify.regString.exec(result[0])) {
|
||||
Linkify.regString.lastIndex = 0;
|
||||
range = Linkify.makeRange(node, node, result.index, result.length);
|
||||
links.push([range, result[0]]);
|
||||
if (link = Linkify.regString.exec(result[0])) {
|
||||
range = Linkify.makeRange(node, node, link.index, link.length);
|
||||
links.push([range, link]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,16 +69,15 @@ Linkify =
|
||||
if length is endNode.data.length then test.lastIndex = 0
|
||||
range = Linkify.makeRange node, endNode, index, length
|
||||
if link = Linkify.regString.exec text = range.toString()
|
||||
if (lIndex = link.index) isnt index
|
||||
range.setStart node, lIndex
|
||||
if lIndex = link.index
|
||||
range.setStart node, lIndex + index
|
||||
links.push [range, text]
|
||||
break
|
||||
|
||||
else
|
||||
if result = Linkify.regString.exec result[0]
|
||||
Linkify.regString.lastIndex = 0
|
||||
range = Linkify.makeRange node, node, result.index, result.length
|
||||
links.push [range, result[0]]
|
||||
if link = Linkify.regString.exec result[0]
|
||||
range = Linkify.makeRange node, node, link.index, link.length
|
||||
links.push [range, link]
|
||||
|
||||
for range in links.reverse()
|
||||
@nodes.links.push Linkify.makeLink range, @
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user