added: section in outline
This commit is contained in:
parent
578e548883
commit
e0ec91ee29
14
main.js
14
main.js
|
@ -549,10 +549,10 @@ function showoutline()
|
||||||
{
|
{
|
||||||
var outline = {};
|
var outline = {};
|
||||||
var pos = 0;
|
var pos = 0;
|
||||||
getnotecontent().split("\n").forEach(line =>
|
getnotecontent().split("\n").forEach((line, index, lines) =>
|
||||||
{
|
{
|
||||||
pos += line.length + 1;
|
pos += line.length + 1;
|
||||||
if (line.startsWith("#"))
|
if (line.startsWith("#") || line == "---")
|
||||||
{
|
{
|
||||||
line = line
|
line = line
|
||||||
.replace("# ", "")
|
.replace("# ", "")
|
||||||
|
@ -560,7 +560,15 @@ function showoutline()
|
||||||
outline[line] = pos;
|
outline[line] = pos;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
searchinlist(Object.keys(outline))
|
|
||||||
|
var keys = Object
|
||||||
|
.keys(outline)
|
||||||
|
.sort((a,b) =>
|
||||||
|
{
|
||||||
|
return outline[a] - outline[b];
|
||||||
|
});
|
||||||
|
|
||||||
|
searchinlist(keys)
|
||||||
.then(line =>
|
.then(line =>
|
||||||
{
|
{
|
||||||
md.setSelectionRange(outline[line], outline[line]);
|
md.setSelectionRange(outline[line], outline[line]);
|
||||||
|
|
Loading…
Reference in New Issue