@elementor/editor-elements 4.5.0-1185 → 4.5.0-1187
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 +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +3 -3
- package/src/sync/get-element-widget-markers.ts +7 -11
package/src/index.ts
CHANGED
|
@@ -51,9 +51,9 @@ export { getElementSetting, getElementSettings } from './sync/get-element-settin
|
|
|
51
51
|
export { getElementStyles } from './sync/get-element-styles';
|
|
52
52
|
export { getElementType } from './sync/get-element-type';
|
|
53
53
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
getContainerPart,
|
|
55
|
+
getContainerWidgetMarker,
|
|
56
|
+
isContainerSlot,
|
|
57
57
|
WIDGET_MARKER_KEYS,
|
|
58
58
|
} from './sync/get-element-widget-markers';
|
|
59
59
|
export { regenerateLocalStyleIds } from './sync/regenerate-local-style-ids';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { z } from '@elementor/schema';
|
|
2
2
|
|
|
3
|
-
import { type
|
|
4
|
-
import { getContainer } from './get-container';
|
|
5
|
-
import { type V1ElementWidgetMarker } from './types';
|
|
3
|
+
import { type V1Element, type V1ElementWidgetMarker } from './types';
|
|
6
4
|
|
|
7
5
|
const WIDGET_ID_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/;
|
|
8
6
|
const PART_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
@@ -22,8 +20,8 @@ const widgetMarkerSchema = z.object( {
|
|
|
22
20
|
|
|
23
21
|
const partSchema = z.string().regex( PART_PATTERN );
|
|
24
22
|
|
|
25
|
-
export function
|
|
26
|
-
const result = widgetMarkerSchema.safeParse(
|
|
23
|
+
export function getContainerWidgetMarker( container: V1Element | null ): Required< V1ElementWidgetMarker > | null {
|
|
24
|
+
const result = widgetMarkerSchema.safeParse( container?.model.get( WIDGET_MARKER_KEYS.widget ) );
|
|
27
25
|
|
|
28
26
|
if ( ! result.success ) {
|
|
29
27
|
return null;
|
|
@@ -32,14 +30,12 @@ export function getElementWidgetMarker( elementId: ElementID ): Required< V1Elem
|
|
|
32
30
|
return { ...result.data, values: result.data.values ?? {} };
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
export function
|
|
36
|
-
const result = partSchema.safeParse(
|
|
33
|
+
export function getContainerPart( container: V1Element | null ): string | null {
|
|
34
|
+
const result = partSchema.safeParse( container?.model.get( WIDGET_MARKER_KEYS.part ) );
|
|
37
35
|
|
|
38
36
|
return result.success ? result.data : null;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
export function
|
|
42
|
-
return (
|
|
43
|
-
true === getContainer( elementId )?.model.get( WIDGET_MARKER_KEYS.slot ) && null !== getElementPart( elementId )
|
|
44
|
-
);
|
|
39
|
+
export function isContainerSlot( container: V1Element | null ): boolean {
|
|
40
|
+
return true === container?.model.get( WIDGET_MARKER_KEYS.slot ) && null !== getContainerPart( container );
|
|
45
41
|
}
|