@elementor/editor-global-classes 4.2.0-860 → 4.2.0-862
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.js +10 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/global-styles-import-listener.tsx +3 -19
- package/src/save-global-classes.tsx +4 -1
package/dist/index.mjs
CHANGED
|
@@ -836,10 +836,12 @@ function calculateChanges(state, initialData) {
|
|
|
836
836
|
const initialDataIds = Object.keys(initialData.items);
|
|
837
837
|
const { order: stateOrder } = state;
|
|
838
838
|
const { order: initialDataOrder } = initialData;
|
|
839
|
+
const stateOrderIdSet = new Set(stateOrder);
|
|
840
|
+
const deleted = initialDataOrder.filter((id2) => !stateOrderIdSet.has(id2));
|
|
839
841
|
const order = stateOrder.join(";") !== initialDataOrder.join(";");
|
|
840
842
|
return {
|
|
841
843
|
added: stateIds.filter((id2) => !initialDataIds.includes(id2)),
|
|
842
|
-
deleted
|
|
844
|
+
deleted,
|
|
843
845
|
modified: stateIds.filter((id2) => {
|
|
844
846
|
return id2 in initialData.items && hash(state.items[id2]) !== hash(initialData.items[id2]);
|
|
845
847
|
}),
|
|
@@ -2872,19 +2874,8 @@ import { __useDispatch as useDispatch2 } from "@elementor/store";
|
|
|
2872
2874
|
function GlobalStylesImportListener() {
|
|
2873
2875
|
const dispatch7 = useDispatch2();
|
|
2874
2876
|
useEffect5(() => {
|
|
2875
|
-
const handleGlobalStylesImported = (
|
|
2876
|
-
|
|
2877
|
-
if (importedClasses?.items && importedClasses?.order) {
|
|
2878
|
-
const { items } = importedClasses;
|
|
2879
|
-
dispatch7(
|
|
2880
|
-
slice.actions.mergeExistingClasses({
|
|
2881
|
-
preview: items,
|
|
2882
|
-
frontend: items
|
|
2883
|
-
})
|
|
2884
|
-
);
|
|
2885
|
-
return;
|
|
2886
|
-
}
|
|
2887
|
-
void loadCurrentDocumentClasses();
|
|
2877
|
+
const handleGlobalStylesImported = () => {
|
|
2878
|
+
loadCurrentDocumentClasses();
|
|
2888
2879
|
};
|
|
2889
2880
|
window.addEventListener(GLOBAL_STYLES_IMPORTED_EVENT, handleGlobalStylesImported);
|
|
2890
2881
|
return () => {
|