Adjusted link class detection

The problem is that it's sometimes useful to use URLs as the title of
tiddlers, making it hard to distinguish URLs from tiddler titles...
print-window-tiddler
Jeremy Ruston 2012-01-07 10:35:02 +00:00
rodzic b92183a3a7
commit bd617b2483
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -185,10 +185,10 @@ WikiStore.prototype.getFormattedTiddlerField = function(title,field,format,templ
WikiStore.prototype.classesForLink = function(target) { WikiStore.prototype.classesForLink = function(target) {
var className = "", var className = "",
externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|data):[^\s'"]+(?:\/|\b)/i; externalRegExp = /(?:file|http|https|mailto|ftp|irc|news|data):[^\s'"]+(?:\/|\b)/i;
if(externalRegExp.test(target)) { if (this.tiddlerExists(target)) {
className = "linkExternal";
} else if (this.tiddlerExists(target)) {
className = "linkInternalResolves"; className = "linkInternalResolves";
} else if(externalRegExp.test(target)) {
className = "linkExternal";
} else { } else {
className = "linkInternalMissing"; className = "linkInternalMissing";
} }