Skip to content

Commit

Permalink
Fix opening history and bookmark items when pressing enter in search
Browse files Browse the repository at this point in the history
fixes #214
  • Loading branch information
kesselborn committed May 3, 2018
1 parent a95a001 commit 13a644f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion conex-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ async function switchToContainer(cookieStoreId) {
if (tabs.length == 0) {
browser.tabs.create({ cookieStoreId: cookieStoreId, active: true });
} else {

const lastAccessedTabs = tabs.sort((a, b) => b.lastAccessed - a.lastAccessed);

// Try to switch to an unpinned tab, as switching a to pinned tab
Expand Down
11 changes: 8 additions & 3 deletions conex-browser-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ const keyPressHandling = function(event) {
} else if(document.activeElement.id == 'search') { // enter in search form == activate first shown container or tab
for(const e of $('li')) {
if(e.style.display != 'none' && e.dataset.tabId) {
console.log('activateTab', e.dataset.tabId, e);
bg.activateTab(e.dataset.tabId);
if(e.dataset.tabId == 0) { // history or bookmark entry
console.log('restoringTab', e.dataset.url, e);
bg.openContainerSelector(e.dataset.url, e.dataset.title);
} else { // a tab that is open
console.log('activateTab', e.dataset.tabId, e);
bg.activateTab(e.dataset.tabId);
}
break;
} else if(e.style.display != 'none' && e.className == 'section' && e.dataset.match == 'true') {
console.log('expandTabContainer', e.dataset.cookieStore, e);
console.log('switchToContainer', e.dataset.cookieStore, e);
bg.switchToContainer(e.dataset.cookieStore);
break;
}
Expand Down
3 changes: 2 additions & 1 deletion conex-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ function createTabContainerHeaderElement(id, color, name, tabindex, icon, contai
iconElement = $e('span', {class: 'icon'}, [$e('span', { class: `icon-${color}`, content: icon || ' ' })]);
}
const tooltip = id == 'firefox-default' ? 'close all tabs' : 'delete this container';
const data_match = id == '' ? 'false' : 'true';

const elment =
$e('ul', {id: id, class: color}, [
$e('li', {tabindex: tabindex || 1, class: 'section', data_match: 'true', data_name: name, data_cookie_store: id, title: 'enter: to expand\nctrl-enter: switch to container\nctrl-shift-enter: new tab in container'}, [
$e('li', {tabindex: tabindex || 1, class: 'section', data_match: data_match, data_name: name, data_cookie_store: id, title: 'enter: to expand\nctrl-enter: switch to container\nctrl-shift-enter: new tab in container'}, [
$e('div', {class: 'delete-container-confirmation'}, [
$e('span', {class: 'confirmation-tabs-count'}),
$e('span', {content: 'yes', class: 'yes', title: 'yes, delete container on all its tabs'}),
Expand Down

0 comments on commit 13a644f

Please sign in to comment.