@react-email/editor 1.0.1 → 1.1.0

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.
@@ -1536,7 +1536,111 @@ function BubbleMenuImageEditLink({ className, children, onClick, onMouseDown, ..
1536
1536
  onClick?.(e);
1537
1537
  setIsEditing(true);
1538
1538
  },
1539
- children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkIcon, {})
1539
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PencilIcon, {})
1540
+ });
1541
+ }
1542
+ //#endregion
1543
+ //#region src/ui/bubble-menu/image-form.tsx
1544
+ function BubbleMenuImageForm({ className, validateUrl, onLinkApply, onLinkRemove }) {
1545
+ const { editor, isEditing, setIsEditing } = useBubbleMenuContext();
1546
+ const inputRef = react.useRef(null);
1547
+ const formRef = react.useRef(null);
1548
+ const imageHref = (0, _tiptap_react.useEditorState)({
1549
+ editor,
1550
+ selector: ({ editor: e }) => e?.getAttributes("image").href ?? ""
1551
+ });
1552
+ const [inputValue, setInputValue] = react.useState(imageHref ?? "");
1553
+ react.useEffect(() => {
1554
+ if (!isEditing) return;
1555
+ setInputValue(imageHref ?? "");
1556
+ const timeoutId = setTimeout(() => {
1557
+ inputRef.current?.focus();
1558
+ }, 0);
1559
+ return () => clearTimeout(timeoutId);
1560
+ }, [isEditing, imageHref]);
1561
+ react.useEffect(() => {
1562
+ if (!isEditing) return;
1563
+ const handleKeyDown = (event) => {
1564
+ if (event.key === "Escape") setIsEditing(false);
1565
+ };
1566
+ const handleClickOutside = (event) => {
1567
+ if (formRef.current && !formRef.current.contains(event.target)) {
1568
+ const form = formRef.current;
1569
+ const submitEvent = new Event("submit", {
1570
+ bubbles: true,
1571
+ cancelable: true
1572
+ });
1573
+ form.dispatchEvent(submitEvent);
1574
+ setIsEditing(false);
1575
+ }
1576
+ };
1577
+ document.addEventListener("mousedown", handleClickOutside);
1578
+ window.addEventListener("keydown", handleKeyDown);
1579
+ return () => {
1580
+ window.removeEventListener("keydown", handleKeyDown);
1581
+ document.removeEventListener("mousedown", handleClickOutside);
1582
+ };
1583
+ }, [isEditing, setIsEditing]);
1584
+ if (!isEditing) return null;
1585
+ function handleSubmit(e) {
1586
+ e.preventDefault();
1587
+ const value = inputValue.trim();
1588
+ if (value === "") {
1589
+ editor.chain().focus().updateAttributes("image", { href: null }).run();
1590
+ setIsEditing(false);
1591
+ focusEditor(editor);
1592
+ onLinkRemove?.();
1593
+ return;
1594
+ }
1595
+ const finalValue = (validateUrl ?? getUrlFromString)(value);
1596
+ if (!finalValue) {
1597
+ editor.chain().focus().updateAttributes("image", { href: null }).run();
1598
+ setIsEditing(false);
1599
+ focusEditor(editor);
1600
+ onLinkRemove?.();
1601
+ return;
1602
+ }
1603
+ editor.chain().focus().updateAttributes("image", { href: finalValue }).run();
1604
+ setIsEditing(false);
1605
+ focusEditor(editor);
1606
+ onLinkApply?.(finalValue);
1607
+ }
1608
+ function handleUnlink(e) {
1609
+ e.stopPropagation();
1610
+ editor.chain().focus().updateAttributes("image", { href: null }).run();
1611
+ setIsEditing(false);
1612
+ focusEditor(editor);
1613
+ onLinkRemove?.();
1614
+ }
1615
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1616
+ ref: formRef,
1617
+ "data-re-img-bm-form": "",
1618
+ className,
1619
+ onMouseDown: (e) => e.stopPropagation(),
1620
+ onClick: (e) => e.stopPropagation(),
1621
+ onKeyDown: (e) => e.stopPropagation(),
1622
+ onSubmit: handleSubmit,
1623
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1624
+ ref: inputRef,
1625
+ "data-re-img-bm-input": "",
1626
+ value: inputValue,
1627
+ onFocus: (e) => e.stopPropagation(),
1628
+ onChange: (e) => setInputValue(e.target.value),
1629
+ placeholder: "Paste a link",
1630
+ type: "text"
1631
+ }), (imageHref ?? "") !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1632
+ type: "button",
1633
+ "aria-label": "Remove link",
1634
+ "data-re-img-bm-unlink": "",
1635
+ onClick: handleUnlink,
1636
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1637
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1638
+ type: "submit",
1639
+ "aria-label": "Apply link",
1640
+ "data-re-img-bm-apply": "",
1641
+ onMouseDown: (e) => e.stopPropagation(),
1642
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, {})
1643
+ })]
1540
1644
  });
