From 1f39b9420918dd04c14c9d3d244673fbca946f12 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Fri, 10 Jan 2020 12:49:23 +0500 Subject: [PATCH 01/10] Fixed: Minor style fix --- src/styles/themes/default/settings.styl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/themes/default/settings.styl b/src/styles/themes/default/settings.styl index 87611d3d..783da052 100644 --- a/src/styles/themes/default/settings.styl +++ b/src/styles/themes/default/settings.styl @@ -466,7 +466,7 @@ footer flex-grow: 1 color: var(--label-fg) margin: 0 6px 0 0 - padding: 6px 0 6px 16px + padding: 6px 0 transition: color var(--d-fast) .Settings .keybinding > .value From 62e29716f944438f9c4f164cd2e58c67d267d216 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Fri, 10 Jan 2020 13:31:57 +0500 Subject: [PATCH 02/10] Fixed: Labels --- addon/locales/en.settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon/locales/en.settings.js b/addon/locales/en.settings.js index fc5731f5..a0719d2b 100644 --- a/addon/locales/en.settings.js +++ b/addon/locales/en.settings.js @@ -10,7 +10,7 @@ export default { 'settings.nav_settings_containers': { message: 'Containers' }, 'settings.nav_settings_panels': { message: 'Panels' }, 'settings.nav_settings_tabs': { message: 'Tabs' }, - 'settings.nav_settings_new_tab_position': { message: 'New tab position' }, + 'settings.nav_settings_new_tab_position': { message: 'Position of new tab' }, 'settings.nav_settings_pinned_tabs': { message: 'Pinned tabs' }, 'settings.nav_settings_tabs_tree': { message: 'Tabs tree' }, 'settings.nav_settings_bookmarks': { message: 'Bookmarks' }, @@ -124,7 +124,7 @@ export default { }, // --- New tab position - 'settings.new_tab_position': { message: 'New tab position' }, + 'settings.new_tab_position': { message: 'Position of new tab' }, 'settings.move_new_tab_pin': { message: 'Place new tab opened from pinned tab' }, 'settings.move_new_tab_pin_start': { message: 'panel start' }, 'settings.move_new_tab_pin_end': { message: 'panel end' }, From 74c2676440324c09660242dcf40eb9cd58fbc811 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Fri, 10 Jan 2020 13:42:38 +0500 Subject: [PATCH 03/10] Added: Option to place new tab (opened from another one) before the parent. --- addon/defaults.js | 2 +- addon/locales/en.settings.js | 3 ++- addon/locales/ru.settings.js | 3 ++- src/sidebar/actions/tabs.js | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addon/defaults.js b/addon/defaults.js index ec08644f..6170ae96 100644 --- a/addon/defaults.js +++ b/addon/defaults.js @@ -33,7 +33,7 @@ export const SETTINGS_OPTIONS = { snapLimitUnitOpts: ['snap', 'kb', 'day'], panelTypeOpts: ['tabs', 'ctx'], moveNewTabPinOpts: ['start', 'end', 'none'], - moveNewTabParentOpts: ['sibling', 'first_child', 'last_child', 'start', 'end', 'none'], + moveNewTabParentOpts: ['before', 'sibling', 'first_child', 'last_child', 'start', 'end', 'none'], moveNewTabOpts: ['start', 'end', 'after', 'first_child', 'last_child', 'none'], midClickBookmarkOpts: ['open_new_tab', 'edit', 'delete'], warnOnMultiTabCloseOpts: ['any', 'collapsed', 'none'], diff --git a/addon/locales/en.settings.js b/addon/locales/en.settings.js index a0719d2b..5f7e80ac 100644 --- a/addon/locales/en.settings.js +++ b/addon/locales/en.settings.js @@ -130,7 +130,8 @@ export default { 'settings.move_new_tab_pin_end': { message: 'panel end' }, 'settings.move_new_tab_pin_none': { message: 'none' }, 'settings.move_new_tab_parent': { message: 'Place new tab opened from another tab' }, - 'settings.move_new_tab_parent_sibling': { message: 'sibling' }, + 'settings.move_new_tab_parent_before': { message: 'before parent' }, + 'settings.move_new_tab_parent_sibling': { message: 'after parent' }, 'settings.move_new_tab_parent_first_child': { message: 'first child' }, 'settings.move_new_tab_parent_last_child': { message: 'last child' }, 'settings.move_new_tab_parent_start': { message: 'panel start' }, diff --git a/addon/locales/ru.settings.js b/addon/locales/ru.settings.js index 3c2c7fcb..f9451018 100644 --- a/addon/locales/ru.settings.js +++ b/addon/locales/ru.settings.js @@ -131,7 +131,8 @@ export default { 'settings.move_new_tab_pin_end': { message: 'конец пенели' }, 'settings.move_new_tab_pin_none': { message: 'выкл' }, 'settings.move_new_tab_parent': { message: 'Открытые из другой вкладки' }, - 'settings.move_new_tab_parent_sibling': { message: 'по соседству' }, + 'settings.move_new_tab_parent_before': { message: 'выше родителькой' }, + 'settings.move_new_tab_parent_sibling': { message: 'ниже родителькой' }, 'settings.move_new_tab_parent_first_child': { message: 'первая дочерняя' }, 'settings.move_new_tab_parent_last_child': { message: 'последняя дочерняя' }, 'settings.move_new_tab_parent_start': { message: 'начало панели' }, diff --git a/src/sidebar/actions/tabs.js b/src/sidebar/actions/tabs.js index 93c0ab03..18feb273 100644 --- a/src/sidebar/actions/tabs.js +++ b/src/sidebar/actions/tabs.js @@ -2115,6 +2115,7 @@ function getIndexForNewTab(panel, tab) { // Place new tab opened from another tab if (parent && !parent.pinned && parent.panelId === panel.id) { + if (this.state.moveNewTabParent === 'before') return parent.index if (this.state.moveNewTabParent === 'sibling' || this.state.moveNewTabParent === 'last_child') { let t let index = parent.index + 1 @@ -2184,6 +2185,7 @@ function getParentForNewTab(panel, openerTabId) { // Place new tab opened from another tab if (parent && !parent.pinned && parent.panelId === panel.id) { + if (this.state.moveNewTabParent === 'before') return parent.parentId if (this.state.moveNewTabParent === 'sibling') return parent.parentId if (this.state.moveNewTabParent === 'first_child') return openerTabId if (this.state.moveNewTabParent === 'last_child') return openerTabId From f4ea8089985766e17d0a3a49d3a38e0e735a9b2b Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Sat, 11 Jan 2020 11:36:07 +0500 Subject: [PATCH 04/10] Added: Option to place new tab: before the active tab --- addon/defaults.js | 2 +- addon/locales/en.settings.js | 1 + addon/locales/ru.settings.js | 7 ++++--- src/sidebar/actions/tabs.js | 11 ++++++++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/addon/defaults.js b/addon/defaults.js index 6170ae96..d2e88ec5 100644 --- a/addon/defaults.js +++ b/addon/defaults.js @@ -34,7 +34,7 @@ export const SETTINGS_OPTIONS = { panelTypeOpts: ['tabs', 'ctx'], moveNewTabPinOpts: ['start', 'end', 'none'], moveNewTabParentOpts: ['before', 'sibling', 'first_child', 'last_child', 'start', 'end', 'none'], - moveNewTabOpts: ['start', 'end', 'after', 'first_child', 'last_child', 'none'], + moveNewTabOpts: ['start', 'end', 'before', 'after', 'first_child', 'last_child', 'none'], midClickBookmarkOpts: ['open_new_tab', 'edit', 'delete'], warnOnMultiTabCloseOpts: ['any', 'collapsed', 'none'], warnOnMultiBookmarkDeleteOpts: ['any', 'collapsed', 'none'], diff --git a/addon/locales/en.settings.js b/addon/locales/en.settings.js index 5f7e80ac..98e9e7f7 100644 --- a/addon/locales/en.settings.js +++ b/addon/locales/en.settings.js @@ -141,6 +141,7 @@ export default { 'settings.move_new_tab': { message: 'Place new tab (for the other cases)' }, 'settings.move_new_tab_start': { message: 'panel start' }, 'settings.move_new_tab_end': { message: 'panel end' }, + 'settings.move_new_tab_before': { message: 'before active tab' }, 'settings.move_new_tab_after': { message: 'after active tab' }, 'settings.move_new_tab_first_child': { message: 'first child of active tab' }, 'settings.move_new_tab_last_child': { message: 'last child of active tab' }, diff --git a/addon/locales/ru.settings.js b/addon/locales/ru.settings.js index f9451018..886662d1 100644 --- a/addon/locales/ru.settings.js +++ b/addon/locales/ru.settings.js @@ -131,8 +131,8 @@ export default { 'settings.move_new_tab_pin_end': { message: 'конец пенели' }, 'settings.move_new_tab_pin_none': { message: 'выкл' }, 'settings.move_new_tab_parent': { message: 'Открытые из другой вкладки' }, - 'settings.move_new_tab_parent_before': { message: 'выше родителькой' }, - 'settings.move_new_tab_parent_sibling': { message: 'ниже родителькой' }, + 'settings.move_new_tab_parent_before': { message: 'перед родительской' }, + 'settings.move_new_tab_parent_sibling': { message: 'после родительской' }, 'settings.move_new_tab_parent_first_child': { message: 'первая дочерняя' }, 'settings.move_new_tab_parent_last_child': { message: 'последняя дочерняя' }, 'settings.move_new_tab_parent_start': { message: 'начало панели' }, @@ -144,7 +144,8 @@ export default { 'settings.move_new_tab': { message: 'Для остальных случаев' }, 'settings.move_new_tab_start': { message: 'начало панели' }, 'settings.move_new_tab_end': { message: 'конец пенели' }, - 'settings.move_new_tab_after': { message: 'после активной вкладки' }, + 'settings.move_new_tab_before': { message: 'перед активной вкладкой' }, + 'settings.move_new_tab_after': { message: 'после активной вкладкой' }, 'settings.move_new_tab_first_child': { message: 'первая дочерняя вкладка активной' }, 'settings.move_new_tab_last_child': { message: 'последняя дочерняя вкладка активной' }, 'settings.move_new_tab_none': { message: 'выкл' }, diff --git a/src/sidebar/actions/tabs.js b/src/sidebar/actions/tabs.js index 18feb273..e8005646 100644 --- a/src/sidebar/actions/tabs.js +++ b/src/sidebar/actions/tabs.js @@ -2076,7 +2076,10 @@ function getPanelForNewTab(tab) { } } + // If position of new tab should be related with active one + // find the panel of active tab let actTabRel = + this.state.moveNewTab === 'before' || this.state.moveNewTab === 'after' || this.state.moveNewTab === 'first_child' || this.state.moveNewTab === 'last_child' @@ -2134,6 +2137,11 @@ function getIndexForNewTab(panel, tab) { // Place new tab (for the other cases) if (this.state.moveNewTab === 'start') return panel.startIndex if (this.state.moveNewTab === 'end') return endIndex + if (this.state.moveNewTab === 'before') { + if (!activeTab || activeTab.panelId !== panel.id) return endIndex + else if (activeTab.pinned) return panel.startIndex + else return activeTab.index + } if (this.state.moveNewTab === 'after') { if (!activeTab || activeTab.panelId !== panel.id) { return endIndex @@ -2198,7 +2206,8 @@ function getParentForNewTab(panel, openerTabId) { if (this.state.moveNewTab === 'start') return if (this.state.moveNewTab === 'end') return if (activeTab && activeTab.panelId === panel.id && !activeTab.pinned) { - if (this.state.moveNewTab === 'after') return activeTab.parentId + if (this.state.moveNewTab === 'before') return activeTab.parentId + else if (this.state.moveNewTab === 'after') return activeTab.parentId else if (this.state.moveNewTab === 'first_child') return activeTab.id else if (this.state.moveNewTab === 'last_child') return activeTab.id } From 3520e268a88cbfe7ed18f0f364ee543ea67e7de3 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Sat, 11 Jan 2020 12:44:12 +0500 Subject: [PATCH 05/10] Fixed: Skipping default data in snapshot to reduce its size --- addon/actions/snapshots.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/addon/actions/snapshots.js b/addon/actions/snapshots.js index a6621003..4fafff9d 100644 --- a/addon/actions/snapshots.js +++ b/addon/actions/snapshots.js @@ -37,15 +37,14 @@ async function createSnapshot() { const items = [] for (let tab of window.tabs) { - items.push({ - id: tab.id, - pinned: tab.pinned, - url: tab.url, - title: tab.title, - lvl: tab.lvl, - ctr: tab.cookieStoreId, - panel: tab.panelId, - }) + let item = { id: tab.id, url: tab.url, title: tab.title } + + if (tab.pinned) item.pinned = true + if (tab.cookieStoreId !== DEFAULT_CTX_ID) item.ctr = tab.cookieStoreId + if (tab.panelId !== DEFAULT_CTX_ID) item.panel = tab.panelId + if (tab.lvl > 0) item.lvl = tab.lvl + + items.push(item) } windows[windowId] = { items } From d573f7455759eda5f807b6507e9f332f7af22235 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Sat, 11 Jan 2020 15:42:17 +0500 Subject: [PATCH 06/10] Fixed: Moving pinned tab to new window --- src/sidebar/actions/tabs.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sidebar/actions/tabs.js b/src/sidebar/actions/tabs.js index e8005646..d6cb7fa5 100644 --- a/src/sidebar/actions/tabs.js +++ b/src/sidebar/actions/tabs.js @@ -315,6 +315,7 @@ async function loadTabsFromInlineData(tabs, dataTabIndex) { } let secondTab = tabs[dataTabIndex + 1] + if (!secondTab) secondTab = tabs[dataTabIndex - 1] if (!secondTab) return this.actions.updatePanelsTabs() await browser.tabs.update(secondTab.id, { active: true }) @@ -978,7 +979,9 @@ async function moveTabsToNewWin(tabIds, incognito = false) { if (toMove.includes(id)) continue tabs.push(tab) toMove.push(id) - tabsInfo.push({ lvl: tab.lvl, panelId: tab.panelId }) + let info = { lvl: tab.lvl, panelId: tab.panelId } + if (tab.pinned) info.pinned = true + tabsInfo.push(info) if (tab.active) activeTab = tab if (tab.folded) { for (let i = tab.index + 1; i < this.state.tabs.length; i++) { @@ -1009,12 +1012,9 @@ async function moveTabsToNewWin(tabIds, incognito = false) { let index = 1 for (let tab of tabs) { if (incognito === this.state.private) { - moving.push( - browser.tabs.move(tab.id, { - windowId: win.id, - index: index++, - }) - ) + let conf = { windowId: win.id } + conf.index = tab.pinned ? 0 : index++ + moving.push(browser.tabs.move(tab.id, conf)) } else { let conf = { windowId: win.id, From 499f19a0d6c2ab5c31d05daaa96c6cbe600d9545 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Sat, 11 Jan 2020 20:03:30 +0500 Subject: [PATCH 07/10] Fixed: Choosing the bookmarks folder to save tabs in --- src/sidebar/actions/misc.js | 7 ++----- src/sidebar/components/bookmark.vue | 1 + .../components/select-bookmarks-folder-bar.vue | 17 +++++++++++++++-- src/styles/themes/default/sidebar.styl | 5 ++++- src/styles/themes/tactile/sidebar.styl | 5 ++++- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/sidebar/actions/misc.js b/src/sidebar/actions/misc.js index 7be70dc7..2fff35d4 100644 --- a/src/sidebar/actions/misc.js +++ b/src/sidebar/actions/misc.js @@ -157,12 +157,12 @@ function resetSelection() { let id = this.state.selected[0] if (typeof id === 'number') { for (let id of this.state.selected) { - this.state.tabsMap[id].sel = false + if (this.state.tabsMap[id]) this.state.tabsMap[id].sel = false } if (this.state.nativeHighlight) this.actions.updateHighlightedTabs(120) } else if (typeof id === 'string') { for (let id of this.state.selected) { - this.state.bookmarksMap[id].sel = false + if (this.state.bookmarksMap[id]) this.state.bookmarksMap[id].sel = false } } this.state.selected = [] @@ -296,9 +296,6 @@ function askNewBookmarkFolder(defaultValue) { if (!bookmarksPanel) res(defaultValue) this.state.panelIndex = bookmarksPanel.index - - if (defaultValue !== undefined) this.actions.selectItem(defaultValue) - this.state.selectBookmarkFolder = { id: '', ok: () => { diff --git a/src/sidebar/components/bookmark.vue b/src/sidebar/components/bookmark.vue index 65f449b4..851653c4 100644 --- a/src/sidebar/components/bookmark.vue +++ b/src/sidebar/components/bookmark.vue @@ -137,6 +137,7 @@ export default { */ onMouseUp(e) { if (e.button === 0) { + if (State.selectBookmarkFolder) return if (e.ctrlKey || e.shiftKey) return if (State.selected.length && !this.node.sel) { diff --git a/src/sidebar/components/select-bookmarks-folder-bar.vue b/src/sidebar/components/select-bookmarks-folder-bar.vue index ba953069..5ad90ed7 100644 --- a/src/sidebar/components/select-bookmarks-folder-bar.vue +++ b/src/sidebar/components/select-bookmarks-folder-bar.vue @@ -1,7 +1,9 @@