mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 22:43:58 +00:00
#457 fixed ctrl+tab
This commit is contained in:
@@ -1,14 +1,11 @@
|
|||||||
<script lang="ts" context="module">
|
<script lang="ts" context="module">
|
||||||
const getCurrentValueMarker: any = {};
|
const getCurrentValueMarker: any = {};
|
||||||
|
|
||||||
export function shouldShowTab(tab, lockedDbMode = getCurrentValueMarker, currentDb = getCurrentValueMarker) {
|
export function shouldShowTab(tab, lockedDbModeArg = getCurrentValueMarker, currentDbArg = getCurrentValueMarker) {
|
||||||
if (lockedDbMode == getCurrentValueMarker) {
|
const lockedDbMode = lockedDbModeArg == getCurrentValueMarker ? getLockedDatabaseMode() : lockedDbModeArg;
|
||||||
lockedDbMode = getLockedDatabaseMode();
|
|
||||||
}
|
|
||||||
if (lockedDbMode) {
|
if (lockedDbMode) {
|
||||||
if (currentDb == getCurrentValueMarker) {
|
const currentDb = currentDbArg == getCurrentValueMarker ? getCurrentDatabase() : currentDbArg;
|
||||||
currentDb = getCurrentDatabase();
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
tab.closedTime == null &&
|
tab.closedTime == null &&
|
||||||
(!tab.props?.conid || tab.props?.conid == currentDb?.connection?._id) &&
|
(!tab.props?.conid || tab.props?.conid == currentDb?.connection?._id) &&
|
||||||
@@ -34,7 +31,7 @@
|
|||||||
const closeCandidates = getOpenedTabs()
|
const closeCandidates = getOpenedTabs()
|
||||||
.filter(x => closeCondition(x, activeCandidate))
|
.filter(x => closeCondition(x, activeCandidate))
|
||||||
.filter(x => x.unsaved)
|
.filter(x => x.unsaved)
|
||||||
.filter(shouldShowTab);
|
.filter(x => shouldShowTab(x));
|
||||||
|
|
||||||
if (!(await allowCloseTabs(closeCandidates))) return;
|
if (!(await allowCloseTabs(closeCandidates))) return;
|
||||||
|
|
||||||
@@ -64,7 +61,7 @@
|
|||||||
const closeCandidates = getOpenedTabs()
|
const closeCandidates = getOpenedTabs()
|
||||||
.filter(x => closeCondition(x))
|
.filter(x => closeCondition(x))
|
||||||
.filter(x => x.unsaved)
|
.filter(x => x.unsaved)
|
||||||
.filter(shouldShowTab);
|
.filter(x => shouldShowTab(x));
|
||||||
|
|
||||||
if (!(await allowCloseTabs(closeCandidates))) return;
|
if (!(await allowCloseTabs(closeCandidates))) return;
|
||||||
|
|
||||||
@@ -93,7 +90,7 @@
|
|||||||
const closeAll = async () => {
|
const closeAll = async () => {
|
||||||
const closeCandidates = getOpenedTabs()
|
const closeCandidates = getOpenedTabs()
|
||||||
.filter(x => x.unsaved)
|
.filter(x => x.unsaved)
|
||||||
.filter(shouldShowTab);
|
.filter(x => shouldShowTab(x));
|
||||||
|
|
||||||
if (!(await allowCloseTabs(closeCandidates))) return;
|
if (!(await allowCloseTabs(closeCandidates))) return;
|
||||||
|
|
||||||
@@ -156,7 +153,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function switchTabByOrder(reverse) {
|
function switchTabByOrder(reverse) {
|
||||||
const tabs = _.sortBy(get(openedTabs).filter(shouldShowTab), 'tabOrder');
|
const tabs = _.sortBy(
|
||||||
|
getOpenedTabs().filter(x => shouldShowTab(x)),
|
||||||
|
'tabOrder'
|
||||||
|
);
|
||||||
if (reverse) tabs.reverse();
|
if (reverse) tabs.reverse();
|
||||||
const selectedTab = tabs.find(x => x.selected);
|
const selectedTab = tabs.find(x => x.selected);
|
||||||
if (!selectedTab) return;
|
if (!selectedTab) return;
|
||||||
@@ -234,7 +234,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { tick } from 'svelte';
|
import { tick } from 'svelte';
|
||||||
import { derived, get } from 'svelte/store';
|
|
||||||
import registerCommand from '../commands/registerCommand';
|
import registerCommand from '../commands/registerCommand';
|
||||||
import FontIcon from '../icons/FontIcon.svelte';
|
import FontIcon from '../icons/FontIcon.svelte';
|
||||||
import FavoriteModal from '../modals/FavoriteModal.svelte';
|
import FavoriteModal from '../modals/FavoriteModal.svelte';
|
||||||
|
|||||||
Reference in New Issue
Block a user