From d0c6693ff78b538f4bb20e1e21328f772236bb5b Mon Sep 17 00:00:00 2001 From: quenousimporte <76260127+quenousimporte@users.noreply.github.com> Date: Mon, 30 Jan 2023 12:16:59 +0100 Subject: [PATCH] removed: section in outline fixed: tag detection --- main.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 54341da..65c4c18 100644 --- a/main.js +++ b/main.js @@ -552,7 +552,7 @@ function showoutline() getnotecontent().split("\n").forEach((line, index, lines) => { pos += line.length + 1; - if (line.startsWith("#") || line == "---") + if (line.startsWith("#")) { line = line .replace("# ", "") @@ -602,12 +602,20 @@ function linkatpos() function tagatpos() { + if (md.value.lastIndexOf("tags: ", md.selectionStart) < md.value.lastIndexOf("\n", md.selectionStart)) + { + return null; + } + var start = md.value.lastIndexOf(" ", md.selectionStart); if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return ""; - var nextcomma = md.value.indexOf(",", md.selectionStart); - var nexteol = md.value.indexOf("\n", md.selectionStart); - var end = Math.min(nexteol, nextcomma); + 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 ""; return md.value.substring(start + 1, end);