mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 19:36:00 +00:00
Merge branch 'develop'
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
import { apiCall } from './utility/api';
|
||||
import { getConfig, getSettings, getUsedApps } from './utility/metadataLoaders';
|
||||
import AppTitleProvider from './utility/AppTitleProvider.svelte';
|
||||
import getElectron from './utility/getElectron';
|
||||
|
||||
let loadedApi = false;
|
||||
let loadedPlugins = false;
|
||||
@@ -63,6 +64,7 @@
|
||||
if (loadedApi && $loadingPluginStore?.loaded) {
|
||||
setAppLoaded();
|
||||
loadedPlugins = true;
|
||||
getElectron()?.send('app-started');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -29,6 +29,7 @@ import { apiCall } from '../utility/api';
|
||||
import runCommand from './runCommand';
|
||||
import { openWebLink } from '../utility/exportFileTools';
|
||||
import { getSettings } from '../utility/metadataLoaders';
|
||||
import { isMac } from '../utility/common';
|
||||
|
||||
// function themeCommand(theme: ThemeDefinition) {
|
||||
// return {
|
||||
@@ -97,7 +98,7 @@ registerCommand({
|
||||
toolbarOrder: 2,
|
||||
name: 'Query',
|
||||
toolbarName: 'New query',
|
||||
keyText: 'CtrlOrCommand+Q',
|
||||
keyText: 'CtrlOrCommand+T',
|
||||
onClick: () => newQuery(),
|
||||
});
|
||||
|
||||
@@ -457,9 +458,10 @@ if (hasPermission('settings/change')) {
|
||||
registerCommand({
|
||||
id: 'file.exit',
|
||||
category: 'File',
|
||||
name: 'Exit',
|
||||
name: isMac() ? 'Quit' : 'Exit',
|
||||
// keyText: isMac() ? 'Command+Q' : null,
|
||||
testEnabled: () => getElectron() != null,
|
||||
onClick: () => getElectron().send('close-window'),
|
||||
onClick: () => getElectron().send('quit-app'),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
|
||||
@@ -306,6 +306,7 @@
|
||||
import EditJsonModal from '../modals/EditJsonModal.svelte';
|
||||
import { apiCall } from '../utility/api';
|
||||
import getElectron from '../utility/getElectron';
|
||||
import { isCtrlOrCommandKey } from '../utility/common';
|
||||
|
||||
export let onLoadNextData = undefined;
|
||||
export let grider = undefined;
|
||||
@@ -976,7 +977,7 @@
|
||||
const oldCurrentCell = currentCell;
|
||||
currentCell = cell;
|
||||
|
||||
if (event.ctrlKey) {
|
||||
if (isCtrlOrCommandKey(event)) {
|
||||
if (isRegularCell(cell)) {
|
||||
if (selectedCells.find(x => x[0] == cell[0] && x[1] == cell[1])) {
|
||||
selectedCells = selectedCells.filter(x => x[0] != cell[0] || x[1] != cell[1]);
|
||||
@@ -1116,6 +1117,7 @@
|
||||
if (
|
||||
!event.ctrlKey &&
|
||||
!event.altKey &&
|
||||
!event.metaKey &&
|
||||
((event.keyCode >= keycodes.a && event.keyCode <= keycodes.z) ||
|
||||
(event.keyCode >= keycodes.n0 && event.keyCode <= keycodes.n9) ||
|
||||
(event.keyCode >= keycodes.numPad0 && event.keyCode <= keycodes.numPad9) ||
|
||||
@@ -1150,7 +1152,7 @@
|
||||
function handleCursorMove(event) {
|
||||
if (!isRegularCell(currentCell)) return null;
|
||||
let rowCount = grider.rowCount;
|
||||
if (event.ctrlKey) {
|
||||
if (isCtrlOrCommandKey(event)) {
|
||||
switch (event.keyCode) {
|
||||
case keycodes.upArrow:
|
||||
case keycodes.pageUp:
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
import createRef from '../utility/createRef';
|
||||
import _ from 'lodash';
|
||||
import { arrayToHexString, parseCellValue, stringifyCellValue } from 'dbgate-tools';
|
||||
import { isCtrlOrCommandKey } from '../utility/common';
|
||||
|
||||
export let inplaceEditorState;
|
||||
export let dispatchInsplaceEditor;
|
||||
@@ -43,7 +44,7 @@
|
||||
dispatchInsplaceEditor({ type: 'close', mode: 'enter' });
|
||||
break;
|
||||
case keycodes.s:
|
||||
if (event.ctrlKey) {
|
||||
if (isCtrlOrCommandKey(event)) {
|
||||
if (isChangedRef.get()) {
|
||||
onSetValue(parseCellValue(domEditor.value));
|
||||
// grider.setCellValue(rowIndex, uniqueName, editor.value);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import { currentThemeDefinition } from '../stores';
|
||||
import VirtualForeignKeyEditorModal from '../tableeditor/VirtualForeignKeyEditorModal.svelte';
|
||||
import { isCtrlOrCommandKey } from '../utility/common';
|
||||
import contextMenu from '../utility/contextMenu';
|
||||
import moveDrag from '../utility/moveDrag';
|
||||
import ColumnLine from './ColumnLine.svelte';
|
||||
@@ -217,7 +218,7 @@
|
||||
e.stopPropagation();
|
||||
onBringToFront(table);
|
||||
if (settings?.canSelectTables && !table?.isSelectedTable) {
|
||||
onSelectTable(table, e.ctrlKey);
|
||||
onSelectTable(table, isCtrlOrCommandKey(e));
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -177,6 +177,7 @@
|
||||
import { apiCall } from '../utility/api';
|
||||
|
||||
import { copyTextToClipboard, extractRowCopiedValue } from '../utility/clipboard';
|
||||
import { isCtrlOrCommandKey } from '../utility/common';
|
||||
import contextMenu, { getContextMenu, registerMenu } from '../utility/contextMenu';
|
||||
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||
import createReducer from '../utility/createReducer';
|
||||
@@ -383,6 +384,7 @@
|
||||
|
||||
if (
|
||||
!event.ctrlKey &&
|
||||
!event.metaKey &&
|
||||
!event.altKey &&
|
||||
((event.keyCode >= keycodes.a && event.keyCode <= keycodes.z) ||
|
||||
(event.keyCode >= keycodes.n0 && event.keyCode <= keycodes.n9) ||
|
||||
@@ -472,7 +474,7 @@
|
||||
return moveCurrentCell(columnIndex % formDisplay.columns.length, Math.floor(columnIndex / rowCount) * 2);
|
||||
};
|
||||
|
||||
if (event.ctrlKey) {
|
||||
if (isCtrlOrCommandKey(event)) {
|
||||
switch (event.keyCode) {
|
||||
case keycodes.leftArrow:
|
||||
return moveCurrentCell(currentCell[0], 0);
|
||||
|
||||
@@ -64,3 +64,10 @@ export function resolveKeyText(keyText: string): string {
|
||||
}
|
||||
return keyText.replace('CtrlOrCommand+', 'Ctrl+');
|
||||
}
|
||||
|
||||
export function isCtrlOrCommandKey(event) {
|
||||
if (isMac()) {
|
||||
return event.metaKey;
|
||||
}
|
||||
return event.ctrlKey;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user