1541
1645
  }
1542
1646
  //#endregion
@@ -1551,10 +1655,49 @@ function BubbleMenuImageToolbar({ children, ...rest }) {
1551
1655
  });
1552
1656
  }
1553
1657
  //#endregion
1658
+ //#region src/ui/bubble-menu/image-unlink.tsx
1659
+ function BubbleMenuImageUnlink({ className, children, onClick, onMouseDown, onLinkRemove, ...rest }) {
1660
+ const { editor } = useBubbleMenuContext();
1661
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1662
+ ...rest,
1663
+ type: "button",
1664
+ "aria-label": "Remove link",
1665
+ "data-re-img-bm-item": "",
1666
+ "data-item": "unlink",
1667
+ className,
1668
+ onMouseDown: (e) => {
1669
+ e.preventDefault();
1670
+ onMouseDown?.(e);
1671
+ },
1672
+ onClick: (e) => {
1673
+ onClick?.(e);
1674
+ editor.chain().focus().updateAttributes("image", { href: null }).run();
1675
+ focusEditor(editor);
1676
+ onLinkRemove?.();
1677
+ },
1678
+ children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnlinkIcon, {})
1679
+ });
1680
+ }
1681
+ //#endregion
1554
1682
  //#region src/ui/bubble-menu/image-default.tsx
1555
1683
  const imagePluginKey = new _tiptap_pm_state.PluginKey("imageBubbleMenu");
1556
- function BubbleMenuImageDefault({ excludeItems = [], placement = "top", offset, onHide, className, ...rest }) {
1557
- const hasEditLink = !excludeItems.includes("edit-link");
1684
+ function BubbleMenuImageDefaultInner({ excludeItems, validateUrl, onLinkApply, onLinkRemove }) {
1685
+ const { editor } = useBubbleMenuContext();
1686
+ const imageHref = (0, _tiptap_react.useEditorState)({
1687
+ editor,
1688
+ selector: ({ editor: e }) => e?.getAttributes("image").href ?? ""
1689
+ });
1690
+ const has = (item) => !excludeItems.includes(item);
1691
+ const hasLink = (imageHref ?? "") !== "";
1692
+ const showEditLink = has("edit-link");
1693
+ const showUnlink = has("unlink") && hasLink;
1694
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(showEditLink || showUnlink) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuImageToolbar, { children: [showEditLink && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuImageEditLink, {}), showUnlink && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuImageUnlink, { onLinkRemove })] }), showEditLink && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuImageForm, {
1695
+ validateUrl,
1696
+ onLinkApply,
1697
+ onLinkRemove
1698
+ })] });
1699
+ }
1700
+ function BubbleMenuImageDefault({ excludeItems = [], placement = "top", offset, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
1558
1701
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RootWithDefault, {
1559
1702
  trigger: bubbleMenuTriggers.node("image"),
1560
1703
  pluginKey: imagePluginKey,
@@ -1563,7 +1706,12 @@ function BubbleMenuImageDefault({ excludeItems = [], placement = "top", offset,
1563
1706
  onHide,
1564
1707
  className,
1565
1708
  ...rest,
1566
- children: hasEditLink && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuImageToolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuImageEditLink, {}) })
1709
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuImageDefaultInner, {
1710
+ excludeItems,
1711
+ validateUrl,
1712
+ onLinkApply,
1713
+ onLinkRemove
1714
+ })
1567
1715
  });
1568
1716
  }
1569
1717
  //#endregion
