Open URLs from bookmarks
This commit is contained in:
parent
76e09c7512
commit
582cc9a25a
3 changed files with 38 additions and 2 deletions
15
src/background/shared/completions/bookmarks.js
Normal file
15
src/background/shared/completions/bookmarks.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
const getCompletions = (keywords) => {
|
||||
return browser.bookmarks.search({ query: keywords }).then((items) => {
|
||||
return items.filter((item) => {
|
||||
let url = undefined;
|
||||
try {
|
||||
url = new URL(item.url);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return item.type === 'bookmark' && url.protocol !== 'place:';
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export { getCompletions };
|
Reference in a new issue