This commit is contained in:
quenousimporte 2023-10-20 11:40:16 +02:00
parent a02c0c37fd
commit 678373913e
1 changed files with 8 additions and 10 deletions

18
main.js
View File

@ -712,11 +712,11 @@ function showoutline()
} }
else if (line == "---" && index != 0 && index != 3) else if (line == "---" && index != 0 && index != 3)
{ {
var next; var next = lines.find((current, i) =>
if (next = lines.find((current, i) =>
{ {
return i > index && current != ""; return i > index && current != "";
})) });
if (next)
{ {
var nbcar = 80; var nbcar = 80;
next = next.length < nbcar ? next : next.substring(0, nbcar) + "..."; next = next.length < nbcar ? next : next.substring(0, nbcar) + "...";
@ -1058,8 +1058,7 @@ function sharehtml()
function getfilename(title) function getfilename(title)
{ {
//return title.replace(/[^a-z0-9]/gi, '_').toLowerCase() + ".md"; title.replace(/[?"<>|*:/\\]/g, "_") + ".md";
return title.replace(/[\?\"<>|\*:\/\\]/g, "_") + ".md";
} }
function download(filename, content) function download(filename, content)
@ -2094,10 +2093,11 @@ function applycolors(currentonly)
language: "" language: ""
}; };
var linediv = null;
if (currentonly) if (currentonly)
{ {
var index = currentline(); var index = currentline();
var linediv = document.getElementById("line" + index); linediv = document.getElementById("line" + index);
options = JSON.parse(linediv.getAttribute("tag")); options = JSON.parse(linediv.getAttribute("tag"));
var line = rawline(index); var line = rawline(index);
line = rawline2html(line, index, options); line = rawline2html(line, index, options);
@ -2110,7 +2110,7 @@ function applycolors(currentonly)
var i = 0; var i = 0;
for (; i < lines.length; i++) for (; i < lines.length; i++)
{ {
var linediv = document.getElementById("line" + i); linediv = document.getElementById("line" + i);
if (!linediv) if (!linediv)
{ {
linediv = document.createElement("div"); linediv = document.createElement("div");
@ -2119,7 +2119,7 @@ function applycolors(currentonly)
linediv.setAttribute("id", "line" + i); linediv.setAttribute("id", "line" + i);
linediv.setAttribute("tag", JSON.stringify(options)); linediv.setAttribute("tag", JSON.stringify(options));
linediv.innerHTML = rawline2html(lines[i], i, options) || emptyline; linediv.innerHTML = rawline2html(lines[i], i, options) || emptyline;
}; }
// remove remanining // remove remanining
linediv = document.getElementById("line" + (i++)); linediv = document.getElementById("line" + (i++));
@ -2500,8 +2500,6 @@ function setwindowtitle()
function ontitlechange() function ontitlechange()
{ {
var oldname = currentnote.title;
if (localdata.find(n => n.title == title.value)) if (localdata.find(n => n.title == title.value))
{ {
showtemporaryinfo(title.value + " alreday exists"); showtemporaryinfo(title.value + " alreday exists");