This commit is contained in:
quenousimporte 2023-10-19 15:28:53 +02:00
parent e8cc0f6c3e
commit 4920358533
1 changed files with 24 additions and 24 deletions

48
main.js
View File

@ -20,7 +20,6 @@ var defaultsettings =
//builtin //builtin
var markerslist = ["* ", "- ", " * ", " - ", ">> ", "> ", "=> ", "— ", "[ ] ", " ", "• ", "- [ ]"]; var markerslist = ["* ", "- ", " * ", " - ", ">> ", "> ", "=> ", "— ", "[ ] ", " ", "• ", "- [ ]"];
var sectionmarks = ["---", "### ", "## ", "# ", "```"];
var codelanguages = ["xml", "js", "sql"]; var codelanguages = ["xml", "js", "sql"];
// globals // globals
@ -365,10 +364,10 @@ function decryptstring(str)
.then(decrypted => .then(decrypted =>
{ {
const chunks = []; const chunks = [];
for (const chunk of decrypted.data) { for (const chunk of decrypted.data) {
chunks.push(chunk); chunks.push(chunk);
} }
return chunks.join(''); return chunks.join('');
}) })
} }
@ -481,7 +480,7 @@ function formatsize(size)
size /= 1024; size /= 1024;
unit = "mb"; unit = "mb";
} }
return size.toFixed(2) + " " + unit; return size.toFixed(2) + " " + unit;
} }
function pospercent() function pospercent()
@ -630,16 +629,17 @@ function toggleeditor(hidden)
} }
} }
function id(note)
{
return localdata.indexOf(note);
}
function shownotelinks() function shownotelinks()
{ {
if (settings.enablenetwork) if (settings.enablenetwork)
{ {
networkpage.hidden = false; networkpage.hidden = false;
toggleeditor(true); toggleeditor(true);
function id(note)
{
return localdata.indexOf(note);
}
var nodes = []; var nodes = [];
var edges = []; var edges = [];
@ -1062,13 +1062,13 @@ function sharehtml()
var file = new File(['<html><body>' + md2html(md.value) + '</body></html>'], var file = new File(['<html><body>' + md2html(md.value) + '</body></html>'],
currentnote.title + ".html", currentnote.title + ".html",
{ {
type: "text/html", type: "text/html",
}); });
navigator.share( navigator.share(
{ {
title: currentnote.title, title: currentnote.title,
files: [file] files: [file]
}); });
} }
} }
@ -1101,7 +1101,7 @@ function downloadnotes()
zip.generateAsync({type:"blob"}) zip.generateAsync({type:"blob"})
.then(function(content) .then(function(content)
{ {
saveAs(content, "notes " + timestamp() + " " + currentvault + ".zip"); saveAs(content, "notes " + timestamp() + " " + currentvault + ".zip");
}); });
} }
@ -1527,12 +1527,12 @@ function selectlines()
function wordatpos() function wordatpos()
{ {
var words = md.value.split(/\s/); var words = md.value.split(/\s/);
var i = 0; var i = 0;
var word = ""; var word = "";
while (i < md.selectionStart) while (i < md.selectionStart)
{ {
word = words.shift(); word = words.shift();
i += word.length + 1; i += word.length + 1;
} }
return word; return word;
} }
@ -1933,12 +1933,12 @@ function save()
} }
function escapeHtml(unsafe) { function escapeHtml(unsafe) {
return unsafe return unsafe
.replace(/&/g, "&amp;") .replace(/&/g, "&amp;")
.replace(/</g, "&lt;") .replace(/</g, "&lt;")
.replace(/>/g, "&gt;") .replace(/>/g, "&gt;")
.replace(/"/g, "&quot;") .replace(/"/g, "&quot;")
.replace(/'/g, "&#039;"); .replace(/'/g, "&#039;");
} }
var languagekeywords = { var languagekeywords = {