mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 21:25:59 +00:00
table data edit - shows editing mark
This commit is contained in:
@@ -51,6 +51,8 @@
|
|||||||
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
|
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
|
||||||
import ToolStripExportButton, { createQuickExportHandlerRef } from '../buttons/ToolStripExportButton.svelte';
|
import ToolStripExportButton, { createQuickExportHandlerRef } from '../buttons/ToolStripExportButton.svelte';
|
||||||
import { getBoolSettingsValue } from '../settings/settingsTools';
|
import { getBoolSettingsValue } from '../settings/settingsTools';
|
||||||
|
import useEditorData from '../query/useEditorData';
|
||||||
|
import { markTabSaved, markTabUnsaved } from '../utility/common';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
@@ -65,8 +67,28 @@
|
|||||||
const config = useGridConfig(tabid);
|
const config = useGridConfig(tabid);
|
||||||
const cache = writable(createGridCache());
|
const cache = writable(createGridCache());
|
||||||
|
|
||||||
|
const { editorState, editorValue, setEditorData } = useEditorData({
|
||||||
|
tabid,
|
||||||
|
onInitialData: value => {
|
||||||
|
dispatchChangeSet({ type: 'reset', value });
|
||||||
|
invalidateCommands();
|
||||||
|
if (changeSetContainsChanges(value)) {
|
||||||
|
markTabUnsaved(tabid);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const [changeSetStore, dispatchChangeSet] = createUndoReducer(createChangeSet());
|
const [changeSetStore, dispatchChangeSet] = createUndoReducer(createChangeSet());
|
||||||
|
|
||||||
|
$: {
|
||||||
|
setEditorData($changeSetStore.value);
|
||||||
|
if (changeSetContainsChanges($changeSetStore?.value)) {
|
||||||
|
markTabUnsaved(tabid);
|
||||||
|
} else {
|
||||||
|
markTabSaved(tabid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
$changeSetStore;
|
$changeSetStore;
|
||||||
invalidateCommands();
|
invalidateCommands();
|
||||||
|
|||||||
@@ -99,6 +99,8 @@
|
|||||||
import ToolStripExportButton, { createQuickExportHandlerRef } from '../buttons/ToolStripExportButton.svelte';
|
import ToolStripExportButton, { createQuickExportHandlerRef } from '../buttons/ToolStripExportButton.svelte';
|
||||||
import ToolStripCommandSplitButton from '../buttons/ToolStripCommandSplitButton.svelte';
|
import ToolStripCommandSplitButton from '../buttons/ToolStripCommandSplitButton.svelte';
|
||||||
import { getBoolSettingsValue, getIntSettingsValue } from '../settings/settingsTools';
|
import { getBoolSettingsValue, getIntSettingsValue } from '../settings/settingsTools';
|
||||||
|
import useEditorData from '../query/useEditorData';
|
||||||
|
import { markTabSaved, markTabUnsaved } from '../utility/common';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
@@ -118,8 +120,28 @@
|
|||||||
|
|
||||||
$: connection = useConnectionInfo({ conid });
|
$: connection = useConnectionInfo({ conid });
|
||||||
|
|
||||||
|
const { editorState, editorValue, setEditorData } = useEditorData({
|
||||||
|
tabid,
|
||||||
|
onInitialData: value => {
|
||||||
|
dispatchChangeSet({ type: 'reset', value });
|
||||||
|
invalidateCommands();
|
||||||
|
if (changeSetContainsChanges(value)) {
|
||||||
|
markTabUnsaved(tabid);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const [changeSetStore, dispatchChangeSet] = createUndoReducer(createChangeSet());
|
const [changeSetStore, dispatchChangeSet] = createUndoReducer(createChangeSet());
|
||||||
|
|
||||||
|
$: {
|
||||||
|
setEditorData($changeSetStore.value);
|
||||||
|
if (changeSetContainsChanges($changeSetStore?.value)) {
|
||||||
|
markTabUnsaved(tabid);
|
||||||
|
} else {
|
||||||
|
markTabSaved(tabid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function handleConfirmSql(sql) {
|
async function handleConfirmSql(sql) {
|
||||||
const resp = await apiCall('database-connections/run-script', { conid, database, sql, useTransaction: true });
|
const resp = await apiCall('database-connections/run-script', { conid, database, sql, useTransaction: true });
|
||||||
const { errorMessage } = resp || {};
|
const { errorMessage } = resp || {};
|
||||||
|
|||||||
Reference in New Issue
Block a user