@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.d.mts
CHANGED
|
@@ -555,6 +555,7 @@ type InlineEditorProps = {
|
|
|
555
555
|
value: string | null;
|
|
556
556
|
setValue: (value: string | null) => void;
|
|
557
557
|
attributes?: Record<string, string>;
|
|
558
|
+
elementClasses?: string;
|
|
558
559
|
sx?: SxProps<Theme>;
|
|
559
560
|
onBlur?: (event: Event) => void;
|
|
560
561
|
showToolbar?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -555,6 +555,7 @@ type InlineEditorProps = {
|
|
|
555
555
|
value: string | null;
|
|
556
556
|
setValue: (value: string | null) => void;
|
|
557
557
|
attributes?: Record<string, string>;
|
|
558
|
+
elementClasses?: string;
|
|
558
559
|
sx?: SxProps<Theme>;
|
|
559
560
|
onBlur?: (event: Event) => void;
|
|
560
561
|
showToolbar?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -5938,9 +5938,7 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
|
|
|
5938
5938
|
|
|
5939
5939
|
// src/controls/inline-editing-control.tsx
|
|
5940
5940
|
var React102 = __toESM(require("react"));
|
|
5941
|
-
var import_react57 = require("react");
|
|
5942
5941
|
var import_editor_props52 = require("@elementor/editor-props");
|
|
5943
|
-
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
5944
5942
|
var import_ui88 = require("@elementor/ui");
|
|
5945
5943
|
|
|
5946
5944
|
// src/components/inline-editor.tsx
|
|
@@ -6218,6 +6216,7 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6218
6216
|
};
|
|
6219
6217
|
|
|
6220
6218
|
// src/components/inline-editor.tsx
|
|
6219
|
+
var INITIAL_STYLE = "margin:0;padding:0;";
|
|
6221
6220
|
var useOnUpdate = (callback, dependencies) => {
|
|
6222
6221
|
const hasMounted = (0, import_react55.useRef)(false);
|
|
6223
6222
|
(0, import_react55.useEffect)(() => {
|
|
@@ -6259,6 +6258,7 @@ var InlineEditor = (0, import_react55.forwardRef)(
|
|
|
6259
6258
|
value,
|
|
6260
6259
|
setValue,
|
|
6261
6260
|
attributes = {},
|
|
6261
|
+
elementClasses = "",
|
|
6262
6262
|
showToolbar = false,
|
|
6263
6263
|
autofocus = false,
|
|
6264
6264
|
sx = {},
|
|
@@ -6304,16 +6304,20 @@ var InlineEditor = (0, import_react55.forwardRef)(
|
|
|
6304
6304
|
import_extension_paragraph.default.extend({
|
|
6305
6305
|
renderHTML({ HTMLAttributes }) {
|
|
6306
6306
|
const tag = expectedTag ?? "p";
|
|
6307
|
-
return [tag, { ...HTMLAttributes, style:
|
|
6307
|
+
return [tag, { ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses }, 0];
|
|
6308
6308
|
}
|
|
6309
6309
|
}),
|
|
6310
6310
|
import_extension_heading.default.extend({
|
|
6311
6311
|
renderHTML({ node, HTMLAttributes }) {
|
|
6312
6312
|
if (expectedTag) {
|
|
6313
|
-
return [
|
|
6313
|
+
return [
|
|
6314
|
+
expectedTag,
|
|
6315
|
+
{ ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses },
|
|
6316
|
+
0
|
|
6317
|
+
];
|
|
6314
6318
|
}
|
|
6315
6319
|
const level = this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0];
|
|
6316
|
-
return [`h${level}`, { ...HTMLAttributes, style:
|
|
6320
|
+
return [`h${level}`, { ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses }, 0];
|
|
6317
6321
|
}
|
|
6318
6322
|
}).configure({
|
|
6319
6323
|
levels: [1, 2, 3, 4, 5, 6]
|
|
@@ -6400,18 +6404,8 @@ var InlineEditingControl = createControl(
|
|
|
6400
6404
|
attributes,
|
|
6401
6405
|
props
|
|
6402
6406
|
}) => {
|
|
6403
|
-
const { value, setValue
|
|
6404
|
-
const [actualValue, setActualValue] = (0, import_react57.useState)(value);
|
|
6407
|
+
const { value, setValue } = useBoundProp(import_editor_props52.htmlPropTypeUtil);
|
|
6405
6408
|
const handleChange = (newValue) => setValue(newValue);
|
|
6406
|
-
(0, import_react57.useEffect)(() => {
|
|
6407
|
-
return (0, import_editor_v1_adapters.__privateListenTo)((0, import_editor_v1_adapters.commandEndEvent)("document/elements/settings"), (e) => {
|
|
6408
|
-
const { args, type } = e;
|
|
6409
|
-
const settingValue = args?.settings?.[bind]?.value ?? null;
|
|
6410
|
-
if (type !== "command" || settingValue !== actualValue) {
|
|
6411
|
-
setActualValue(settingValue);
|
|
6412
|
-
}
|
|
6413
|
-
});
|
|
6414
|
-
}, []);
|
|
6415
6409
|
return /* @__PURE__ */ React102.createElement(ControlActions, null, /* @__PURE__ */ React102.createElement(
|
|
6416
6410
|
import_ui88.Box,
|
|
6417
6411
|
{
|
|
@@ -6446,7 +6440,7 @@ var InlineEditingControl = createControl(
|
|
|
6446
6440
|
...attributes,
|
|
6447
6441
|
...props
|
|
6448
6442
|
},
|
|
6449
|
-
/* @__PURE__ */ React102.createElement(InlineEditor, { value:
|
|
6443
|
+
/* @__PURE__ */ React102.createElement(InlineEditor, { value: value || "", setValue: handleChange })
|
|
6450
6444
|
));
|
|
6451
6445
|
}
|
|
6452
6446
|
);
|
|
@@ -6463,7 +6457,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
|
|
|
6463
6457
|
|
|
6464
6458
|
// src/components/repeater/repeater.tsx
|
|
6465
6459
|
var React104 = __toESM(require("react"));
|
|
6466
|
-
var
|
|
6460
|
+
var import_react57 = require("react");
|
|
6467
6461
|
var import_icons36 = require("@elementor/icons");
|
|
6468
6462
|
var import_ui90 = require("@elementor/ui");
|
|
6469
6463
|
var import_i18n52 = require("@wordpress/i18n");
|
|
@@ -6484,7 +6478,7 @@ var Repeater3 = ({
|
|
|
6484
6478
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6485
6479
|
isSortable = true
|
|
6486
6480
|
}) => {
|
|
6487
|
-
const [openItem, setOpenItem] = (0,
|
|
6481
|
+
const [openItem, setOpenItem] = (0, import_react57.useState)(initialOpenItem);
|
|
6488
6482
|
const uniqueKeys = items2.map(
|
|
6489
6483
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6490
6484
|
);
|
|
@@ -6640,10 +6634,10 @@ var RepeaterItem = ({
|
|
|
6640
6634
|
), /* @__PURE__ */ React104.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React104.createElement(import_ui90.Box, null, children({ anchorEl: ref }))));
|
|
6641
6635
|
};
|
|
6642
6636
|
var usePopover = (openOnMount, onOpen) => {
|
|
6643
|
-
const [ref, setRef] = (0,
|
|
6637
|
+
const [ref, setRef] = (0, import_react57.useState)(null);
|
|
6644
6638
|
const popoverState = (0, import_ui90.usePopupState)({ variant: "popover" });
|
|
6645
6639
|
const popoverProps = (0, import_ui90.bindPopover)(popoverState);
|
|
6646
|
-
(0,
|
|
6640
|
+
(0, import_react57.useEffect)(() => {
|
|
6647
6641
|
if (openOnMount && ref) {
|
|
6648
6642
|
popoverState.open(ref);
|
|
6649
6643
|
onOpen?.();
|