ability to disable tab preview mode

This commit is contained in:
SPRINX0\prochazka
2024-12-17 09:34:16 +01:00
parent ca5dd0ac30
commit 7759fd862f
3 changed files with 26 additions and 1 deletions

View File

@@ -287,6 +287,7 @@
'img import': 'mdi mdi-database-import color-icon-green',
'img export': 'mdi mdi-database-export color-icon-green',
'img transform': 'mdi mdi-rotate-orbit color-icon-blue',
'img tip': 'mdi mdi-lightbulb-on color-icon-yellow',
};
</script>

View File

@@ -100,7 +100,7 @@ ORDER BY
{ label: 'Connection', slot: 2 },
{ label: 'Themes', slot: 3 },
{ label: 'Default Actions', slot: 4 },
{ label: 'Confirmations', slot: 5 },
{ label: 'Behaviour', slot: 5 },
{ label: 'Other', slot: 6 },
]}
>
@@ -331,6 +331,17 @@ ORDER BY
/>
</svelte:fragment>
<svelte:fragment slot="5">
<div class="heading">Behaviour</div>
<FormCheckboxField name="behaviour.useTabPreviewMode" label="Use tab preview mode" defaultValue={true} />
<div class="tip">
<FontIcon icon="img tip" /> When you single-click or select a file in the "Tables, Views, Functions" view, it
is shown in a preview mode and reuses an existing tab (preview tab). This is useful if you are quickly browsing
tables and don't want every visited table to have its own tab. When you start editing the table or use double-click
to open the table from the "Tables" view, a new tab is dedicated to that table.
</div>
<div class="heading">Confirmations</div>
<FormCheckboxField name="skipConfirm.tableDataSave" label="Skip confirmation when saving table data (SQL)" />
@@ -405,6 +416,11 @@ ORDER BY
margin-top: var(--dim-large-form-margin);
}
.tip {
margin-left: var(--dim-large-form-margin);
margin-top: var(--dim-large-form-margin);
}
.themes {
overflow-x: scroll;
display: flex;

View File

@@ -7,6 +7,7 @@ import localforage from 'localforage';
import stableStringify from 'json-stable-stringify';
import { saveAllPendingEditorData } from '../query/useEditorData';
import { getConnectionInfo } from './metadataLoaders';
import { getBoolSettingsValue } from '../settings/settingsTools';
function findFreeNumber(numbers: number[]) {
if (numbers.length == 0) return 1;
@@ -22,6 +23,13 @@ export default async function openNewTab(newTab, initialData: any = undefined, o
let existing = null;
if (!getBoolSettingsValue('behaviour.useTabPreviewMode', true) && newTab.tabPreviewMode) {
newTab = {
...newTab,
tabPreviewMode: false,
};
}
const { savedFile, savedFolder, savedFilePath, conid, database } = newTab.props || {};
if (conid && database) {