refactor open bookmark
This commit is contained in:
parent
d065c41686
commit
63286cd4ec
16
main.js
16
main.js
|
@ -321,14 +321,7 @@ function browsebookmarks()
|
||||||
{
|
{
|
||||||
var bookmarks = JSON.parse(getnote("bookmarks").content);
|
var bookmarks = JSON.parse(getnote("bookmarks").content);
|
||||||
searchinlist(bookmarks.map(b => b.title))
|
searchinlist(bookmarks.map(b => b.title))
|
||||||
.then(title =>
|
.then(openbookmark);
|
||||||
{
|
|
||||||
var url = bookmarks
|
|
||||||
.find(b => b.title == title)
|
|
||||||
.url;
|
|
||||||
|
|
||||||
window.open(url, "_blank");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function purgetodo()
|
function purgetodo()
|
||||||
|
@ -1639,6 +1632,11 @@ function titlewithtags(note)
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openbookmark(title)
|
||||||
|
{
|
||||||
|
window.open(JSON.parse(getnote("bookmarks").content).find(b => b.title == title).url, "_blank");
|
||||||
|
}
|
||||||
|
|
||||||
function commandpalette()
|
function commandpalette()
|
||||||
{
|
{
|
||||||
searchinlist(commands
|
searchinlist(commands
|
||||||
|
@ -1699,7 +1697,7 @@ function commandpalette()
|
||||||
}
|
}
|
||||||
else if (selected.prefix == "open bookmark ")
|
else if (selected.prefix == "open bookmark ")
|
||||||
{
|
{
|
||||||
window.open(JSON.parse(getnote("bookmarks").content).find(b => b.title == selected.text).url, "_blank");
|
openbookmark(selected.text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue