@elementor/editor-elements 4.4.0-1113 → 4.4.0-1114
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +1 -0
- package/src/sync/clone-element-tree.ts +24 -0
- package/src/sync/resolve-element.ts +1 -1
- package/src/sync/types.ts +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -75,6 +75,7 @@ type ExtendedWindow = Window & {
|
|
|
75
75
|
findModelById?: (id: string, collection?: unknown) => BackboneModel | null;
|
|
76
76
|
addModelToParent?: (parentId: string, childData: unknown, options?: {
|
|
77
77
|
at?: number;
|
|
78
|
+
clone?: boolean;
|
|
78
79
|
}) => boolean;
|
|
79
80
|
removeModelFromParent?: (parentId: string, childId: string) => boolean;
|
|
80
81
|
};
|
|
@@ -426,6 +427,9 @@ type DuplicatedElementsResult = {
|
|
|
426
427
|
|
|
427
428
|
declare const duplicateElements: ({ elementIds, title, subtitle, onDuplicateElements, onRestoreElements, }: DuplicateElementsParams) => DuplicatedElementsResult;
|
|
428
429
|
|
|
430
|
+
type CloneableElement = Partial<V1ElementModelProps> | BackboneModel;
|
|
431
|
+
declare function cloneElementTree(item: CloneableElement): V1ElementModelProps;
|
|
432
|
+
|
|
429
433
|
declare const generateElementId: () => string;
|
|
430
434
|
|
|
431
435
|
declare function getContainer(id: string): V1Element | null;
|
|
@@ -437,6 +441,7 @@ declare function resolveContainer(container: V1Element, id: string): V1Element |
|
|
|
437
441
|
declare function findModelInDocument(id: string): BackboneModel | null;
|
|
438
442
|
declare function addModelToParent(parentId: string, childData: V1ElementModelProps, options?: {
|
|
439
443
|
at?: number;
|
|
444
|
+
clone?: boolean;
|
|
440
445
|
}): boolean;
|
|
441
446
|
declare function removeModelFromParent(parentId: string, childId: string): boolean;
|
|
442
447
|
|
|
@@ -621,4 +626,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
621
626
|
}) => void;
|
|
622
627
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
623
628
|
|
|
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 };
|
|
629
|
+
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, cloneElementTree, 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
|
@@ -75,6 +75,7 @@ type ExtendedWindow = Window & {
|
|
|
75
75
|
findModelById?: (id: string, collection?: unknown) => BackboneModel | null;
|
|
76
76
|
addModelToParent?: (parentId: string, childData: unknown, options?: {
|
|
77
77
|
at?: number;
|
|
78
|
+
clone?: boolean;
|
|
78
79
|
}) => boolean;
|
|
79
80
|
removeModelFromParent?: (parentId: string, childId: string) => boolean;
|
|
80
81
|
};
|
|
@@ -426,6 +427,9 @@ type DuplicatedElementsResult = {
|
|
|
426
427
|
|
|
427
428
|
declare const duplicateElements: ({ elementIds, title, subtitle, onDuplicateElements, onRestoreElements, }: DuplicateElementsParams) => DuplicatedElementsResult;
|
|
428
429
|
|
|
430
|
+
type CloneableElement = Partial<V1ElementModelProps> | BackboneModel;
|
|
431
|
+
declare function cloneElementTree(item: CloneableElement): V1ElementModelProps;
|
|
432
|
+
|
|
429
433
|
declare const generateElementId: () => string;
|
|
430
434
|
|
|
431
435
|
declare function getContainer(id: string): V1Element | null;
|
|
@@ -437,6 +441,7 @@ declare function resolveContainer(container: V1Element, id: string): V1Element |
|
|
|
437
441
|
declare function findModelInDocument(id: string): BackboneModel | null;
|
|
438
442
|
declare function addModelToParent(parentId: string, childData: V1ElementModelProps, options?: {
|
|
439
443
|
at?: number;
|
|
444
|
+
clone?: boolean;
|
|
440
445
|
}): boolean;
|
|
441
446
|
declare function removeModelFromParent(parentId: string, childId: string): boolean;
|
|
442
447
|
|
|
@@ -621,4 +626,4 @@ declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
|
621
626
|
}) => void;
|
|
622
627
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
623
628
|
|
|
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 };
|
|
629
|
+
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, cloneElementTree, 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
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
ELEMENT_STYLE_CHANGE_EVENT: () => ELEMENT_STYLE_CHANGE_EVENT,
|
|
25
25
|
addModelToParent: () => addModelToParent,
|
|
26
26
|
bindSettingsReconcile: () => bindSettingsReconcile,
|
|
27
|
+
cloneElementTree: () => cloneElementTree,
|
|
27
28
|
createElement: () => createElement,
|
|
28
29
|
createElementStyle: () => createElementStyle,
|
|
29
30
|
createElements: () => createElements,
|
|
@@ -775,6 +776,25 @@ var duplicateElements = ({
|
|
|
775
776
|
return undoableDuplicate({ elementIds });
|
|
776
777
|
};
|
|
777
778
|
|
|
779
|
+
// src/sync/clone-element-tree.ts
|
|
780
|
+
function isBackboneModel(item) {
|
|
781
|
+
return "toJSON" in item && "get" in item;
|
|
782
|
+
}
|
|
783
|
+
function cloneElementTree(item) {
|
|
784
|
+
const source = isBackboneModel(item) ? item.toJSON() : item;
|
|
785
|
+
return {
|
|
786
|
+
...source,
|
|
787
|
+
id: generateElementId(),
|
|
788
|
+
settings: {
|
|
789
|
+
...source.settings ?? {},
|
|
790
|
+
_element_id: ""
|
|
791
|
+
},
|
|
792
|
+
elements: (source.elements ?? []).map(
|
|
793
|
+
(child) => cloneElementTree(child)
|
|
794
|
+
)
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
|
|
778
798
|
// src/sync/get-preview-element-dom.ts
|
|
779
799
|
function getPreviewElementDOM(id) {
|
|
780
800
|
try {
|
|
@@ -1582,6 +1602,7 @@ var playElementInteractions = (elementId, interactionId) => {
|
|
|
1582
1602
|
ELEMENT_STYLE_CHANGE_EVENT,
|
|
1583
1603
|
addModelToParent,
|
|
1584
1604
|
bindSettingsReconcile,
|
|
1605
|
+
cloneElementTree,
|
|
1585
1606
|
createElement,
|
|
1586
1607
|
createElementStyle,
|
|
1587
1608
|
createElements,
|