From bf20689df8d7afc634826b0aab0903de6a09bae0 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 27 Jan 2024 12:52:59 +0100 Subject: [PATCH] enh(bookmarks folder selection): Select sub folder in Vivaldi fixes #1524 Signed-off-by: Marcel Klehr --- src/lib/browser/BrowserDetection.ts | 6 ++++++ src/lib/browser/BrowserTree.ts | 4 +++- src/ui/components/OptionSyncFolder.vue | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/lib/browser/BrowserDetection.ts diff --git a/src/lib/browser/BrowserDetection.ts b/src/lib/browser/BrowserDetection.ts new file mode 100644 index 0000000000..efbffc8f7e --- /dev/null +++ b/src/lib/browser/BrowserDetection.ts @@ -0,0 +1,6 @@ +import browser from '../browser-api' + +export const isVivaldi = async() => { + const tabs = await browser.tabs.query({ active: true, currentWindow: true }); + return Boolean(tabs?.[0]?.['vivExtData']) +} diff --git a/src/lib/browser/BrowserTree.ts b/src/lib/browser/BrowserTree.ts index bc3f65fd89..2244c0d028 100644 --- a/src/lib/browser/BrowserTree.ts +++ b/src/lib/browser/BrowserTree.ts @@ -9,6 +9,7 @@ import Ordering from '../interfaces/Ordering' import url from 'url' import random from 'random' import seedrandom from 'seedrandom' +import { isVivaldi } from './BrowserDetection' let absoluteRoot: {id: string} @@ -29,6 +30,7 @@ export default class BrowserTree implements IResource { } async getBookmarksTree():Promise { + const isVivaldiBrowser = await isVivaldi() const [tree] = await browser.bookmarks.getSubTree(this.rootId) await this.absoluteRootPromise const allAccounts = await (await Account.getAccountClass()).getAllAccounts() @@ -43,7 +45,7 @@ export default class BrowserTree implements IResource { return } let overrideTitle, isRoot - if (node.parentId === this.absoluteRoot.id) { + if (node.parentId === this.absoluteRoot.id && !isVivaldiBrowser) { switch (node.id) { case '1': // Chrome case 'toolbar_____': // Firefox diff --git a/src/ui/components/OptionSyncFolder.vue b/src/ui/components/OptionSyncFolder.vue index 0f0a700144..adb7833746 100644 --- a/src/ui/components/OptionSyncFolder.vue +++ b/src/ui/components/OptionSyncFolder.vue @@ -89,6 +89,8 @@