@@ -1818,6 +1966,8 @@ const BubbleMenu = Object.assign(RootWithDefault, {
1818
1966
  LinkDefault: BubbleMenuLinkDefault,
1819
1967
  ImageToolbar: BubbleMenuImageToolbar,
1820
1968
  ImageEditLink: BubbleMenuImageEditLink,
1969
+ ImageUnlink: BubbleMenuImageUnlink,
1970
+ ImageForm: BubbleMenuImageForm,
1821
1971
  ImageDefault: BubbleMenuImageDefault
1822
1972
  });
1823
1973
  //#endregion
@@ -1895,29 +2045,35 @@ function CommandList({ items, query, selectedIndex, onSelect }) {
1895
2045
  });
1896
2046
  if (query.trim().length > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1897
2047
  "data-re-slash-command": "",
1898
- ref: containerRef,
1899
- children: items.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandItem, {
1900
- item,
1901
- onSelect: () => onSelect(index),
1902
- selected: index === selectedIndex
1903
- }, item.title))
2048
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2049
+ "data-re-slash-command-scroll": "",
2050
+ ref: containerRef,
2051
+ children: items.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandItem, {
2052
+ item,
2053
+ onSelect: () => onSelect(index),
2054
+ selected: index === selectedIndex
2055
+ }, item.title))
2056
+ })
1904
2057
  });
1905
2058
  const groups = groupByCategory(items);
1906
2059
  let flatIndex = 0;
1907
2060
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1908
2061
  "data-re-slash-command": "",
1909
- ref: containerRef,
1910
- children: groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1911
- "data-re-slash-command-category": "",
1912
- children: group.category
1913
- }), group.items.map((item) => {
1914
- const currentIndex = flatIndex++;
1915
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandItem, {
1916
- item,
1917
- onSelect: () => onSelect(currentIndex),
1918
- selected: currentIndex === selectedIndex
1919
- }, item.title);
1920
- })] }, group.category))
2062
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2063
+ "data-re-slash-command-scroll": "",
2064
+ ref: containerRef,
2065
+ children: groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2066
+ "data-re-slash-command-category": "",
2067
+ children: group.category
2068
+ }), group.items.map((item) => {
2069
+ const currentIndex = flatIndex++;
2070
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommandItem, {
2071
+ item,
2072
+ onSelect: () => onSelect(currentIndex),
2073
+ selected: currentIndex === selectedIndex
2074
+ }, item.title);
2075
+ })] }, group.category))
2076
+ })
1921
2077
  });
1922
2078
  }
1923
2079
  //#endregion
@@ -2406,12 +2562,24 @@ Object.defineProperty(exports, "BubbleMenuImageEditLink", {
2406
2562
  return BubbleMenuImageEditLink;
2407
2563
  }
2408
2564
  });
2565
+ Object.defineProperty(exports, "BubbleMenuImageForm", {
2566
+ enumerable: true,
2567
+ get: function() {
2568
+ return BubbleMenuImageForm;
2569
+ }
2570
+ });
2409
2571
  Object.defineProperty(exports, "BubbleMenuImageToolbar", {
2410
2572
  enumerable: true,
2411
2573
  get: function() {
2412
2574
  return BubbleMenuImageToolbar;
2413
2575
  }
2414
2576
  });
2577
+ Object.defineProperty(exports, "BubbleMenuImageUnlink", {
2578
+ enumerable: true,
2579
+ get: function() {
2580
+ return BubbleMenuImageUnlink;
2581
+ }
2582
+ });
2415
2583
  Object.defineProperty(exports, "BubbleMenuItalic", {
2416
2584
  enumerable: true,
2417
2585
  get: function() {
@@ -1534,7 +1534,111 @@ function BubbleMenuImageEditLink({ className, children, onClick, onMouseDown, ..
1534
1534
  onClick?.(e);
1535
1535
  setIsEditing(true);
1536
1536
  },
1537
- children: children ?? /* @__PURE__ */ jsx(LinkIcon, {})
1537
+ children: children ?? /* @__PURE__ */ jsx(PencilIcon, {})
1538
+ });
1539
+ }
1540
+ //#endregion
1541
+ //#region src/ui/bubble-menu/image-form.tsx
1542
+ function BubbleMenuImageForm({ className, validateUrl, onLinkApply, onLinkRemove }) {
1543
+ const { editor, isEditing, setIsEditing } = useBubbleMenuContext();
1544
+ const inputRef = React$1.useRef(null);
1545
+ const formRef = React$1.useRef(null);
1546
+ const imageHref = useEditorState({
1547
+ editor,
1548
+ selector: ({ editor: e }) => e?.getAttributes("image").href ?? ""
1549
+ });
1550
+ const [inputValue, setInputValue] = React$1.useState(imageHref ?? "");
1551
+ React$1.useEffect(() => {
1552
+ if (!isEditing) return;
1553
+ setInputValue(imageHref ?? "");
1554
+ const timeoutId = setTimeout(() => {
1555
+ inputRef.current?.focus();
1556
+ }, 0);
1557
+ return () => clearTimeout(timeoutId);
1558
+ }, [isEditing, imageHref]);
1559
+ React$1.useEffect(() => {
1560
+ if (!isEditing) return;
1561
+ const handleKeyDown = (event) => {
1562
+ if (event.key === "Escape") setIsEditing(false);
1563
+ };
1564
+ const handleClickOutside = (event) => {
1565
+ if (formRef.current && !formRef.current.contains(event.target)) {
1566
+ const form = formRef.current;
1567
+ const submitEvent = new Event("submit", {
1568
+ bubbles: true,
1569
+ cancelable: true
1570
+ });
1571
+ form.dispatchEvent(submitEvent);
1572
+ setIsEditing(false);
1573
+ }
1574
+ };
1575
+ document.addEventListener("mousedown", handleClickOutside);
1576
+ window.addEventListener("keydown", handleKeyDown);
1577
+ return () => {
1578
+ window.removeEventListener("keydown", handleKeyDown);
1579
+ document.removeEventListener("mousedown", handleClickOutside);
1580
+ };
1581
+ }, [isEditing, setIsEditing]);
1582
+ if (!isEditing) return null;
1583
+ function handleSubmit(e) {
1584
+ e.preventDefault();
1585
+ const value = inputValue.trim();
1586
+ if (value === "") {
1587
+ editor.chain().focus().updateAttributes("image", { href: null }).run();
1588
+ setIsEditing(false);
1589
+ focusEditor(editor);
1590
+ onLinkRemove?.();
1591
+ return;
1592
+ }
1593
+ const finalValue = (validateUrl ?? getUrlFromString)(value);
1594
+ if (!finalValue) {
1595
+ editor.chain().focus().updateAttributes("image", { href: null }).run();
1596
+ setIsEditing(false);
1597
+ focusEditor(editor);
1598
+ onLinkRemove?.();
1599
+ return;
1600
+ }
1601
+ editor.chain().focus().updateAttributes("image", { href: finalValue }).run();
1602
+ setIsEditing(false);
1603
+ focusEditor(editor);
1604
+ onLinkApply?.(finalValue);
1605
+ }
1606
+ function handleUnlink(e) {
1607
+ e.stopPropagation();
1608
+ editor.chain().focus().updateAttributes("image", { href: null }).run();
1609
+ setIsEditing(false);
1610
+ focusEditor(editor);
1611
+ onLinkRemove?.();
1612
+ }
1613
+ return /* @__PURE__ */ jsxs("form", {
1614
+ ref: formRef,
1615
+ "data-re-img-bm-form": "",
1616
+ className,
1617
+ onMouseDown: (e) => e.stopPropagation(),
1618
+ onClick: (e) => e.stopPropagation(),
1619
+ onKeyDown: (e) => e.stopPropagation(),
1620
+ onSubmit: handleSubmit,
1621
+ children: [/* @__PURE__ */ jsx("input", {
1622
+ ref: inputRef,
1623
+ "data-re-img-bm-input": "",
1624
+ value: inputValue,
1625
+ onFocus: (e) => e.stopPropagation(),
1626
+ onChange: (e) => setInputValue(e.target.value),
1627
+ placeholder: "Paste a link",
1628
+ type: "text"
1629
+ }), (imageHref ?? "") !== "" ? /* @__PURE__ */ jsx("button", {
1630
+ type: "button",
1631
+ "aria-label": "Remove link",
1632
+ "data-re-img-bm-unlink": "",
1633
+ onClick: handleUnlink,
1634
+ children: /* @__PURE__ */ jsx(UnlinkIcon, {})
1635
+ }) : /* @__PURE__ */ jsx("button", {
1636
+ type: "submit",
1637
+ "aria-label": "Apply link",
1638
+ "data-re-img-bm-apply": "",
1639
+ onMouseDown: (e) => e.stopPropagation(),
1640
+ children: /* @__PURE__ */ jsx(CheckIcon, {})
1641
+ })]
1538
1642
  });
1539
1643
  }
1540
1644
  //#endregion
@@ -1549,10 +1653,49 @@ function BubbleMenuImageToolbar({ children, ...rest }) {
1549
1653
  });
1550
1654
  }
1551
1655
  //#endregion
1656
+ //#region src/ui/bubble-menu/image-unlink.tsx
1657
+ function BubbleMenuImageUnlink({ className, children, onClick, onMouseDown, onLinkRemove, ...rest }) {
1658
+ const { editor } = useBubbleMenuContext();
1659
+ return /* @__PURE__ */ jsx("button", {
1660
+ ...rest,
1661
+ type: "button",
1662
+ "aria-label": "Remove link",
1663
+ "data-re-img-bm-item": "",
1664
+ "data-item": "unlink",
1665
+ className,
1666
+ onMouseDown: (e) => {
1667
+ e.preventDefault();
1668
+ onMouseDown?.(e);
1669
+ },
1670
+ onClick: (e) => {
1671
+ onClick?.(e);
1672
+ editor.chain().focus().updateAttributes("image", { href: null }).run();
1673
+ focusEditor(editor);
1674
+ onLinkRemove?.();
1675
+ },
1676
+ children: children ?? /* @__PURE__ */ jsx(UnlinkIcon, {})
1677
+ });
1678
+ }
1679
+ //#endregion
1552
1680
  //#region src/ui/bubble-menu/image-default.tsx
1553
1681
  const imagePluginKey = new PluginKey("imageBubbleMenu");
