saving colors when not modified
This commit is contained in:
1 parent
7afda7eb1c
commit
48decb2e16
2 files changed
+11
-2
No files matched your search
@@ -20,7 +20,10 @@ export const useEditorNodeState = (originalNode: AutomationNode, isErrored: bool
|
||||
setAllState({ ...allState, node: originalNode, isModified: false, })
|
||||
// eslint-disable-next-line
|
||||
}, [originalNode])
|
||||
const setState = (node: AutomationNode) => setAllState(({ ...allState, node, isModified: true, }));
|
||||
const setState = (node: AutomationNode) => setAllState(({
|
||||
...allState, node,
|
||||
isModified: JSON.stringify(node) !== JSON.stringify(originalNode),
|
||||
}));
|
||||
const setYamlMode = (yamlMode: boolean) => setAllState({ ...allState, yamlMode, });
|
||||
const setStateForManualYaml = (yaml: any) => {
|
||||
try {
|
||||
|
||||
@@ -66,7 +66,13 @@ export const NodeEditor: FC<NodeEditorProps> = ({
|
||||
<Button
|
||||
className="node-editor--footer--save"
|
||||
onClick={() => {
|
||||
areYouSureNotReady('save') && onSave(state.data)
|
||||
if (areYouSureNotReady('save')) {
|
||||
if (JSON.stringify(state.data) !== JSON.stringify(node)) {
|
||||
onSave(state.data)
|
||||
} else {
|
||||
onClose()
|
||||
}
|
||||
}
|
||||
}}
|
||||
title={
|
||||
!isReady ? "Some fields have not been properly filled up" : ""
|
||||
|
||||
Reference in new issue
Block a user