@elementor/editor-controls 4.0.0-552 → 4.0.0-564
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 +58 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/controls/chips-control.tsx +5 -3
- package/src/controls/inline-editing-control.tsx +37 -5
package/dist/index.js
CHANGED
|
@@ -2269,10 +2269,10 @@ var import_ui37 = require("@elementor/ui");
|
|
|
2269
2269
|
var SIZE6 = "tiny";
|
|
2270
2270
|
var ChipsControl = createControl(({ options }) => {
|
|
2271
2271
|
const { value, setValue, disabled } = useBoundProp(import_editor_props16.stringArrayPropTypeUtil);
|
|
2272
|
-
const selectedValues = value || [];
|
|
2272
|
+
const selectedValues = (value || []).map((item) => import_editor_props16.stringPropTypeUtil.extract(item)).filter((val) => val !== null);
|
|
2273
2273
|
const selectedOptions = selectedValues.map((val) => options.find((opt) => opt.value === val)).filter((opt) => opt !== void 0);
|
|
2274
2274
|
const handleChange = (_, newValue) => {
|
|
2275
|
-
const values = newValue.map((option) => option.value);
|
|
2275
|
+
const values = newValue.map((option) => import_editor_props16.stringPropTypeUtil.create(option.value));
|
|
2276
2276
|
setValue(values.length > 0 ? values : null);
|
|
2277
2277
|
};
|
|
2278
2278
|
return /* @__PURE__ */ React50.createElement(ControlActions, null, /* @__PURE__ */ React50.createElement(
|
|
@@ -6244,8 +6244,10 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
|
|
|
6244
6244
|
|
|
6245
6245
|
// src/controls/inline-editing-control.tsx
|
|
6246
6246
|
var React100 = __toESM(require("react"));
|
|
6247
|
+
var import_react54 = require("react");
|
|
6247
6248
|
var import_editor_props52 = require("@elementor/editor-props");
|
|
6248
6249
|
var import_ui86 = require("@elementor/ui");
|
|
6250
|
+
var import_utils7 = require("@elementor/utils");
|
|
6249
6251
|
|
|
6250
6252
|
// src/components/inline-editor.tsx
|
|
6251
6253
|
var React99 = __toESM(require("react"));
|
|
@@ -6418,14 +6420,37 @@ var useOnUpdate = (callback, dependencies) => {
|
|
|
6418
6420
|
};
|
|
6419
6421
|
|
|
6420
6422
|
// src/controls/inline-editing-control.tsx
|
|
6423
|
+
var CHILDREN_PARSE_DEBOUNCE_MS = 300;
|
|
6421
6424
|
var InlineEditingControl = createControl(
|
|
6422
6425
|
({
|
|
6423
6426
|
sx,
|
|
6424
6427
|
attributes,
|
|
6425
6428
|
props
|
|
6426
6429
|
}) => {
|
|
6427
|
-
const { value, setValue } = useBoundProp(import_editor_props52.
|
|
6428
|
-
const
|
|
6430
|
+
const { value, setValue } = useBoundProp(import_editor_props52.htmlV2PropTypeUtil);
|
|
6431
|
+
const content = value?.content ?? "";
|
|
6432
|
+
const debouncedParse = (0, import_react54.useMemo)(
|
|
6433
|
+
() => (0, import_utils7.debounce)((html) => {
|
|
6434
|
+
const parsed = (0, import_editor_props52.parseHtmlChildren)(html);
|
|
6435
|
+
setValue({
|
|
6436
|
+
content: parsed.content || null,
|
|
6437
|
+
children: parsed.children
|
|
6438
|
+
});
|
|
6439
|
+
}, CHILDREN_PARSE_DEBOUNCE_MS),
|
|
6440
|
+
[setValue]
|
|
6441
|
+
);
|
|
6442
|
+
const handleChange = (0, import_react54.useCallback)(
|
|
6443
|
+
(newValue) => {
|
|
6444
|
+
const html = newValue ?? "";
|
|
6445
|
+
setValue({
|
|
6446
|
+
content: html || null,
|
|
6447
|
+
children: value?.children ?? []
|
|
6448
|
+
});
|
|
6449
|
+
debouncedParse(html);
|
|
6450
|
+
},
|
|
6451
|
+
[setValue, value?.children, debouncedParse]
|
|
6452
|
+
);
|
|
6453
|
+
(0, import_react54.useEffect)(() => () => debouncedParse.cancel(), [debouncedParse]);
|
|
6429
6454
|
return /* @__PURE__ */ React100.createElement(ControlActions, null, /* @__PURE__ */ React100.createElement(
|
|
6430
6455
|
import_ui86.Box,
|
|
6431
6456
|
{
|
|
@@ -6464,32 +6489,32 @@ var InlineEditingControl = createControl(
|
|
|
6464
6489
|
...attributes,
|
|
6465
6490
|
...props
|
|
6466
6491
|
},
|
|
6467
|
-
/* @__PURE__ */ React100.createElement(InlineEditor, { value:
|
|
6492
|
+
/* @__PURE__ */ React100.createElement(InlineEditor, { value: content, setValue: handleChange })
|
|
6468
6493
|
));
|
|
6469
6494
|
}
|
|
6470
6495
|
);
|
|
6471
6496
|
|
|
6472
6497
|
// src/components/promotions/display-conditions-control.tsx
|
|
6473
6498
|
var React102 = __toESM(require("react"));
|
|
6474
|
-
var
|
|
6499
|
+
var import_react56 = require("react");
|
|
6475
6500
|
var import_icons33 = require("@elementor/icons");
|
|
6476
6501
|
var import_ui88 = require("@elementor/ui");
|
|
6477
6502
|
var import_i18n50 = require("@wordpress/i18n");
|
|
6478
6503
|
|
|
6479
6504
|
// src/components/promotions/promotion-trigger.tsx
|
|
6480
6505
|
var React101 = __toESM(require("react"));
|
|
6481
|
-
var
|
|
6506
|
+
var import_react55 = require("react");
|
|
6482
6507
|
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
6483
6508
|
var import_ui87 = require("@elementor/ui");
|
|
6484
6509
|
function getV4Promotion(key) {
|
|
6485
6510
|
return window.elementor?.config?.v4Promotions?.[key];
|
|
6486
6511
|
}
|
|
6487
|
-
var PromotionTrigger = (0,
|
|
6512
|
+
var PromotionTrigger = (0, import_react55.forwardRef)(
|
|
6488
6513
|
({ promotionKey, children }, ref) => {
|
|
6489
|
-
const [isOpen, setIsOpen] = (0,
|
|
6514
|
+
const [isOpen, setIsOpen] = (0, import_react55.useState)(false);
|
|
6490
6515
|
const promotion = getV4Promotion(promotionKey);
|
|
6491
6516
|
const toggle = () => setIsOpen((prev) => !prev);
|
|
6492
|
-
(0,
|
|
6517
|
+
(0, import_react55.useImperativeHandle)(ref, () => ({ toggle }), []);
|
|
6493
6518
|
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, promotion && /* @__PURE__ */ React101.createElement(
|
|
6494
6519
|
import_editor_ui13.PromotionInfotip,
|
|
6495
6520
|
{
|
|
@@ -6521,7 +6546,7 @@ var PromotionTrigger = (0, import_react54.forwardRef)(
|
|
|
6521
6546
|
// src/components/promotions/display-conditions-control.tsx
|
|
6522
6547
|
var ARIA_LABEL = (0, import_i18n50.__)("Display Conditions", "elementor");
|
|
6523
6548
|
var DisplayConditionsControl = createControl(() => {
|
|
6524
|
-
const triggerRef = (0,
|
|
6549
|
+
const triggerRef = (0, import_react56.useRef)(null);
|
|
6525
6550
|
return /* @__PURE__ */ React102.createElement(
|
|
6526
6551
|
import_ui88.Stack,
|
|
6527
6552
|
{
|
|
@@ -6553,13 +6578,13 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
6553
6578
|
|
|
6554
6579
|
// src/components/promotions/attributes-control.tsx
|
|
6555
6580
|
var React103 = __toESM(require("react"));
|
|
6556
|
-
var
|
|
6581
|
+
var import_react57 = require("react");
|
|
6557
6582
|
var import_icons34 = require("@elementor/icons");
|
|
6558
6583
|
var import_ui89 = require("@elementor/ui");
|
|
6559
6584
|
var import_i18n51 = require("@wordpress/i18n");
|
|
6560
6585
|
var ARIA_LABEL2 = (0, import_i18n51.__)("Attributes", "elementor");
|
|
6561
6586
|
var AttributesControl = createControl(() => {
|
|
6562
|
-
const triggerRef = (0,
|
|
6587
|
+
const triggerRef = (0, import_react57.useRef)(null);
|
|
6563
6588
|
return /* @__PURE__ */ React103.createElement(
|
|
6564
6589
|
import_ui89.Stack,
|
|
6565
6590
|
{
|
|
@@ -6596,7 +6621,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
|
|
|
6596
6621
|
|
|
6597
6622
|
// src/components/repeater/repeater.tsx
|
|
6598
6623
|
var React105 = __toESM(require("react"));
|
|
6599
|
-
var
|
|
6624
|
+
var import_react58 = require("react");
|
|
6600
6625
|
var import_icons36 = require("@elementor/icons");
|
|
6601
6626
|
var import_ui91 = require("@elementor/ui");
|
|
6602
6627
|
var import_i18n52 = require("@wordpress/i18n");
|
|
@@ -6617,7 +6642,7 @@ var Repeater3 = ({
|
|
|
6617
6642
|
openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
|
|
6618
6643
|
isSortable = true
|
|
6619
6644
|
}) => {
|
|
6620
|
-
const [openItem, setOpenItem] = (0,
|
|
6645
|
+
const [openItem, setOpenItem] = (0, import_react58.useState)(initialOpenItem);
|
|
6621
6646
|
const uniqueKeys = items2.map(
|
|
6622
6647
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
6623
6648
|
);
|
|
@@ -6773,10 +6798,10 @@ var RepeaterItem = ({
|
|
|
6773
6798
|
), /* @__PURE__ */ React105.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React105.createElement(import_ui91.Box, null, children({ anchorEl: ref }))));
|
|
6774
6799
|
};
|
|
6775
6800
|
var usePopover = (openOnMount, onOpen) => {
|
|
6776
|
-
const [ref, setRef] = (0,
|
|
6801
|
+
const [ref, setRef] = (0, import_react58.useState)(null);
|
|
6777
6802
|
const popoverState = (0, import_ui91.usePopupState)({ variant: "popover" });
|
|
6778
6803
|
const popoverProps = (0, import_ui91.bindPopover)(popoverState);
|
|
6779
|
-
(0,
|
|
6804
|
+
(0, import_react58.useEffect)(() => {
|
|
6780
6805
|
if (openOnMount && ref) {
|
|
6781
6806
|
popoverState.open(ref);
|
|
6782
6807
|
onOpen?.();
|
|
@@ -6792,16 +6817,16 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
6792
6817
|
|
|
6793
6818
|
// src/components/inline-editor-toolbar.tsx
|
|
6794
6819
|
var React107 = __toESM(require("react"));
|
|
6795
|
-
var
|
|
6820
|
+
var import_react60 = require("react");
|
|
6796
6821
|
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
6797
6822
|
var import_icons38 = require("@elementor/icons");
|
|
6798
6823
|
var import_ui93 = require("@elementor/ui");
|
|
6799
|
-
var
|
|
6824
|
+
var import_react61 = require("@tiptap/react");
|
|
6800
6825
|
var import_i18n54 = require("@wordpress/i18n");
|
|
6801
6826
|
|
|
6802
6827
|
// src/components/url-popover.tsx
|
|
6803
6828
|
var React106 = __toESM(require("react"));
|
|
6804
|
-
var
|
|
6829
|
+
var import_react59 = require("react");
|
|
6805
6830
|
var import_icons37 = require("@elementor/icons");
|
|
6806
6831
|
var import_ui92 = require("@elementor/ui");
|
|
6807
6832
|
var import_i18n53 = require("@wordpress/i18n");
|
|
@@ -6814,8 +6839,8 @@ var UrlPopover = ({
|
|
|
6814
6839
|
openInNewTab,
|
|
6815
6840
|
onToggleNewTab
|
|
6816
6841
|
}) => {
|
|
6817
|
-
const inputRef = (0,
|
|
6818
|
-
(0,
|
|
6842
|
+
const inputRef = (0, import_react59.useRef)(null);
|
|
6843
|
+
(0, import_react59.useEffect)(() => {
|
|
6819
6844
|
if (popupState.isOpen) {
|
|
6820
6845
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
6821
6846
|
}
|
|
@@ -6865,16 +6890,16 @@ var UrlPopover = ({
|
|
|
6865
6890
|
|
|
6866
6891
|
// src/components/inline-editor-toolbar.tsx
|
|
6867
6892
|
var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
6868
|
-
const [urlValue, setUrlValue] = (0,
|
|
6869
|
-
const [openInNewTab, setOpenInNewTab] = (0,
|
|
6870
|
-
const toolbarRef = (0,
|
|
6893
|
+
const [urlValue, setUrlValue] = (0, import_react60.useState)("");
|
|
6894
|
+
const [openInNewTab, setOpenInNewTab] = (0, import_react60.useState)(false);
|
|
6895
|
+
const toolbarRef = (0, import_react60.useRef)(null);
|
|
6871
6896
|
const linkPopupState = (0, import_ui93.usePopupState)({ variant: "popover" });
|
|
6872
6897
|
const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
|
|
6873
|
-
const editorState = (0,
|
|
6898
|
+
const editorState = (0, import_react61.useEditorState)({
|
|
6874
6899
|
editor,
|
|
6875
6900
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
6876
6901
|
});
|
|
6877
|
-
const formatButtonsList = (0,
|
|
6902
|
+
const formatButtonsList = (0, import_react60.useMemo)(() => {
|
|
6878
6903
|
const buttons = Object.values(formatButtons);
|
|
6879
6904
|
if (isElementClickable) {
|
|
6880
6905
|
return buttons.filter((button) => button.action !== "link");
|
|
@@ -7103,7 +7128,7 @@ var differsFromExternal = (newState, externalState) => {
|
|
|
7103
7128
|
|
|
7104
7129
|
// src/components/size/unit-select.tsx
|
|
7105
7130
|
var React108 = __toESM(require("react"));
|
|
7106
|
-
var
|
|
7131
|
+
var import_react62 = require("react");
|
|
7107
7132
|
var import_editor_ui14 = require("@elementor/editor-ui");
|
|
7108
7133
|
var import_ui94 = require("@elementor/ui");
|
|
7109
7134
|
var menuItemContentStyles = {
|
|
@@ -7114,7 +7139,7 @@ var menuItemContentStyles = {
|
|
|
7114
7139
|
var UnitSelect = ({ value, showPrimaryColor, onClick, options }) => {
|
|
7115
7140
|
const popupState = (0, import_ui94.usePopupState)({
|
|
7116
7141
|
variant: "popover",
|
|
7117
|
-
popupId: (0,
|
|
7142
|
+
popupId: (0, import_react62.useId)()
|
|
7118
7143
|
});
|
|
7119
7144
|
const handleMenuItemClick = (index) => {
|
|
7120
7145
|
onClick(options[index]);
|
|
@@ -7150,8 +7175,8 @@ var StyledButton2 = (0, import_ui94.styled)(import_ui94.Button, {
|
|
|
7150
7175
|
|
|
7151
7176
|
// src/components/size/unstable-size-input.tsx
|
|
7152
7177
|
var React109 = __toESM(require("react"));
|
|
7153
|
-
var
|
|
7154
|
-
var UnstableSizeInput = (0,
|
|
7178
|
+
var import_react63 = require("react");
|
|
7179
|
+
var UnstableSizeInput = (0, import_react63.forwardRef)(
|
|
7155
7180
|
({ type, value, onChange, onKeyDown, onKeyUp, InputProps, onBlur, focused, disabled }, ref) => {
|
|
7156
7181
|
return /* @__PURE__ */ React109.createElement(
|
|
7157
7182
|
NumberInput,
|
|
@@ -7224,7 +7249,7 @@ var hasValue = (value) => {
|
|
|
7224
7249
|
};
|
|
7225
7250
|
|
|
7226
7251
|
// src/hooks/use-font-families.ts
|
|
7227
|
-
var
|
|
7252
|
+
var import_react64 = require("react");
|
|
7228
7253
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
7229
7254
|
var import_i18n55 = require("@wordpress/i18n");
|
|
7230
7255
|
var supportedCategories = {
|
|
@@ -7242,7 +7267,7 @@ var getFontFamilies = () => {
|
|
|
7242
7267
|
};
|
|
7243
7268
|
var useFontFamilies = () => {
|
|
7244
7269
|
const fontFamilies = getFontFamilies();
|
|
7245
|
-
return (0,
|
|
7270
|
+
return (0, import_react64.useMemo)(() => {
|
|
7246
7271
|
const categoriesOrder = ["system", "custom", "googlefonts"];
|
|
7247
7272
|
return Object.entries(fontFamilies || {}).reduce((acc, [font, category]) => {
|
|
7248
7273
|
if (!supportedCategories[category]) {
|