1554
- function BubbleMenuImageDefault({ excludeItems = [], placement = "top", offset, onHide, className, ...rest }) {
1555
- const hasEditLink = !excludeItems.includes("edit-link");
1682
+ function BubbleMenuImageDefaultInner({ excludeItems, validateUrl, onLinkApply, onLinkRemove }) {
1683
+ const { editor } = useBubbleMenuContext();
1684
+ const imageHref = useEditorState({
1685
+ editor,
1686
+ selector: ({ editor: e }) => e?.getAttributes("image").href ?? ""
1687
+ });
1688
+ const has = (item) => !excludeItems.includes(item);
1689
+ const hasLink = (imageHref ?? "") !== "";
1690
+ const showEditLink = has("edit-link");
1691
+ const showUnlink = has("unlink") && hasLink;
1692
+ return /* @__PURE__ */ jsxs(Fragment, { children: [(showEditLink || showUnlink) && /* @__PURE__ */ jsxs(BubbleMenuImageToolbar, { children: [showEditLink && /* @__PURE__ */ jsx(BubbleMenuImageEditLink, {}), showUnlink && /* @__PURE__ */ jsx(BubbleMenuImageUnlink, { onLinkRemove })] }), showEditLink && /* @__PURE__ */ jsx(BubbleMenuImageForm, {
1693
+ validateUrl,
1694
+ onLinkApply,
1695
+ onLinkRemove
1696
+ })] });
1697
+ }
1698
+ function BubbleMenuImageDefault({ excludeItems = [], placement = "top", offset, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
1556
1699
  return /* @__PURE__ */ jsx(RootWithDefault, {
1557
1700
  trigger: bubbleMenuTriggers.node("image"),
1558
1701
  pluginKey: imagePluginKey,
@@ -1561,7 +1704,12 @@ function BubbleMenuImageDefault({ excludeItems = [], placement = "top", offset,
1561
1704
  onHide,
1562
1705
  className,
1563
1706
  ...rest,
1564
- children: hasEditLink && /* @__PURE__ */ jsx(BubbleMenuImageToolbar, { children: /* @__PURE__ */ jsx(BubbleMenuImageEditLink, {}) })
1707
+ children: /* @__PURE__ */ jsx(BubbleMenuImageDefaultInner, {
1708
+ excludeItems,
1709
+ validateUrl,
1710
+ onLinkApply,
1711
+ onLinkRemove
1712
+ })
1565
1713
  });
1566
1714
  }
1567
1715
  //#endregion
@@ -1816,6 +1964,8 @@ const BubbleMenu$1 = Object.assign(RootWithDefault, {
1816
1964
  LinkDefault: BubbleMenuLinkDefault,
1817
1965
  ImageToolbar: BubbleMenuImageToolbar,
1818
1966
  ImageEditLink: BubbleMenuImageEditLink,
1967
+ ImageUnlink: BubbleMenuImageUnlink,
1968
+ ImageForm: BubbleMenuImageForm,
1819
1969
  ImageDefault: BubbleMenuImageDefault
1820
1970
  });
1821
1971
  //#endregion
@@ -1893,29 +2043,35 @@ function CommandList({ items, query, selectedIndex, onSelect }) {
1893
2043
  });
1894
2044
  if (query.trim().length > 0) return /* @__PURE__ */ jsx("div", {
1895
2045
  "data-re-slash-command": "",
1896
- ref: containerRef,
1897
- children: items.map((item, index) => /* @__PURE__ */ jsx(CommandItem, {
1898
- item,
1899
- onSelect: () => onSelect(index),
1900
- selected: index === selectedIndex
1901
- }, item.title))
2046
+ children: /* @__PURE__ */ jsx("div", {
2047
+ "data-re-slash-command-scroll": "",
2048
+ ref: containerRef,
2049
+ children: items.map((item, index) => /* @__PURE__ */ jsx(CommandItem, {
2050
+ item,
2051
+ onSelect: () => onSelect(index),
2052
+ selected: index === selectedIndex
2053
+ }, item.title))
2054
+ })
1902
2055
  });
1903
2056
  const groups = groupByCategory(items);
1904
2057
  let flatIndex = 0;
1905
2058
  return /* @__PURE__ */ jsx("div", {
1906
2059
  "data-re-slash-command": "",
1907
- ref: containerRef,
1908
- children: groups.map((group) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
1909
- "data-re-slash-command-category": "",
1910
- children: group.category
1911
- }), group.items.map((item) => {
1912
- const currentIndex = flatIndex++;
1913
- return /* @__PURE__ */ jsx(CommandItem, {
1914
- item,
1915
- onSelect: () => onSelect(currentIndex),
1916
- selected: currentIndex === selectedIndex
1917
- }, item.title);
1918
- })] }, group.category))
2060
+ children: /* @__PURE__ */ jsx("div", {
2061
+ "data-re-slash-command-scroll": "",
2062
+ ref: containerRef,
2063
+ children: groups.map((group) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
2064
+ "data-re-slash-command-category": "",
2065
+ children: group.category
2066
+ }), group.items.map((item) => {
2067
+ const currentIndex = flatIndex++;
2068
+ return /* @__PURE__ */ jsx(CommandItem, {
2069
+ item,
2070
+ onSelect: () => onSelect(currentIndex),
2071
+ selected: currentIndex === selectedIndex
2072
+ }, item.title);
2073
+ })] }, group.category))
2074
+ })
1919
2075
  });
1920
2076
  }
1921
2077
  //#endregion
@@ -2290,6 +2446,6 @@ function SlashCommandRoot({ items: itemsProp, filterItems: filterItemsProp, char
2290
2446
  }), document.body);
2291
2447
  }
2292
2448
  //#endregion
