@elementor/editor-controls 4.0.0-511 → 4.0.0-513

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.mjs CHANGED
@@ -264,14 +264,15 @@ var useControlReplacement = (OriginalComponent) => {
264
264
  };
265
265
  var createControlReplacementsRegistry = () => {
266
266
  const controlReplacements = [];
267
- function registerControlReplacement(replacement) {
267
+ function registerControlReplacement2(replacement) {
268
268
  controlReplacements.push(replacement);
269
269
  }
270
- function getControlReplacements() {
270
+ function getControlReplacements2() {
271
271
  return controlReplacements;
272
272
  }
273
- return { registerControlReplacement, getControlReplacements };
273
+ return { registerControlReplacement: registerControlReplacement2, getControlReplacements: getControlReplacements2 };
274
274
  };
275
+ var { registerControlReplacement, getControlReplacements } = createControlReplacementsRegistry();
275
276
 
276
277
  // src/create-control.tsx
277
278
  var brandSymbol = Symbol("control");
@@ -6202,19 +6203,17 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
6202
6203
  });
6203
6204
 
6204
6205
  // src/controls/inline-editing-control.tsx
6205
- import * as React101 from "react";
6206
+ import * as React99 from "react";
6206
6207
  import { htmlPropTypeUtil } from "@elementor/editor-props";
6207
- import { Box as Box24 } from "@elementor/ui";
6208
+ import { Box as Box23 } from "@elementor/ui";
6208
6209
 
6209
6210
  // src/components/inline-editor.tsx
6210
- import * as React100 from "react";
6211
+ import * as React98 from "react";
6211
6212
  import {
6212
- forwardRef as forwardRef10,
6213
- useEffect as useEffect13,
6214
- useRef as useRef26,
6215
- useState as useState18
6213
+ useEffect as useEffect11,
6214
+ useRef as useRef24
6216
6215
  } from "react";
6217
- import { bindPopover as bindPopover8, Box as Box23, ClickAwayListener, Popover as Popover8, usePopupState as usePopupState9 } from "@elementor/ui";
6216
+ import { Box as Box22, ClickAwayListener } from "@elementor/ui";
6218
6217
  import Bold from "@tiptap/extension-bold";
6219
6218
  import Document from "@tiptap/extension-document";
6220
6219
  import HardBreak from "@tiptap/extension-hard-break";
@@ -6239,474 +6238,147 @@ function isEmpty(value = "") {
6239
6238
  return !pseudoElement.textContent?.length;
6240
6239
  }
6241
6240
 
6242
- // src/components/inline-editor-toolbar.tsx
6243
- import * as React99 from "react";
6244
- import { useMemo as useMemo15, useRef as useRef25, useState as useState17 } from "react";
6245
- import { getElementSetting } from "@elementor/editor-elements";
6246
- import {
6247
- BoldIcon,
6248
- ItalicIcon,
6249
- LinkIcon as LinkIcon3,
6250
- MinusIcon as MinusIcon2,
6251
- StrikethroughIcon,
6252
- SubscriptIcon,
6253
- SuperscriptIcon,
6254
- UnderlineIcon
6255
- } from "@elementor/icons";
6256
- import {
6257
- Box as Box22,
6258
- IconButton as IconButton8,
6259
- ToggleButton as ToggleButton3,
6260
- ToggleButtonGroup as ToggleButtonGroup2,
6261
- toggleButtonGroupClasses,
6262
- Tooltip as Tooltip10,
6263
- usePopupState as usePopupState8
6264
- } from "@elementor/ui";
6265
- import { useEditorState } from "@tiptap/react";
6266
- import { __ as __51 } from "@wordpress/i18n";
6267
-
6268
- // src/components/url-popover.tsx
6269
- import * as React98 from "react";
6270
- import { useEffect as useEffect11, useRef as useRef24 } from "react";
6271
- import { ExternalLinkIcon } from "@elementor/icons";
6272
- import { bindPopover as bindPopover7, Popover as Popover7, Stack as Stack16, TextField as TextField8, ToggleButton as ToggleButton2, Tooltip as Tooltip9 } from "@elementor/ui";
6273
- import { __ as __50 } from "@wordpress/i18n";
6274
- var UrlPopover = ({
6275
- popupState,
6276
- restoreValue,
6277
- anchorRef,
6278
- value,
6279
- onChange,
6280
- openInNewTab,
6281
- onToggleNewTab
6282
- }) => {
6283
- const inputRef = useRef24(null);
6284
- useEffect11(() => {
6285
- if (popupState.isOpen) {
6286
- requestAnimationFrame(() => inputRef.current?.focus());
6287
- }
6288
- }, [popupState.isOpen]);
6289
- const handleClose = () => {
6290
- restoreValue();
6291
- popupState.close();
6241
+ // src/components/inline-editor.tsx
6242
+ var ITALIC_KEYBOARD_SHORTCUT = "i";
6243
+ var BOLD_KEYBOARD_SHORTCUT = "b";
6244
+ var UNDERLINE_KEYBOARD_SHORTCUT = "u";
6245
+ var InlineEditor = React98.forwardRef((props, ref) => {
6246
+ const {
6247
+ value,
6248
+ setValue,
6249
+ editorProps = {},
6250
+ elementClasses = "",
6251
+ autofocus = false,
6252
+ sx = {},
6253
+ onBlur = void 0,
6254
+ expectedTag = null,
6255
+ onEditorCreate,
6256
+ wrapperClassName,
6257
+ onSelectionEnd
6258
+ } = props;
6259
+ const containerRef = useRef24(null);
6260
+ const documentContentSettings = !!expectedTag ? "block+" : "inline*";
6261
+ const onUpdate = ({ editor: updatedEditor }) => {
6262
+ const newValue = updatedEditor.getHTML();
6263
+ setValue(isEmpty(newValue) ? null : newValue);
6292
6264
  };
6293
- return /* @__PURE__ */ React98.createElement(
6294
- Popover7,
6295
- {
6296
- slotProps: {
6297
- paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
6298
- },
6299
- ...bindPopover7(popupState),
6300
- anchorOrigin: { vertical: "top", horizontal: "left" },
6301
- transformOrigin: { vertical: "top", horizontal: "left" },
6302
- onClose: handleClose
6303
- },
6304
- /* @__PURE__ */ React98.createElement(Stack16, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React98.createElement(
6305
- TextField8,
6306
- {
6307
- value,
6308
- onChange,
6309
- size: "tiny",
6310
- fullWidth: true,
6311
- placeholder: __50("Type a URL", "elementor"),
6312
- inputProps: { ref: inputRef },
6313
- color: "secondary",
6314
- InputProps: { sx: { borderRadius: "8px" } },
6315
- onKeyUp: (event) => event.key === "Enter" && handleClose()
6316
- }
6317
- ), /* @__PURE__ */ React98.createElement(Tooltip9, { title: __50("Open in a new tab", "elementor") }, /* @__PURE__ */ React98.createElement(
6318
- ToggleButton2,
6319
- {
6320
- size: "tiny",
6321
- value: "newTab",
6322
- selected: openInNewTab,
6323
- onClick: onToggleNewTab,
6324
- "aria-label": __50("Open in a new tab", "elementor"),
6325
- sx: { borderRadius: "8px" }
6326
- },
6327
- /* @__PURE__ */ React98.createElement(ExternalLinkIcon, { fontSize: "tiny" })
6328
- )))
6329
- );
6330
- };
6331
-
6332
- // src/components/inline-editor-toolbar.tsx
6333
- var checkIfElementHasLink = (elementId) => !!getElementSetting(elementId, "link")?.value?.destination;
6334
- var toolbarButtons = {
6335
- clear: {
6336
- label: __51("Clear", "elementor"),
6337
- icon: /* @__PURE__ */ React99.createElement(MinusIcon2, { fontSize: "tiny" }),
6338
- action: "clear",
6339
- method: (editor) => {
6340
- editor.chain().focus().clearNodes().unsetAllMarks().run();
6341
- }
6342
- },
6343
- bold: {
6344
- label: __51("Bold", "elementor"),
6345
- icon: /* @__PURE__ */ React99.createElement(BoldIcon, { fontSize: "tiny" }),
6346
- action: "bold",
6347
- method: (editor) => {
6348
- editor.chain().focus().toggleBold().run();
6349
- }
6350
- },
6351
- italic: {
6352
- label: __51("Italic", "elementor"),
6353
- icon: /* @__PURE__ */ React99.createElement(ItalicIcon, { fontSize: "tiny" }),
6354
- action: "italic",
6355
- method: (editor) => {
6356
- editor.chain().focus().toggleItalic().run();
6357
- }
6358
- },
6359
- underline: {
6360
- label: __51("Underline", "elementor"),
6361
- icon: /* @__PURE__ */ React99.createElement(UnderlineIcon, { fontSize: "tiny" }),
6362
- action: "underline",
6363
- method: (editor) => {
6364
- editor.chain().focus().toggleUnderline().run();
6365
- }
6366
- },
6367
- strike: {
6368
- label: __51("Strikethrough", "elementor"),
6369
- icon: /* @__PURE__ */ React99.createElement(StrikethroughIcon, { fontSize: "tiny" }),
6370
- action: "strike",
6371
- method: (editor) => {
6372
- editor.chain().focus().toggleStrike().run();
6265
+ const onKeyDown = (_, event) => {
6266
+ if (event.key === "Escape") {
6267
+ onBlur?.();
6373
6268
  }
6374
- },
6375
- superscript: {
6376
- label: __51("Superscript", "elementor"),
6377
- icon: /* @__PURE__ */ React99.createElement(SuperscriptIcon, { fontSize: "tiny" }),
6378
- action: "superscript",
6379
- method: (editor) => {
6380
- editor.chain().focus().toggleSuperscript().run();
6381
- }
6382
- },
6383
- subscript: {
6384
- label: __51("Subscript", "elementor"),
6385
- icon: /* @__PURE__ */ React99.createElement(SubscriptIcon, { fontSize: "tiny" }),
6386
- action: "subscript",
6387
- method: (editor) => {
6388
- editor.chain().focus().toggleSubscript().run();
6389
- }
6390
- },
6391
- link: {
6392
- label: __51("Link", "elementor"),
6393
- icon: /* @__PURE__ */ React99.createElement(LinkIcon3, { fontSize: "tiny" }),
6394
- action: "link",
6395
- method: null
6396
- }
6397
- };
6398
- var { clear: clearButton, ...formatButtons } = toolbarButtons;
6399
- var possibleFormats = Object.keys(formatButtons);
6400
- var InlineEditorToolbar = ({ editor, elementId }) => {
6401
- const [urlValue, setUrlValue] = useState17("");
6402
- const [openInNewTab, setOpenInNewTab] = useState17(false);
6403
- const toolbarRef = useRef25(null);
6404
- const linkPopupState = usePopupState8({ variant: "popover" });
6405
- const hasLinkOnElement = elementId ? checkIfElementHasLink(elementId) : false;
6406
- const editorState = useEditorState({
6407
- editor,
6408
- selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
6409
- });
6410
- const formatButtonsList = useMemo15(() => {
6411
- const buttons = Object.values(formatButtons);
6412
- if (hasLinkOnElement) {
6413
- return buttons.filter((button) => button.action !== "link");
6414
- }
6415
- return buttons;
6416
- }, [hasLinkOnElement]);
6417
- const handleLinkClick = () => {
6418
- const linkAttrs = editor.getAttributes("link");
6419
- setUrlValue(linkAttrs.href || "");
6420
- setOpenInNewTab(linkAttrs.target === "_blank");
6421
- linkPopupState.open(toolbarRef.current);
6422
- };
6423
- const handleUrlChange = (event) => {
6424
- setUrlValue(event.target.value);
6425
- };
6426
- const handleToggleNewTab = () => {
6427
- setOpenInNewTab(!openInNewTab);
6428
- };
6429
- const handleUrlSubmit = () => {
6430
- if (urlValue) {
6431
- editor.chain().focus().setLink({
6432
- href: urlValue,
6433
- target: openInNewTab ? "_blank" : "_self"
6434
- }).run();
6435
- } else {
6436
- editor.chain().focus().unsetLink().run();
6269
+ if (!event.metaKey && !event.ctrlKey || event.altKey) {
6270
+ return;
6437
6271
  }
6438
- if (elementId) {
6439
- window.dispatchEvent(
6440
- new CustomEvent("elementor:inline-link-changed", {
6441
- detail: { elementId }
6442
- })
6443
- );
6272
+ if ([ITALIC_KEYBOARD_SHORTCUT, BOLD_KEYBOARD_SHORTCUT, UNDERLINE_KEYBOARD_SHORTCUT].includes(event.key)) {
6273
+ event.stopPropagation();
6444
6274
  }
6445
- linkPopupState.close();
6446
6275
  };
6447
- React99.useEffect(() => {
6448
- editor?.commands?.focus();
6449
- }, [editor]);
6450
- return /* @__PURE__ */ React99.createElement(
6451
- Box22,
6452
- {
6453
- ref: toolbarRef,
6454
- sx: {
6455
- display: "inline-flex",
6456
- gap: 0.5,
6457
- padding: 0.5,
6458
- borderRadius: "8px",
6459
- backgroundColor: "background.paper",
6460
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
6461
- alignItems: "center",
6462
- visibility: linkPopupState.isOpen ? "hidden" : "visible",
6463
- pointerEvents: linkPopupState.isOpen ? "none" : "all"
6464
- }
6465
- },
6466
- /* @__PURE__ */ React99.createElement(Tooltip10, { title: clearButton.label, placement: "top", sx: { borderRadius: "8px" } }, /* @__PURE__ */ React99.createElement(IconButton8, { "aria-label": clearButton.label, onClick: () => clearButton.method(editor), size: "tiny" }, clearButton.icon)),
6467
- /* @__PURE__ */ React99.createElement(
6468
- ToggleButtonGroup2,
6469
- {
6470
- value: editorState,
6471
- size: "tiny",
6472
- sx: {
6473
- display: "flex",
6474
- gap: 0.5,
6475
- border: "none",
6476
- [`& .${toggleButtonGroupClasses.firstButton}, & .${toggleButtonGroupClasses.middleButton}, & .${toggleButtonGroupClasses.lastButton}`]: {
6477
- borderRadius: "8px",
6478
- border: "none",
6479
- marginLeft: 0,
6480
- "&.Mui-selected": {
6481
- marginLeft: 0
6482
- },
6483
- "& + &.Mui-selected": {
6484
- marginLeft: 0
6485
- }
6276
+ const editedElementAttributes = (HTMLAttributes) => ({
6277
+ ...HTMLAttributes,
6278
+ class: elementClasses
6279
+ });
6280
+ const editor = useEditor({
6281
+ extensions: [
6282
+ Document.extend({
6283
+ content: documentContentSettings
6284
+ }),
6285
+ Paragraph.extend({
6286
+ renderHTML({ HTMLAttributes }) {
6287
+ const tag = expectedTag ?? "p";
6288
+ return [tag, editedElementAttributes(HTMLAttributes), 0];
6289
+ }
6290
+ }),
6291
+ Heading.extend({
6292
+ renderHTML({ node, HTMLAttributes }) {
6293
+ if (expectedTag) {
6294
+ return [expectedTag, editedElementAttributes(HTMLAttributes), 0];
6486
6295
  }
6296
+ const level = this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0];
6297
+ return [`h${level}`, editedElementAttributes(HTMLAttributes), 0];
6298
+ }
6299
+ }).configure({
6300
+ levels: [1, 2, 3, 4, 5, 6]
6301
+ }),
6302
+ Link3.configure({
6303
+ openOnClick: false
6304
+ }),
6305
+ Text,
6306
+ Bold,
6307
+ Italic,
6308
+ Strike,
6309
+ Superscript,
6310
+ Subscript,
6311
+ Underline,
6312
+ HardBreak.extend({
6313
+ addKeyboardShortcuts() {
6314
+ return {
6315
+ Enter: () => this.editor.commands.setHardBreak()
6316
+ };
6487
6317
  }
6318
+ })
6319
+ ],
6320
+ content: value,
6321
+ onUpdate,
6322
+ autofocus,
6323
+ editorProps: {
6324
+ ...editorProps,
6325
+ handleDOMEvents: {
6326
+ keydown: onKeyDown
6488
6327
  },
6489
- formatButtonsList.map((button) => /* @__PURE__ */ React99.createElement(Tooltip10, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React99.createElement(
6490
- ToggleButton3,
6491
- {
6492
- value: button.action,
6493
- "aria-label": button.label,
6494
- size: "tiny",
6495
- onClick: () => {
6496
- if (button.action === "link") {
6497
- handleLinkClick();
6498
- } else {
6499
- button.method?.(editor);
6500
- }
6501
- editor?.commands?.focus();
6502
- }
6503
- },
6504
- button.icon
6505
- )))
6506
- ),
6507
- /* @__PURE__ */ React99.createElement(
6508
- UrlPopover,
6509
- {
6510
- popupState: linkPopupState,
6511
- anchorRef: toolbarRef,
6512
- restoreValue: handleUrlSubmit,
6513
- value: urlValue,
6514
- onChange: handleUrlChange,
6515
- openInNewTab,
6516
- onToggleNewTab: handleToggleNewTab
6328
+ attributes: {
6329
+ ...editorProps.attributes ?? {},
6330
+ role: "textbox"
6517
6331
  }
6518
- )
6519
- );
6520
- };
6521
-
6522
- // src/components/inline-editor.tsx
6523
- var ITALIC_KEYBOARD_SHORTCUT = "i";
6524
- var BOLD_KEYBOARD_SHORTCUT = "b";
6525
- var UNDERLINE_KEYBOARD_SHORTCUT = "u";
6526
- var INLINE_EDITOR_RESET_CLASS = "elementor-inline-editor-reset";
6527
- var useOnUpdate = (callback, dependencies) => {
6528
- const hasMounted = useRef26(false);
6529
- useEffect13(() => {
6530
- if (hasMounted.current) {
6531
- callback();
6532
- } else {
6533
- hasMounted.current = true;
6332
+ },
6333
+ onCreate: onEditorCreate ? ({ editor: mountedEditor }) => onEditorCreate(mountedEditor) : void 0,
6334
+ onSelectionUpdate: onSelectionEnd ? ({ editor: updatedEditor }) => onSelectionEnd(updatedEditor.view) : void 0
6335
+ });
6336
+ useOnUpdate(() => {
6337
+ if (!editor) {
6338
+ return;
6534
6339
  }
6535
- }, dependencies);
6536
- };
6537
- var calcSelectionCenter = (view, container) => {
6538
- if (!container) {
6539
- return null;
6540
- }
6541
- const { from, to } = view.state.selection;
6542
- const start = view.coordsAtPos(from);
6543
- const end = view.coordsAtPos(to);
6544
- const left = (start.left + end.left) / 2 - container.left;
6545
- const top = Math.min(start.top, end.top) - container.top;
6546
- return { left, top };
6547
- };
6548
- var Wrapper = ({ children, containerRef, editor, sx, onBlur }) => {
6549
- const wrappedChildren = /* @__PURE__ */ React100.createElement(Box23, { ref: containerRef, ...sx }, children);
6550
- return onBlur ? /* @__PURE__ */ React100.createElement(
6340
+ const currentContent = editor.getHTML();
6341
+ if (currentContent !== value) {
6342
+ editor.commands.setContent(value, { emitUpdate: false });
6343
+ }
6344
+ }, [editor, value]);
6345
+ return /* @__PURE__ */ React98.createElement(React98.Fragment, null, /* @__PURE__ */ React98.createElement(
6346
+ Wrapper,
6347
+ {
6348
+ containerRef,
6349
+ editor,
6350
+ sx,
6351
+ onBlur,
6352
+ className: wrapperClassName
6353
+ },
6354
+ /* @__PURE__ */ React98.createElement(EditorContent, { ref, editor })
6355
+ ));
6356
+ });
6357
+ var Wrapper = ({ children, containerRef, editor, sx, onBlur, className }) => {
6358
+ const wrappedChildren = /* @__PURE__ */ React98.createElement(Box22, { ref: containerRef, ...sx, className }, children);
6359
+ return onBlur ? /* @__PURE__ */ React98.createElement(
6551
6360
  ClickAwayListener,
6552
6361
  {
6553
6362
  onClickAway: (event) => {
6554
6363
  if (containerRef.current?.contains(event.target) || editor.view.dom.contains(event.target)) {
6555
6364
  return;
6556
6365
  }
6557
- onBlur?.(event);
6366
+ onBlur?.();
6558
6367
  }
6559
6368
  },
6560
6369
  wrappedChildren
6561
- ) : /* @__PURE__ */ React100.createElement(React100.Fragment, null, wrappedChildren);
6370
+ ) : /* @__PURE__ */ React98.createElement(React98.Fragment, null, wrappedChildren);
6371
+ };
6372
+ var useOnUpdate = (callback, dependencies) => {
6373
+ const hasMounted = useRef24(false);
6374
+ useEffect11(() => {
6375
+ if (hasMounted.current) {
6376
+ callback();
6377
+ } else {
6378
+ hasMounted.current = true;
6379
+ }
6380
+ }, dependencies);
6562
6381
  };
6563
- var InlineEditor = forwardRef10(
6564
- ({
6565
- value,
6566
- setValue,
6567
- attributes = {},
6568
- elementClasses = "",
6569
- showToolbar = false,
6570
- autofocus = false,
6571
- sx = {},
6572
- onBlur = void 0,
6573
- getInitialPopoverPosition = void 0,
6574
- expectedTag = null,
6575
- elementId = void 0
6576
- }, ref) => {
6577
- const containerRef = useRef26(null);
6578
- const popupState = usePopupState9({ variant: "popover", disableAutoFocus: true });
6579
- const [hasSelectedContent, setHasSelectedContent] = useState18(false);
6580
- const documentContentSettings = !!expectedTag ? "block+" : "inline*";
6581
- const [selectionRect, setSelectionRect] = useState18(null);
6582
- const onSelectionEnd = (view) => {
6583
- const hasSelection = !view.state.selection.empty;
6584
- setHasSelectedContent(hasSelection);
6585
- if (hasSelection) {
6586
- const container = containerRef.current?.getBoundingClientRect();
6587
- setSelectionRect(calcSelectionCenter(view, container));
6588
- } else {
6589
- setSelectionRect(null);
6590
- }
6591
- queueMicrotask(() => view.focus());
6592
- };
6593
- const onKeyDown = (_, event) => {
6594
- if (event.key === "Escape") {
6595
- onBlur?.(event);
6596
- }
6597
- if (!event.metaKey && !event.ctrlKey || event.altKey) {
6598
- return;
6599
- }
6600
- if ([ITALIC_KEYBOARD_SHORTCUT, BOLD_KEYBOARD_SHORTCUT, UNDERLINE_KEYBOARD_SHORTCUT].includes(event.key)) {
6601
- event.stopPropagation();
6602
- }
6603
- };
6604
- const toolbarRelatedListeners = showToolbar ? {
6605
- mouseup: onSelectionEnd,
6606
- keyup: onSelectionEnd,
6607
- keydown: onKeyDown
6608
- } : void 0;
6609
- const onUpdate = ({ editor: updatedEditor }) => {
6610
- const newValue = updatedEditor.getHTML();
6611
- setValue(isEmpty(newValue) ? null : newValue);
6612
- };
6613
- const classes = `${INLINE_EDITOR_RESET_CLASS} ${elementClasses}`;
6614
- const editor = useEditor({
6615
- extensions: [
6616
- Document.extend({
6617
- content: documentContentSettings
6618
- }),
6619
- Paragraph.extend({
6620
- renderHTML({ HTMLAttributes }) {
6621
- const tag = expectedTag ?? "p";
6622
- return [tag, { ...HTMLAttributes, class: classes }, 0];
6623
- }
6624
- }),
6625
- Heading.extend({
6626
- renderHTML({ node, HTMLAttributes }) {
6627
- if (expectedTag) {
6628
- return [expectedTag, { ...HTMLAttributes, class: classes }, 0];
6629
- }
6630
- const level = this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0];
6631
- return [`h${level}`, { ...HTMLAttributes, class: classes }, 0];
6632
- }
6633
- }).configure({
6634
- levels: [1, 2, 3, 4, 5, 6]
6635
- }),
6636
- Link3.configure({
6637
- openOnClick: false
6638
- }),
6639
- Text,
6640
- Bold,
6641
- Italic,
6642
- Strike,
6643
- Superscript,
6644
- Subscript,
6645
- Underline,
6646
- HardBreak.extend({
6647
- addKeyboardShortcuts() {
6648
- return {
6649
- Enter: () => this.editor.commands.setHardBreak()
6650
- };
6651
- }
6652
- })
6653
- ],
6654
- content: value,
6655
- onUpdate,
6656
- autofocus,
6657
- editorProps: {
6658
- attributes: {
6659
- ...attributes,
6660
- class: attributes.class ?? "",
6661
- role: "textbox"
6662
- },
6663
- handleDOMEvents: toolbarRelatedListeners
6664
- }
6665
- });
6666
- useOnUpdate(() => {
6667
- if (!editor) {
6668
- return;
6669
- }
6670
- const currentContent = editor.getHTML();
6671
- if (currentContent !== value) {
6672
- editor.commands.setContent(value, { emitUpdate: false });
6673
- }
6674
- }, [editor, value]);
6675
- const computePopupPosition = () => {
6676
- if (!selectionRect) {
6677
- return { left: 0, top: 0 };
6678
- }
6679
- const container = containerRef.current?.getBoundingClientRect();
6680
- if (!container) {
6681
- return { left: 0, top: 0 };
6682
- }
6683
- const initial = getInitialPopoverPosition?.() ?? { left: 0, top: 0 };
6684
- return {
6685
- left: container.left + selectionRect.left + initial.left,
6686
- top: container.top + selectionRect.top + initial.top
6687
- };
6688
- };
6689
- return /* @__PURE__ */ React100.createElement(React100.Fragment, null, /* @__PURE__ */ React100.createElement(Wrapper, { containerRef, editor, sx, onBlur }, /* @__PURE__ */ React100.createElement(EditorContent, { ref, editor })), showToolbar && containerRef.current && /* @__PURE__ */ React100.createElement(
6690
- Popover8,
6691
- {
6692
- slotProps: {
6693
- root: {
6694
- sx: {
6695
- pointerEvents: "none"
6696
- }
6697
- }
6698
- },
6699
- ...bindPopover8(popupState),
6700
- open: hasSelectedContent && selectionRect !== null,
6701
- anchorReference: "anchorPosition",
6702
- anchorPosition: computePopupPosition(),
6703
- anchorOrigin: { vertical: "top", horizontal: "center" },
6704
- transformOrigin: { vertical: "bottom", horizontal: "center" }
6705
- },
6706
- /* @__PURE__ */ React100.createElement(InlineEditorToolbar, { editor, elementId })
6707
- ));
6708
- }
6709
- );
6710
6382
 
6711
6383
  // src/controls/inline-editing-control.tsx
6712
6384
  var InlineEditingControl = createControl(
@@ -6717,8 +6389,8 @@ var InlineEditingControl = createControl(
6717
6389
  }) => {
6718
6390
  const { value, setValue } = useBoundProp(htmlPropTypeUtil);
6719
6391
  const handleChange = (newValue) => setValue(newValue);
6720
- return /* @__PURE__ */ React101.createElement(ControlActions, null, /* @__PURE__ */ React101.createElement(
6721
- Box24,
6392
+ return /* @__PURE__ */ React99.createElement(ControlActions, null, /* @__PURE__ */ React99.createElement(
6393
+ Box23,
6722
6394
  {
6723
6395
  sx: {
6724
6396
  p: 0.8,
@@ -6755,35 +6427,35 @@ var InlineEditingControl = createControl(
6755
6427
  ...attributes,
6756
6428
  ...props
6757
6429
  },
6758
- /* @__PURE__ */ React101.createElement(InlineEditor, { value: value || "", setValue: handleChange })
6430
+ /* @__PURE__ */ React99.createElement(InlineEditor, { value: value || "", setValue: handleChange })
6759
6431
  ));
6760
6432
  }
6761
6433
  );
6762
6434
 
6763
6435
  // src/components/icon-buttons/clear-icon-button.tsx
6764
- import * as React102 from "react";
6436
+ import * as React100 from "react";
6765
6437
  import { BrushBigIcon } from "@elementor/icons";
6766
- import { IconButton as IconButton9, styled as styled9, Tooltip as Tooltip11 } from "@elementor/ui";
6767
- var CustomIconButton = styled9(IconButton9)(({ theme }) => ({
6438
+ import { IconButton as IconButton8, styled as styled9, Tooltip as Tooltip9 } from "@elementor/ui";
6439
+ var CustomIconButton = styled9(IconButton8)(({ theme }) => ({
6768
6440
  width: theme.spacing(2.5),
6769
6441
  height: theme.spacing(2.5)
6770
6442
  }));
6771
- var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React102.createElement(Tooltip11, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React102.createElement(CustomIconButton, { "aria-label": tooltipText, size, onClick, disabled }, /* @__PURE__ */ React102.createElement(BrushBigIcon, { fontSize: size })));
6443
+ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ React100.createElement(Tooltip9, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React100.createElement(CustomIconButton, { "aria-label": tooltipText, size, onClick, disabled }, /* @__PURE__ */ React100.createElement(BrushBigIcon, { fontSize: size })));
6772
6444
 
6773
6445
  // src/components/repeater/repeater.tsx
6774
- import * as React103 from "react";
6775
- import { useEffect as useEffect14, useState as useState19 } from "react";
6446
+ import * as React101 from "react";
6447
+ import { useEffect as useEffect12, useState as useState17 } from "react";
6776
6448
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon3, XIcon as XIcon4 } from "@elementor/icons";
6777
6449
  import {
6778
- bindPopover as bindPopover9,
6450
+ bindPopover as bindPopover7,
6779
6451
  bindTrigger as bindTrigger6,
6780
- Box as Box25,
6781
- IconButton as IconButton10,
6452
+ Box as Box24,
6453
+ IconButton as IconButton9,
6782
6454
  Infotip as Infotip4,
6783
- Tooltip as Tooltip12,
6784
- usePopupState as usePopupState10
6455
+ Tooltip as Tooltip10,
6456
+ usePopupState as usePopupState8
6785
6457
  } from "@elementor/ui";
6786
- import { __ as __52 } from "@wordpress/i18n";
6458
+ import { __ as __50 } from "@wordpress/i18n";
6787
6459
  var SIZE9 = "tiny";
6788
6460
  var EMPTY_OPEN_ITEM2 = -1;
6789
6461
  var Repeater3 = ({
@@ -6801,7 +6473,7 @@ var Repeater3 = ({
6801
6473
  openItem: initialOpenItem = EMPTY_OPEN_ITEM2,
6802
6474
  isSortable = true
6803
6475
  }) => {
6804
- const [openItem, setOpenItem] = useState19(initialOpenItem);
6476
+ const [openItem, setOpenItem] = useState17(initialOpenItem);
6805
6477
  const uniqueKeys = items2.map(
6806
6478
  (item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
6807
6479
  );
@@ -6864,8 +6536,8 @@ var Repeater3 = ({
6864
6536
  };
6865
6537
  const isButtonDisabled = disabled || disableAddItemButton;
6866
6538
  const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
6867
- const addButton = /* @__PURE__ */ React103.createElement(
6868
- IconButton10,
6539
+ const addButton = /* @__PURE__ */ React101.createElement(
6540
+ IconButton9,
6869
6541
  {
6870
6542
  size: SIZE9,
6871
6543
  sx: {
@@ -6873,11 +6545,11 @@ var Repeater3 = ({
6873
6545
  },
6874
6546
  disabled: isButtonDisabled,
6875
6547
  onClick: addRepeaterItem,
6876
- "aria-label": __52("Add item", "elementor")
6548
+ "aria-label": __50("Add item", "elementor")
6877
6549
  },
6878
- /* @__PURE__ */ React103.createElement(PlusIcon3, { fontSize: SIZE9 })
6550
+ /* @__PURE__ */ React101.createElement(PlusIcon3, { fontSize: SIZE9 })
6879
6551
  );
6880
- return /* @__PURE__ */ React103.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React103.createElement(RepeaterHeader, { label, adornment: ControlAdornments }, shouldShowInfotip ? /* @__PURE__ */ React103.createElement(
6552
+ return /* @__PURE__ */ React101.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ React101.createElement(RepeaterHeader, { label, adornment: ControlAdornments }, shouldShowInfotip ? /* @__PURE__ */ React101.createElement(
6881
6553
  Infotip4,
6882
6554
  {
6883
6555
  placement: "right",
@@ -6885,20 +6557,20 @@ var Repeater3 = ({
6885
6557
  color: "secondary",
6886
6558
  slotProps: { popper: { sx: { width: 300 } } }
6887
6559
  },
6888
- /* @__PURE__ */ React103.createElement(Box25, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
6889
- ) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React103.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
6560
+ /* @__PURE__ */ React101.createElement(Box24, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)
6561
+ ) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ React101.createElement(SortableProvider, { value: uniqueKeys, onChange: onChangeOrder }, uniqueKeys.map((key) => {
6890
6562
  const index = uniqueKeys.indexOf(key);
6891
6563
  const value = items2[index];
6892
6564
  if (!value) {
6893
6565
  return null;
6894
6566
  }
6895
- return /* @__PURE__ */ React103.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React103.createElement(
6567
+ return /* @__PURE__ */ React101.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, /* @__PURE__ */ React101.createElement(
6896
6568
  RepeaterItem,
6897
6569
  {
6898
6570
  disabled,
6899
6571
  propDisabled: value?.disabled,
6900
- label: /* @__PURE__ */ React103.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React103.createElement(itemSettings.Label, { value, index })),
6901
- startIcon: /* @__PURE__ */ React103.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React103.createElement(itemSettings.Icon, { value })),
6572
+ label: /* @__PURE__ */ React101.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React101.createElement(itemSettings.Label, { value, index })),
6573
+ startIcon: /* @__PURE__ */ React101.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React101.createElement(itemSettings.Icon, { value })),
6902
6574
  removeItem: () => removeRepeaterItem(index),
6903
6575
  duplicateItem: () => duplicateRepeaterItem(index),
6904
6576
  toggleDisableItem: () => toggleDisableRepeaterItem(index),
@@ -6910,7 +6582,7 @@ var Repeater3 = ({
6910
6582
  actions: itemSettings.actions,
6911
6583
  value
6912
6584
  },
6913
- (props) => /* @__PURE__ */ React103.createElement(
6585
+ (props) => /* @__PURE__ */ React101.createElement(
6914
6586
  itemSettings.Content,
6915
6587
  {
6916
6588
  ...props,
@@ -6940,27 +6612,27 @@ var RepeaterItem = ({
6940
6612
  value
6941
6613
  }) => {
6942
6614
  const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
6943
- const duplicateLabel = __52("Duplicate", "elementor");
6944
- const toggleLabel = propDisabled ? __52("Show", "elementor") : __52("Hide", "elementor");
6945
- const removeLabel = __52("Remove", "elementor");
6946
- return /* @__PURE__ */ React103.createElement(React103.Fragment, null, /* @__PURE__ */ React103.createElement(
6615
+ const duplicateLabel = __50("Duplicate", "elementor");
6616
+ const toggleLabel = propDisabled ? __50("Show", "elementor") : __50("Hide", "elementor");
6617
+ const removeLabel = __50("Remove", "elementor");
6618
+ return /* @__PURE__ */ React101.createElement(React101.Fragment, null, /* @__PURE__ */ React101.createElement(
6947
6619
  RepeaterTag,
6948
6620
  {
6949
6621
  disabled,
6950
6622
  label,
6951
6623
  ref: setRef,
6952
- "aria-label": __52("Open item", "elementor"),
6624
+ "aria-label": __50("Open item", "elementor"),
6953
6625
  ...bindTrigger6(popoverState),
6954
6626
  startIcon,
6955
- actions: /* @__PURE__ */ React103.createElement(React103.Fragment, null, showDuplicate && /* @__PURE__ */ React103.createElement(Tooltip12, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React103.createElement(IconButton10, { size: SIZE9, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React103.createElement(CopyIcon2, { fontSize: SIZE9 }))), showToggle && /* @__PURE__ */ React103.createElement(Tooltip12, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React103.createElement(IconButton10, { size: SIZE9, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React103.createElement(EyeOffIcon2, { fontSize: SIZE9 }) : /* @__PURE__ */ React103.createElement(EyeIcon2, { fontSize: SIZE9 }))), actions?.(value), showRemove && /* @__PURE__ */ React103.createElement(Tooltip12, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React103.createElement(IconButton10, { size: SIZE9, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React103.createElement(XIcon4, { fontSize: SIZE9 }))))
6627
+ actions: /* @__PURE__ */ React101.createElement(React101.Fragment, null, showDuplicate && /* @__PURE__ */ React101.createElement(Tooltip10, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React101.createElement(IconButton9, { size: SIZE9, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React101.createElement(CopyIcon2, { fontSize: SIZE9 }))), showToggle && /* @__PURE__ */ React101.createElement(Tooltip10, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React101.createElement(IconButton9, { size: SIZE9, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React101.createElement(EyeOffIcon2, { fontSize: SIZE9 }) : /* @__PURE__ */ React101.createElement(EyeIcon2, { fontSize: SIZE9 }))), actions?.(value), showRemove && /* @__PURE__ */ React101.createElement(Tooltip10, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React101.createElement(IconButton9, { size: SIZE9, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React101.createElement(XIcon4, { fontSize: SIZE9 }))))
6956
6628
  }
6957
- ), /* @__PURE__ */ React103.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React103.createElement(Box25, null, children({ anchorEl: ref }))));
6629
+ ), /* @__PURE__ */ React101.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React101.createElement(Box24, null, children({ anchorEl: ref }))));
6958
6630
  };
6959
6631
  var usePopover = (openOnMount, onOpen) => {
6960
- const [ref, setRef] = useState19(null);
6961
- const popoverState = usePopupState10({ variant: "popover" });
6962
- const popoverProps = bindPopover9(popoverState);
6963
- useEffect14(() => {
6632
+ const [ref, setRef] = useState17(null);
6633
+ const popoverState = usePopupState8({ variant: "popover" });
6634
+ const popoverProps = bindPopover7(popoverState);
6635
+ useEffect12(() => {
6964
6636
  if (openOnMount && ref) {
6965
6637
  popoverState.open(ref);
6966
6638
  onOpen?.();
@@ -6974,6 +6646,287 @@ var usePopover = (openOnMount, onOpen) => {
6974
6646
  };
6975
6647
  };
6976
6648
 
6649
+ // src/components/inline-editor-toolbar.tsx
6650
+ import * as React103 from "react";
6651
+ import { useMemo as useMemo15, useRef as useRef26, useState as useState18 } from "react";
6652
+ import { getElementSetting } from "@elementor/editor-elements";
6653
+ import {
6654
+ BoldIcon,
6655
+ ItalicIcon,
6656
+ LinkIcon as LinkIcon3,
6657
+ MinusIcon as MinusIcon2,
6658
+ StrikethroughIcon,
6659
+ SubscriptIcon,
6660
+ SuperscriptIcon,
6661
+ UnderlineIcon
6662
+ } from "@elementor/icons";
6663
+ import {
6664
+ Box as Box25,
6665
+ IconButton as IconButton10,
6666
+ ToggleButton as ToggleButton3,
6667
+ ToggleButtonGroup as ToggleButtonGroup2,
6668
+ toggleButtonGroupClasses,
6669
+ Tooltip as Tooltip12,
6670
+ usePopupState as usePopupState9
6671
+ } from "@elementor/ui";
6672
+ import { useEditorState } from "@tiptap/react";
6673
+ import { __ as __52 } from "@wordpress/i18n";
6674
+
6675
+ // src/components/url-popover.tsx
6676
+ import * as React102 from "react";
6677
+ import { useEffect as useEffect13, useRef as useRef25 } from "react";
6678
+ import { ExternalLinkIcon } from "@elementor/icons";
6679
+ import { bindPopover as bindPopover8, Popover as Popover7, Stack as Stack16, TextField as TextField8, ToggleButton as ToggleButton2, Tooltip as Tooltip11 } from "@elementor/ui";
6680
+ import { __ as __51 } from "@wordpress/i18n";
6681
+ var UrlPopover = ({
6682
+ popupState,
6683
+ restoreValue,
6684
+ anchorRef,
6685
+ value,
6686
+ onChange,
6687
+ openInNewTab,
6688
+ onToggleNewTab
6689
+ }) => {
6690
+ const inputRef = useRef25(null);
6691
+ useEffect13(() => {
6692
+ if (popupState.isOpen) {
6693
+ requestAnimationFrame(() => inputRef.current?.focus());
6694
+ }
6695
+ }, [popupState.isOpen]);
6696
+ const handleClose = () => {
6697
+ restoreValue();
6698
+ popupState.close();
6699
+ };
6700
+ return /* @__PURE__ */ React102.createElement(
6701
+ Popover7,
6702
+ {
6703
+ slotProps: {
6704
+ paper: { sx: { borderRadius: "16px", width: anchorRef.current?.offsetWidth + "px", marginTop: -1 } }
6705
+ },
6706
+ ...bindPopover8(popupState),
6707
+ anchorOrigin: { vertical: "top", horizontal: "left" },
6708
+ transformOrigin: { vertical: "top", horizontal: "left" },
6709
+ onClose: handleClose
6710
+ },
6711
+ /* @__PURE__ */ React102.createElement(Stack16, { direction: "row", alignItems: "center", gap: 1, sx: { p: 1.5 } }, /* @__PURE__ */ React102.createElement(
6712
+ TextField8,
6713
+ {
6714
+ value,
6715
+ onChange,
6716
+ size: "tiny",
6717
+ fullWidth: true,
6718
+ placeholder: __51("Type a URL", "elementor"),
6719
+ inputProps: { ref: inputRef },
6720
+ color: "secondary",
6721
+ InputProps: { sx: { borderRadius: "8px" } },
6722
+ onKeyUp: (event) => event.key === "Enter" && handleClose()
6723
+ }
6724
+ ), /* @__PURE__ */ React102.createElement(Tooltip11, { title: __51("Open in a new tab", "elementor") }, /* @__PURE__ */ React102.createElement(
6725
+ ToggleButton2,
6726
+ {
6727
+ size: "tiny",
6728
+ value: "newTab",
6729
+ selected: openInNewTab,
6730
+ onClick: onToggleNewTab,
6731
+ "aria-label": __51("Open in a new tab", "elementor"),
6732
+ sx: { borderRadius: "8px" }
6733
+ },
6734
+ /* @__PURE__ */ React102.createElement(ExternalLinkIcon, { fontSize: "tiny" })
6735
+ )))
6736
+ );
6737
+ };
6738
+
6739
+ // src/components/inline-editor-toolbar.tsx
6740
+ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
6741
+ const [urlValue, setUrlValue] = useState18("");
6742
+ const [openInNewTab, setOpenInNewTab] = useState18(false);
6743
+ const toolbarRef = useRef26(null);
6744
+ const linkPopupState = usePopupState9({ variant: "popover" });
6745
+ const hasLinkOnElement = elementId ? checkIfElementHasLink(elementId) : false;
6746
+ const editorState = useEditorState({
6747
+ editor,
6748
+ selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
6749
+ });
6750
+ const formatButtonsList = useMemo15(() => {
6751
+ const buttons = Object.values(formatButtons);
6752
+ if (hasLinkOnElement) {
6753
+ return buttons.filter((button) => button.action !== "link");
6754
+ }
6755
+ return buttons;
6756
+ }, [hasLinkOnElement]);
6757
+ const handleLinkClick = () => {
6758
+ const linkAttrs = editor.getAttributes("link");
6759
+ setUrlValue(linkAttrs.href || "");
6760
+ setOpenInNewTab(linkAttrs.target === "_blank");
6761
+ linkPopupState.open(toolbarRef.current);
6762
+ };
6763
+ const handleUrlChange = (event) => {
6764
+ setUrlValue(event.target.value);
6765
+ };
6766
+ const handleToggleNewTab = () => {
6767
+ setOpenInNewTab(!openInNewTab);
6768
+ };
6769
+ const handleUrlSubmit = () => {
6770
+ if (urlValue) {
6771
+ editor.chain().focus().setLink({
6772
+ href: urlValue,
6773
+ target: openInNewTab ? "_blank" : "_self"
6774
+ }).run();
6775
+ } else {
6776
+ editor.chain().focus().unsetLink().run();
6777
+ }
6778
+ if (elementId) {
6779
+ window.dispatchEvent(
6780
+ new CustomEvent("elementor:inline-link-changed", {
6781
+ detail: { elementId }
6782
+ })
6783
+ );
6784
+ }
6785
+ linkPopupState.close();
6786
+ };
6787
+ React103.useEffect(() => {
6788
+ editor?.commands?.focus();
6789
+ }, [editor]);
6790
+ return /* @__PURE__ */ React103.createElement(
6791
+ Box25,
6792
+ {
6793
+ ref: toolbarRef,
6794
+ sx: {
6795
+ display: "inline-flex",
6796
+ gap: 0.5,
6797
+ padding: 0.5,
6798
+ borderRadius: "8px",
6799
+ backgroundColor: "background.paper",
6800
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
6801
+ alignItems: "center",
6802
+ visibility: linkPopupState.isOpen ? "hidden" : "visible",
6803
+ pointerEvents: linkPopupState.isOpen ? "none" : "all",
6804
+ ...sx
6805
+ }
6806
+ },
6807
+ /* @__PURE__ */ React103.createElement(Tooltip12, { title: clearButton.label, placement: "top", sx: { borderRadius: "8px" } }, /* @__PURE__ */ React103.createElement(IconButton10, { "aria-label": clearButton.label, onClick: () => clearButton.method(editor), size: "tiny" }, clearButton.icon)),
6808
+ /* @__PURE__ */ React103.createElement(
6809
+ ToggleButtonGroup2,
6810
+ {
6811
+ value: editorState,
6812
+ size: "tiny",
6813
+ sx: {
6814
+ display: "flex",
6815
+ gap: 0.5,
6816
+ border: "none",
6817
+ [`& .${toggleButtonGroupClasses.firstButton}, & .${toggleButtonGroupClasses.middleButton}, & .${toggleButtonGroupClasses.lastButton}`]: {
6818
+ borderRadius: "8px",
6819
+ border: "none",
6820
+ marginLeft: 0,
6821
+ "&.Mui-selected": {
6822
+ marginLeft: 0
6823
+ },
6824
+ "& + &.Mui-selected": {
6825
+ marginLeft: 0
6826
+ }
6827
+ }
6828
+ }
6829
+ },
6830
+ formatButtonsList.map((button) => /* @__PURE__ */ React103.createElement(Tooltip12, { title: button.label, key: button.action, placement: "top" }, /* @__PURE__ */ React103.createElement(
6831
+ ToggleButton3,
6832
+ {
6833
+ value: button.action,
6834
+ "aria-label": button.label,
6835
+ size: "tiny",
6836
+ onClick: () => {
6837
+ if (button.action === "link") {
6838
+ handleLinkClick();
6839
+ } else {
6840
+ button.method?.(editor);
6841
+ }
6842
+ editor?.commands?.focus();
6843
+ }
6844
+ },
6845
+ button.icon
6846
+ )))
6847
+ ),
6848
+ /* @__PURE__ */ React103.createElement(
6849
+ UrlPopover,
6850
+ {
6851
+ popupState: linkPopupState,
6852
+ anchorRef: toolbarRef,
6853
+ restoreValue: handleUrlSubmit,
6854
+ value: urlValue,
6855
+ onChange: handleUrlChange,
6856
+ openInNewTab,
6857
+ onToggleNewTab: handleToggleNewTab
6858
+ }
6859
+ )
6860
+ );
6861
+ };
6862
+ var checkIfElementHasLink = (elementId) => !!getElementSetting(elementId, "link")?.value?.destination;
6863
+ var toolbarButtons = {
6864
+ clear: {
6865
+ label: __52("Clear", "elementor"),
6866
+ icon: /* @__PURE__ */ React103.createElement(MinusIcon2, { fontSize: "tiny" }),
6867
+ action: "clear",
6868
+ method: (editor) => {
6869
+ editor.chain().focus().clearNodes().unsetAllMarks().run();
6870
+ }
6871
+ },
6872
+ bold: {
6873
+ label: __52("Bold", "elementor"),
6874
+ icon: /* @__PURE__ */ React103.createElement(BoldIcon, { fontSize: "tiny" }),
6875
+ action: "bold",
6876
+ method: (editor) => {
6877
+ editor.chain().focus().toggleBold().run();
6878
+ }
6879
+ },
6880
+ italic: {
6881
+ label: __52("Italic", "elementor"),
6882
+ icon: /* @__PURE__ */ React103.createElement(ItalicIcon, { fontSize: "tiny" }),
6883
+ action: "italic",
6884
+ method: (editor) => {
6885
+ editor.chain().focus().toggleItalic().run();
6886
+ }
6887
+ },
6888
+ underline: {
6889
+ label: __52("Underline", "elementor"),
6890
+ icon: /* @__PURE__ */ React103.createElement(UnderlineIcon, { fontSize: "tiny" }),
6891
+ action: "underline",
6892
+ method: (editor) => {
6893
+ editor.chain().focus().toggleUnderline().run();
6894
+ }
6895
+ },
6896
+ strike: {
6897
+ label: __52("Strikethrough", "elementor"),
6898
+ icon: /* @__PURE__ */ React103.createElement(StrikethroughIcon, { fontSize: "tiny" }),
6899
+ action: "strike",
6900
+ method: (editor) => {
6901
+ editor.chain().focus().toggleStrike().run();
6902
+ }
6903
+ },
6904
+ superscript: {
6905
+ label: __52("Superscript", "elementor"),
6906
+ icon: /* @__PURE__ */ React103.createElement(SuperscriptIcon, { fontSize: "tiny" }),
6907
+ action: "superscript",
6908
+ method: (editor) => {
6909
+ editor.chain().focus().toggleSuperscript().run();
6910
+ }
6911
+ },
6912
+ subscript: {
6913
+ label: __52("Subscript", "elementor"),
6914
+ icon: /* @__PURE__ */ React103.createElement(SubscriptIcon, { fontSize: "tiny" }),
6915
+ action: "subscript",
6916
+ method: (editor) => {
6917
+ editor.chain().focus().toggleSubscript().run();
6918
+ }
6919
+ },
6920
+ link: {
6921
+ label: __52("Link", "elementor"),
6922
+ icon: /* @__PURE__ */ React103.createElement(LinkIcon3, { fontSize: "tiny" }),
6923
+ action: "link",
6924
+ method: null
6925
+ }
6926
+ };
6927
+ var { clear: clearButton, ...formatButtons } = toolbarButtons;
6928
+ var possibleFormats = Object.keys(formatButtons);
6929
+
6977
6930
  // src/components/size/unstable-size-field.tsx
6978
6931
  import * as React106 from "react";
6979
6932
  import { InputAdornment as InputAdornment5 } from "@elementor/ui";
@@ -7019,14 +6972,14 @@ var differsFromExternal = (newState, externalState) => {
7019
6972
  import * as React104 from "react";
7020
6973
  import { useId as useId3 } from "react";
7021
6974
  import { MenuListItem as MenuListItem7 } from "@elementor/editor-ui";
7022
- import { bindMenu as bindMenu2, bindTrigger as bindTrigger7, Button as Button5, Menu as Menu3, styled as styled10, usePopupState as usePopupState11 } from "@elementor/ui";
6975
+ import { bindMenu as bindMenu2, bindTrigger as bindTrigger7, Button as Button5, Menu as Menu3, styled as styled10, usePopupState as usePopupState10 } from "@elementor/ui";
7023
6976
  var menuItemContentStyles = {
7024
6977
  display: "flex",
7025
6978
  flexDirection: "column",
7026
6979
  justifyContent: "center"
7027
6980
  };
7028
6981
  var UnitSelect = ({ value, showPrimaryColor, onClick, options }) => {
7029
- const popupState = usePopupState11({
6982
+ const popupState = usePopupState10({
7030
6983
  variant: "popover",
7031
6984
  popupId: useId3()
7032
6985
  });
@@ -7225,9 +7178,11 @@ export {
7225
7178
  createControl,
7226
7179
  createControlReplacementsRegistry,
7227
7180
  enqueueFont,
7181
+ getControlReplacements,
7228
7182
  injectIntoRepeaterItemActions,
7229
7183
  injectIntoRepeaterItemIcon,
7230
7184
  injectIntoRepeaterItemLabel,
7185
+ registerControlReplacement,
7231
7186
  transitionProperties,
7232
7187
  transitionsItemsList,
7233
7188
  useBoundProp,