@elementor/editor-editing-panel 4.2.0-848 → 4.2.0-849
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 +51 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/apply-unapply-actions.ts +17 -1
package/dist/index.mjs
CHANGED
|
@@ -152,7 +152,7 @@ import * as React11 from "react";
|
|
|
152
152
|
import { useRef, useState as useState4 } from "react";
|
|
153
153
|
import {
|
|
154
154
|
isElementsStylesProvider as isElementsStylesProvider4,
|
|
155
|
-
stylesRepository as
|
|
155
|
+
stylesRepository as stylesRepository7,
|
|
156
156
|
useProviders,
|
|
157
157
|
useUserStylesCapability as useUserStylesCapability5,
|
|
158
158
|
validateStyleLabel as validateStyleLabel2
|
|
@@ -554,7 +554,7 @@ var StyledGroupItems = styled("ul")`
|
|
|
554
554
|
import * as React10 from "react";
|
|
555
555
|
import { useEffect, useMemo as useMemo3, useState as useState3 } from "react";
|
|
556
556
|
import { isClassState } from "@elementor/editor-styles";
|
|
557
|
-
import { stylesRepository as
|
|
557
|
+
import { stylesRepository as stylesRepository6, useUserStylesCapability as useUserStylesCapability4, validateStyleLabel } from "@elementor/editor-styles-repository";
|
|
558
558
|
import { EditableField, EllipsisWithTooltip, useEditable } from "@elementor/editor-ui";
|
|
559
559
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
560
560
|
import { useSessionStorage as useSessionStorage3 } from "@elementor/session";
|
|
@@ -588,7 +588,7 @@ function CssClassProvider({ children, ...contextValue }) {
|
|
|
588
588
|
import * as React9 from "react";
|
|
589
589
|
import {
|
|
590
590
|
isElementsStylesProvider as isElementsStylesProvider3,
|
|
591
|
-
stylesRepository as
|
|
591
|
+
stylesRepository as stylesRepository5,
|
|
592
592
|
useUserStylesCapability as useUserStylesCapability3
|
|
593
593
|
} from "@elementor/editor-styles-repository";
|
|
594
594
|
import { MenuItemInfotip, MenuListItem as MenuListItem2 } from "@elementor/editor-ui";
|
|
@@ -614,7 +614,7 @@ var StyleIndicator = styled2("div", {
|
|
|
614
614
|
|
|
615
615
|
// src/components/css-classes/duplicate-class-menu-item.tsx
|
|
616
616
|
import * as React7 from "react";
|
|
617
|
-
import { stylesRepository as
|
|
617
|
+
import { stylesRepository as stylesRepository4, useUserStylesCapability as useUserStylesCapability2 } from "@elementor/editor-styles-repository";
|
|
618
618
|
import { MenuListItem } from "@elementor/editor-ui";
|
|
619
619
|
import { useSessionStorage as useSessionStorage2 } from "@elementor/session";
|
|
620
620
|
import { __ as __2 } from "@wordpress/i18n";
|
|
@@ -630,6 +630,7 @@ import { __ } from "@wordpress/i18n";
|
|
|
630
630
|
import { setDocumentModifiedStatus } from "@elementor/editor-documents";
|
|
631
631
|
import { getElementSetting as getElementSetting2, updateElementSettings as updateElementSettings2 } from "@elementor/editor-elements";
|
|
632
632
|
import { classesPropTypeUtil as classesPropTypeUtil2 } from "@elementor/editor-props";
|
|
633
|
+
import { stylesRepository as stylesRepository3 } from "@elementor/editor-styles-repository";
|
|
633
634
|
function doGetAppliedClasses(elementId, classesPropType = "classes") {
|
|
634
635
|
return getElementSetting2(elementId, classesPropType)?.value || [];
|
|
635
636
|
}
|
|
@@ -640,6 +641,17 @@ function doApplyClasses(elementId, classIds, classesPropType = "classes") {
|
|
|
640
641
|
withHistory: false
|
|
641
642
|
});
|
|
642
643
|
setDocumentModifiedStatus(true);
|
|
644
|
+
ensureClassesAreLoaded(classIds);
|
|
645
|
+
}
|
|
646
|
+
function ensureClassesAreLoaded(classIds) {
|
|
647
|
+
const providers = stylesRepository3.getProviders();
|
|
648
|
+
classIds.forEach((classId) => {
|
|
649
|
+
stylesRepository3.getProviderByKey(classId)?.actions.get(classId);
|
|
650
|
+
const owningProvider = providers.find(
|
|
651
|
+
(provider) => provider.actions.all().some((style) => style.id === classId)
|
|
652
|
+
);
|
|
653
|
+
owningProvider?.actions.get(classId);
|
|
654
|
+
});
|
|
643
655
|
}
|
|
644
656
|
function doUnapplyClass(elementId, classId, classesPropType = "classes") {
|
|
645
657
|
const appliedClasses = getElementSetting2(elementId, classesPropType)?.value || [];
|
|
@@ -820,7 +832,7 @@ function DuplicateClassMenuItem({ closeMenu }) {
|
|
|
820
832
|
if (!provider || !classId) {
|
|
821
833
|
return null;
|
|
822
834
|
}
|
|
823
|
-
const providerInstance =
|
|
835
|
+
const providerInstance = stylesRepository4.getProviderByKey(provider);
|
|
824
836
|
const createAction = providerInstance?.actions.create;
|
|
825
837
|
const getAction = providerInstance?.actions.get;
|
|
826
838
|
if (!createAction || !getAction) {
|
|
@@ -976,7 +988,7 @@ function useElementStates() {
|
|
|
976
988
|
}
|
|
977
989
|
function useModifiedStates(styleId) {
|
|
978
990
|
const { meta } = useStyle();
|
|
979
|
-
const styleDef =
|
|
991
|
+
const styleDef = stylesRepository5.all().find((style) => style.id === styleId);
|
|
980
992
|
return Object.fromEntries(
|
|
981
993
|
styleDef?.variants.filter((variant) => meta.breakpoint === variant.meta.breakpoint).map((variant) => [variant.meta.state ?? "normal", true]) ?? []
|
|
982
994
|
);
|
|
@@ -989,7 +1001,7 @@ function getMenuItemsByProvider({
|
|
|
989
1001
|
if (!provider) {
|
|
990
1002
|
return [];
|
|
991
1003
|
}
|
|
992
|
-
const providerInstance =
|
|
1004
|
+
const providerInstance = stylesRepository5.getProviderByKey(provider);
|
|
993
1005
|
const providerActions = providerInstance?.actions;
|
|
994
1006
|
const canUpdate = providerActions?.update;
|
|
995
1007
|
const canDuplicate = providerActions?.create && providerActions?.get;
|
|
@@ -1139,7 +1151,7 @@ function CssClassItem(props) {
|
|
|
1139
1151
|
onError: setError
|
|
1140
1152
|
});
|
|
1141
1153
|
const color = error ? "error" : colorProp;
|
|
1142
|
-
const providerActions = provider ?
|
|
1154
|
+
const providerActions = provider ? stylesRepository6.getProviderByKey(provider)?.actions : null;
|
|
1143
1155
|
const allowRename = Boolean(providerActions?.update) && userCan(provider ?? "")?.update;
|
|
1144
1156
|
const isShowingState = isActive && meta.state;
|
|
1145
1157
|
const stateLabel = useMemo3(() => {
|
|
@@ -1329,7 +1341,7 @@ var updateClassByProvider = (provider, data) => {
|
|
|
1329
1341
|
if (!provider) {
|
|
1330
1342
|
return;
|
|
1331
1343
|
}
|
|
1332
|
-
const providerInstance =
|
|
1344
|
+
const providerInstance = stylesRepository7.getProviderByKey(provider);
|
|
1333
1345
|
if (!providerInstance) {
|
|
1334
1346
|
return;
|
|
1335
1347
|
}
|
|
@@ -2578,7 +2590,7 @@ import { getWidgetsCache } from "@elementor/editor-elements";
|
|
|
2578
2590
|
import { classesPropTypeUtil as classesPropTypeUtil3 } from "@elementor/editor-props";
|
|
2579
2591
|
import { getBreakpointsTree as getBreakpointsTree2 } from "@elementor/editor-responsive";
|
|
2580
2592
|
import { getStylesSchema } from "@elementor/editor-styles";
|
|
2581
|
-
import { stylesRepository as
|
|
2593
|
+
import { stylesRepository as stylesRepository8 } from "@elementor/editor-styles-repository";
|
|
2582
2594
|
|
|
2583
2595
|
// src/styles-inheritance/create-styles-inheritance.ts
|
|
2584
2596
|
import {
|
|
@@ -2855,7 +2867,7 @@ var useAppliedStyles = () => {
|
|
|
2855
2867
|
useStylesRerender();
|
|
2856
2868
|
const classesProp = usePanelElementSetting(currentClassesProp);
|
|
2857
2869
|
const appliedStyles = classesPropTypeUtil3.extract(classesProp) ?? [];
|
|
2858
|
-
return
|
|
2870
|
+
return stylesRepository8.all().filter((style) => [...baseStyles, ...appliedStyles].includes(style.id));
|
|
2859
2871
|
};
|
|
2860
2872
|
var useBaseStyles = () => {
|
|
2861
2873
|
const { elementType } = useElement();
|