2293
- export { BubbleMenuAlignCenter as $, BubbleMenuImageToolbar as A, AlignCenterIcon as At, NodeSelectorRoot as B, BubbleMenuLinkDefault as C, CodeIcon as Ct, BubbleMenuLinkForm as D, BoldIcon as Dt, BubbleMenuLinkOpenLink as E, CaseUpperIcon as Et, BubbleMenuUnderline as F, BubbleMenuCode as G, BubbleMenuLinkSelector as H, bubbleMenuTriggers as I, BubbleMenuButtonForm as J, BubbleMenuButtonUnlink as K, BubbleMenuStrike as L, BubbleMenuButtonDefault as M, RootWithDefault as N, BubbleMenuLinkEditLink as O, AlignRightIcon as Ot, BubbleMenuUppercase as P, BubbleMenuAlignLeft as Q, BubbleMenuNodeSelector as R, BubbleMenuSeparator as S, Columns2Icon as St, BubbleMenuLinkToolbar as T, CheckIcon as Tt, BubbleMenuItalic as U, NodeSelectorTrigger as V, BubbleMenuItemGroup as W, BubbleMenuBold as X, BubbleMenuButtonEditLink as Y, BubbleMenuAlignRight as Z, TWO_COLUMNS as _, Heading2Icon as _t, BUTTON as a, TextIcon as at, isInsideNode as b, Columns4Icon as bt, FOUR_COLUMNS as c, SplitSquareVerticalIcon as ct, H3 as d, MousePointerIcon as dt, BubbleMenuItem as et, NUMBERED_LIST as f, ListOrderedIcon as ft, THREE_COLUMNS as g, Heading3Icon as gt, TEXT as h, ItalicIcon as ht, BULLET_LIST as i, TextQuoteIcon as it, BubbleMenuImageEditLink as j, BubbleMenuImageDefault as k, AlignLeftIcon as kt, H1 as l, Rows2Icon as lt, SECTION as m, LinkIcon as mt, filterAndRankItems as n, UnlinkIcon as nt, CODE as o, StrikethroughIcon as ot, QUOTE as p, ListIcon as pt, BubbleMenuButtonToolbar as q, scoreItem as r, UnderlineIcon as rt, DIVIDER as s, SquareCodeIcon as st, SlashCommandRoot as t, useBubbleMenuContext as tt, H2 as u, PencilIcon as ut, defaultSlashCommands as v, Heading1Icon as vt, BubbleMenuLinkUnlink as w, ChevronDownIcon as wt, BubbleMenu$1 as x, Columns3Icon as xt, isAtMaxColumnsDepth as y, ExternalLinkIcon as yt, NodeSelectorContent as z };
2449
+ export { BubbleMenuAlignRight as $, BubbleMenuImageUnlink as A, AlignRightIcon as At, BubbleMenuNodeSelector as B, BubbleMenuLinkDefault as C, Columns3Icon as Ct, BubbleMenuLinkForm as D, CheckIcon as Dt, BubbleMenuLinkOpenLink as E, ChevronDownIcon as Et, RootWithDefault as F, BubbleMenuItalic as G, NodeSelectorRoot as H, BubbleMenuUppercase as I, BubbleMenuButtonUnlink as J, BubbleMenuItemGroup as K, BubbleMenuUnderline as L, BubbleMenuImageForm as M, AlignCenterIcon as Mt, BubbleMenuImageEditLink as N, BubbleMenuLinkEditLink as O, CaseUpperIcon as Ot, BubbleMenuButtonDefault as P, BubbleMenuBold as Q, bubbleMenuTriggers as R, BubbleMenuSeparator as S, Columns4Icon as St, BubbleMenuLinkToolbar as T, CodeIcon as Tt, NodeSelectorTrigger as U, NodeSelectorContent as V, BubbleMenuLinkSelector as W, BubbleMenuButtonForm as X, BubbleMenuButtonToolbar as Y, BubbleMenuButtonEditLink as Z, TWO_COLUMNS as _, ItalicIcon as _t, BUTTON as a, UnderlineIcon as at, isInsideNode as b, Heading1Icon as bt, FOUR_COLUMNS as c, StrikethroughIcon as ct, H3 as d, Rows2Icon as dt, BubbleMenuAlignLeft as et, NUMBERED_LIST as f, PencilIcon as ft, THREE_COLUMNS as g, LinkIcon as gt, TEXT as h, ListIcon as ht, BULLET_LIST as i, UnlinkIcon as it, BubbleMenuImageToolbar as j, AlignLeftIcon as jt, BubbleMenuImageDefault as k, BoldIcon as kt, H1 as l, SquareCodeIcon as lt, SECTION as m, ListOrderedIcon as mt, filterAndRankItems as n, BubbleMenuItem as nt, CODE as o, TextQuoteIcon as ot, QUOTE as p, MousePointerIcon as pt, BubbleMenuCode as q, scoreItem as r, useBubbleMenuContext as rt, DIVIDER as s, TextIcon as st, SlashCommandRoot as t, BubbleMenuAlignCenter as tt, H2 as u, SplitSquareVerticalIcon as ut, defaultSlashCommands as v, Heading3Icon as vt, BubbleMenuLinkUnlink as w, Columns2Icon as wt, BubbleMenu$1 as x, ExternalLinkIcon as xt, isAtMaxColumnsDepth as y, Heading2Icon as yt, BubbleMenuStrike as z };
2294
2450
 
2295
- //# sourceMappingURL=root-uvdshbyT.mjs.map
2451
+ //# sourceMappingURL=root-rLoIsGE0.mjs.map