fixed: subnote

This commit is contained in:
quenousimporte 2023-11-07 11:48:37 +01:00
parent f2cb4b4bfe
commit d805864972
1 changed files with 26 additions and 28 deletions

24
main.js
View File

@ -397,31 +397,29 @@ function getrangecontent(range)
return md.value.substring(range.start, range.end);
}
function createsubnote(suggestedtitle)
function createsubnote()
{
var name = [];
if (suggestedtitle)
{
name.push(suggestedtitle);
}
var range = getlinesrange();
var content = getrangecontent(range);
filter.placeholder = "Create subnote...";
searchinlist(name)
.then(title =>
{
var title = prompt("Subnote tite:");
if (!title)
{
showtemporaryinfo("No title provided");
setpos(md.selectionStart);
md.focus();
}
else if (getnote(title))
{
showtemporaryinfo("'" + title + "' already exists");
setpos(md.selectionStart);
md.focus();
}
else
{
var range =
{
start: md.selectionStart,
end: md.selectionEnd
}
var content = getrangecontent(range);
var newnote =
{
title: title,
@ -432,9 +430,9 @@ function createsubnote(suggestedtitle)
+ "[[" + title + "]]"
+ md.value.substring(range.end));
}
});
}
function comment()
{
seteditorcontent(md.value.substring(0, md.selectionStart)