@griddo/ax 11.10.36 → 11.10.37
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/__tests__/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/PasteModuleButton.test.tsx +1 -3
- package/src/components/Browser/index.tsx +20 -18
- package/src/components/BrowserContent/index.tsx +8 -6
- package/src/components/Fields/ComponentArray/BulkHeader/index.tsx +1 -2
- package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +1 -1
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +29 -43
- package/src/components/Fields/ComponentArray/{MixableComponentArray/PasteModuleButton → PasteModuleButton}/index.tsx +6 -6
- package/src/components/Fields/ComponentArray/SameComponentArray/AddItemButton/index.tsx +1 -1
- package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +103 -61
- package/src/components/Fields/ComponentArray/SameComponentArray/style.tsx +7 -1
- package/src/components/Fields/ComponentArray/helpers.tsx +2 -2
- package/src/components/Fields/ComponentArray/index.tsx +4 -4
- package/src/components/Fields/ComponentContainer/EmptyContainer/index.tsx +7 -8
- package/src/components/Fields/ComponentContainer/atoms.tsx +0 -2
- package/src/components/Fields/ComponentContainer/index.tsx +26 -30
- package/src/components/SideModal/SideModalOption/index.tsx +14 -11
- package/src/components/SideModal/index.tsx +16 -19
- package/src/containers/PageEditor/actions.tsx +17 -20
- package/src/helpers/containerEvaluations.tsx +1 -12
- package/src/hooks/iframe.ts +13 -9
- package/src/modules/Forms/FormEditor/PageBrowser/index.tsx +1 -15
- package/src/modules/FramePreview/index.tsx +17 -4
- package/src/modules/GlobalEditor/PageBrowser/index.tsx +5 -2
- package/src/modules/PageEditor/Editor/index.tsx +1 -2
- package/src/modules/PageEditor/PageBrowser/index.tsx +5 -2
- package/src/modules/PageEditor/index.tsx +0 -1
- package/src/types/index.tsx +11 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { connect } from "react-redux";
|
|
2
2
|
|
|
3
|
-
import { BrowserContent, Loading } from "@ax/components";
|
|
3
|
+
import { BrowserContent, Loading, Toast } from "@ax/components";
|
|
4
4
|
import { formsActions } from "@ax/containers/Forms";
|
|
5
5
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
6
6
|
import { findByEditorID } from "@ax/forms";
|
|
7
|
-
import { useDefaultTheme, useOnMessageReceivedFromOutside, useURLSearchParam } from "@ax/hooks";
|
|
7
|
+
import { useDefaultTheme, useOnMessageReceivedFromOutside, useToast, useURLSearchParam } from "@ax/hooks";
|
|
8
8
|
import type { FormContent, ILanguage, IRootState, ISite, ISocialState } from "@ax/types";
|
|
9
9
|
|
|
10
10
|
import * as S from "./style";
|
|
@@ -25,6 +25,7 @@ const FramePreview = (props: IProps) => {
|
|
|
25
25
|
setFormContent,
|
|
26
26
|
deleteModule,
|
|
27
27
|
duplicateModule,
|
|
28
|
+
copyModule,
|
|
28
29
|
} = props;
|
|
29
30
|
|
|
30
31
|
const isPreview = useURLSearchParam("preview");
|
|
@@ -37,8 +38,10 @@ const FramePreview = (props: IProps) => {
|
|
|
37
38
|
const content = isForm ? formContent : pageContent;
|
|
38
39
|
const { canonicalSite, language, pageLanguages, header, footer } = content;
|
|
39
40
|
|
|
41
|
+
const { isVisible, toggleToast, setIsVisible, state: toastState } = useToast();
|
|
40
42
|
useOnMessageReceivedFromOutside(setContent, setSelectedContent);
|
|
41
43
|
|
|
44
|
+
|
|
42
45
|
window.addEventListener("mousemove", (e) => {
|
|
43
46
|
window.parent.postMessage(
|
|
44
47
|
{
|
|
@@ -66,7 +69,7 @@ const FramePreview = (props: IProps) => {
|
|
|
66
69
|
|
|
67
70
|
if (isPreview === "false" && (isDisabled === "false" || isNavigationModule)) {
|
|
68
71
|
window.parent.postMessage({ type: "module-click", message: editorID }, "*");
|
|
69
|
-
setSelectedContent
|
|
72
|
+
setSelectedContent?.(editorID);
|
|
70
73
|
}
|
|
71
74
|
};
|
|
72
75
|
|
|
@@ -85,7 +88,7 @@ const FramePreview = (props: IProps) => {
|
|
|
85
88
|
|
|
86
89
|
const deleteModuleSelected = (editorID: number) => {
|
|
87
90
|
window.parent.postMessage({ type: "module-delete", message: editorID }, "*");
|
|
88
|
-
setSelectedContent
|
|
91
|
+
setSelectedContent?.(0);
|
|
89
92
|
deleteModule([editorID]);
|
|
90
93
|
};
|
|
91
94
|
|
|
@@ -94,9 +97,16 @@ const FramePreview = (props: IProps) => {
|
|
|
94
97
|
duplicateModule([editorID]);
|
|
95
98
|
};
|
|
96
99
|
|
|
100
|
+
const copyModuleSelected = (editorID: number) => {
|
|
101
|
+
window.parent.postMessage({ type: "module-copy", message: editorID }, "*");
|
|
102
|
+
const isCopied = copyModule([editorID]);
|
|
103
|
+
!!isCopied && toggleToast?.("1 module copied to clipboard");
|
|
104
|
+
};
|
|
105
|
+
|
|
97
106
|
const moduleActions = {
|
|
98
107
|
deleteModuleAction: deleteModuleSelected,
|
|
99
108
|
duplicateModuleAction: duplicateModuleSelected,
|
|
109
|
+
copyModuleAction: copyModuleSelected,
|
|
100
110
|
};
|
|
101
111
|
|
|
102
112
|
if (isLoading || schemasLoading) return <Loading />;
|
|
@@ -121,6 +131,7 @@ const FramePreview = (props: IProps) => {
|
|
|
121
131
|
renderer={renderer}
|
|
122
132
|
selectHoverEditorID={selectHoverEditorID}
|
|
123
133
|
/>
|
|
134
|
+
{isVisible && <Toast message={toastState} setIsVisible={setIsVisible} />}
|
|
124
135
|
</S.Wrapper>
|
|
125
136
|
);
|
|
126
137
|
};
|
|
@@ -140,6 +151,7 @@ interface IProps {
|
|
|
140
151
|
setFormContent(formContent: FormContent | null): void;
|
|
141
152
|
deleteModule(editorID: number[]): void;
|
|
142
153
|
duplicateModule(editorID: number[]): number;
|
|
154
|
+
copyModule(editorID: number[]): boolean | number;
|
|
143
155
|
}
|
|
144
156
|
|
|
145
157
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -160,6 +172,7 @@ const mapDispatchToProps = {
|
|
|
160
172
|
setFormContent: formsActions.setFormContent,
|
|
161
173
|
deleteModule: pageEditorActions.deleteModule,
|
|
162
174
|
duplicateModule: pageEditorActions.duplicateModule,
|
|
175
|
+
copyModule: pageEditorActions.copyModule,
|
|
163
176
|
};
|
|
164
177
|
|
|
165
178
|
export default connect(mapStateToProps, mapDispatchToProps)(FramePreview);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { connect } from "react-redux";
|
|
3
2
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
4
3
|
|
|
5
4
|
import { Browser } from "@ax/components";
|
|
6
|
-
import { ILanguage, IRootState, ISchema, ISocialState } from "@ax/types";
|
|
5
|
+
import type { ILanguage, IRootState, ISchema, ISocialState } from "@ax/types";
|
|
7
6
|
|
|
8
7
|
const PageBrowser = (props: IProps) => {
|
|
9
8
|
const {
|
|
@@ -18,6 +17,7 @@ const PageBrowser = (props: IProps) => {
|
|
|
18
17
|
browserRef,
|
|
19
18
|
deleteModule,
|
|
20
19
|
duplicateModule,
|
|
20
|
+
copyModule,
|
|
21
21
|
setScrollEditorID,
|
|
22
22
|
} = props;
|
|
23
23
|
|
|
@@ -28,6 +28,7 @@ const PageBrowser = (props: IProps) => {
|
|
|
28
28
|
const actions = {
|
|
29
29
|
deleteModuleAction: deleteModule,
|
|
30
30
|
duplicateModuleAction: duplicateModule,
|
|
31
|
+
copyModuleAction: copyModule,
|
|
31
32
|
setSelectedContentAction: setSelectedContent,
|
|
32
33
|
setScrollEditorIDAction: setScrollEditorID,
|
|
33
34
|
};
|
|
@@ -69,6 +70,7 @@ interface IPageBrowserDispatchProps {
|
|
|
69
70
|
browserRef?: any;
|
|
70
71
|
deleteModule(editorID: number[]): void;
|
|
71
72
|
duplicateModule(editorID: number[]): number;
|
|
73
|
+
copyModule(editorID: number[]): number | boolean;
|
|
72
74
|
setScrollEditorID(editorID: number | null): void;
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -87,6 +89,7 @@ const mapDispatchToProps = {
|
|
|
87
89
|
setSelectedContent: pageEditorActions.setSelectedContent,
|
|
88
90
|
deleteModule: pageEditorActions.deleteModule,
|
|
89
91
|
duplicateModule: pageEditorActions.duplicateModule,
|
|
92
|
+
copyModule: pageEditorActions.copyModule,
|
|
90
93
|
setScrollEditorID: pageEditorActions.setScrollEditorID,
|
|
91
94
|
};
|
|
92
95
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { connect } from "react-redux";
|
|
3
2
|
|
|
4
3
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
5
4
|
import { sitesActions } from "@ax/containers/Sites";
|
|
6
5
|
import { appActions } from "@ax/containers/App";
|
|
7
6
|
import { ConfigPanel, ResizePanel } from "@ax/components";
|
|
8
|
-
import { IBreadcrumbItem, IModule, INotification, IRootState, ISchema, ISite, IUserEditing } from "@ax/types";
|
|
7
|
+
import type { IBreadcrumbItem, IModule, INotification, IRootState, ISchema, ISite, IUserEditing } from "@ax/types";
|
|
9
8
|
import PageBrowser from "../PageBrowser";
|
|
10
9
|
|
|
11
10
|
const Editor = (props: IProps) => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { connect } from "react-redux";
|
|
3
2
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
4
3
|
|
|
5
4
|
import { Browser } from "@ax/components";
|
|
6
|
-
import { ILanguage, IRootState, ISite, ISocialState } from "@ax/types";
|
|
5
|
+
import type { ILanguage, IRootState, ISite, ISocialState } from "@ax/types";
|
|
7
6
|
|
|
8
7
|
const PageBrowser = (props: IProps) => {
|
|
9
8
|
const {
|
|
@@ -19,6 +18,7 @@ const PageBrowser = (props: IProps) => {
|
|
|
19
18
|
browserRef,
|
|
20
19
|
deleteModule,
|
|
21
20
|
duplicateModule,
|
|
21
|
+
copyModule,
|
|
22
22
|
setScrollEditorID,
|
|
23
23
|
} = props;
|
|
24
24
|
|
|
@@ -36,6 +36,7 @@ const PageBrowser = (props: IProps) => {
|
|
|
36
36
|
const actions = {
|
|
37
37
|
deleteModuleAction: deleteModule,
|
|
38
38
|
duplicateModuleAction: duplicateModule,
|
|
39
|
+
copyModuleAction: copyModule,
|
|
39
40
|
setSelectedContentAction: setSelectedContent,
|
|
40
41
|
setScrollEditorIDAction: setScrollEditorID,
|
|
41
42
|
};
|
|
@@ -79,6 +80,7 @@ interface IPageBrowserDispatchProps {
|
|
|
79
80
|
browserRef?: any;
|
|
80
81
|
deleteModule(editorID: number[]): void;
|
|
81
82
|
duplicateModule(editorID: number[]): number;
|
|
83
|
+
copyModule(editorID: number[]): number | boolean;
|
|
82
84
|
setScrollEditorID(editorID: number | null): void;
|
|
83
85
|
}
|
|
84
86
|
|
|
@@ -97,6 +99,7 @@ const mapDispatchToProps = {
|
|
|
97
99
|
setSelectedContent: pageEditorActions.setSelectedContent,
|
|
98
100
|
deleteModule: pageEditorActions.deleteModule,
|
|
99
101
|
duplicateModule: pageEditorActions.duplicateModule,
|
|
102
|
+
copyModule: pageEditorActions.copyModule,
|
|
100
103
|
setScrollEditorID: pageEditorActions.setScrollEditorID,
|
|
101
104
|
};
|
|
102
105
|
|
|
@@ -280,7 +280,6 @@ const PageEditor = (props: IProps) => {
|
|
|
280
280
|
};
|
|
281
281
|
|
|
282
282
|
const handleSchedulePublication = async () => {
|
|
283
|
-
console.log(scheduleDate, "scheduleDate");
|
|
284
283
|
const date = new Date(`${scheduleDate.date} ${scheduleDate.time}`);
|
|
285
284
|
const dateString = dateToString(date, "dd/MM/yyyy HH:mm:ss");
|
|
286
285
|
const saved = await schedulePublication(dateString, isDraft);
|
package/src/types/index.tsx
CHANGED
|
@@ -1103,6 +1103,17 @@ export interface IExportDataParams {
|
|
|
1103
1103
|
format: string[];
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
|
+
export interface IContainerEvaluation {
|
|
1107
|
+
isEmpty: boolean;
|
|
1108
|
+
containedComponent: IContainedComponent;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
export interface IContainedComponent {
|
|
1112
|
+
containerText: string;
|
|
1113
|
+
component: string;
|
|
1114
|
+
componentID: number;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1106
1117
|
export type Field =
|
|
1107
1118
|
| "AsyncCheckGroup"
|
|
1108
1119
|
| "AsyncSelect"
|