@elementor/editor-elements 4.3.0-999 → 4.4.0-1064
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 +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +73 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/hooks/use-element-children.ts +17 -2
- package/src/index.ts +12 -1
- package/src/link-restriction.ts +2 -28
- package/src/sync/get-preview-element-dom.ts +32 -0
- package/src/sync/types.ts +3 -0
- package/src/utils/get-default-style-tag-from-preview.ts +59 -0
package/dist/index.d.mts
CHANGED
|
@@ -227,6 +227,7 @@ type V1ElementEditorSettingsProps = {
|
|
|
227
227
|
initial_position?: number;
|
|
228
228
|
component_uid?: string;
|
|
229
229
|
grid_outline?: boolean;
|
|
230
|
+
empty_state_preview?: boolean;
|
|
230
231
|
};
|
|
231
232
|
type V1ElementSettingsProps = Record<string, PropValue>;
|
|
232
233
|
type V1ElementConfig<T = object, TChild = unknown> = {
|
|
@@ -253,6 +254,8 @@ type V1ElementConfig<T = object, TChild = unknown> = {
|
|
|
253
254
|
meta?: {
|
|
254
255
|
[key: string]: string | number | boolean | null | NonNullable<V1ElementConfig['meta']>;
|
|
255
256
|
};
|
|
257
|
+
default_html_tag?: string;
|
|
258
|
+
html_tag_follows_link?: boolean;
|
|
256
259
|
} & T;
|
|
257
260
|
type V1Model$1<T> = {
|
|
258
261
|
get: <K extends keyof T>(key: K) => T[K];
|
|
@@ -292,7 +295,17 @@ type ElementModel = {
|
|
|
292
295
|
editorSettings: V1ElementEditorSettingsProps;
|
|
293
296
|
};
|
|
294
297
|
type ElementChildren = Record<string, ElementModel[]>;
|
|
295
|
-
|
|
298
|
+
type UseElementChildrenOptions = {
|
|
299
|
+
/**
|
|
300
|
+
* Let the element itself match a requested parent type. Off by default, because
|
|
301
|
+
* `findChildRecursive` only inspects descendants and existing callers rely on that: an element
|
|
302
|
+
* whose repeater items are its own direct children (e.g. `e-accordion` -> `e-accordion-item`)
|
|
303
|
+
* has no intermediate wrapper to look for, while one that keeps them in a sub-container
|
|
304
|
+
* (e.g. `e-tabs` -> `e-tabs-menu` -> `e-tab`) must not match itself.
|
|
305
|
+
*/
|
|
306
|
+
includeSelfAsParent?: boolean;
|
|
307
|
+
};
|
|
308
|
+
declare function useElementChildren<T extends ElementChildren>(elementId: ElementID, childrenTypes: Record<string, string>, { includeSelfAsParent }?: UseElementChildrenOptions): T;
|
|
296
309
|
|
|
297
310
|
declare const useElementEditorSettings: (elementId: ElementID) => V1ElementEditorSettingsProps;
|
|
298
311
|
|
|
@@ -413,6 +426,8 @@ declare const generateElementId: () => string;
|
|
|
413
426
|
declare function getContainer(id: string): V1Element | null;
|
|
414
427
|
declare const selectElement: (elementId: string) => void;
|
|
415
428
|
|
|
429
|
+
declare function getPreviewElementDOM(id: string): HTMLElement | null;
|
|
430
|
+
|
|
416
431
|
declare function resolveContainer(container: V1Element, id: string): V1Element | null;
|
|
417
432
|
declare function findModelInDocument(id: string): BackboneModel | null;
|
|
418
433
|
declare function addModelToParent(parentId: string, childData: V1ElementModelProps, options?: {
|
|
@@ -588,10 +603,14 @@ declare function updateElementStyle(args: UpdateElementStyleArgs): void;
|
|
|
588
603
|
|
|
589
604
|
declare function getElementInteractions(elementId: ElementID): ElementInteractions | undefined;
|
|
590
605
|
|
|
606
|
+
declare const DEFAULT_STYLE_CLASS_PREFIX = "e-default-";
|
|
607
|
+
declare function parseDefaultStyleTagFromClassList(classList: DOMTokenList): string | null;
|
|
608
|
+
declare function getDefaultStyleTagFromPreviewElement(elementId: string): string | null;
|
|
609
|
+
|
|
591
610
|
declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
592
611
|
elementId: string;
|
|
593
612
|
interactions: V1ElementModelProps["interactions"];
|
|
594
613
|
}) => void;
|
|
595
614
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
596
615
|
|
|
597
|
-
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, 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 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, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getLinkInLinkRestriction, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
|
616
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -227,6 +227,7 @@ type V1ElementEditorSettingsProps = {
|
|
|
227
227
|
initial_position?: number;
|
|
228
228
|
component_uid?: string;
|
|
229
229
|
grid_outline?: boolean;
|
|
230
|
+
empty_state_preview?: boolean;
|
|
230
231
|
};
|
|
231
232
|
type V1ElementSettingsProps = Record<string, PropValue>;
|
|
232
233
|
type V1ElementConfig<T = object, TChild = unknown> = {
|
|
@@ -253,6 +254,8 @@ type V1ElementConfig<T = object, TChild = unknown> = {
|
|
|
253
254
|
meta?: {
|
|
254
255
|
[key: string]: string | number | boolean | null | NonNullable<V1ElementConfig['meta']>;
|
|
255
256
|
};
|
|
257
|
+
default_html_tag?: string;
|
|
258
|
+
html_tag_follows_link?: boolean;
|
|
256
259
|
} & T;
|
|
257
260
|
type V1Model$1<T> = {
|
|
258
261
|
get: <K extends keyof T>(key: K) => T[K];
|
|
@@ -292,7 +295,17 @@ type ElementModel = {
|
|
|
292
295
|
editorSettings: V1ElementEditorSettingsProps;
|
|
293
296
|
};
|
|
294
297
|
type ElementChildren = Record<string, ElementModel[]>;
|
|
295
|
-
|
|
298
|
+
type UseElementChildrenOptions = {
|
|
299
|
+
/**
|
|
300
|
+
* Let the element itself match a requested parent type. Off by default, because
|
|
301
|
+
* `findChildRecursive` only inspects descendants and existing callers rely on that: an element
|
|
302
|
+
* whose repeater items are its own direct children (e.g. `e-accordion` -> `e-accordion-item`)
|
|
303
|
+
* has no intermediate wrapper to look for, while one that keeps them in a sub-container
|
|
304
|
+
* (e.g. `e-tabs` -> `e-tabs-menu` -> `e-tab`) must not match itself.
|
|
305
|
+
*/
|
|
306
|
+
includeSelfAsParent?: boolean;
|
|
307
|
+
};
|
|
308
|
+
declare function useElementChildren<T extends ElementChildren>(elementId: ElementID, childrenTypes: Record<string, string>, { includeSelfAsParent }?: UseElementChildrenOptions): T;
|
|
296
309
|
|
|
297
310
|
declare const useElementEditorSettings: (elementId: ElementID) => V1ElementEditorSettingsProps;
|
|
298
311
|
|
|
@@ -413,6 +426,8 @@ declare const generateElementId: () => string;
|
|
|
413
426
|
declare function getContainer(id: string): V1Element | null;
|
|
414
427
|
declare const selectElement: (elementId: string) => void;
|
|
415
428
|
|
|
429
|
+
declare function getPreviewElementDOM(id: string): HTMLElement | null;
|
|
430
|
+
|
|
416
431
|
declare function resolveContainer(container: V1Element, id: string): V1Element | null;
|
|
417
432
|
declare function findModelInDocument(id: string): BackboneModel | null;
|
|
418
433
|
declare function addModelToParent(parentId: string, childData: V1ElementModelProps, options?: {
|
|
@@ -588,10 +603,14 @@ declare function updateElementStyle(args: UpdateElementStyleArgs): void;
|
|
|
588
603
|
|
|
589
604
|
declare function getElementInteractions(elementId: ElementID): ElementInteractions | undefined;
|
|
590
605
|
|
|
606
|
+
declare const DEFAULT_STYLE_CLASS_PREFIX = "e-default-";
|
|
607
|
+
declare function parseDefaultStyleTagFromClassList(classList: DOMTokenList): string | null;
|
|
608
|
+
declare function getDefaultStyleTagFromPreviewElement(elementId: string): string | null;
|
|
609
|
+
|
|
591
610
|
declare const updateElementInteractions: ({ elementId, interactions, }: {
|
|
592
611
|
elementId: string;
|
|
593
612
|
interactions: V1ElementModelProps["interactions"];
|
|
594
613
|
}) => void;
|
|
595
614
|
declare const playElementInteractions: (elementId: string, interactionId: string) => void;
|
|
596
615
|
|
|
597
|
-
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, 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 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, getElementChildren as getElementChildrenWithFallback, getElementEditorSettings, getElementIcon, getElementInteractions, getElementLabel, getElementSetting, getElementSettings, getElementStyles, getElementTitle, getElementType, getElements, getLinkInLinkRestriction, getSelectedElements, getWidgetsCache, isElementAnchored, moveElement, moveElements, playElementInteractions, reconcileInitialChildren, removeElements, removeModelFromParent, replaceElement, resolveContainer, resolveInsertIndex, selectElement, shouldCreateNewLocalStyle, styleRerenderEvents, updateElementEditorSettings, updateElementInteractions, updateElementSettings, updateElementStyle, useElementChildren, useElementEditorSettings, useParentElement, useSelectedElement, useSelectedElementSettings };
|
|
616
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
DEFAULT_STYLE_CLASS_PREFIX: () => DEFAULT_STYLE_CLASS_PREFIX,
|
|
23
24
|
ELEMENT_STYLE_CHANGE_EVENT: () => ELEMENT_STYLE_CHANGE_EVENT,
|
|
24
25
|
addModelToParent: () => addModelToParent,
|
|
25
26
|
bindSettingsReconcile: () => bindSettingsReconcile,
|
|
@@ -41,6 +42,7 @@ __export(index_exports, {
|
|
|
41
42
|
getContainer: () => getContainer,
|
|
42
43
|
getCurrentDocumentContainer: () => getCurrentDocumentContainer,
|
|
43
44
|
getCurrentDocumentId: () => getCurrentDocumentId,
|
|
45
|
+
getDefaultStyleTagFromPreviewElement: () => getDefaultStyleTagFromPreviewElement,
|
|
44
46
|
getElementChildrenWithFallback: () => getElementChildren,
|
|
45
47
|
getElementEditorSettings: () => getElementEditorSettings,
|
|
46
48
|
getElementIcon: () => getElementIcon,
|
|
@@ -53,11 +55,13 @@ __export(index_exports, {
|
|
|
53
55
|
getElementType: () => getElementType,
|
|
54
56
|
getElements: () => getElements,
|
|
55
57
|
getLinkInLinkRestriction: () => getLinkInLinkRestriction,
|
|
58
|
+
getPreviewElementDOM: () => getPreviewElementDOM,
|
|
56
59
|
getSelectedElements: () => getSelectedElements,
|
|
57
60
|
getWidgetsCache: () => getWidgetsCache,
|
|
58
61
|
isElementAnchored: () => isElementAnchored,
|
|
59
62
|
moveElement: () => moveElement,
|
|
60
63
|
moveElements: () => moveElements,
|
|
64
|
+
parseDefaultStyleTagFromClassList: () => parseDefaultStyleTagFromClassList,
|
|
61
65
|
playElementInteractions: () => playElementInteractions,
|
|
62
66
|
reconcileInitialChildren: () => reconcileInitialChildren,
|
|
63
67
|
removeElements: () => removeElements,
|
|
@@ -365,7 +369,7 @@ function toElementModel({ model }) {
|
|
|
365
369
|
editorSettings: model.get("editor_settings") ?? {}
|
|
366
370
|
};
|
|
367
371
|
}
|
|
368
|
-
function useElementChildren(elementId, childrenTypes) {
|
|
372
|
+
function useElementChildren(elementId, childrenTypes, { includeSelfAsParent = false } = {}) {
|
|
369
373
|
return (0, import_editor_v1_adapters2.__privateUseListenTo)(
|
|
370
374
|
[
|
|
371
375
|
(0, import_editor_v1_adapters2.v1ReadyEvent)(),
|
|
@@ -381,7 +385,7 @@ function useElementChildren(elementId, childrenTypes) {
|
|
|
381
385
|
return {};
|
|
382
386
|
}
|
|
383
387
|
const elementChildren = Object.entries(childrenTypes).reduce((acc, [parentType, childType]) => {
|
|
384
|
-
const parent = findChildRecursive(model, (m) => m.get("elType") === parentType);
|
|
388
|
+
const parent = includeSelfAsParent && model.get("elType") === parentType ? { model } : findChildRecursive(model, (m) => m.get("elType") === parentType);
|
|
385
389
|
if (!parent) {
|
|
386
390
|
acc[childType] = [];
|
|
387
391
|
return acc;
|
|
@@ -769,6 +773,26 @@ var duplicateElements = ({
|
|
|
769
773
|
return undoableDuplicate({ elementIds });
|
|
770
774
|
};
|
|
771
775
|
|
|
776
|
+
// src/sync/get-preview-element-dom.ts
|
|
777
|
+
function getPreviewElementDOM(id) {
|
|
778
|
+
try {
|
|
779
|
+
const fromContainer = getContainer(id)?.view?.el;
|
|
780
|
+
if (fromContainer) {
|
|
781
|
+
return fromContainer;
|
|
782
|
+
}
|
|
783
|
+
return queryPreviewDOMByElementId(id);
|
|
784
|
+
} catch {
|
|
785
|
+
return null;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
function queryPreviewDOMByElementId(id) {
|
|
789
|
+
const previewDocument = window.elementor?.getPreviewContainer?.()?.view?.el?.ownerDocument;
|
|
790
|
+
if (!previewDocument) {
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
793
|
+
return previewDocument.querySelector(`[data-id="${id}"]`);
|
|
794
|
+
}
|
|
795
|
+
|
|
772
796
|
// src/sync/get-current-document-container.ts
|
|
773
797
|
function getCurrentDocumentContainer() {
|
|
774
798
|
const extendedWindow = window;
|
|
@@ -1290,22 +1314,7 @@ function checkForInlineLink(elementId, resolvedValue) {
|
|
|
1290
1314
|
return element.querySelector(ANCHOR_SELECTOR) !== null;
|
|
1291
1315
|
}
|
|
1292
1316
|
function getElementDOM(id) {
|
|
1293
|
-
|
|
1294
|
-
const fromContainer = getContainer(id)?.view?.el;
|
|
1295
|
-
if (fromContainer) {
|
|
1296
|
-
return fromContainer;
|
|
1297
|
-
}
|
|
1298
|
-
return queryPreviewDOMByElementId(id);
|
|
1299
|
-
} catch {
|
|
1300
|
-
return null;
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
function queryPreviewDOMByElementId(id) {
|
|
1304
|
-
const previewDocument = window.elementor?.getPreviewContainer?.()?.view?.el?.ownerDocument;
|
|
1305
|
-
if (!previewDocument) {
|
|
1306
|
-
return null;
|
|
1307
|
-
}
|
|
1308
|
-
return previewDocument.querySelector(`[data-id="${id}"]`);
|
|
1317
|
+
return getPreviewElementDOM(id);
|
|
1309
1318
|
}
|
|
1310
1319
|
function isElementorElement(element) {
|
|
1311
1320
|
return element.hasAttribute("data-id");
|
|
@@ -1475,6 +1484,48 @@ function getElementInteractions(elementId) {
|
|
|
1475
1484
|
return interactions;
|
|
1476
1485
|
}
|
|
1477
1486
|
|
|
1487
|
+
// src/utils/get-default-style-tag-from-preview.ts
|
|
1488
|
+
var DEFAULT_STYLE_CLASS_PREFIX = "e-default-";
|
|
1489
|
+
function parseDefaultStyleTagFromClassList(classList) {
|
|
1490
|
+
for (const className of classList) {
|
|
1491
|
+
if (className.startsWith(DEFAULT_STYLE_CLASS_PREFIX)) {
|
|
1492
|
+
return className.slice(DEFAULT_STYLE_CLASS_PREFIX.length);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
return null;
|
|
1496
|
+
}
|
|
1497
|
+
function getDefaultStyleTagFromPreviewElement(elementId) {
|
|
1498
|
+
const renderRoot = getAtomicElementRenderRoot(elementId);
|
|
1499
|
+
if (!renderRoot) {
|
|
1500
|
+
return null;
|
|
1501
|
+
}
|
|
1502
|
+
return parseDefaultStyleTagFromClassList(renderRoot.classList);
|
|
1503
|
+
}
|
|
1504
|
+
function getAtomicElementRenderRoot(elementId) {
|
|
1505
|
+
const view = getContainerView(elementId);
|
|
1506
|
+
if (view?.getDomElement) {
|
|
1507
|
+
const domElement = view.getDomElement().get?.(0);
|
|
1508
|
+
if (domElement) {
|
|
1509
|
+
return domElement;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
const wrapper = view?.el ?? getPreviewElementDOM(elementId);
|
|
1513
|
+
if (!wrapper) {
|
|
1514
|
+
return null;
|
|
1515
|
+
}
|
|
1516
|
+
if (wrapper.hasAttribute("data-id")) {
|
|
1517
|
+
return wrapper;
|
|
1518
|
+
}
|
|
1519
|
+
const firstChild = wrapper.firstElementChild;
|
|
1520
|
+
if (firstChild instanceof HTMLElement) {
|
|
1521
|
+
return firstChild;
|
|
1522
|
+
}
|
|
1523
|
+
return wrapper;
|
|
1524
|
+
}
|
|
1525
|
+
function getContainerView(elementId) {
|
|
1526
|
+
return getContainer(elementId)?.view ?? null;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1478
1529
|
// src/sync/update-element-interactions.ts
|
|
1479
1530
|
var import_editor_v1_adapters19 = require("@elementor/editor-v1-adapters");
|
|
1480
1531
|
var updateElementInteractions = ({
|
|
@@ -1496,6 +1547,7 @@ var playElementInteractions = (elementId, interactionId) => {
|
|
|
1496
1547
|
};
|
|
1497
1548
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1498
1549
|
0 && (module.exports = {
|
|
1550
|
+
DEFAULT_STYLE_CLASS_PREFIX,
|
|
1499
1551
|
ELEMENT_STYLE_CHANGE_EVENT,
|
|
1500
1552
|
addModelToParent,
|
|
1501
1553
|
bindSettingsReconcile,
|
|
@@ -1517,6 +1569,7 @@ var playElementInteractions = (elementId, interactionId) => {
|
|
|
1517
1569
|
getContainer,
|
|
1518
1570
|
getCurrentDocumentContainer,
|
|
1519
1571
|
getCurrentDocumentId,
|
|
1572
|
+
getDefaultStyleTagFromPreviewElement,
|
|
1520
1573
|
getElementChildrenWithFallback,
|
|
1521
1574
|
getElementEditorSettings,
|
|
1522
1575
|
getElementIcon,
|
|
@@ -1529,11 +1582,13 @@ var playElementInteractions = (elementId, interactionId) => {
|
|
|
1529
1582
|
getElementType,
|
|
1530
1583
|
getElements,
|
|
1531
1584
|
getLinkInLinkRestriction,
|
|
1585
|
+
getPreviewElementDOM,
|
|
1532
1586
|
getSelectedElements,
|
|
1533
1587
|
getWidgetsCache,
|
|
1534
1588
|
isElementAnchored,
|
|
1535
1589
|
moveElement,
|
|
1536
1590
|
moveElements,
|
|
1591
|
+
parseDefaultStyleTagFromClassList,
|
|
1537
1592
|
playElementInteractions,
|
|
1538
1593
|
reconcileInitialChildren,
|
|
1539
1594
|
removeElements,
|