fixed: subnote
This commit is contained in:
parent
f2cb4b4bfe
commit
d805864972
24
main.js
24
main.js
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue