fixed: detection of last tag
This commit is contained in:
parent
d0c6693ff7
commit
2d30055274
12
main.js
12
main.js
|
@ -602,7 +602,7 @@ function linkatpos()
|
|||
|
||||
function tagatpos()
|
||||
{
|
||||
if (md.value.lastIndexOf("tags: ", md.selectionStart) < md.value.lastIndexOf("\n", md.selectionStart))
|
||||
if (md.value.lastIndexOf("tags: ", md.selectionStart) < md.value.lastIndexOf("\n", md.selectionStart) || md.selectionStart < 6)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -610,13 +610,13 @@ function tagatpos()
|
|||
var start = md.value.lastIndexOf(" ", md.selectionStart);
|
||||
if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return "";
|
||||
|
||||
var eol = md.value.indexOf("\n", md.selectionStart);
|
||||
var end = md.value.indexOf(",", md.selectionStart);
|
||||
if (end == -1)
|
||||
{
|
||||
end = md.value.indexOf("\n", md.selectionStart);
|
||||
}
|
||||
|
||||
if (end == -1 || md.value.substring(md.selectionStart, end).indexOf("\n") != -1) return "";
|
||||
if (end == -1 || eol < end)
|
||||
{
|
||||
end = eol;
|
||||
}
|
||||
|
||||
return md.value.substring(start + 1, end);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue