@elementor/editor-controls 3.35.0-350 → 3.35.0-352
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 +25 -15
- package/dist/index.d.ts +25 -15
- package/dist/index.js +168 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -15
- package/src/components/inline-editor-toolbar.tsx +19 -11
- package/src/components/inline-editor.tsx +152 -49
- package/src/controls/inline-editing-control.tsx +53 -9
- package/src/index.ts +2 -2
- package/src/utils/inline-editing.ts +11 -0
package/dist/index.d.mts
CHANGED
|
@@ -378,22 +378,11 @@ declare const DateTimeControl: ControlComponent$1<({ inputDisabled }: {
|
|
|
378
378
|
inputDisabled?: boolean;
|
|
379
379
|
}) => React$1.JSX.Element>;
|
|
380
380
|
|
|
381
|
-
declare const InlineEditingControl: ControlComponent$1<(
|
|
382
|
-
|
|
383
|
-
type InlineEditorProps = {
|
|
384
|
-
value: string;
|
|
385
|
-
setValue: (value: string) => void;
|
|
386
|
-
attributes?: Record<string, string>;
|
|
381
|
+
declare const InlineEditingControl: ControlComponent$1<({ sx, attributes, props, }: {
|
|
387
382
|
sx?: SxProps<Theme>;
|
|
388
|
-
|
|
389
|
-
props?: React$1.ComponentProps<
|
|
390
|
-
}
|
|
391
|
-
declare const InlineEditor: React$1.ForwardRefExoticComponent<InlineEditorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
392
|
-
|
|
393
|
-
type InlineEditorToolbarProps = {
|
|
394
|
-
editor: Editor;
|
|
395
|
-
};
|
|
396
|
-
declare const InlineEditorToolbar: ({ editor }: InlineEditorToolbarProps) => React$1.JSX.Element;
|
|
383
|
+
attributes?: Record<string, string>;
|
|
384
|
+
props?: React$1.ComponentProps<"div">;
|
|
385
|
+
}) => React$1.JSX.Element>;
|
|
397
386
|
|
|
398
387
|
declare const ControlFormLabel: (props: FormLabelProps) => React$1.JSX.Element;
|
|
399
388
|
|
|
@@ -563,6 +552,27 @@ declare const PopoverGridContainer: React$1.ForwardRefExoticComponent<{
|
|
|
563
552
|
children?: React$1.ReactNode | undefined;
|
|
564
553
|
} & React$1.RefAttributes<unknown>>;
|
|
565
554
|
|
|
555
|
+
type InlineEditorProps = {
|
|
556
|
+
value: string | null;
|
|
557
|
+
setValue: (value: string | null) => void;
|
|
558
|
+
attributes?: Record<string, string>;
|
|
559
|
+
sx?: SxProps<Theme>;
|
|
560
|
+
onBlur?: (event: Event) => void;
|
|
561
|
+
showToolbar?: boolean;
|
|
562
|
+
autofocus?: boolean;
|
|
563
|
+
getInitialPopoverPosition?: () => {
|
|
564
|
+
left: number;
|
|
565
|
+
top: number;
|
|
566
|
+
};
|
|
567
|
+
expectedTag?: string | null;
|
|
568
|
+
};
|
|
569
|
+
declare const InlineEditor: React$1.ForwardRefExoticComponent<InlineEditorProps & React$1.RefAttributes<unknown>>;
|
|
570
|
+
|
|
571
|
+
type InlineEditorToolbarProps = {
|
|
572
|
+
editor: Editor;
|
|
573
|
+
};
|
|
574
|
+
declare const InlineEditorToolbar: ({ editor }: InlineEditorToolbarProps) => React$1.JSX.Element;
|
|
575
|
+
|
|
566
576
|
type AnyComponentType = ComponentType<any>;
|
|
567
577
|
declare const brandSymbol: unique symbol;
|
|
568
578
|
type ControlComponent$1<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
|
package/dist/index.d.ts
CHANGED
|
@@ -378,22 +378,11 @@ declare const DateTimeControl: ControlComponent$1<({ inputDisabled }: {
|
|
|
378
378
|
inputDisabled?: boolean;
|
|
379
379
|
}) => React$1.JSX.Element>;
|
|
380
380
|
|
|
381
|
-
declare const InlineEditingControl: ControlComponent$1<(
|
|
382
|
-
|
|
383
|
-
type InlineEditorProps = {
|
|
384
|
-
value: string;
|
|
385
|
-
setValue: (value: string) => void;
|
|
386
|
-
attributes?: Record<string, string>;
|
|
381
|
+
declare const InlineEditingControl: ControlComponent$1<({ sx, attributes, props, }: {
|
|
387
382
|
sx?: SxProps<Theme>;
|
|
388
|
-
|
|
389
|
-
props?: React$1.ComponentProps<
|
|
390
|
-
}
|
|
391
|
-
declare const InlineEditor: React$1.ForwardRefExoticComponent<InlineEditorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
392
|
-
|
|
393
|
-
type InlineEditorToolbarProps = {
|
|
394
|
-
editor: Editor;
|
|
395
|
-
};
|
|
396
|
-
declare const InlineEditorToolbar: ({ editor }: InlineEditorToolbarProps) => React$1.JSX.Element;
|
|
383
|
+
attributes?: Record<string, string>;
|
|
384
|
+
props?: React$1.ComponentProps<"div">;
|
|
385
|
+
}) => React$1.JSX.Element>;
|
|
397
386
|
|
|
398
387
|
declare const ControlFormLabel: (props: FormLabelProps) => React$1.JSX.Element;
|
|
399
388
|
|
|
@@ -563,6 +552,27 @@ declare const PopoverGridContainer: React$1.ForwardRefExoticComponent<{
|
|
|
563
552
|
children?: React$1.ReactNode | undefined;
|
|
564
553
|
} & React$1.RefAttributes<unknown>>;
|
|
565
554
|
|
|
555
|
+
type InlineEditorProps = {
|
|
556
|
+
value: string | null;
|
|
557
|
+
setValue: (value: string | null) => void;
|
|
558
|
+
attributes?: Record<string, string>;
|
|
559
|
+
sx?: SxProps<Theme>;
|
|
560
|
+
onBlur?: (event: Event) => void;
|
|
561
|
+
showToolbar?: boolean;
|
|
562
|
+
autofocus?: boolean;
|
|
563
|
+
getInitialPopoverPosition?: () => {
|
|
564
|
+
left: number;
|
|
565
|
+
top: number;
|
|
566
|
+
};
|
|
567
|
+
expectedTag?: string | null;
|
|
568
|
+
};
|
|
569
|
+
declare const InlineEditor: React$1.ForwardRefExoticComponent<InlineEditorProps & React$1.RefAttributes<unknown>>;
|
|
570
|
+
|
|
571
|
+
type InlineEditorToolbarProps = {
|
|
572
|
+
editor: Editor;
|
|
573
|
+
};
|
|
574
|
+
declare const InlineEditorToolbar: ({ editor }: InlineEditorToolbarProps) => React$1.JSX.Element;
|
|
575
|
+
|
|
566
576
|
type AnyComponentType = ComponentType<any>;
|
|
567
577
|
declare const brandSymbol: unique symbol;
|
|
568
578
|
type ControlComponent$1<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
|
package/dist/index.js
CHANGED
|
@@ -5915,6 +5915,7 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
|
|
|
5915
5915
|
// src/controls/inline-editing-control.tsx
|
|
5916
5916
|
var React102 = __toESM(require("react"));
|
|
5917
5917
|
var import_editor_props52 = require("@elementor/editor-props");
|
|
5918
|
+
var import_ui88 = require("@elementor/ui");
|
|
5918
5919
|
|
|
5919
5920
|
// src/components/inline-editor.tsx
|
|
5920
5921
|
var React101 = __toESM(require("react"));
|
|
@@ -5923,8 +5924,10 @@ var import_ui87 = require("@elementor/ui");
|
|
|
5923
5924
|
var import_extension_bold = __toESM(require("@tiptap/extension-bold"));
|
|
5924
5925
|
var import_extension_document = __toESM(require("@tiptap/extension-document"));
|
|
5925
5926
|
var import_extension_hard_break = __toESM(require("@tiptap/extension-hard-break"));
|
|
5927
|
+
var import_extension_heading = __toESM(require("@tiptap/extension-heading"));
|
|
5926
5928
|
var import_extension_italic = __toESM(require("@tiptap/extension-italic"));
|
|
5927
5929
|
var import_extension_link = __toESM(require("@tiptap/extension-link"));
|
|
5930
|
+
var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"));
|
|
5928
5931
|
var import_extension_strike = __toESM(require("@tiptap/extension-strike"));
|
|
5929
5932
|
var import_extension_subscript = __toESM(require("@tiptap/extension-subscript"));
|
|
5930
5933
|
var import_extension_superscript = __toESM(require("@tiptap/extension-superscript"));
|
|
@@ -5932,6 +5935,16 @@ var import_extension_text = __toESM(require("@tiptap/extension-text"));
|
|
|
5932
5935
|
var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
|
|
5933
5936
|
var import_react56 = require("@tiptap/react");
|
|
5934
5937
|
|
|
5938
|
+
// src/utils/inline-editing.ts
|
|
5939
|
+
function isEmpty(value = "") {
|
|
5940
|
+
if (!value) {
|
|
5941
|
+
return true;
|
|
5942
|
+
}
|
|
5943
|
+
const pseudoElement = document.createElement("div");
|
|
5944
|
+
pseudoElement.innerHTML = value;
|
|
5945
|
+
return !pseudoElement.textContent?.length;
|
|
5946
|
+
}
|
|
5947
|
+
|
|
5935
5948
|
// src/components/inline-editor-toolbar.tsx
|
|
5936
5949
|
var React100 = __toESM(require("react"));
|
|
5937
5950
|
var import_react53 = require("react");
|
|
@@ -6074,7 +6087,7 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6074
6087
|
const [urlValue, setUrlValue] = (0, import_react53.useState)("");
|
|
6075
6088
|
const [openInNewTab, setOpenInNewTab] = (0, import_react53.useState)(false);
|
|
6076
6089
|
const toolbarRef = (0, import_react53.useRef)(null);
|
|
6077
|
-
const
|
|
6090
|
+
const linkPopupState = (0, import_ui86.usePopupState)({ variant: "popover" });
|
|
6078
6091
|
const editorState = (0, import_react54.useEditorState)({
|
|
6079
6092
|
editor,
|
|
6080
6093
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
@@ -6084,7 +6097,7 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6084
6097
|
const linkAttrs = editor.getAttributes("link");
|
|
6085
6098
|
setUrlValue(linkAttrs.href || "");
|
|
6086
6099
|
setOpenInNewTab(linkAttrs.target === "_blank");
|
|
6087
|
-
|
|
6100
|
+
linkPopupState.open(toolbarRef.current);
|
|
6088
6101
|
};
|
|
6089
6102
|
const handleUrlChange = (event) => {
|
|
6090
6103
|
setUrlValue(event.target.value);
|
|
@@ -6101,16 +6114,16 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6101
6114
|
} else {
|
|
6102
6115
|
editor.chain().focus().unsetLink().run();
|
|
6103
6116
|
}
|
|
6104
|
-
|
|
6117
|
+
linkPopupState.close();
|
|
6105
6118
|
};
|
|
6119
|
+
React100.useEffect(() => {
|
|
6120
|
+
editor?.commands?.focus();
|
|
6121
|
+
}, [editor]);
|
|
6106
6122
|
return /* @__PURE__ */ React100.createElement(
|
|
6107
6123
|
import_ui86.Box,
|
|
6108
6124
|
{
|
|
6109
6125
|
ref: toolbarRef,
|
|
6110
6126
|
sx: {
|
|
6111
|
-
position: "absolute",
|
|
6112
|
-
left: 0,
|
|
6113
|
-
top: -40,
|
|
6114
6127
|
display: "inline-flex",
|
|
6115
6128
|
gap: 0.5,
|
|
6116
6129
|
padding: 0.5,
|
|
@@ -6118,7 +6131,8 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6118
6131
|
backgroundColor: "background.paper",
|
|
6119
6132
|
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
|
|
6120
6133
|
alignItems: "center",
|
|
6121
|
-
visibility:
|
|
6134
|
+
visibility: linkPopupState.isOpen ? "hidden" : "visible",
|
|
6135
|
+
pointerEvents: linkPopupState.isOpen ? "none" : "all"
|
|
6122
6136
|
}
|
|
6123
6137
|
},
|
|
6124
6138
|
/* @__PURE__ */ React100.createElement(import_ui86.Tooltip, { title: clearButton.label, placement: "top", sx: { borderRadius: "8px" } }, /* @__PURE__ */ React100.createElement(import_ui86.IconButton, { "aria-label": clearButton.label, onClick: () => clearButton.method(editor), size: "tiny" }, clearButton.icon)),
|
|
@@ -6150,7 +6164,14 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6150
6164
|
value: button.action,
|
|
6151
6165
|
"aria-label": button.label,
|
|
6152
6166
|
size: "tiny",
|
|
6153
|
-
onClick: () =>
|
|
6167
|
+
onClick: () => {
|
|
6168
|
+
if (button.action === "link") {
|
|
6169
|
+
handleLinkClick();
|
|
6170
|
+
} else {
|
|
6171
|
+
button.method?.(editor);
|
|
6172
|
+
}
|
|
6173
|
+
editor?.commands?.focus();
|
|
6174
|
+
}
|
|
6154
6175
|
},
|
|
6155
6176
|
button.icon
|
|
6156
6177
|
)))
|
|
@@ -6158,7 +6179,7 @@ var InlineEditorToolbar = ({ editor }) => {
|
|
|
6158
6179
|
/* @__PURE__ */ React100.createElement(
|
|
6159
6180
|
UrlPopover,
|
|
6160
6181
|
{
|
|
6161
|
-
popupState,
|
|
6182
|
+
popupState: linkPopupState,
|
|
6162
6183
|
anchorRef: toolbarRef,
|
|
6163
6184
|
restoreValue: handleUrlSubmit,
|
|
6164
6185
|
value: urlValue,
|
|
@@ -6182,22 +6203,67 @@ var useOnUpdate = (callback, dependencies) => {
|
|
|
6182
6203
|
}, dependencies);
|
|
6183
6204
|
};
|
|
6184
6205
|
var InlineEditor = React101.forwardRef(
|
|
6185
|
-
({
|
|
6206
|
+
({
|
|
6207
|
+
value,
|
|
6208
|
+
setValue,
|
|
6209
|
+
attributes = {},
|
|
6210
|
+
showToolbar = false,
|
|
6211
|
+
autofocus = false,
|
|
6212
|
+
sx = {},
|
|
6213
|
+
onBlur = void 0,
|
|
6214
|
+
getInitialPopoverPosition = void 0,
|
|
6215
|
+
expectedTag = null
|
|
6216
|
+
}, ref) => {
|
|
6217
|
+
const containerRef = React101.useRef(null);
|
|
6218
|
+
const popupState = (0, import_ui87.usePopupState)({ variant: "popover", disableAutoFocus: true });
|
|
6219
|
+
const [hasSelectedContent, setHasSelectedContent] = React101.useState(false);
|
|
6220
|
+
const documentContentSettings = !!expectedTag ? "block+" : "inline*";
|
|
6221
|
+
const onSelectionEnd = (view) => {
|
|
6222
|
+
setHasSelectedContent(() => !view.state.selection.empty);
|
|
6223
|
+
queueMicrotask(() => view.focus());
|
|
6224
|
+
};
|
|
6225
|
+
const onKeyDown = (_, event) => {
|
|
6226
|
+
if (event.key === "Escape") {
|
|
6227
|
+
onBlur?.(event);
|
|
6228
|
+
}
|
|
6229
|
+
};
|
|
6230
|
+
const toolbarRelatedListeners = showToolbar ? {
|
|
6231
|
+
mouseup: onSelectionEnd,
|
|
6232
|
+
keyup: onSelectionEnd,
|
|
6233
|
+
keydown: onKeyDown
|
|
6234
|
+
} : void 0;
|
|
6186
6235
|
const editor = (0, import_react56.useEditor)({
|
|
6187
6236
|
extensions: [
|
|
6188
6237
|
import_extension_document.default.extend({
|
|
6189
|
-
content:
|
|
6238
|
+
content: documentContentSettings
|
|
6239
|
+
}),
|
|
6240
|
+
import_extension_paragraph.default.extend({
|
|
6241
|
+
renderHTML({ HTMLAttributes }) {
|
|
6242
|
+
const tag = expectedTag ?? "p";
|
|
6243
|
+
return [tag, { ...HTMLAttributes, style: "margin:0;padding:0;" }, 0];
|
|
6244
|
+
}
|
|
6245
|
+
}),
|
|
6246
|
+
import_extension_heading.default.extend({
|
|
6247
|
+
renderHTML({ node, HTMLAttributes }) {
|
|
6248
|
+
if (expectedTag) {
|
|
6249
|
+
return [expectedTag, { ...HTMLAttributes, style: "margin:0;padding:0;" }, 0];
|
|
6250
|
+
}
|
|
6251
|
+
const level = this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0];
|
|
6252
|
+
return [`h${level}`, { ...HTMLAttributes, style: "margin:0;padding:0;" }, 0];
|
|
6253
|
+
}
|
|
6254
|
+
}).configure({
|
|
6255
|
+
levels: [1, 2, 3, 4, 5, 6]
|
|
6256
|
+
}),
|
|
6257
|
+
import_extension_link.default.configure({
|
|
6258
|
+
openOnClick: false
|
|
6190
6259
|
}),
|
|
6191
6260
|
import_extension_text.default,
|
|
6192
6261
|
import_extension_bold.default,
|
|
6193
6262
|
import_extension_italic.default,
|
|
6194
6263
|
import_extension_strike.default,
|
|
6195
|
-
import_extension_underline.default,
|
|
6196
6264
|
import_extension_superscript.default,
|
|
6197
6265
|
import_extension_subscript.default,
|
|
6198
|
-
|
|
6199
|
-
openOnClick: false
|
|
6200
|
-
}),
|
|
6266
|
+
import_extension_underline.default,
|
|
6201
6267
|
import_extension_hard_break.default.extend({
|
|
6202
6268
|
addKeyboardShortcuts() {
|
|
6203
6269
|
return {
|
|
@@ -6207,7 +6273,19 @@ var InlineEditor = React101.forwardRef(
|
|
|
6207
6273
|
})
|
|
6208
6274
|
],
|
|
6209
6275
|
content: value,
|
|
6210
|
-
onUpdate: ({ editor: updatedEditor }) =>
|
|
6276
|
+
onUpdate: ({ editor: updatedEditor }) => {
|
|
6277
|
+
const newValue = updatedEditor.getHTML();
|
|
6278
|
+
setValue(isEmpty(newValue) ? null : newValue);
|
|
6279
|
+
},
|
|
6280
|
+
autofocus,
|
|
6281
|
+
editorProps: {
|
|
6282
|
+
attributes: {
|
|
6283
|
+
...attributes,
|
|
6284
|
+
class: attributes.class ?? "",
|
|
6285
|
+
role: "textbox"
|
|
6286
|
+
},
|
|
6287
|
+
handleDOMEvents: toolbarRelatedListeners
|
|
6288
|
+
}
|
|
6211
6289
|
});
|
|
6212
6290
|
useOnUpdate(() => {
|
|
6213
6291
|
if (!editor) {
|
|
@@ -6218,10 +6296,64 @@ var InlineEditor = React101.forwardRef(
|
|
|
6218
6296
|
editor.commands.setContent(value, { emitUpdate: false });
|
|
6219
6297
|
}
|
|
6220
6298
|
}, [editor, value]);
|
|
6221
|
-
|
|
6222
|
-
|
|
6299
|
+
const computePopupPosition = () => {
|
|
6300
|
+
const positionFallback = { left: 0, top: 0 };
|
|
6301
|
+
const { left, top } = containerRef.current?.getBoundingClientRect() ?? positionFallback;
|
|
6302
|
+
const initial = getInitialPopoverPosition?.() ?? positionFallback;
|
|
6303
|
+
return {
|
|
6304
|
+
left: left + initial.left,
|
|
6305
|
+
top: top + initial.top
|
|
6306
|
+
};
|
|
6307
|
+
};
|
|
6308
|
+
const Wrapper = ({ children }) => {
|
|
6309
|
+
const wrappedChildren = /* @__PURE__ */ React101.createElement(import_ui87.Box, { ref: containerRef, ...sx }, children);
|
|
6310
|
+
return onBlur ? /* @__PURE__ */ React101.createElement(
|
|
6311
|
+
import_ui87.ClickAwayListener,
|
|
6312
|
+
{
|
|
6313
|
+
onClickAway: (event) => {
|
|
6314
|
+
if (containerRef.current?.contains(event.target) || editor.view.dom.contains(event.target)) {
|
|
6315
|
+
return;
|
|
6316
|
+
}
|
|
6317
|
+
onBlur?.(event);
|
|
6318
|
+
}
|
|
6319
|
+
},
|
|
6320
|
+
wrappedChildren
|
|
6321
|
+
) : /* @__PURE__ */ React101.createElement(React101.Fragment, null, wrappedChildren);
|
|
6322
|
+
};
|
|
6323
|
+
return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(Wrapper, null, /* @__PURE__ */ React101.createElement(import_react56.EditorContent, { ref, editor })), showToolbar && containerRef.current && /* @__PURE__ */ React101.createElement(
|
|
6324
|
+
import_ui87.Popover,
|
|
6325
|
+
{
|
|
6326
|
+
slotProps: {
|
|
6327
|
+
root: {
|
|
6328
|
+
sx: {
|
|
6329
|
+
pointerEvents: "none"
|
|
6330
|
+
}
|
|
6331
|
+
}
|
|
6332
|
+
},
|
|
6333
|
+
...(0, import_ui87.bindPopover)(popupState),
|
|
6334
|
+
open: hasSelectedContent,
|
|
6335
|
+
anchorReference: "anchorPosition",
|
|
6336
|
+
anchorPosition: computePopupPosition(),
|
|
6337
|
+
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
6338
|
+
transformOrigin: { vertical: "bottom", horizontal: "left" }
|
|
6339
|
+
},
|
|
6340
|
+
/* @__PURE__ */ React101.createElement(InlineEditorToolbar, { editor })
|
|
6341
|
+
));
|
|
6342
|
+
}
|
|
6343
|
+
);
|
|
6344
|
+
|
|
6345
|
+
// src/controls/inline-editing-control.tsx
|
|
6346
|
+
var InlineEditingControl = createControl(
|
|
6347
|
+
({
|
|
6348
|
+
sx,
|
|
6349
|
+
attributes,
|
|
6350
|
+
props
|
|
6351
|
+
}) => {
|
|
6352
|
+
const { value, setValue } = useBoundProp(import_editor_props52.htmlPropTypeUtil);
|
|
6353
|
+
const handleChange = (newValue) => setValue(newValue);
|
|
6354
|
+
return /* @__PURE__ */ React102.createElement(ControlActions, null, /* @__PURE__ */ React102.createElement(
|
|
6355
|
+
import_ui88.Box,
|
|
6223
6356
|
{
|
|
6224
|
-
ref,
|
|
6225
6357
|
sx: {
|
|
6226
6358
|
p: 0.8,
|
|
6227
6359
|
border: "1px solid",
|
|
@@ -6245,39 +6377,34 @@ var InlineEditor = React101.forwardRef(
|
|
|
6245
6377
|
color: "inherit"
|
|
6246
6378
|
}
|
|
6247
6379
|
},
|
|
6380
|
+
".strip-styles *": {
|
|
6381
|
+
all: "unset"
|
|
6382
|
+
},
|
|
6248
6383
|
...sx
|
|
6249
6384
|
},
|
|
6250
6385
|
...attributes,
|
|
6251
6386
|
...props
|
|
6252
6387
|
},
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
);
|
|
6388
|
+
/* @__PURE__ */ React102.createElement(InlineEditor, { value: value || "", setValue: handleChange })
|
|
6389
|
+
));
|
|
6256
6390
|
}
|
|
6257
6391
|
);
|
|
6258
6392
|
|
|
6259
|
-
// src/controls/inline-editing-control.tsx
|
|
6260
|
-
var InlineEditingControl = createControl(() => {
|
|
6261
|
-
const { value, setValue } = useBoundProp(import_editor_props52.htmlPropTypeUtil);
|
|
6262
|
-
const handleChange = (newValue) => setValue(newValue);
|
|
6263
|
-
return /* @__PURE__ */ React102.createElement(ControlActions, null, /* @__PURE__ */ React102.createElement(InlineEditor, { value: value || "", setValue: handleChange }));
|
|
6264
|
-
});
|
|
6265
|
-
|
|
6266
6393
|
// src/components/icon-buttons/clear-icon-button.tsx
|
|
6267
6394
|
var React103 = __toESM(require("react"));
|
|
6268
6395
|
var import_icons35 = require("@elementor/icons");
|
|
6269
|
-
var
|
|
6270
|
-
var CustomIconButton = (0,
|
|
6396
|
+
var import_ui89 = require("@elementor/ui");
|
|
6397
|
+
var CustomIconButton = (0, import_ui89.styled)(import_ui89.IconButton)(({ theme }) => ({
|
|
6271
6398
|
width: theme.spacing(2.5),
|
|
6272
6399
|
height: theme.spacing(2.5)
|
|
6273
6400
|
}));
|
|
6274
|
-
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React103.createElement(
|
|
6401
|
+
var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React103.createElement(import_ui89.Tooltip, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React103.createElement(CustomIconButton, { "aria-label": tooltipText, size, onClick, disabled }, /* @__PURE__ */ React103.createElement(import_icons35.BrushBigIcon, { fontSize: size })));
|
|
6275
6402
|
|
|
6276
6403
|
// src/components/repeater/repeater.tsx
|
|
6277
6404
|
var React104 = __toESM(require("react"));
|
|
6278
6405
|
var import_react57 = require("react");
|
|
6279
6406
|
var import_icons36 = require("@elementor/icons");
|
|
6280
|
-
var
|
|
6407
|
+
var import_ui90 = require("@elementor/ui");
|
|
6281
6408
|
var import_i18n52 = require("@wordpress/i18n");
|
|
6282
6409
|
var SIZE9 = "tiny";
|
|
6283
6410
|
var EMPTY_OPEN_ITEM2 = -1;
|
|
@@ -6360,7 +6487,7 @@ var Repeater3 = ({
|
|
|
6360
6487
|
const isButtonDisabled = disabled || disableAddItemButton;
|
|
6361
6488
|
const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
|
|
6362
6489
|
const addButton = /* @__PURE__ */ React104.createElement(
|
|
6363
|
-
|
|
6490
|
+
import_ui90.IconButton,
|
|
6364
6491
|
{
|
|
6365
6492
|
size: SIZE9,
|
|
6366
6493
|
sx: {
|
|
@@ -6373,14 +6500,14 @@ var Repeater3 = ({
|
|
|
6373
6500
|
/* @__PURE__ */ React104.createElement(import_icons36.PlusIcon, { fontSize: SIZE9 })
|
|
6374
6501
|
);
|
|
6375
6502
|
return /* @__PURE__ */ React104.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React104.createElement(RepeaterHeader, { label, adornment: ControlAdornments }, shouldShowInfotip ? /* @__PURE__ */ React104.createElement(
|
|
6376
|
-
|
|
6503
|
+
import_ui90.Infotip,
|
|
6377
6504
|
{
|
|
6378
6505
|
placement: "right",
|
|
6379
6506
|
content: addButtonInfotipContent,
|
|
6380
6507
|
color: "secondary",
|
|
6381
6508
|
slotProps: { popper: { sx: { width: 300 } } }
|
|
6382
6509
|
},
|
|
6383
|
-
/* @__PURE__ */ React104.createElement(
|
|
6510
|
+
/* @__PURE__ */ React104.createElement(import_ui90.Box, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
|
|
6384
6511
|
) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React104.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
|
|
6385
6512
|
const index = uniqueKeys.indexOf(key);
|
|
6386
6513
|
const value = items2[index];
|
|
@@ -6445,16 +6572,16 @@ var RepeaterItem = ({
|
|
|
6445
6572
|
label,
|
|
6446
6573
|
ref: setRef,
|
|
6447
6574
|
"aria-label": (0, import_i18n52.__)("Open item", "elementor"),
|
|
6448
|
-
...(0,
|
|
6575
|
+
...(0, import_ui90.bindTrigger)(popoverState),
|
|
6449
6576
|
startIcon,
|
|
6450
|
-
actions: /* @__PURE__ */ React104.createElement(React104.Fragment, null, showDuplicate && /* @__PURE__ */ React104.createElement(
|
|
6577
|
+
actions: /* @__PURE__ */ React104.createElement(React104.Fragment, null, showDuplicate && /* @__PURE__ */ React104.createElement(import_ui90.Tooltip, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(import_ui90.IconButton, { size: SIZE9, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React104.createElement(import_icons36.CopyIcon, { fontSize: SIZE9 }))), showToggle && /* @__PURE__ */ React104.createElement(import_ui90.Tooltip, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(import_ui90.IconButton, { size: SIZE9, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React104.createElement(import_icons36.EyeOffIcon, { fontSize: SIZE9 }) : /* @__PURE__ */ React104.createElement(import_icons36.EyeIcon, { fontSize: SIZE9 }))), actions?.(value), showRemove && /* @__PURE__ */ React104.createElement(import_ui90.Tooltip, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React104.createElement(import_ui90.IconButton, { size: SIZE9, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React104.createElement(import_icons36.XIcon, { fontSize: SIZE9 }))))
|
|
6451
6578
|
}
|
|
6452
|
-
), /* @__PURE__ */ React104.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React104.createElement(
|
|
6579
|
+
), /* @__PURE__ */ React104.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React104.createElement(import_ui90.Box, null, children({ anchorEl: ref }))));
|
|
6453
6580
|
};
|
|
6454
6581
|
var usePopover = (openOnMount, onOpen) => {
|
|
6455
6582
|
const [ref, setRef] = (0, import_react57.useState)(null);
|
|
6456
|
-
const popoverState = (0,
|
|
6457
|
-
const popoverProps = (0,
|
|
6583
|
+
const popoverState = (0, import_ui90.usePopupState)({ variant: "popover" });
|
|
6584
|
+
const popoverProps = (0, import_ui90.bindPopover)(popoverState);
|
|
6458
6585
|
(0, import_react57.useEffect)(() => {
|
|
6459
6586
|
if (openOnMount && ref) {
|
|
6460
6587
|
popoverState.open(ref);
|