@react-email/editor 0.0.0-experimental.10 → 0.0.0-experimental.12
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 +143 -40
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +143 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +187 -7
- package/dist/index.mjs +178 -8
- package/dist/index.mjs.map +1 -1
- package/dist/ui/button-bubble-menu/button-bubble-menu.css +29 -0
- package/dist/ui/image-bubble-menu/image-bubble-menu.css +29 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2470,6 +2470,170 @@ const BubbleMenu = {
|
|
|
2470
2470
|
Default: BubbleMenuDefault
|
|
2471
2471
|
};
|
|
2472
2472
|
|
|
2473
|
+
//#endregion
|
|
2474
|
+
//#region src/ui/button-bubble-menu/context.tsx
|
|
2475
|
+
const ButtonBubbleMenuContext = react.createContext(null);
|
|
2476
|
+
function useButtonBubbleMenuContext() {
|
|
2477
|
+
const context = react.useContext(ButtonBubbleMenuContext);
|
|
2478
|
+
if (!context) throw new Error("ButtonBubbleMenu compound components must be used within <ButtonBubbleMenu.Root>");
|
|
2479
|
+
return context;
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
//#endregion
|
|
2483
|
+
//#region src/ui/button-bubble-menu/edit-link.tsx
|
|
2484
|
+
function ButtonBubbleMenuEditLink({ className, children, onClick, onMouseDown,...rest }) {
|
|
2485
|
+
const { setIsEditing } = useButtonBubbleMenuContext();
|
|
2486
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2487
|
+
...rest,
|
|
2488
|
+
type: "button",
|
|
2489
|
+
"aria-label": "Edit link",
|
|
2490
|
+
"data-re-btn-bm-item": "",
|
|
2491
|
+
"data-item": "edit-link",
|
|
2492
|
+
className,
|
|
2493
|
+
onMouseDown: (e) => {
|
|
2494
|
+
e.preventDefault();
|
|
2495
|
+
onMouseDown?.(e);
|
|
2496
|
+
},
|
|
2497
|
+
onClick: (e) => {
|
|
2498
|
+
onClick?.(e);
|
|
2499
|
+
setIsEditing(true);
|
|
2500
|
+
},
|
|
2501
|
+
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LinkIcon, {})
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
//#endregion
|
|
2506
|
+
//#region src/ui/button-bubble-menu/root.tsx
|
|
2507
|
+
function ButtonBubbleMenuRoot({ onHide, placement = "top", offset = 8, className, children }) {
|
|
2508
|
+
const { editor } = (0, __tiptap_react.useCurrentEditor)();
|
|
2509
|
+
const [isEditing, setIsEditing] = react.useState(false);
|
|
2510
|
+
if (!editor) return null;
|
|
2511
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tiptap_react_menus.BubbleMenu, {
|
|
2512
|
+
editor,
|
|
2513
|
+
"data-re-btn-bm": "",
|
|
2514
|
+
shouldShow: ({ editor: e, view }) => e.isActive("button") && !view.dom.classList.contains("dragging"),
|
|
2515
|
+
options: {
|
|
2516
|
+
placement,
|
|
2517
|
+
offset,
|
|
2518
|
+
onHide: () => {
|
|
2519
|
+
setIsEditing(false);
|
|
2520
|
+
onHide?.();
|
|
2521
|
+
}
|
|
2522
|
+
},
|
|
2523
|
+
className,
|
|
2524
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ButtonBubbleMenuContext.Provider, {
|
|
2525
|
+
value: {
|
|
2526
|
+
editor,
|
|
2527
|
+
isEditing,
|
|
2528
|
+
setIsEditing
|
|
2529
|
+
},
|
|
2530
|
+
children
|
|
2531
|
+
})
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
//#endregion
|
|
2536
|
+
//#region src/ui/button-bubble-menu/toolbar.tsx
|
|
2537
|
+
function ButtonBubbleMenuToolbar({ children,...rest }) {
|
|
2538
|
+
const { isEditing } = useButtonBubbleMenuContext();
|
|
2539
|
+
if (isEditing) return null;
|
|
2540
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2541
|
+
"data-re-btn-bm-toolbar": "",
|
|
2542
|
+
...rest,
|
|
2543
|
+
children
|
|
2544
|
+
});
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
//#endregion
|
|
2548
|
+
//#region src/ui/button-bubble-menu/index.ts
|
|
2549
|
+
const ButtonBubbleMenu = {
|
|
2550
|
+
Root: ButtonBubbleMenuRoot,
|
|
2551
|
+
Toolbar: ButtonBubbleMenuToolbar,
|
|
2552
|
+
EditLink: ButtonBubbleMenuEditLink
|
|
2553
|
+
};
|
|
2554
|
+
|
|
2555
|
+
//#endregion
|
|
2556
|
+
//#region src/ui/image-bubble-menu/context.tsx
|
|
2557
|
+
const ImageBubbleMenuContext = react.createContext(null);
|
|
2558
|
+
function useImageBubbleMenuContext() {
|
|
2559
|
+
const context = react.useContext(ImageBubbleMenuContext);
|
|
2560
|
+
if (!context) throw new Error("ImageBubbleMenu compound components must be used within <ImageBubbleMenu.Root>");
|
|
2561
|
+
return context;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
//#endregion
|
|
2565
|
+
//#region src/ui/image-bubble-menu/edit-link.tsx
|
|
2566
|
+
function ImageBubbleMenuEditLink({ className, children, onClick, onMouseDown,...rest }) {
|
|
2567
|
+
const { setIsEditing } = useImageBubbleMenuContext();
|
|
2568
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2569
|
+
...rest,
|
|
2570
|
+
type: "button",
|
|
2571
|
+
"aria-label": "Edit link",
|
|
2572
|
+
"data-re-img-bm-item": "",
|
|
2573
|
+
"data-item": "edit-link",
|
|
2574
|
+
className,
|
|
2575
|
+
onMouseDown: (e) => {
|
|
2576
|
+
e.preventDefault();
|
|
2577
|
+
onMouseDown?.(e);
|
|
2578
|
+
},
|
|
2579
|
+
onClick: (e) => {
|
|
2580
|
+
onClick?.(e);
|
|
2581
|
+
setIsEditing(true);
|
|
2582
|
+
},
|
|
2583
|
+
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LinkIcon, {})
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
//#endregion
|
|
2588
|
+
//#region src/ui/image-bubble-menu/root.tsx
|
|
2589
|
+
function ImageBubbleMenuRoot({ onHide, placement = "top", offset = 8, className, children }) {
|
|
2590
|
+
const { editor } = (0, __tiptap_react.useCurrentEditor)();
|
|
2591
|
+
const [isEditing, setIsEditing] = react.useState(false);
|
|
2592
|
+
if (!editor) return null;
|
|
2593
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tiptap_react_menus.BubbleMenu, {
|
|
2594
|
+
editor,
|
|
2595
|
+
"data-re-img-bm": "",
|
|
2596
|
+
shouldShow: ({ editor: e, view }) => e.isActive("image") && !view.dom.classList.contains("dragging"),
|
|
2597
|
+
options: {
|
|
2598
|
+
placement,
|
|
2599
|
+
offset,
|
|
2600
|
+
onHide: () => {
|
|
2601
|
+
setIsEditing(false);
|
|
2602
|
+
onHide?.();
|
|
2603
|
+
}
|
|
2604
|
+
},
|
|
2605
|
+
className,
|
|
2606
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageBubbleMenuContext.Provider, {
|
|
2607
|
+
value: {
|
|
2608
|
+
editor,
|
|
2609
|
+
isEditing,
|
|
2610
|
+
setIsEditing
|
|
2611
|
+
},
|
|
2612
|
+
children
|
|
2613
|
+
})
|
|
2614
|
+
});
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
//#endregion
|
|
2618
|
+
//#region src/ui/image-bubble-menu/toolbar.tsx
|
|
2619
|
+
function ImageBubbleMenuToolbar({ children,...rest }) {
|
|
2620
|
+
const { isEditing } = useImageBubbleMenuContext();
|
|
2621
|
+
if (isEditing) return null;
|
|
2622
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2623
|
+
"data-re-img-bm-toolbar": "",
|
|
2624
|
+
...rest,
|
|
2625
|
+
children
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
//#endregion
|
|
2630
|
+
//#region src/ui/image-bubble-menu/index.ts
|
|
2631
|
+
const ImageBubbleMenu = {
|
|
2632
|
+
Root: ImageBubbleMenuRoot,
|
|
2633
|
+
Toolbar: ImageBubbleMenuToolbar,
|
|
2634
|
+
EditLink: ImageBubbleMenuEditLink
|
|
2635
|
+
};
|
|
2636
|
+
|
|
2473
2637
|
//#endregion
|
|
2474
2638
|
//#region src/ui/link-bubble-menu/context.tsx
|
|
2475
2639
|
const LinkBubbleMenuContext = react.createContext(null);
|
|
@@ -2481,7 +2645,7 @@ function useLinkBubbleMenuContext() {
|
|
|
2481
2645
|
|
|
2482
2646
|
//#endregion
|
|
2483
2647
|
//#region src/ui/link-bubble-menu/edit-link.tsx
|
|
2484
|
-
function LinkBubbleMenuEditLink({ className, children, onClick,...rest }) {
|
|
2648
|
+
function LinkBubbleMenuEditLink({ className, children, onClick, onMouseDown,...rest }) {
|
|
2485
2649
|
const { setIsEditing } = useLinkBubbleMenuContext();
|
|
2486
2650
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2487
2651
|
type: "button",
|
|
@@ -2489,7 +2653,10 @@ function LinkBubbleMenuEditLink({ className, children, onClick,...rest }) {
|
|
|
2489
2653
|
"data-re-link-bm-item": "",
|
|
2490
2654
|
"data-item": "edit-link",
|
|
2491
2655
|
className,
|
|
2492
|
-
onMouseDown: (e) =>
|
|
2656
|
+
onMouseDown: (e) => {
|
|
2657
|
+
e.preventDefault();
|
|
2658
|
+
onMouseDown?.(e);
|
|
2659
|
+
},
|
|
2493
2660
|
onClick: (e) => {
|
|
2494
2661
|
onClick?.(e);
|
|
2495
2662
|
setIsEditing(true);
|
|
@@ -2623,7 +2790,7 @@ function LinkBubbleMenuOpenLink({ className, children,...rest }) {
|
|
|
2623
2790
|
|
|
2624
2791
|
//#endregion
|
|
2625
2792
|
//#region src/ui/link-bubble-menu/root.tsx
|
|
2626
|
-
function LinkBubbleMenuRoot({ onHide, placement = "
|
|
2793
|
+
function LinkBubbleMenuRoot({ onHide, placement = "top", offset = 8, className, children }) {
|
|
2627
2794
|
const { editor } = (0, __tiptap_react.useCurrentEditor)();
|
|
2628
2795
|
const [isEditing, setIsEditing] = react.useState(false);
|
|
2629
2796
|
const linkHref = (0, __tiptap_react.useEditorState)({
|
|
@@ -2658,19 +2825,19 @@ function LinkBubbleMenuRoot({ onHide, placement = "bottom", offset = 8, classNam
|
|
|
2658
2825
|
|
|
2659
2826
|
//#endregion
|
|
2660
2827
|
//#region src/ui/link-bubble-menu/toolbar.tsx
|
|
2661
|
-
function LinkBubbleMenuToolbar({
|
|
2828
|
+
function LinkBubbleMenuToolbar({ children,...rest }) {
|
|
2662
2829
|
const { isEditing } = useLinkBubbleMenuContext();
|
|
2663
2830
|
if (isEditing) return null;
|
|
2664
2831
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2665
2832
|
"data-re-link-bm-toolbar": "",
|
|
2666
|
-
|
|
2833
|
+
...rest,
|
|
2667
2834
|
children
|
|
2668
2835
|
});
|
|
2669
2836
|
}
|
|
2670
2837
|
|
|
2671
2838
|
//#endregion
|
|
2672
2839
|
//#region src/ui/link-bubble-menu/unlink.tsx
|
|
2673
|
-
function LinkBubbleMenuUnlink({ className, children, onClick,...rest }) {
|
|
2840
|
+
function LinkBubbleMenuUnlink({ className, children, onClick, onMouseDown,...rest }) {
|
|
2674
2841
|
const { editor } = useLinkBubbleMenuContext();
|
|
2675
2842
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2676
2843
|
type: "button",
|
|
@@ -2678,7 +2845,10 @@ function LinkBubbleMenuUnlink({ className, children, onClick,...rest }) {
|
|
|
2678
2845
|
"data-re-link-bm-item": "",
|
|
2679
2846
|
"data-item": "unlink",
|
|
2680
2847
|
className,
|
|
2681
|
-
onMouseDown: (e) =>
|
|
2848
|
+
onMouseDown: (e) => {
|
|
2849
|
+
e.preventDefault();
|
|
2850
|
+
onMouseDown?.(e);
|
|
2851
|
+
},
|
|
2682
2852
|
onClick: (e) => {
|
|
2683
2853
|
onClick?.(e);
|
|
2684
2854
|
editor.chain().focus().unsetLink().run();
|
|
@@ -2721,6 +2891,10 @@ exports.BubbleMenuStrike = BubbleMenuStrike;
|
|
|
2721
2891
|
exports.BubbleMenuUnderline = BubbleMenuUnderline;
|
|
2722
2892
|
exports.BubbleMenuUppercase = BubbleMenuUppercase;
|
|
2723
2893
|
exports.Button = Button;
|
|
2894
|
+
exports.ButtonBubbleMenu = ButtonBubbleMenu;
|
|
2895
|
+
exports.ButtonBubbleMenuEditLink = ButtonBubbleMenuEditLink;
|
|
2896
|
+
exports.ButtonBubbleMenuRoot = ButtonBubbleMenuRoot;
|
|
2897
|
+
exports.ButtonBubbleMenuToolbar = ButtonBubbleMenuToolbar;
|
|
2724
2898
|
exports.COLUMN_PARENT_TYPES = COLUMN_PARENT_TYPES;
|
|
2725
2899
|
exports.ClassAttribute = ClassAttribute;
|
|
2726
2900
|
exports.CodeBlockPrism = CodeBlockPrism;
|
|
@@ -2728,6 +2902,10 @@ exports.ColumnsColumn = ColumnsColumn;
|
|
|
2728
2902
|
exports.Div = Div;
|
|
2729
2903
|
exports.EmailNode = EmailNode;
|
|
2730
2904
|
exports.FourColumns = FourColumns;
|
|
2905
|
+
exports.ImageBubbleMenu = ImageBubbleMenu;
|
|
2906
|
+
exports.ImageBubbleMenuEditLink = ImageBubbleMenuEditLink;
|
|
2907
|
+
exports.ImageBubbleMenuRoot = ImageBubbleMenuRoot;
|
|
2908
|
+
exports.ImageBubbleMenuToolbar = ImageBubbleMenuToolbar;
|
|
2731
2909
|
exports.LinkBubbleMenu = LinkBubbleMenu;
|
|
2732
2910
|
exports.LinkBubbleMenuEditLink = LinkBubbleMenuEditLink;
|
|
2733
2911
|
exports.LinkBubbleMenuForm = LinkBubbleMenuForm;
|
|
@@ -2758,4 +2936,6 @@ exports.editorEventBus = editorEventBus;
|
|
|
2758
2936
|
exports.getColumnsDepth = getColumnsDepth;
|
|
2759
2937
|
exports.processStylesForUnlink = processStylesForUnlink;
|
|
2760
2938
|
exports.setTextAlignment = setTextAlignment;
|
|
2939
|
+
exports.useButtonBubbleMenuContext = useButtonBubbleMenuContext;
|
|
2940
|
+
exports.useImageBubbleMenuContext = useImageBubbleMenuContext;
|
|
2761
2941
|
exports.useLinkBubbleMenuContext = useLinkBubbleMenuContext;
|
package/dist/index.mjs
CHANGED
|
@@ -2433,6 +2433,170 @@ const BubbleMenu = {
|
|
|
2433
2433
|
Default: BubbleMenuDefault
|
|
2434
2434
|
};
|
|
2435
2435
|
|
|
2436
|
+
//#endregion
|
|
2437
|
+
//#region src/ui/button-bubble-menu/context.tsx
|
|
2438
|
+
const ButtonBubbleMenuContext = React.createContext(null);
|
|
2439
|
+
function useButtonBubbleMenuContext() {
|
|
2440
|
+
const context = React.useContext(ButtonBubbleMenuContext);
|
|
2441
|
+
if (!context) throw new Error("ButtonBubbleMenu compound components must be used within <ButtonBubbleMenu.Root>");
|
|
2442
|
+
return context;
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
//#endregion
|
|
2446
|
+
//#region src/ui/button-bubble-menu/edit-link.tsx
|
|
2447
|
+
function ButtonBubbleMenuEditLink({ className, children, onClick, onMouseDown,...rest }) {
|
|
2448
|
+
const { setIsEditing } = useButtonBubbleMenuContext();
|
|
2449
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2450
|
+
...rest,
|
|
2451
|
+
type: "button",
|
|
2452
|
+
"aria-label": "Edit link",
|
|
2453
|
+
"data-re-btn-bm-item": "",
|
|
2454
|
+
"data-item": "edit-link",
|
|
2455
|
+
className,
|
|
2456
|
+
onMouseDown: (e) => {
|
|
2457
|
+
e.preventDefault();
|
|
2458
|
+
onMouseDown?.(e);
|
|
2459
|
+
},
|
|
2460
|
+
onClick: (e) => {
|
|
2461
|
+
onClick?.(e);
|
|
2462
|
+
setIsEditing(true);
|
|
2463
|
+
},
|
|
2464
|
+
children: children ?? /* @__PURE__ */ jsx(LinkIcon, {})
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
//#endregion
|
|
2469
|
+
//#region src/ui/button-bubble-menu/root.tsx
|
|
2470
|
+
function ButtonBubbleMenuRoot({ onHide, placement = "top", offset = 8, className, children }) {
|
|
2471
|
+
const { editor } = useCurrentEditor();
|
|
2472
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
2473
|
+
if (!editor) return null;
|
|
2474
|
+
return /* @__PURE__ */ jsx(BubbleMenu$1, {
|
|
2475
|
+
editor,
|
|
2476
|
+
"data-re-btn-bm": "",
|
|
2477
|
+
shouldShow: ({ editor: e, view }) => e.isActive("button") && !view.dom.classList.contains("dragging"),
|
|
2478
|
+
options: {
|
|
2479
|
+
placement,
|
|
2480
|
+
offset,
|
|
2481
|
+
onHide: () => {
|
|
2482
|
+
setIsEditing(false);
|
|
2483
|
+
onHide?.();
|
|
2484
|
+
}
|
|
2485
|
+
},
|
|
2486
|
+
className,
|
|
2487
|
+
children: /* @__PURE__ */ jsx(ButtonBubbleMenuContext.Provider, {
|
|
2488
|
+
value: {
|
|
2489
|
+
editor,
|
|
2490
|
+
isEditing,
|
|
2491
|
+
setIsEditing
|
|
2492
|
+
},
|
|
2493
|
+
children
|
|
2494
|
+
})
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
//#endregion
|
|
2499
|
+
//#region src/ui/button-bubble-menu/toolbar.tsx
|
|
2500
|
+
function ButtonBubbleMenuToolbar({ children,...rest }) {
|
|
2501
|
+
const { isEditing } = useButtonBubbleMenuContext();
|
|
2502
|
+
if (isEditing) return null;
|
|
2503
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2504
|
+
"data-re-btn-bm-toolbar": "",
|
|
2505
|
+
...rest,
|
|
2506
|
+
children
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
//#endregion
|
|
2511
|
+
//#region src/ui/button-bubble-menu/index.ts
|
|
2512
|
+
const ButtonBubbleMenu = {
|
|
2513
|
+
Root: ButtonBubbleMenuRoot,
|
|
2514
|
+
Toolbar: ButtonBubbleMenuToolbar,
|
|
2515
|
+
EditLink: ButtonBubbleMenuEditLink
|
|
2516
|
+
};
|
|
2517
|
+
|
|
2518
|
+
//#endregion
|
|
2519
|
+
//#region src/ui/image-bubble-menu/context.tsx
|
|
2520
|
+
const ImageBubbleMenuContext = React.createContext(null);
|
|
2521
|
+
function useImageBubbleMenuContext() {
|
|
2522
|
+
const context = React.useContext(ImageBubbleMenuContext);
|
|
2523
|
+
if (!context) throw new Error("ImageBubbleMenu compound components must be used within <ImageBubbleMenu.Root>");
|
|
2524
|
+
return context;
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
//#endregion
|
|
2528
|
+
//#region src/ui/image-bubble-menu/edit-link.tsx
|
|
2529
|
+
function ImageBubbleMenuEditLink({ className, children, onClick, onMouseDown,...rest }) {
|
|
2530
|
+
const { setIsEditing } = useImageBubbleMenuContext();
|
|
2531
|
+
return /* @__PURE__ */ jsx("button", {
|
|
2532
|
+
...rest,
|
|
2533
|
+
type: "button",
|
|
2534
|
+
"aria-label": "Edit link",
|
|
2535
|
+
"data-re-img-bm-item": "",
|
|
2536
|
+
"data-item": "edit-link",
|
|
2537
|
+
className,
|
|
2538
|
+
onMouseDown: (e) => {
|
|
2539
|
+
e.preventDefault();
|
|
2540
|
+
onMouseDown?.(e);
|
|
2541
|
+
},
|
|
2542
|
+
onClick: (e) => {
|
|
2543
|
+
onClick?.(e);
|
|
2544
|
+
setIsEditing(true);
|
|
2545
|
+
},
|
|
2546
|
+
children: children ?? /* @__PURE__ */ jsx(LinkIcon, {})
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
//#endregion
|
|
2551
|
+
//#region src/ui/image-bubble-menu/root.tsx
|
|
2552
|
+
function ImageBubbleMenuRoot({ onHide, placement = "top", offset = 8, className, children }) {
|
|
2553
|
+
const { editor } = useCurrentEditor();
|
|
2554
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
2555
|
+
if (!editor) return null;
|
|
2556
|
+
return /* @__PURE__ */ jsx(BubbleMenu$1, {
|
|
2557
|
+
editor,
|
|
2558
|
+
"data-re-img-bm": "",
|
|
2559
|
+
shouldShow: ({ editor: e, view }) => e.isActive("image") && !view.dom.classList.contains("dragging"),
|
|
2560
|
+
options: {
|
|
2561
|
+
placement,
|
|
2562
|
+
offset,
|
|
2563
|
+
onHide: () => {
|
|
2564
|
+
setIsEditing(false);
|
|
2565
|
+
onHide?.();
|
|
2566
|
+
}
|
|
2567
|
+
},
|
|
2568
|
+
className,
|
|
2569
|
+
children: /* @__PURE__ */ jsx(ImageBubbleMenuContext.Provider, {
|
|
2570
|
+
value: {
|
|
2571
|
+
editor,
|
|
2572
|
+
isEditing,
|
|
2573
|
+
setIsEditing
|
|
2574
|
+
},
|
|
2575
|
+
children
|
|
2576
|
+
})
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
//#endregion
|
|
2581
|
+
//#region src/ui/image-bubble-menu/toolbar.tsx
|
|
2582
|
+
function ImageBubbleMenuToolbar({ children,...rest }) {
|
|
2583
|
+
const { isEditing } = useImageBubbleMenuContext();
|
|
2584
|
+
if (isEditing) return null;
|
|
2585
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2586
|
+
"data-re-img-bm-toolbar": "",
|
|
2587
|
+
...rest,
|
|
2588
|
+
children
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
//#endregion
|
|
2593
|
+
//#region src/ui/image-bubble-menu/index.ts
|
|
2594
|
+
const ImageBubbleMenu = {
|
|
2595
|
+
Root: ImageBubbleMenuRoot,
|
|
2596
|
+
Toolbar: ImageBubbleMenuToolbar,
|
|
2597
|
+
EditLink: ImageBubbleMenuEditLink
|
|
2598
|
+
};
|
|
2599
|
+
|
|
2436
2600
|
//#endregion
|
|
2437
2601
|
//#region src/ui/link-bubble-menu/context.tsx
|
|
2438
2602
|
const LinkBubbleMenuContext = React.createContext(null);
|
|
@@ -2444,7 +2608,7 @@ function useLinkBubbleMenuContext() {
|
|
|
2444
2608
|
|
|
2445
2609
|
//#endregion
|
|
2446
2610
|
//#region src/ui/link-bubble-menu/edit-link.tsx
|
|
2447
|
-
function LinkBubbleMenuEditLink({ className, children, onClick,...rest }) {
|
|
2611
|
+
function LinkBubbleMenuEditLink({ className, children, onClick, onMouseDown,...rest }) {
|
|
2448
2612
|
const { setIsEditing } = useLinkBubbleMenuContext();
|
|
2449
2613
|
return /* @__PURE__ */ jsx("button", {
|
|
2450
2614
|
type: "button",
|
|
@@ -2452,7 +2616,10 @@ function LinkBubbleMenuEditLink({ className, children, onClick,...rest }) {
|
|
|
2452
2616
|
"data-re-link-bm-item": "",
|
|
2453
2617
|
"data-item": "edit-link",
|
|
2454
2618
|
className,
|
|
2455
|
-
onMouseDown: (e) =>
|
|
2619
|
+
onMouseDown: (e) => {
|
|
2620
|
+
e.preventDefault();
|
|
2621
|
+
onMouseDown?.(e);
|
|
2622
|
+
},
|
|
2456
2623
|
onClick: (e) => {
|
|
2457
2624
|
onClick?.(e);
|
|
2458
2625
|
setIsEditing(true);
|
|
@@ -2586,7 +2753,7 @@ function LinkBubbleMenuOpenLink({ className, children,...rest }) {
|
|
|
2586
2753
|
|
|
2587
2754
|
//#endregion
|
|
2588
2755
|
//#region src/ui/link-bubble-menu/root.tsx
|
|
2589
|
-
function LinkBubbleMenuRoot({ onHide, placement = "
|
|
2756
|
+
function LinkBubbleMenuRoot({ onHide, placement = "top", offset = 8, className, children }) {
|
|
2590
2757
|
const { editor } = useCurrentEditor();
|
|
2591
2758
|
const [isEditing, setIsEditing] = React.useState(false);
|
|
2592
2759
|
const linkHref = useEditorState({
|
|
@@ -2621,19 +2788,19 @@ function LinkBubbleMenuRoot({ onHide, placement = "bottom", offset = 8, classNam
|
|
|
2621
2788
|
|
|
2622
2789
|
//#endregion
|
|
2623
2790
|
//#region src/ui/link-bubble-menu/toolbar.tsx
|
|
2624
|
-
function LinkBubbleMenuToolbar({
|
|
2791
|
+
function LinkBubbleMenuToolbar({ children,...rest }) {
|
|
2625
2792
|
const { isEditing } = useLinkBubbleMenuContext();
|
|
2626
2793
|
if (isEditing) return null;
|
|
2627
2794
|
return /* @__PURE__ */ jsx("div", {
|
|
2628
2795
|
"data-re-link-bm-toolbar": "",
|
|
2629
|
-
|
|
2796
|
+
...rest,
|
|
2630
2797
|
children
|
|
2631
2798
|
});
|
|
2632
2799
|
}
|
|
2633
2800
|
|
|
2634
2801
|
//#endregion
|
|
2635
2802
|
//#region src/ui/link-bubble-menu/unlink.tsx
|
|
2636
|
-
function LinkBubbleMenuUnlink({ className, children, onClick,...rest }) {
|
|
2803
|
+
function LinkBubbleMenuUnlink({ className, children, onClick, onMouseDown,...rest }) {
|
|
2637
2804
|
const { editor } = useLinkBubbleMenuContext();
|
|
2638
2805
|
return /* @__PURE__ */ jsx("button", {
|
|
2639
2806
|
type: "button",
|
|
@@ -2641,7 +2808,10 @@ function LinkBubbleMenuUnlink({ className, children, onClick,...rest }) {
|
|
|
2641
2808
|
"data-re-link-bm-item": "",
|
|
2642
2809
|
"data-item": "unlink",
|
|
2643
2810
|
className,
|
|
2644
|
-
onMouseDown: (e) =>
|
|
2811
|
+
onMouseDown: (e) => {
|
|
2812
|
+
e.preventDefault();
|
|
2813
|
+
onMouseDown?.(e);
|
|
2814
|
+
},
|
|
2645
2815
|
onClick: (e) => {
|
|
2646
2816
|
onClick?.(e);
|
|
2647
2817
|
editor.chain().focus().unsetLink().run();
|
|
@@ -2663,5 +2833,5 @@ const LinkBubbleMenu = {
|
|
|
2663
2833
|
};
|
|
2664
2834
|
|
|
2665
2835
|
//#endregion
|
|
2666
|
-
export { AlignmentAttribute, Body, Bold, BubbleMenu, BubbleMenuAlignCenter, BubbleMenuAlignLeft, BubbleMenuAlignRight, BubbleMenuBold, BubbleMenuCode, BubbleMenuDefault, BubbleMenuItalic, BubbleMenuItem, BubbleMenuItemGroup, BubbleMenuLinkSelector, BubbleMenuNodeSelector, BubbleMenuRoot, BubbleMenuSeparator, BubbleMenuStrike, BubbleMenuUnderline, BubbleMenuUppercase, Button, COLUMN_PARENT_TYPES, ClassAttribute, CodeBlockPrism, ColumnsColumn, Div, EmailNode, FourColumns, LinkBubbleMenu, LinkBubbleMenuEditLink, LinkBubbleMenuForm, LinkBubbleMenuOpenLink, LinkBubbleMenuRoot, LinkBubbleMenuToolbar, LinkBubbleMenuUnlink, MAX_COLUMNS_DEPTH, MaxNesting, NodeSelectorContent, NodeSelectorRoot, NodeSelectorTrigger, Placeholder, PreservedStyle, PreviewText, Section, StyleAttribute, Sup, Table, TableCell, TableHeader, TableRow, ThreeColumns, TwoColumns, Uppercase, coreExtensions, editorEventBus, getColumnsDepth, processStylesForUnlink, setTextAlignment, useLinkBubbleMenuContext };
|
|
2836
|
+
export { AlignmentAttribute, Body, Bold, BubbleMenu, BubbleMenuAlignCenter, BubbleMenuAlignLeft, BubbleMenuAlignRight, BubbleMenuBold, BubbleMenuCode, BubbleMenuDefault, BubbleMenuItalic, BubbleMenuItem, BubbleMenuItemGroup, BubbleMenuLinkSelector, BubbleMenuNodeSelector, BubbleMenuRoot, BubbleMenuSeparator, BubbleMenuStrike, BubbleMenuUnderline, BubbleMenuUppercase, Button, ButtonBubbleMenu, ButtonBubbleMenuEditLink, ButtonBubbleMenuRoot, ButtonBubbleMenuToolbar, COLUMN_PARENT_TYPES, ClassAttribute, CodeBlockPrism, ColumnsColumn, Div, EmailNode, FourColumns, ImageBubbleMenu, ImageBubbleMenuEditLink, ImageBubbleMenuRoot, ImageBubbleMenuToolbar, LinkBubbleMenu, LinkBubbleMenuEditLink, LinkBubbleMenuForm, LinkBubbleMenuOpenLink, LinkBubbleMenuRoot, LinkBubbleMenuToolbar, LinkBubbleMenuUnlink, MAX_COLUMNS_DEPTH, MaxNesting, NodeSelectorContent, NodeSelectorRoot, NodeSelectorTrigger, Placeholder, PreservedStyle, PreviewText, Section, StyleAttribute, Sup, Table, TableCell, TableHeader, TableRow, ThreeColumns, TwoColumns, Uppercase, coreExtensions, editorEventBus, getColumnsDepth, processStylesForUnlink, setTextAlignment, useButtonBubbleMenuContext, useImageBubbleMenuContext, useLinkBubbleMenuContext };
|
|
2667
2837
|
//# sourceMappingURL=index.mjs.map
|