@elementor/editor-components 3.35.0-401 → 3.35.0-403
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 +45 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/components-tab/component-introduction.tsx +13 -4
- package/src/create-component-type.ts +1 -1
- package/src/utils/switch-to-component.ts +46 -2
package/dist/index.mjs
CHANGED
|
@@ -339,15 +339,44 @@ import { __useSelector as useSelector2 } from "@elementor/store";
|
|
|
339
339
|
|
|
340
340
|
// src/utils/switch-to-component.ts
|
|
341
341
|
import { __privateRunCommand as runCommand } from "@elementor/editor-v1-adapters";
|
|
342
|
-
function switchToComponent(componentId, componentInstanceId) {
|
|
342
|
+
function switchToComponent(componentId, componentInstanceId, element) {
|
|
343
|
+
const selector = getSelector(element, componentInstanceId);
|
|
343
344
|
runCommand("editor/documents/switch", {
|
|
344
345
|
id: componentId,
|
|
345
|
-
selector
|
|
346
|
+
selector,
|
|
346
347
|
mode: "autosave",
|
|
347
348
|
setAsInitial: false,
|
|
348
349
|
shouldScroll: false
|
|
349
350
|
});
|
|
350
351
|
}
|
|
352
|
+
function getSelector(element, componentInstanceId) {
|
|
353
|
+
if (element) {
|
|
354
|
+
return buildUniqueSelector(element);
|
|
355
|
+
}
|
|
356
|
+
if (componentInstanceId) {
|
|
357
|
+
return `[data-id="${componentInstanceId}"]`;
|
|
358
|
+
}
|
|
359
|
+
return void 0;
|
|
360
|
+
}
|
|
361
|
+
function buildUniqueSelector(element) {
|
|
362
|
+
const selectors = [];
|
|
363
|
+
let current = element.closest("[data-id]");
|
|
364
|
+
while (current) {
|
|
365
|
+
const dataId = current.dataset.id;
|
|
366
|
+
const isComponentInstance2 = current.hasAttribute("data-elementor-id");
|
|
367
|
+
if (isComponentInstance2) {
|
|
368
|
+
selectors.unshift(`[data-id="${dataId}"]`);
|
|
369
|
+
}
|
|
370
|
+
current = current.parentElement?.closest("[data-id]") ?? null;
|
|
371
|
+
}
|
|
372
|
+
if (selectors.length === 0) {
|
|
373
|
+
const closestElement = element.closest("[data-id]");
|
|
374
|
+
if (closestElement?.dataset?.id) {
|
|
375
|
+
return `[data-id="${closestElement.dataset.id}"]`;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return selectors.join(" ");
|
|
379
|
+
}
|
|
351
380
|
|
|
352
381
|
// src/hooks/use-navigate-back.ts
|
|
353
382
|
function useNavigateBack() {
|
|
@@ -732,14 +761,14 @@ function useOverridableProps2(componentId) {
|
|
|
732
761
|
import * as React2 from "react";
|
|
733
762
|
import { useState } from "react";
|
|
734
763
|
import { ComponentPropListIcon } from "@elementor/icons";
|
|
735
|
-
import { Link, Stack as Stack2, Typography as Typography2 } from "@elementor/ui";
|
|
764
|
+
import { Link as Link2, Stack as Stack2, Typography as Typography2 } from "@elementor/ui";
|
|
736
765
|
import { __ as __3 } from "@wordpress/i18n";
|
|
737
766
|
|
|
738
767
|
// src/components/components-tab/component-introduction.tsx
|
|
739
768
|
import * as React from "react";
|
|
740
769
|
import { PopoverContent } from "@elementor/editor-controls";
|
|
741
770
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
742
|
-
import { Box, Button, Image, Popover, Stack, Typography } from "@elementor/ui";
|
|
771
|
+
import { Box, Button, Image, Link, Popover, Stack, Typography } from "@elementor/ui";
|
|
743
772
|
import { __ as __2 } from "@wordpress/i18n";
|
|
744
773
|
var ComponentIntroduction = ({
|
|
745
774
|
anchorRef,
|
|
@@ -771,13 +800,23 @@ var ComponentIntroduction = ({
|
|
|
771
800
|
src: "https://assets.elementor.com/packages/v1/images/components-properties-intro.png",
|
|
772
801
|
alt: ""
|
|
773
802
|
}
|
|
774
|
-
), /* @__PURE__ */ React.createElement(PopoverContent, null, /* @__PURE__ */ React.createElement(Stack, {
|
|
803
|
+
), /* @__PURE__ */ React.createElement(PopoverContent, null, /* @__PURE__ */ React.createElement(Stack, { sx: { p: 2 } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, __2("Properties make instances flexible.", "elementor")), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, __2(
|
|
775
804
|
"Click next to any setting you want users to customize - like text, images, or links.",
|
|
776
805
|
"elementor"
|
|
777
|
-
)), /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, __2(
|
|
806
|
+
)), /* @__PURE__ */ React.createElement(Typography, { variant: "body2", sx: { mt: 2 } }, __2(
|
|
778
807
|
"Your properties will appear in the Properties panel, where you can organize and manage them anytime.",
|
|
779
808
|
"elementor"
|
|
780
|
-
)), /* @__PURE__ */ React.createElement(
|
|
809
|
+
)), /* @__PURE__ */ React.createElement(
|
|
810
|
+
Link,
|
|
811
|
+
{
|
|
812
|
+
href: "http://go.elementor.com/components-guide",
|
|
813
|
+
target: "_blank",
|
|
814
|
+
sx: { mt: 2 },
|
|
815
|
+
color: "info.main",
|
|
816
|
+
variant: "body2"
|
|
817
|
+
},
|
|
818
|
+
__2("Learn more", "elementor")
|
|
819
|
+
), /* @__PURE__ */ React.createElement(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", sx: { pt: 1 } }, /* @__PURE__ */ React.createElement(Button, { size: "medium", variant: "contained", onClick: onClose }, __2("Got it", "elementor"))))))
|
|
781
820
|
);
|
|
782
821
|
};
|
|
783
822
|
|
|
@@ -799,7 +838,7 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
799
838
|
/* @__PURE__ */ React2.createElement(Typography2, { align: "center", variant: "caption" }, __3("Make instances flexible while keeping design synced.", "elementor")),
|
|
800
839
|
/* @__PURE__ */ React2.createElement(Typography2, { align: "center", variant: "caption" }, __3("Select any element, then click + next to a setting to expose it.", "elementor")),
|
|
801
840
|
/* @__PURE__ */ React2.createElement(
|
|
802
|
-
|
|
841
|
+
Link2,
|
|
803
842
|
{
|
|
804
843
|
variant: "caption",
|
|
805
844
|
color: "secondary",
|
|
@@ -1596,7 +1635,7 @@ var ComponentSearch = () => {
|
|
|
1596
1635
|
// src/components/components-tab/components-list.tsx
|
|
1597
1636
|
import * as React15 from "react";
|
|
1598
1637
|
import { ComponentsIcon as ComponentsIcon2, EyeIcon } from "@elementor/icons";
|
|
1599
|
-
import { Box as Box11, Divider as Divider3, Icon, Link as
|
|
1638
|
+
import { Box as Box11, Divider as Divider3, Icon, Link as Link3, List as List3, Stack as Stack10, Typography as Typography8 } from "@elementor/ui";
|
|
1600
1639
|
import { __ as __15 } from "@wordpress/i18n";
|
|
1601
1640
|
|
|
1602
1641
|
// src/hooks/use-components.ts
|
|
@@ -1786,7 +1825,7 @@ function createComponentView(options) {
|
|
|
1786
1825
|
if (!isAllowedToSwitchDocument) {
|
|
1787
1826
|
options.showLockedByModal?.(lockedBy || "");
|
|
1788
1827
|
} else {
|
|
1789
|
-
switchToComponent(this.getComponentId(), this.model.get("id"));
|
|
1828
|
+
switchToComponent(this.getComponentId(), this.model.get("id"), this.el);
|
|
1790
1829
|
}
|
|
1791
1830
|
}
|
|
1792
1831
|
editComponent({ trigger, location, secondaryLocation }) {
|
|
@@ -2245,7 +2284,7 @@ var EmptySearchResult = () => {
|
|
|
2245
2284
|
)
|
|
2246
2285
|
),
|
|
2247
2286
|
/* @__PURE__ */ React15.createElement(Typography8, { align: "center", variant: "caption", color: "inherit" }, __15("Try something else.", "elementor")),
|
|
2248
|
-
/* @__PURE__ */ React15.createElement(Typography8, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React15.createElement(
|
|
2287
|
+
/* @__PURE__ */ React15.createElement(Typography8, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React15.createElement(Link3, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, __15("Clear & try again", "elementor")))
|
|
2249
2288
|
);
|
|
2250
2289
|
};
|
|
2251
2290
|
var useFilteredComponents = () => {
|