@elementor/editor-elements 4.4.0-1112 → 4.4.0-1113
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 +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +2 -1
- package/src/sync/get-elements.ts +12 -3
- package/src/sync/get-host-document-container.ts +13 -0
- package/src/sync/get-host-document-id.ts +11 -0
- package/src/sync/types.ts +6 -0
package/dist/index.d.mts
CHANGED
|
@@ -91,6 +91,10 @@ type ExtendedWindow = Window & {
|
|
|
91
91
|
container: V1Element;
|
|
92
92
|
} | undefined;
|
|
93
93
|
getCurrentId?: () => number;
|
|
94
|
+
getInitialId?: () => number;
|
|
95
|
+
get?: (id: number) => {
|
|
96
|
+
container: V1Element;
|
|
97
|
+
} | undefined;
|
|
94
98
|
};
|
|
95
99
|
getContainer?: (id: string) => V1Element | undefined;
|
|
96
100
|
getPreviewContainer?: () => V1Element | undefined;
|
|
@@ -465,6 +469,9 @@ declare function findChildRecursive(model: V1Model, predicate: (model: V1Model)
|
|
|
465
469
|
declare function getElementChildren(model: V1Model, predicate?: (model: V1Model) => boolean): ModelResult[];
|
|
466
470
|
|
|
467
471
|
declare function getElements(root?: ElementID): V1Element[];
|
|
472
|
+
declare function getHostDocumentElements(): V1Element[];
|
|
473
|
+
|
|
474
|
+
declare function getHostDocumentId(): number | null;
|
|
468
475
|
|
|
469
476
|
declare function getSelectedElements(): Element[];
|
|
470
477
|
|
|
@@ -614,4 +621,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
614
621
|
}) => void;
|
|
615
622
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
616
623
|
|
|
617
|
-
export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, type BooleanPropValue, type ChildDependenciesConfig, type ChildDependencyRule, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, DEFAULT_STYLE_CLASS_PREFIX, type DropElementParams, type DuplicateElementParams, type DuplicateElementsParams, type DuplicatedElement, type DuplicatedElementsResult, ELEMENT_STYLE_CHANGE_EVENT, type Element, type ElementChildren, type ElementControl, type ElementID, type ElementInteractions, type ElementModel, type ElementPosition, type ElementPositionKind, type ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type UseElementChildrenOptions, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, bindSettingsReconcile, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getDefaultStyleTagFromPreviewElement, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getLinkInLinkRestriction, getPreviewElementDOM, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, parseDefaultStyleTagFromClassList, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
|
624
|
+
export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, type BooleanPropValue, type ChildDependenciesConfig, type ChildDependencyRule, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, DEFAULT_STYLE_CLASS_PREFIX, type DropElementParams, type DuplicateElementParams, type DuplicateElementsParams, type DuplicatedElement, type DuplicatedElementsResult, ELEMENT_STYLE_CHANGE_EVENT, type Element, type ElementChildren, type ElementControl, type ElementID, type ElementInteractions, type ElementModel, type ElementPosition, type ElementPositionKind, type ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type UseElementChildrenOptions, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, bindSettingsReconcile, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getDefaultStyleTagFromPreviewElement, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getHostDocumentElements, getHostDocumentId, getLinkInLinkRestriction, getPreviewElementDOM, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, parseDefaultStyleTagFromClassList, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,10 @@ type ExtendedWindow = Window & {
|
|
|
91
91
|
container: V1Element;
|
|
92
92
|
} | undefined;
|
|
93
93
|
getCurrentId?: () => number;
|
|
94
|
+
getInitialId?: () => number;
|
|
95
|
+
get?: (id: number) => {
|
|
96
|
+
container: V1Element;
|
|
97
|
+
} | undefined;
|
|
94
98
|
};
|
|
95
99
|
getContainer?: (id: string) => V1Element | undefined;
|
|
96
100
|
getPreviewContainer?: () => V1Element | undefined;
|
|
@@ -465,6 +469,9 @@ declare function findChildRecursive(model: V1Model, predicate: (model: V1Model)
|
|
|
465
469
|
declare function getElementChildren(model: V1Model, predicate?: (model: V1Model) => boolean): ModelResult[];
|
|
466
470
|
|
|
467
471
|
declare function getElements(root?: ElementID): V1Element[];
|
|
472
|
+
declare function getHostDocumentElements(): V1Element[];
|
|
473
|
+
|
|
474
|
+
declare function getHostDocumentId(): number | null;
|
|
468
475
|
|
|
469
476
|
declare function getSelectedElements(): Element[];
|
|
470
477
|
|
|
@@ -614,4 +621,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
614
621
|
}) => void;
|
|
615
622
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
616
623
|
|
|
617
|
-
export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, type BooleanPropValue, type ChildDependenciesConfig, type ChildDependencyRule, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, DEFAULT_STYLE_CLASS_PREFIX, type DropElementParams, type DuplicateElementParams, type DuplicateElementsParams, type DuplicatedElement, type DuplicatedElementsResult, ELEMENT_STYLE_CHANGE_EVENT, type Element, type ElementChildren, type ElementControl, type ElementID, type ElementInteractions, type ElementModel, type ElementPosition, type ElementPositionKind, type ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type UseElementChildrenOptions, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, bindSettingsReconcile, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getDefaultStyleTagFromPreviewElement, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getLinkInLinkRestriction, getPreviewElementDOM, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, parseDefaultStyleTagFromClassList, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
|
624
|
+
export { type AnimationPresetPropValue, type BackboneCollection, type BackboneModel, type BooleanPropValue, type ChildDependenciesConfig, type ChildDependencyRule, type ConfigPropValue, type Control, type ControlItem, type ControlLayout, type ControlsSection, type CreateElementParams, type CreateElementStyleArgs, DEFAULT_STYLE_CLASS_PREFIX, type DropElementParams, type DuplicateElementParams, type DuplicateElementsParams, type DuplicatedElement, type DuplicatedElementsResult, ELEMENT_STYLE_CHANGE_EVENT, type Element, type ElementChildren, type ElementControl, type ElementID, type ElementInteractions, type ElementModel, type ElementPosition, type ElementPositionKind, type ElementType, type ExcludedBreakpointsPropValue, type ExtendedWindow, type InteractionBreakpointsPropValue, type InteractionItemPropValue, type LinkInLinkRestriction, type ModelResult, type MoveElementParams, type NumberPropValue, type PseudoState, type StringPropValue, type TimingConfigPropValue, type UpdateElementSettingsArgs, type UpdateElementStyleArgs, type UseElementChildrenOptions, type V1Element, type V1ElementConfig, type V1ElementData, type V1ElementEditorSettingsProps, type V1ElementModelProps, type V1ElementSettingsProps, addModelToParent, bindSettingsReconcile, createElement, createElementStyle, createElements, deleteElement, deleteElementStyle, dropElement, duplicateElement, duplicateElements, evaluateWhen, findChildRecursive, findModelInDocument, generateElementId, getAllDescendants, getAnchoredAncestorId, getAnchoredDescendantId, getContainer, getCurrentDocumentContainer, getCurrentDocumentId, getDefaultStyleTagFromPreviewElement, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getHostDocumentElements, getHostDocumentId, getLinkInLinkRestriction, getPreviewElementDOM, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, parseDefaultStyleTagFromClassList, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,8 @@ __export(index_exports, {
|
|
|
54
54
|
getElementTitle: () => getElementTitle,
|
|
55
55
|
getElementType: () => getElementType,
|
|
56
56
|
getElements: () => getElements,
|
|
57
|
+
getHostDocumentElements: () => getHostDocumentElements,
|
|
58
|
+
getHostDocumentId: () => getHostDocumentId,
|
|
57
59
|
getLinkInLinkRestriction: () => getLinkInLinkRestriction,
|
|
58
60
|
getPreviewElementDOM: () => getPreviewElementDOM,
|
|
59
61
|
getSelectedElements: () => getSelectedElements,
|
|
@@ -906,9 +908,28 @@ function getAllDescendants(container) {
|
|
|
906
908
|
return [container, ...children];
|
|
907
909
|
}
|
|
908
910
|
|
|
911
|
+
// src/sync/get-host-document-id.ts
|
|
912
|
+
function getHostDocumentId() {
|
|
913
|
+
const extendedWindow = window;
|
|
914
|
+
try {
|
|
915
|
+
return extendedWindow.elementor?.documents?.getInitialId?.() ?? null;
|
|
916
|
+
} catch {
|
|
917
|
+
return null;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// src/sync/get-host-document-container.ts
|
|
922
|
+
function getHostDocumentContainer() {
|
|
923
|
+
const extendedWindow = window;
|
|
924
|
+
const hostId = getHostDocumentId();
|
|
925
|
+
if (!hostId) {
|
|
926
|
+
return null;
|
|
927
|
+
}
|
|
928
|
+
return extendedWindow.elementor?.documents?.get?.(hostId)?.container ?? null;
|
|
929
|
+
}
|
|
930
|
+
|
|
909
931
|
// src/sync/get-elements.ts
|
|
910
|
-
function
|
|
911
|
-
const container = root ? getContainer(root) : getCurrentDocumentContainer();
|
|
932
|
+
function collectElements(container) {
|
|
912
933
|
if (!container) {
|
|
913
934
|
return [];
|
|
914
935
|
}
|
|
@@ -917,6 +938,13 @@ function getElements(root) {
|
|
|
917
938
|
);
|
|
918
939
|
return [container, ...children];
|
|
919
940
|
}
|
|
941
|
+
function getElements(root) {
|
|
942
|
+
const container = root ? getContainer(root) : getCurrentDocumentContainer();
|
|
943
|
+
return collectElements(container);
|
|
944
|
+
}
|
|
945
|
+
function getHostDocumentElements() {
|
|
946
|
+
return collectElements(getHostDocumentContainer());
|
|
947
|
+
}
|
|
920
948
|
|
|
921
949
|
// src/sync/move-element.ts
|
|
922
950
|
function moveElement({ element, targetContainer, options = {} }) {
|
|
@@ -1584,6 +1612,8 @@ var playElementInteractions = (elementId, interactionId) => {
|
|
|
1584
1612
|
getElementTitle,
|
|
1585
1613
|
getElementType,
|
|
1586
1614
|
getElements,
|
|
1615
|
+
getHostDocumentElements,
|
|
1616
|
+
getHostDocumentId,
|
|
1587
1617
|
getLinkInLinkRestriction,
|
|
1588
1618
|
getPreviewElementDOM,
|
|
1589
1619
|
getSelectedElements,
|