@griddo/ax 1.62.5 → 1.62.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/containers/Navigation/Defaults/actions.tsx +2 -1
- package/src/helpers/schemas.tsx +10 -4
- package/src/hooks/forms.tsx +1 -2
- package/src/modules/GlobalEditor/index.tsx +5 -0
- package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +9 -7
- package/src/modules/PageEditor/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.62.
|
|
4
|
+
"version": "1.62.8",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -244,5 +244,5 @@
|
|
|
244
244
|
"publishConfig": {
|
|
245
245
|
"access": "public"
|
|
246
246
|
},
|
|
247
|
-
"gitHead": "
|
|
247
|
+
"gitHead": "f2c87c6b1fcba0fd6042c269efb4673299800d0d"
|
|
248
248
|
}
|
|
@@ -230,7 +230,8 @@ function createNavigation(): (dispatch: Dispatch, getState: any) => Promise<bool
|
|
|
230
230
|
const cleanValues = removeEditorIds(navigationValues);
|
|
231
231
|
|
|
232
232
|
const successAction = async (response: any) => {
|
|
233
|
-
|
|
233
|
+
const updatedContent = { ...editorContent, ...response };
|
|
234
|
+
generateContent(updatedContent, dispatch, getState);
|
|
234
235
|
dispatch(setIsNewTranslation(false));
|
|
235
236
|
};
|
|
236
237
|
|
package/src/helpers/schemas.tsx
CHANGED
|
@@ -8,17 +8,23 @@ const allSChemas = { ...schemas.all, ...pageSchemas };
|
|
|
8
8
|
const getSchema = (name: string) => allSChemas[name];
|
|
9
9
|
const getDefaultSchema = (name: string) => allSChemas[name].default;
|
|
10
10
|
|
|
11
|
-
const getSchemaThumbnails = (name: string, theme?: string) =>
|
|
12
|
-
|
|
11
|
+
const getSchemaThumbnails = (name: string, theme?: string) => {
|
|
12
|
+
if (!allSChemas[name].thumbnails) return null;
|
|
13
|
+
|
|
14
|
+
return theme && allSChemas[name].thumbnails[theme] ? allSChemas[name].thumbnails[theme] : allSChemas[name].thumbnails;
|
|
15
|
+
};
|
|
13
16
|
|
|
14
17
|
const getTemplate = (name: string) => schemas.templates[name];
|
|
15
18
|
|
|
16
19
|
const getDefaultTemplate = (name: string) => schemas.templates[name].default;
|
|
17
20
|
|
|
18
|
-
const getTemplateThumbnails = (name: string, theme?: string) =>
|
|
19
|
-
|
|
21
|
+
const getTemplateThumbnails = (name: string, theme?: string) => {
|
|
22
|
+
if (!schemas.templates[name].thumbnails) return null;
|
|
23
|
+
|
|
24
|
+
return theme && schemas.templates[name].thumbnails[theme]
|
|
20
25
|
? schemas.templates[name].thumbnails[theme]
|
|
21
26
|
: schemas.templates[name] && schemas.templates[name].thumbnails;
|
|
27
|
+
};
|
|
22
28
|
|
|
23
29
|
const getDataPackSchema = (name: string) => schemas.dataPacks[name];
|
|
24
30
|
|
package/src/hooks/forms.tsx
CHANGED
|
@@ -89,7 +89,6 @@ const useIsDirty = (
|
|
|
89
89
|
const [isResetting, setIsResetting] = useState(false);
|
|
90
90
|
|
|
91
91
|
const prevContent = usePrevious(updatedValues, isSaved);
|
|
92
|
-
const isTranslatedVersion: boolean = prevContent?.language !== updatedValues?.language;
|
|
93
92
|
|
|
94
93
|
const hasChanged = () => {
|
|
95
94
|
if (prevContent && updatedValues) {
|
|
@@ -98,7 +97,7 @@ const useIsDirty = (
|
|
|
98
97
|
|
|
99
98
|
const { cleanUpdatedValues, cleanOriginalValues } = cleanPageValues(updatedValuesCloned, originalValuesCloned);
|
|
100
99
|
|
|
101
|
-
const hasChanged = !
|
|
100
|
+
const hasChanged = !isEqual(cleanUpdatedValues, cleanOriginalValues);
|
|
102
101
|
|
|
103
102
|
return hasChanged;
|
|
104
103
|
}
|
|
@@ -72,6 +72,11 @@ const GlobalEditor = (props: IProps) => {
|
|
|
72
72
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
73
|
}, []);
|
|
74
74
|
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
resetDirty();
|
|
77
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
|
+
}, [lang]);
|
|
79
|
+
|
|
75
80
|
useEffect(() => {
|
|
76
81
|
const { pageID, sendPagePing, currentUserID } = props;
|
|
77
82
|
if (userEditing && userEditing.id !== currentUserID) {
|
|
@@ -31,15 +31,12 @@ const DefaultsEditor = (props: IProps) => {
|
|
|
31
31
|
setHeader,
|
|
32
32
|
setFooter,
|
|
33
33
|
setHistoryPush,
|
|
34
|
-
header,
|
|
35
|
-
footer,
|
|
36
34
|
} = props;
|
|
37
35
|
|
|
38
36
|
const { isOpen, toggleModal } = useModal();
|
|
39
37
|
const { isDirty, setIsDirty, resetDirty } = useIsDirty(editorContent, isNewTranslation);
|
|
40
|
-
|
|
41
38
|
const currentDefaultNav = currentDefaultsContent.find((item: any) => item.setAsDefault);
|
|
42
|
-
const isNew = !
|
|
39
|
+
const isNew = !editorContent?.id || null;
|
|
43
40
|
const isSetAsDefault = editorContent && editorContent.setAsDefault;
|
|
44
41
|
|
|
45
42
|
useEffect(() => {
|
|
@@ -50,6 +47,11 @@ const DefaultsEditor = (props: IProps) => {
|
|
|
50
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
48
|
}, []);
|
|
52
49
|
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
resetDirty();
|
|
52
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
+
}, [lang]);
|
|
54
|
+
|
|
53
55
|
const save = () => {
|
|
54
56
|
isNew || isNewTranslation
|
|
55
57
|
? createNavigation().then((isSaved: boolean) => {
|
|
@@ -76,8 +78,8 @@ const DefaultsEditor = (props: IProps) => {
|
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
const rightButtonProps = {
|
|
79
|
-
label: !isDirty ? "Saved" : isSaving ? "Saving" : "Save",
|
|
80
|
-
disabled:
|
|
81
|
+
label: !isDirty && !isNewTranslation && !isNew ? "Saved" : isSaving ? "Saving" : "Save",
|
|
82
|
+
disabled: (!isDirty && !isNewTranslation && !isNew) || isSaving,
|
|
81
83
|
action: () => saveButtonAction(),
|
|
82
84
|
};
|
|
83
85
|
|
|
@@ -88,7 +90,7 @@ const DefaultsEditor = (props: IProps) => {
|
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
const createNewTranslation = (isNewTranslation: boolean) => {
|
|
91
|
-
setIsDirty(
|
|
93
|
+
setIsDirty(true);
|
|
92
94
|
createTranslation(isNewTranslation);
|
|
93
95
|
};
|
|
94
96
|
|