@elementor/editor-controls 3.35.0-375 → 3.35.0-377
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/inline-editor.tsx +23 -13
- package/src/controls/inline-editing-control.tsx +24 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import { RefObject, ReactNode, FC, PropsWithChildren, ReactElement, ComponentType } from 'react';
|
|
2
|
+
import { RefObject, ReactNode, FC, PropsWithChildren, ComponentProps, ReactElement, ComponentType } from 'react';
|
|
3
3
|
import { SxProps, SelectProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, PopupState, Theme, FormLabelProps, Grid } from '@elementor/ui';
|
|
4
4
|
import { StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, LinkPropValue, TransformablePropValue, PropType, CreateOptions } from '@elementor/editor-props';
|
|
5
5
|
import { StyleDefinitionState } from '@elementor/editor-styles';
|
|
@@ -380,7 +380,7 @@ declare const DateTimeControl: ControlComponent$1<({ inputDisabled }: {
|
|
|
380
380
|
declare const InlineEditingControl: ControlComponent$1<({ sx, attributes, props, }: {
|
|
381
381
|
sx?: SxProps<Theme>;
|
|
382
382
|
attributes?: Record<string, string>;
|
|
383
|
-
props?:
|
|
383
|
+
props?: ComponentProps<"div">;
|
|
384
384
|
}) => React$1.JSX.Element>;
|
|
385
385
|
|
|
386
386
|
declare const ControlFormLabel: (props: FormLabelProps) => React$1.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import { RefObject, ReactNode, FC, PropsWithChildren, ReactElement, ComponentType } from 'react';
|
|
2
|
+
import { RefObject, ReactNode, FC, PropsWithChildren, ComponentProps, ReactElement, ComponentType } from 'react';
|
|
3
3
|
import { SxProps, SelectProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, PopupState, Theme, FormLabelProps, Grid } from '@elementor/ui';
|
|
4
4
|
import { StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, LinkPropValue, TransformablePropValue, PropType, CreateOptions } from '@elementor/editor-props';
|
|
5
5
|
import { StyleDefinitionState } from '@elementor/editor-styles';
|
|
@@ -380,7 +380,7 @@ declare const DateTimeControl: ControlComponent$1<({ inputDisabled }: {
|
|
|
380
380
|
declare const InlineEditingControl: ControlComponent$1<({ sx, attributes, props, }: {
|
|
381
381
|
sx?: SxProps<Theme>;
|
|
382
382
|
attributes?: Record<string, string>;
|
|
383
|
-
props?:
|
|
383
|
+
props?: ComponentProps<"div">;
|
|
384
384
|
}) => React$1.JSX.Element>;
|
|
385
385
|
|
|
386
386
|
declare const ControlFormLabel: (props: FormLabelProps) => React$1.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -5938,7 +5938,9 @@ 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");
|
|
5941
5942
|
var import_editor_props52 = require("@elementor/editor-props");
|
|
5943
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
5942
5944
|
var import_ui88 = require("@elementor/ui");
|
|
5943
5945
|
|
|
5944
5946
|
// src/components/inline-editor.tsx
|
|
@@ -6252,7 +6254,7 @@ var Wrapper = ({ children, containerRef, editor, sx, onBlur }) => {
|
|
|
6252
6254
|
wrappedChildren
|
|
6253
6255
|
) : /* @__PURE__ */ React101.createElement(React101.Fragment, null, wrappedChildren);
|
|
6254
6256
|
};
|
|
6255
|
-
var InlineEditor =
|
|
6257
|
+
var InlineEditor = (0, import_react55.forwardRef)(
|
|
6256
6258
|
({
|
|
6257
6259
|
value,
|
|
6258
6260
|
setValue,
|
|
@@ -6264,11 +6266,11 @@ var InlineEditor = React101.forwardRef(
|
|
|
6264
6266
|
getInitialPopoverPosition = void 0,
|
|
6265
6267
|
expectedTag = null
|
|
6266
6268
|
}, ref) => {
|
|
6267
|
-
const containerRef =
|
|
6269
|
+
const containerRef = (0, import_react55.useRef)(null);
|
|
6268
6270
|
const popupState = (0, import_ui87.usePopupState)({ variant: "popover", disableAutoFocus: true });
|
|
6269
|
-
const [hasSelectedContent, setHasSelectedContent] =
|
|
6271
|
+
const [hasSelectedContent, setHasSelectedContent] = (0, import_react55.useState)(false);
|
|
6270
6272
|
const documentContentSettings = !!expectedTag ? "block+" : "inline*";
|
|
6271
|
-
const [selectionRect, setSelectionRect] =
|
|
6273
|
+
const [selectionRect, setSelectionRect] = (0, import_react55.useState)(null);
|
|
6272
6274
|
const onSelectionEnd = (view) => {
|
|
6273
6275
|
const hasSelection = !view.state.selection.empty;
|
|
6274
6276
|
setHasSelectedContent(hasSelection);
|
|
@@ -6290,6 +6292,10 @@ var InlineEditor = React101.forwardRef(
|
|
|
6290
6292
|
keyup: onSelectionEnd,
|
|
6291
6293
|
keydown: onKeyDown
|
|
6292
6294
|
} : void 0;
|
|
6295
|
+
const onUpdate = ({ editor: updatedEditor }) => {
|
|
6296
|
+
const newValue = updatedEditor.getHTML();
|
|
6297
|
+
setValue(isEmpty(newValue) ? null : newValue);
|
|
6298
|
+
};
|
|
6293
6299
|
const editor = (0, import_react56.useEditor)({
|
|
6294
6300
|
extensions: [
|
|
6295
6301
|
import_extension_document.default.extend({
|
|
@@ -6331,10 +6337,7 @@ var InlineEditor = React101.forwardRef(
|
|
|
6331
6337
|
})
|
|
6332
6338
|
],
|
|
6333
6339
|
content: value,
|
|
6334
|
-
onUpdate
|
|
6335
|
-
const newValue = updatedEditor.getHTML();
|
|
6336
|
-
setValue(isEmpty(newValue) ? null : newValue);
|
|
6337
|
-
},
|
|
6340
|
+
onUpdate,
|
|
6338
6341
|
autofocus,
|
|
6339
6342
|
editorProps: {
|
|
6340
6343
|
attributes: {
|
|
@@ -6397,8 +6400,18 @@ var InlineEditingControl = createControl(
|
|
|
6397
6400
|
attributes,
|
|
6398
6401
|
props
|
|
6399
6402
|
}) => {
|
|
6400
|
-
const { value, setValue } = useBoundProp(import_editor_props52.htmlPropTypeUtil);
|
|
6403
|
+
const { value, setValue, bind } = useBoundProp(import_editor_props52.htmlPropTypeUtil);
|
|
6404
|
+
const [actualValue, setActualValue] = (0, import_react57.useState)(value);
|
|
6401
6405
|
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
|
+
}, []);
|
|
6402
6415
|
return /* @__PURE__ */ React102.createElement(ControlActions, null, /* @__PURE__ */ React102.createElement(
|
|
6403
6416
|
import_ui88.Box,
|
|
6404
6417
|
{
|
|
@@ -6433,7 +6446,7 @@ var InlineEditingControl = createControl(
|
|
|
6433
6446
|
...attributes,
|
|
6434
6447
|
...props
|
|
6435
6448
|
},
|
|
6436
|
-
/* @__PURE__ */ React102.createElement(InlineEditor, { value:
|
|
6449
|
+
/* @__PURE__ */ React102.createElement(InlineEditor, { value: actualValue || "", setValue: handleChange })
|
|
6437
6450
|
));
|
|
6438
6451
|
}
|
|
6439
6452
|
);
|
|
@@ -6450,7 +6463,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
|
|
|
6450
6463
|
|
|
6451
6464
|
// src/components/repeater/repeater.tsx
|
|
6452
6465
|
var React104 = __toESM(require("react"));
|
|
6453
|
-
var
|
|
6466
|
+
var import_react58 = require("react");
|
|
6454
6467
|
var import_icons36 = require("@elementor/icons");
|
|
6455
6468
|
var import_ui90 = require("@elementor/ui");
|
|
6456
6469
|
var import_i18n52 = require("@wordpress/i18n");
|
|
@@ -6471,7 +6484,7 @@ var Repeater3 = ({
|
|
|
6471
6484
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6472
6485
|
isSortable = true
|
|
6473
6486
|
}) => {
|
|
6474
|
-
const [openItem, setOpenItem] = (0,
|
|
6487
|
+
const [openItem, setOpenItem] = (0, import_react58.useState)(initialOpenItem);
|
|
6475
6488
|
const uniqueKeys = items2.map(
|
|
6476
6489
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6477
6490
|
);
|
|
@@ -6627,10 +6640,10 @@ var RepeaterItem = ({
|
|
|
6627
6640
|
), /* @__PURE__ */ React104.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React104.createElement(import_ui90.Box, null, children({ anchorEl: ref }))));
|
|
6628
6641
|
};
|
|
6629
6642
|
var usePopover = (openOnMount, onOpen) => {
|
|
6630
|
-
const [ref, setRef] = (0,
|
|
6643
|
+
const [ref, setRef] = (0, import_react58.useState)(null);
|
|
6631
6644
|
const popoverState = (0, import_ui90.usePopupState)({ variant: "popover" });
|
|
6632
6645
|
const popoverProps = (0, import_ui90.bindPopover)(popoverState);
|
|
6633
|
-
(0,
|
|
6646
|
+
(0, import_react58.useEffect)(() => {
|
|
6634
6647
|
if (openOnMount && ref) {
|
|
6635
6648
|
popoverState.open(ref);
|
|
6636
6649
|
onOpen?.();
|