table data edit - shows editing mark

This commit is contained in:
Jan Prochazka
2023-02-05 19:58:45 +01:00
parent cd000098f1
commit d61a7c54ce
2 changed files with 44 additions and 0 deletions

View File

@@ -51,6 +51,8 @@
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
import ToolStripExportButton, { createQuickExportHandlerRef } from '../buttons/ToolStripExportButton.svelte';
import { getBoolSettingsValue } from '../settings/settingsTools';
import useEditorData from '../query/useEditorData';
import { markTabSaved, markTabUnsaved } from '../utility/common';
export let tabid;
export let conid;
@@ -65,8 +67,28 @@
const config = useGridConfig(tabid);
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());
$: {
setEditorData($changeSetStore.value);
if (changeSetContainsChanges($changeSetStore?.value)) {
markTabUnsaved(tabid);
} else {
markTabSaved(tabid);
}
}
$: {
$changeSetStore;
invalidateCommands();