@elementor/editor-components 4.1.0-767 → 4.1.0-769
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/dist/index.d.mts +43 -39
- package/dist/index.d.ts +43 -39
- package/dist/index.js +49 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/init.ts +2 -2
- package/src/store/actions/remove-component-styles.ts +9 -0
- package/src/store/dispatchers.ts +3 -0
- package/src/store/extensible-slice.ts +5 -0
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,38 @@ import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adap
|
|
|
12
12
|
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
13
13
|
import { __ as __16 } from "@wordpress/i18n";
|
|
14
14
|
|
|
15
|
+
// src/component-instance-transformer.ts
|
|
16
|
+
import { createTransformer } from "@elementor/editor-canvas";
|
|
17
|
+
import { __getState as getState } from "@elementor/store";
|
|
18
|
+
|
|
19
|
+
// src/store/store.ts
|
|
20
|
+
import { __createSelector as createSelector, __useSelector as useSelector } from "@elementor/store";
|
|
21
|
+
|
|
22
|
+
// src/store/store-types.ts
|
|
23
|
+
var initialState = {
|
|
24
|
+
data: [],
|
|
25
|
+
unpublishedData: [],
|
|
26
|
+
loadStatus: "idle",
|
|
27
|
+
styles: {},
|
|
28
|
+
createdThisSession: [],
|
|
29
|
+
archivedThisSession: [],
|
|
30
|
+
path: [],
|
|
31
|
+
currentComponentId: null,
|
|
32
|
+
updatedComponentNames: {},
|
|
33
|
+
sanitized: {}
|
|
34
|
+
};
|
|
35
|
+
var SLICE_NAME = "components";
|
|
36
|
+
|
|
37
|
+
// src/store/extensible-slice.ts
|
|
38
|
+
import {
|
|
39
|
+
__createAction as createAction,
|
|
40
|
+
__createSlice as createSlice,
|
|
41
|
+
__dispatch as dispatch
|
|
42
|
+
} from "@elementor/store";
|
|
43
|
+
|
|
44
|
+
// src/store/thunks.ts
|
|
45
|
+
import { __createAsyncThunk as createAsyncThunk } from "@elementor/store";
|
|
46
|
+
|
|
15
47
|
// src/api.ts
|
|
16
48
|
import { ajax } from "@elementor/editor-v1-adapters";
|
|
17
49
|
import { httpService } from "@elementor/http-client";
|
|
@@ -67,37 +99,7 @@ var apiClient = {
|
|
|
67
99
|
validate: async (payload) => await httpService().post(`${BASE_URL}/create-validate`, payload).then((res) => res.data)
|
|
68
100
|
};
|
|
69
101
|
|
|
70
|
-
// src/component-instance-transformer.ts
|
|
71
|
-
import { createTransformer } from "@elementor/editor-canvas";
|
|
72
|
-
import { __getState as getState } from "@elementor/store";
|
|
73
|
-
|
|
74
|
-
// src/store/store.ts
|
|
75
|
-
import { __createSelector as createSelector, __useSelector as useSelector } from "@elementor/store";
|
|
76
|
-
|
|
77
|
-
// src/store/store-types.ts
|
|
78
|
-
var initialState = {
|
|
79
|
-
data: [],
|
|
80
|
-
unpublishedData: [],
|
|
81
|
-
loadStatus: "idle",
|
|
82
|
-
styles: {},
|
|
83
|
-
createdThisSession: [],
|
|
84
|
-
archivedThisSession: [],
|
|
85
|
-
path: [],
|
|
86
|
-
currentComponentId: null,
|
|
87
|
-
updatedComponentNames: {},
|
|
88
|
-
sanitized: {}
|
|
89
|
-
};
|
|
90
|
-
var SLICE_NAME = "components";
|
|
91
|
-
|
|
92
|
-
// src/store/extensible-slice.ts
|
|
93
|
-
import {
|
|
94
|
-
__createAction as createAction,
|
|
95
|
-
__createSlice as createSlice,
|
|
96
|
-
__dispatch as dispatch
|
|
97
|
-
} from "@elementor/store";
|
|
98
|
-
|
|
99
102
|
// src/store/thunks.ts
|
|
100
|
-
import { __createAsyncThunk as createAsyncThunk } from "@elementor/store";
|
|
101
103
|
var loadComponents = createAsyncThunk("components/load", async () => {
|
|
102
104
|
const response = await apiClient.get();
|
|
103
105
|
return response;
|
|
@@ -146,6 +148,10 @@ var baseSlice = createSlice({
|
|
|
146
148
|
resetUnpublished: (state) => {
|
|
147
149
|
state.unpublishedData = [];
|
|
148
150
|
},
|
|
151
|
+
removeStyles(state, { payload }) {
|
|
152
|
+
const { [payload.id]: _, ...rest } = state.styles;
|
|
153
|
+
state.styles = rest;
|
|
154
|
+
},
|
|
149
155
|
addStyles: (state, { payload }) => {
|
|
150
156
|
state.styles = { ...state.styles, ...payload };
|
|
151
157
|
},
|
|
@@ -1659,6 +1665,9 @@ var componentsActions = {
|
|
|
1659
1665
|
resetUnpublished() {
|
|
1660
1666
|
dispatch3(slice.actions.resetUnpublished());
|
|
1661
1667
|
},
|
|
1668
|
+
removeStyles(id) {
|
|
1669
|
+
dispatch3(slice.actions.removeStyles({ id }));
|
|
1670
|
+
},
|
|
1662
1671
|
addStyles(styles) {
|
|
1663
1672
|
dispatch3(slice.actions.addStyles(styles));
|
|
1664
1673
|
},
|
|
@@ -3149,6 +3158,13 @@ function blockCircularPaste(args) {
|
|
|
3149
3158
|
return hasCircularComponent;
|
|
3150
3159
|
}
|
|
3151
3160
|
|
|
3161
|
+
// src/store/actions/remove-component-styles.ts
|
|
3162
|
+
import { __dispatch as dispatch7 } from "@elementor/store";
|
|
3163
|
+
function removeComponentStyles(id) {
|
|
3164
|
+
apiClient.invalidateComponentConfigCache(id);
|
|
3165
|
+
dispatch7(slice.actions.removeStyles({ id }));
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3152
3168
|
// src/store/components-styles-provider.ts
|
|
3153
3169
|
import { getCurrentDocumentId } from "@elementor/editor-elements";
|
|
3154
3170
|
import { createStylesProvider } from "@elementor/editor-styles-repository";
|
|
@@ -3272,7 +3288,7 @@ function init() {
|
|
|
3272
3288
|
registerDataHook2("after", "editor/documents/attach-preview", async () => {
|
|
3273
3289
|
const { id, config } = getV1CurrentDocument();
|
|
3274
3290
|
if (id) {
|
|
3275
|
-
|
|
3291
|
+
removeComponentStyles(id);
|
|
3276
3292
|
}
|
|
3277
3293
|
await loadComponentsAssets(config?.elements ?? []);
|
|
3278
3294
|
});
|