mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 13:36:02 +00:00
handle tab focus
This commit is contained in:
@@ -4,17 +4,22 @@
|
||||
|
||||
export let tabid;
|
||||
export let tabVisible;
|
||||
export let tabFocused;
|
||||
export let tabComponent;
|
||||
|
||||
const tabVisibleStore = writable(tabVisible);
|
||||
setContext('tabid', tabid);
|
||||
setContext('tabVisible', tabVisibleStore);
|
||||
|
||||
const tabVisibleStore = writable(tabVisible);
|
||||
setContext('tabVisible', tabVisibleStore);
|
||||
$: tabVisibleStore.set(tabVisible);
|
||||
|
||||
const tabFocusedStore = writable(tabFocused);
|
||||
setContext('tabFocused', tabFocusedStore);
|
||||
$: tabFocusedStore.set(tabFocused);
|
||||
</script>
|
||||
|
||||
<div class:tabVisible>
|
||||
<svelte:component this={tabComponent} {...$$restProps} {tabid} {tabVisible} />
|
||||
<svelte:component this={tabComponent} {...$$restProps} {tabid} {tabVisible} {tabFocused} />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -52,5 +52,6 @@
|
||||
{tabid}
|
||||
unsaved={openedTabsByTabId[tabid]?.unsaved}
|
||||
tabVisible={tabid == shownTab?.tabid}
|
||||
tabFocused={tabid == shownTab?.tabid && shownTab?.focused}
|
||||
/>
|
||||
{/each}
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
import CloseTabModal from '../modals/CloseTabModal.svelte';
|
||||
import SwitchDatabaseModal from '../modals/SwitchDatabaseModal.svelte';
|
||||
import { getConnectionLabel } from 'dbgate-tools';
|
||||
import { changeDatabaseByCurrentTab } from '../utility/changeCurrentDbByTab';
|
||||
import { handleAfterTabClick } from '../utility/changeCurrentDbByTab';
|
||||
|
||||
export let multiTabIndex;
|
||||
export let shownTab;
|
||||
@@ -335,7 +335,7 @@
|
||||
return;
|
||||
}
|
||||
setSelectedTab(tabid);
|
||||
changeDatabaseByCurrentTab();
|
||||
handleAfterTabClick();
|
||||
};
|
||||
|
||||
const handleMouseDown = (e, tabid) => {
|
||||
|
||||
Reference in New Issue
Block a user