@elementor/editor-controls 3.35.0-380 → 3.35.0-382
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/inline-editor.tsx +11 -3
- package/src/controls/inline-editing-control.tsx +4 -23
package/dist/index.mjs
CHANGED
|
@@ -5932,12 +5932,7 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
|
|
|
5932
5932
|
|
|
5933
5933
|
// src/controls/inline-editing-control.tsx
|
|
5934
5934
|
import * as React102 from "react";
|
|
5935
|
-
import { useEffect as useEffect12, useState as useState20 } from "react";
|
|
5936
5935
|
import { htmlPropTypeUtil } from "@elementor/editor-props";
|
|
5937
|
-
import {
|
|
5938
|
-
__privateListenTo as listenTo,
|
|
5939
|
-
commandEndEvent
|
|
5940
|
-
} from "@elementor/editor-v1-adapters";
|
|
5941
5936
|
import { Box as Box23 } from "@elementor/ui";
|
|
5942
5937
|
|
|
5943
5938
|
// src/components/inline-editor.tsx
|
|
@@ -6237,6 +6232,7 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6237
6232
|
};
|
|
6238
6233
|
|
|
6239
6234
|
// src/components/inline-editor.tsx
|
|
6235
|
+
var INITIAL_STYLE = "margin:0;padding:0;";
|
|
6240
6236
|
var useOnUpdate = (callback, dependencies) => {
|
|
6241
6237
|
const hasMounted = useRef26(false);
|
|
6242
6238
|
useEffect11(() => {
|
|
@@ -6278,6 +6274,7 @@ var InlineEditor = forwardRef10(
|
|
|
6278
6274
|
value,
|
|
6279
6275
|
setValue,
|
|
6280
6276
|
attributes = {},
|
|
6277
|
+
elementClasses = "",
|
|
6281
6278
|
showToolbar = false,
|
|
6282
6279
|
autofocus = false,
|
|
6283
6280
|
sx = {},
|
|
@@ -6323,16 +6320,20 @@ var InlineEditor = forwardRef10(
|
|
|
6323
6320
|
Paragraph.extend({
|
|
6324
6321
|
renderHTML({ HTMLAttributes }) {
|
|
6325
6322
|
const tag = expectedTag ?? "p";
|
|
6326
|
-
return [tag, { ...HTMLAttributes, style:
|
|
6323
|
+
return [tag, { ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses }, 0];
|
|
6327
6324
|
}
|
|
6328
6325
|
}),
|
|
6329
6326
|
Heading.extend({
|
|
6330
6327
|
renderHTML({ node, HTMLAttributes }) {
|
|
6331
6328
|
if (expectedTag) {
|
|
6332
|
-
return [
|
|
6329
|
+
return [
|
|
6330
|
+
expectedTag,
|
|
6331
|
+
{ ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses },
|
|
6332
|
+
0
|
|
6333
|
+
];
|
|
6333
6334
|
}
|
|
6334
6335
|
const level = this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0];
|
|
6335
|
-
return [`h${level}`, { ...HTMLAttributes, style:
|
|
6336
|
+
return [`h${level}`, { ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses }, 0];
|
|
6336
6337
|
}
|
|
6337
6338
|
}).configure({
|
|
6338
6339
|
levels: [1, 2, 3, 4, 5, 6]
|
|
@@ -6419,18 +6420,8 @@ var InlineEditingControl = createControl(
|
|
|
6419
6420
|
attributes,
|
|
6420
6421
|
props
|
|
6421
6422
|
}) => {
|
|
6422
|
-
const { value, setValue
|
|
6423
|
-
const [actualValue, setActualValue] = useState20(value);
|
|
6423
|
+
const { value, setValue } = useBoundProp(htmlPropTypeUtil);
|
|
6424
6424
|
const handleChange = (newValue) => setValue(newValue);
|
|
6425
|
-
useEffect12(() => {
|
|
6426
|
-
return listenTo(commandEndEvent("document/elements/settings"), (e) => {
|
|
6427
|
-
const { args, type } = e;
|
|
6428
|
-
const settingValue = args?.settings?.[bind]?.value ?? null;
|
|
6429
|
-
if (type !== "command" || settingValue !== actualValue) {
|
|
6430
|
-
setActualValue(settingValue);
|
|
6431
|
-
}
|
|
6432
|
-
});
|
|
6433
|
-
}, []);
|
|
6434
6425
|
return /* @__PURE__ */ React102.createElement(ControlActions, null, /* @__PURE__ */ React102.createElement(
|
|
6435
6426
|
Box23,
|
|
6436
6427
|
{
|
|
@@ -6465,7 +6456,7 @@ var InlineEditingControl = createControl(
|
|
|
6465
6456
|
...attributes,
|
|
6466
6457
|
...props
|
|
6467
6458
|
},
|
|
6468
|
-
/* @__PURE__ */ React102.createElement(InlineEditor, { value:
|
|
6459
|
+
/* @__PURE__ */ React102.createElement(InlineEditor, { value: value || "", setValue: handleChange })
|
|
6469
6460
|
));
|
|
6470
6461
|
}
|
|
6471
6462
|
);
|
|
@@ -6482,7 +6473,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
|
|
|
6482
6473
|
|
|
6483
6474
|
// src/components/repeater/repeater.tsx
|
|
6484
6475
|
import * as React104 from "react";
|
|
6485
|
-
import { useEffect as
|
|
6476
|
+
import { useEffect as useEffect12, useState as useState20 } from "react";
|
|
6486
6477
|
import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon3, XIcon as XIcon4 } from "@elementor/icons";
|
|
6487
6478
|
import {
|
|
6488
6479
|
bindPopover as bindPopover9,
|
|
@@ -6511,7 +6502,7 @@ var Repeater3 = ({
|
|
|
6511
6502
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6512
6503
|
isSortable = true
|
|
6513
6504
|
}) => {
|
|
6514
|
-
const [openItem, setOpenItem] =
|
|
6505
|
+
const [openItem, setOpenItem] = useState20(initialOpenItem);
|
|
6515
6506
|
const uniqueKeys = items2.map(
|
|
6516
6507
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6517
6508
|
);
|
|
@@ -6667,10 +6658,10 @@ var RepeaterItem = ({
|
|
|
6667
6658
|
), /* @__PURE__ */ React104.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React104.createElement(Box24, null, children({ anchorEl: ref }))));
|
|
6668
6659
|
};
|
|
6669
6660
|
var usePopover = (openOnMount, onOpen) => {
|
|
6670
|
-
const [ref, setRef] =
|
|
6661
|
+
const [ref, setRef] = useState20(null);
|
|
6671
6662
|
const popoverState = usePopupState10({ variant: "popover" });
|
|
6672
6663
|
const popoverProps = bindPopover9(popoverState);
|
|
6673
|
-
|
|
6664
|
+
useEffect12(() => {
|
|
6674
6665
|
if (openOnMount && ref) {
|
|
6675
6666
|
popoverState.open(ref);
|
|
6676
6667
|
onOpen?.();
|