@daisychainapp/maily-to-core 0.4.4 → 0.4.5
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/blocks/index.cjs +12 -0
- package/dist/blocks/index.cjs.map +1 -1
- package/dist/blocks/index.mjs +12 -0
- package/dist/blocks/index.mjs.map +1 -1
- package/dist/extensions/index.cjs +2945 -2950
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +6 -3
- package/dist/extensions/index.d.ts +6 -3
- package/dist/extensions/index.mjs +3023 -3029
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +1205 -1145
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +161 -3
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +879 -819
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -85,8 +85,8 @@ __export(src_exports, {
|
|
|
85
85
|
module.exports = __toCommonJS(src_exports);
|
|
86
86
|
|
|
87
87
|
// src/editor/index.tsx
|
|
88
|
-
var
|
|
89
|
-
var
|
|
88
|
+
var import_react64 = require("@tiptap/react");
|
|
89
|
+
var import_react65 = require("react");
|
|
90
90
|
|
|
91
91
|
// src/editor/components/column-menu/columns-bubble-menu.tsx
|
|
92
92
|
var import_react8 = require("@tiptap/react");
|
|
@@ -3478,7 +3478,10 @@ function Divider(props) {
|
|
|
3478
3478
|
var React = __toESM(require("react"), 1);
|
|
3479
3479
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
3480
3480
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
3481
|
-
var TooltipProvider =
|
|
3481
|
+
var TooltipProvider = (_a) => {
|
|
3482
|
+
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
3483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TooltipPrimitive.Provider, __spreadProps(__spreadValues({ delayDuration: 80, skipDelayDuration: 120 }, props), { children }));
|
|
3484
|
+
};
|
|
3482
3485
|
var Tooltip = TooltipPrimitive.Root;
|
|
3483
3486
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
3484
3487
|
var TooltipContent = React.forwardRef((_a, ref) => {
|
|
@@ -3559,6 +3562,7 @@ function BubbleMenuButton(item) {
|
|
|
3559
3562
|
}, item.command ? { onClick: item.command } : {}), {
|
|
3560
3563
|
"data-state": isActive,
|
|
3561
3564
|
className: cn(
|
|
3565
|
+
"menu-option",
|
|
3562
3566
|
isActive && "menu-active-option",
|
|
3563
3567
|
"mly:size-7! mly:px-2.5 mly:disabled:cursor-not-allowed",
|
|
3564
3568
|
item == null ? void 0 : item.className
|
|
@@ -3986,11 +3990,11 @@ function ColumnsWidthConfig(props) {
|
|
|
3986
3990
|
onColumnWidthChange
|
|
3987
3991
|
} = props;
|
|
3988
3992
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Popover, { children: [
|
|
3989
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverTrigger, { className: "mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.SlidersVertical, { className: "mly:h-3 mly:w-3 mly:stroke-[2.5]" }) }),
|
|
3993
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverTrigger, { className: "menu-option mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.SlidersVertical, { className: "mly:h-3 mly:w-3 mly:stroke-[2.5]" }) }),
|
|
3990
3994
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3991
3995
|
PopoverContent,
|
|
3992
3996
|
{
|
|
3993
|
-
className: "mly:w-[300px] mly:rounded-lg mly:p-0.5!",
|
|
3997
|
+
className: "menu-dropdown-surface mly:w-[300px] mly:rounded-lg mly:p-0.5!",
|
|
3994
3998
|
side: "top",
|
|
3995
3999
|
sideOffset: 8,
|
|
3996
4000
|
align: "center",
|
|
@@ -4069,8 +4073,8 @@ function SwitchButton(props) {
|
|
|
4069
4073
|
"button",
|
|
4070
4074
|
{
|
|
4071
4075
|
className: cn(
|
|
4072
|
-
"mly:flex mly:h-7 mly:items-center mly:gap-1 mly:rounded-md mly:px-2 mly:text-sm mly:text-gray-500 mly:hover:bg-soft-gray mly:hover:text-midnight-gray",
|
|
4073
|
-
isActive && "mly:bg-soft-gray mly:text-midnight-gray"
|
|
4076
|
+
"menu-option mly:flex mly:h-7 mly:items-center mly:gap-1 mly:rounded-md mly:px-2 mly:text-sm mly:text-gray-500 mly:hover:bg-soft-gray mly:hover:text-midnight-gray",
|
|
4077
|
+
isActive && "menu-active-option mly:bg-soft-gray mly:text-midnight-gray"
|
|
4074
4078
|
),
|
|
4075
4079
|
onClick,
|
|
4076
4080
|
children
|
|
@@ -4095,7 +4099,7 @@ function Select(props) {
|
|
|
4095
4099
|
placeholder
|
|
4096
4100
|
} = props;
|
|
4097
4101
|
const selectId = `mly${(0, import_react7.useId)()}`;
|
|
4098
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mly:relative mly:inline-flex mly:h-7 mly:items-center mly:overflow-hidden", children: [
|
|
4102
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "menu-select-wrap mly:relative mly:inline-flex mly:h-7 mly:items-center mly:overflow-hidden", children: [
|
|
4099
4103
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { htmlFor: selectId, className: "mly:sr-only", children: label }),
|
|
4100
4104
|
Icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mly:pointer-events-none mly:absolute mly:left-2 mly:top-1/2 mly:z-20 mly:flex mly:h-7 mly:-translate-y-1/2 mly:items-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: cn("mly:size-3.5", iconClassName) }) }),
|
|
4101
4105
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
@@ -4103,7 +4107,7 @@ function Select(props) {
|
|
|
4103
4107
|
{
|
|
4104
4108
|
id: selectId,
|
|
4105
4109
|
className: cn(
|
|
4106
|
-
"mly-select-padding mly:flex mly:h-7 mly:max-w-max mly:appearance-none mly:items-center mly:rounded-md mly:bg-white mly:text-sm mly:leading-none mly:text-midnight-gray mly:ring-offset-white mly:transition-colors mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2 mly:active:bg-soft-gray",
|
|
4110
|
+
"menu-option menu-select-control mly-select-padding mly:flex mly:h-7 mly:max-w-max mly:appearance-none mly:items-center mly:rounded-md mly:bg-white mly:text-sm mly:leading-none mly:text-midnight-gray mly:ring-offset-white mly:transition-colors mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2 mly:active:bg-soft-gray",
|
|
4107
4111
|
!!Icon && "mly:pl-[25px]",
|
|
4108
4112
|
className
|
|
4109
4113
|
),
|
|
@@ -4820,14 +4824,14 @@ function ContentMenu(props) {
|
|
|
4820
4824
|
},
|
|
4821
4825
|
onNodeChange: handleNodeChange,
|
|
4822
4826
|
className: cn(editor.isEditable ? "mly:visible" : "mly:hidden"),
|
|
4823
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mly:flex mly:items-center mly:pr-1.5", children: [
|
|
4827
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "menu-content-actions-offset mly:flex mly:items-center mly:pr-1.5", children: [
|
|
4824
4828
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tooltip, { children: [
|
|
4825
4829
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4826
4830
|
BaseButton,
|
|
4827
4831
|
{
|
|
4828
4832
|
variant: "ghost",
|
|
4829
4833
|
size: "icon",
|
|
4830
|
-
className: "mly:size-5! mly:cursor-grab mly:text-gray-500 mly:hover:text-black",
|
|
4834
|
+
className: "menu-icon-button mly:size-5! mly:cursor-grab mly:text-gray-500 mly:hover:text-black",
|
|
4831
4835
|
onClick: handleAddNewNode,
|
|
4832
4836
|
type: "button",
|
|
4833
4837
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Plus, { className: "mly:size-3.5 mly:shrink-0" })
|
|
@@ -4850,7 +4854,7 @@ function ContentMenu(props) {
|
|
|
4850
4854
|
{
|
|
4851
4855
|
variant: "ghost",
|
|
4852
4856
|
size: "icon",
|
|
4853
|
-
className: "mly:relative mly:z-1 mly:size-5! mly:cursor-grab mly:text-gray-500 mly:hover:text-black",
|
|
4857
|
+
className: "menu-icon-button mly:relative mly:z-1 mly:size-5! mly:cursor-grab mly:text-gray-500 mly:hover:text-black",
|
|
4854
4858
|
onClick: (e) => {
|
|
4855
4859
|
e.preventDefault();
|
|
4856
4860
|
setMenuOpen(true);
|
|
@@ -4877,26 +4881,26 @@ function ContentMenu(props) {
|
|
|
4877
4881
|
align: "start",
|
|
4878
4882
|
side: "bottom",
|
|
4879
4883
|
sideOffset: 8,
|
|
4880
|
-
className: "mly:flex mly:w-max mly:flex-col mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:p-1 mly:shadow-md",
|
|
4884
|
+
className: "menu-actions-surface mly:flex mly:w-max mly:flex-col mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:p-1 mly:shadow-md",
|
|
4881
4885
|
children: [
|
|
4882
4886
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4883
4887
|
BaseButton,
|
|
4884
4888
|
{
|
|
4885
4889
|
variant: "ghost",
|
|
4886
4890
|
onClick: duplicateNode,
|
|
4887
|
-
className: "mly:h-auto mly:justify-start mly:gap-2 mly:rounded! mly:!px-2 mly:!py-1.5 mly:text-sm mly:font-normal mly:hover:bg-soft-gray",
|
|
4891
|
+
className: "menu-action-item mly:h-auto mly:justify-start mly:gap-2 mly:rounded! mly:!px-2 mly:!py-1.5 mly:text-sm mly:font-normal mly:hover:bg-soft-gray",
|
|
4888
4892
|
children: [
|
|
4889
4893
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Copy, { className: "mly:size-[15px] mly:shrink-0" }),
|
|
4890
4894
|
"Duplicate"
|
|
4891
4895
|
]
|
|
4892
4896
|
}
|
|
4893
4897
|
),
|
|
4894
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Divider, { type: "horizontal" }),
|
|
4898
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Divider, { type: "horizontal", className: "menu-actions-divider" }),
|
|
4895
4899
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4896
4900
|
BaseButton,
|
|
4897
4901
|
{
|
|
4898
4902
|
onClick: deleteCurrentNode,
|
|
4899
|
-
className: "mly:h-auto mly:justify-start mly:gap-2 mly:rounded! mly:bg-red-100 mly:!px-2 mly:!py-1.5 mly:text-sm mly:font-normal mly:text-red-600 mly:hover:bg-red-200 mly:focus:bg-red-200",
|
|
4903
|
+
className: "menu-action-item menu-action-item-danger mly:h-auto mly:justify-start mly:gap-2 mly:rounded! mly:bg-red-100 mly:!px-2 mly:!py-1.5 mly:text-sm mly:font-normal mly:text-red-600 mly:hover:bg-red-200 mly:focus:bg-red-200",
|
|
4900
4904
|
children: [
|
|
4901
4905
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Trash2, { className: "mly:size-[15px] mly:shrink-0" }),
|
|
4902
4906
|
"Delete"
|
|
@@ -4912,13 +4916,64 @@ function ContentMenu(props) {
|
|
|
4912
4916
|
);
|
|
4913
4917
|
}
|
|
4914
4918
|
|
|
4919
|
+
// src/editor/components/divider-menu/divider-bubble-menu.tsx
|
|
4920
|
+
var import_react12 = require("@tiptap/react");
|
|
4921
|
+
var import_react13 = require("react");
|
|
4922
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
4923
|
+
function DividerBubbleMenu(props) {
|
|
4924
|
+
const { editor, appendTo } = props;
|
|
4925
|
+
if (!editor) {
|
|
4926
|
+
return null;
|
|
4927
|
+
}
|
|
4928
|
+
const items = (0, import_react13.useMemo)(
|
|
4929
|
+
() => spacing.map((space) => {
|
|
4930
|
+
const { value: size, short: name } = space;
|
|
4931
|
+
return {
|
|
4932
|
+
name,
|
|
4933
|
+
isActive: () => editor.isActive("horizontalRule", { size }),
|
|
4934
|
+
command: () => {
|
|
4935
|
+
editor.chain().focus().updateAttributes("horizontalRule", { size }).run();
|
|
4936
|
+
}
|
|
4937
|
+
};
|
|
4938
|
+
}),
|
|
4939
|
+
[editor]
|
|
4940
|
+
);
|
|
4941
|
+
const bubbleMenuProps = __spreadProps(__spreadValues(__spreadValues({}, props), appendTo ? { appendTo: appendTo.current } : {}), {
|
|
4942
|
+
shouldShow: ({ editor: editor2 }) => {
|
|
4943
|
+
if (!editor2.isEditable) {
|
|
4944
|
+
return false;
|
|
4945
|
+
}
|
|
4946
|
+
return editor2.isActive("horizontalRule");
|
|
4947
|
+
},
|
|
4948
|
+
tippyOptions: {
|
|
4949
|
+
maxWidth: "100%",
|
|
4950
|
+
moveTransition: "mly:transform 0.15s mly:ease-out"
|
|
4951
|
+
}
|
|
4952
|
+
});
|
|
4953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4954
|
+
import_react12.BubbleMenu,
|
|
4955
|
+
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
4956
|
+
className: "menu-surface mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
4957
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipProvider, { children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4958
|
+
BubbleMenuButton,
|
|
4959
|
+
__spreadValues({
|
|
4960
|
+
className: "!mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",
|
|
4961
|
+
iconClassName: "mly:w-3 mly:h-3",
|
|
4962
|
+
nameClassName: "mly:text-xs"
|
|
4963
|
+
}, item),
|
|
4964
|
+
index
|
|
4965
|
+
)) })
|
|
4966
|
+
})
|
|
4967
|
+
);
|
|
4968
|
+
}
|
|
4969
|
+
|
|
4915
4970
|
// src/editor/components/editor-menu-bar.tsx
|
|
4916
|
-
var
|
|
4971
|
+
var import_react14 = require("react");
|
|
4917
4972
|
var import_lucide_react8 = require("lucide-react");
|
|
4918
|
-
var
|
|
4973
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
4919
4974
|
var EditorMenuBar = (props) => {
|
|
4920
4975
|
const { editor, config } = props;
|
|
4921
|
-
const items = (0,
|
|
4976
|
+
const items = (0, import_react14.useMemo)(
|
|
4922
4977
|
() => [
|
|
4923
4978
|
{
|
|
4924
4979
|
name: "bold",
|
|
@@ -4957,7 +5012,21 @@ var EditorMenuBar = (props) => {
|
|
|
4957
5012
|
},
|
|
4958
5013
|
{
|
|
4959
5014
|
name: "divider",
|
|
4960
|
-
command: () =>
|
|
5015
|
+
command: () => {
|
|
5016
|
+
editor.chain().focus().setHorizontalRule().run();
|
|
5017
|
+
const { from } = editor.state.selection;
|
|
5018
|
+
const nearbyPositions = [from, from - 1, from - 2, from + 1];
|
|
5019
|
+
const dividerPos = nearbyPositions.find((pos) => {
|
|
5020
|
+
var _a;
|
|
5021
|
+
if (pos < 0) {
|
|
5022
|
+
return false;
|
|
5023
|
+
}
|
|
5024
|
+
return ((_a = editor.state.doc.nodeAt(pos)) == null ? void 0 : _a.type.name) === "horizontalRule";
|
|
5025
|
+
});
|
|
5026
|
+
if (dividerPos != null) {
|
|
5027
|
+
editor.chain().focus().setNodeSelection(dividerPos).run();
|
|
5028
|
+
}
|
|
5029
|
+
},
|
|
4961
5030
|
isActive: () => editor.isActive("horizontalRule"),
|
|
4962
5031
|
group: "custom",
|
|
4963
5032
|
icon: import_lucide_react8.SeparatorHorizontal
|
|
@@ -5002,7 +5071,7 @@ var EditorMenuBar = (props) => {
|
|
|
5002
5071
|
],
|
|
5003
5072
|
[editor]
|
|
5004
5073
|
);
|
|
5005
|
-
const groups = (0,
|
|
5074
|
+
const groups = (0, import_react14.useMemo)(
|
|
5006
5075
|
() => items.reduce((acc, item) => {
|
|
5007
5076
|
if (!acc.includes(item.group)) {
|
|
5008
5077
|
acc.push(item.group);
|
|
@@ -5014,15 +5083,15 @@ var EditorMenuBar = (props) => {
|
|
|
5014
5083
|
if (!editor) {
|
|
5015
5084
|
return null;
|
|
5016
5085
|
}
|
|
5017
|
-
return /* @__PURE__ */ (0,
|
|
5086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5018
5087
|
"div",
|
|
5019
5088
|
{
|
|
5020
5089
|
className: `mly:flex mly:items-center mly:gap-3 ${config == null ? void 0 : config.toolbarClassName}`,
|
|
5021
|
-
children: groups.map((group, index) => /* @__PURE__ */ (0,
|
|
5090
|
+
children: groups.map((group, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5022
5091
|
"div",
|
|
5023
5092
|
{
|
|
5024
5093
|
className: "mly:flex mly:items-center mly:gap-1 mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:p-1",
|
|
5025
|
-
children: items.filter((item) => item.group === group).map((item, index2) => /* @__PURE__ */ (0,
|
|
5094
|
+
children: items.filter((item) => item.group === group).map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BubbleMenuButton, __spreadValues({}, item), index2))
|
|
5026
5095
|
},
|
|
5027
5096
|
index
|
|
5028
5097
|
))
|
|
@@ -5032,7 +5101,7 @@ var EditorMenuBar = (props) => {
|
|
|
5032
5101
|
|
|
5033
5102
|
// src/editor/nodes/logo/logo.ts
|
|
5034
5103
|
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
5035
|
-
var
|
|
5104
|
+
var import_react22 = require("@tiptap/react");
|
|
5036
5105
|
|
|
5037
5106
|
// src/editor/nodes/section/section.ts
|
|
5038
5107
|
var import_core5 = require("@tiptap/core");
|
|
@@ -5333,13 +5402,13 @@ var SectionExtension = import_core5.Node.create({
|
|
|
5333
5402
|
});
|
|
5334
5403
|
|
|
5335
5404
|
// src/editor/nodes/logo/logo-view.tsx
|
|
5336
|
-
var
|
|
5337
|
-
var
|
|
5338
|
-
var
|
|
5405
|
+
var import_react19 = require("@tiptap/react");
|
|
5406
|
+
var import_react20 = require("react");
|
|
5407
|
+
var import_react21 = require("react");
|
|
5339
5408
|
|
|
5340
5409
|
// src/editor/nodes/image/image-view.tsx
|
|
5341
|
-
var
|
|
5342
|
-
var
|
|
5410
|
+
var import_react17 = require("react");
|
|
5411
|
+
var import_react18 = require("@tiptap/react");
|
|
5343
5412
|
var import_lucide_react9 = require("lucide-react");
|
|
5344
5413
|
|
|
5345
5414
|
// src/editor/plugins/image-upload/image-upload-plugin.ts
|
|
@@ -5434,7 +5503,7 @@ function ImageUploadPlugin(options) {
|
|
|
5434
5503
|
|
|
5435
5504
|
// src/editor/extensions/image-upload/image-upload.ts
|
|
5436
5505
|
var import_core6 = require("@tiptap/core");
|
|
5437
|
-
var
|
|
5506
|
+
var import_react15 = require("react");
|
|
5438
5507
|
var ImageUploadExtension = import_core6.Extension.create({
|
|
5439
5508
|
name: "imageUpload",
|
|
5440
5509
|
addOptions() {
|
|
@@ -5469,7 +5538,7 @@ var ImageUploadExtension = import_core6.Extension.create({
|
|
|
5469
5538
|
}
|
|
5470
5539
|
});
|
|
5471
5540
|
function useImageUploadOptions(editor) {
|
|
5472
|
-
return (0,
|
|
5541
|
+
return (0, import_react15.useMemo)(() => {
|
|
5473
5542
|
const node = editor.extensionManager.extensions.find(
|
|
5474
5543
|
(extension) => extension.name === "imageUpload"
|
|
5475
5544
|
);
|
|
@@ -5478,13 +5547,13 @@ function useImageUploadOptions(editor) {
|
|
|
5478
5547
|
}
|
|
5479
5548
|
|
|
5480
5549
|
// src/editor/utils/use-event.ts
|
|
5481
|
-
var
|
|
5550
|
+
var import_react16 = require("react");
|
|
5482
5551
|
var useEvent = (handler) => {
|
|
5483
|
-
const handlerRef = (0,
|
|
5484
|
-
(0,
|
|
5552
|
+
const handlerRef = (0, import_react16.useRef)(null);
|
|
5553
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
5485
5554
|
handlerRef.current = handler;
|
|
5486
5555
|
}, [handler]);
|
|
5487
|
-
return (0,
|
|
5556
|
+
return (0, import_react16.useCallback)((...args) => {
|
|
5488
5557
|
if (handlerRef.current === null) {
|
|
5489
5558
|
throw new Error("Handler is not assigned");
|
|
5490
5559
|
}
|
|
@@ -5502,24 +5571,21 @@ function getNewHeight(width, aspectRatio) {
|
|
|
5502
5571
|
}
|
|
5503
5572
|
return width / aspectRatio;
|
|
5504
5573
|
}
|
|
5505
|
-
function getNewWidth(height, aspectRatio) {
|
|
5506
|
-
return height * aspectRatio;
|
|
5507
|
-
}
|
|
5508
5574
|
|
|
5509
5575
|
// src/editor/nodes/image/image-view.tsx
|
|
5510
|
-
var
|
|
5576
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5511
5577
|
var MIN_WIDTH = 20;
|
|
5512
5578
|
var IMAGE_MAX_WIDTH = 600;
|
|
5513
5579
|
var IMAGE_MAX_HEIGHT = 400;
|
|
5514
5580
|
function ImageView(props) {
|
|
5515
5581
|
const { node, updateAttributes: updateAttributes2, selected, editor } = props;
|
|
5516
|
-
const [status, setStatus] = (0,
|
|
5517
|
-
const [isPlaceholderImage, setIsPlaceholderImage] = (0,
|
|
5582
|
+
const [status, setStatus] = (0, import_react17.useState)("idle");
|
|
5583
|
+
const [isPlaceholderImage, setIsPlaceholderImage] = (0, import_react17.useState)(false);
|
|
5518
5584
|
const { onImageUpload, allowedMimeTypes = [] } = useImageUploadOptions(editor);
|
|
5519
|
-
const wrapperRef = (0,
|
|
5520
|
-
const imgRef = (0,
|
|
5521
|
-
const [resizingStyle, setResizingStyle] = (0,
|
|
5522
|
-
const [isDraggingOver, setIsDraggingOver] = (0,
|
|
5585
|
+
const wrapperRef = (0, import_react17.useRef)(null);
|
|
5586
|
+
const imgRef = (0, import_react17.useRef)(null);
|
|
5587
|
+
const [resizingStyle, setResizingStyle] = (0, import_react17.useState)();
|
|
5588
|
+
const [isDraggingOver, setIsDraggingOver] = (0, import_react17.useState)(false);
|
|
5523
5589
|
const handleMouseDown = useEvent(
|
|
5524
5590
|
(event) => {
|
|
5525
5591
|
const imageParent = document.querySelector(
|
|
@@ -5576,12 +5642,12 @@ function ImageView(props) {
|
|
|
5576
5642
|
window.addEventListener("mouseup", removeListeners);
|
|
5577
5643
|
}
|
|
5578
5644
|
);
|
|
5579
|
-
const dragCornerButton = (0,
|
|
5645
|
+
const dragCornerButton = (0, import_react17.useCallback)(
|
|
5580
5646
|
(direction) => {
|
|
5581
5647
|
if (isPlaceholderImage) {
|
|
5582
5648
|
return null;
|
|
5583
5649
|
}
|
|
5584
|
-
return /* @__PURE__ */ (0,
|
|
5650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5585
5651
|
"div",
|
|
5586
5652
|
{
|
|
5587
5653
|
role: "button",
|
|
@@ -5634,7 +5700,7 @@ function ImageView(props) {
|
|
|
5634
5700
|
const file = e.target.files[0];
|
|
5635
5701
|
yield handleImageUpload(file);
|
|
5636
5702
|
});
|
|
5637
|
-
const handleImageUpload = (0,
|
|
5703
|
+
const handleImageUpload = (0, import_react17.useCallback)(
|
|
5638
5704
|
(file) => __async(this, null, function* () {
|
|
5639
5705
|
if (!isDroppable) {
|
|
5640
5706
|
return;
|
|
@@ -5652,7 +5718,7 @@ function ImageView(props) {
|
|
|
5652
5718
|
}),
|
|
5653
5719
|
[onImageUpload, updateAttributes2]
|
|
5654
5720
|
);
|
|
5655
|
-
(0,
|
|
5721
|
+
(0, import_react17.useEffect)(() => {
|
|
5656
5722
|
var _a2, _b, _c, _d;
|
|
5657
5723
|
if (!src || isSrcVariable) {
|
|
5658
5724
|
return;
|
|
@@ -5690,7 +5756,7 @@ function ImageView(props) {
|
|
|
5690
5756
|
img.onerror = null;
|
|
5691
5757
|
};
|
|
5692
5758
|
}, [src]);
|
|
5693
|
-
const handleDragOver = (0,
|
|
5759
|
+
const handleDragOver = (0, import_react17.useCallback)(
|
|
5694
5760
|
(e) => {
|
|
5695
5761
|
if (!isDroppable) {
|
|
5696
5762
|
return;
|
|
@@ -5701,7 +5767,7 @@ function ImageView(props) {
|
|
|
5701
5767
|
},
|
|
5702
5768
|
[onImageUpload]
|
|
5703
5769
|
);
|
|
5704
|
-
const handleDragLeave = (0,
|
|
5770
|
+
const handleDragLeave = (0, import_react17.useCallback)(
|
|
5705
5771
|
(e) => {
|
|
5706
5772
|
if (!isDroppable) {
|
|
5707
5773
|
return;
|
|
@@ -5712,7 +5778,7 @@ function ImageView(props) {
|
|
|
5712
5778
|
},
|
|
5713
5779
|
[onImageUpload]
|
|
5714
5780
|
);
|
|
5715
|
-
const handleDrop = (0,
|
|
5781
|
+
const handleDrop = (0, import_react17.useCallback)(
|
|
5716
5782
|
(e) => __async(this, null, function* () {
|
|
5717
5783
|
var _a2;
|
|
5718
5784
|
if (!isDroppable) {
|
|
@@ -5737,8 +5803,8 @@ function ImageView(props) {
|
|
|
5737
5803
|
const heightValue = height && height !== "auto" ? `${height}px` : void 0;
|
|
5738
5804
|
const hasExplicitWidth = Boolean(widthValue || (resizingStyle == null ? void 0 : resizingStyle.width));
|
|
5739
5805
|
const hasExplicitHeight = Boolean(heightValue || (resizingStyle == null ? void 0 : resizingStyle.height));
|
|
5740
|
-
return /* @__PURE__ */ (0,
|
|
5741
|
-
|
|
5806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
5807
|
+
import_react18.NodeViewWrapper,
|
|
5742
5808
|
__spreadProps(__spreadValues({
|
|
5743
5809
|
as: "div",
|
|
5744
5810
|
draggable: editor.isEditable,
|
|
@@ -5766,7 +5832,7 @@ function ImageView(props) {
|
|
|
5766
5832
|
onDrop: handleDrop
|
|
5767
5833
|
} : {}), {
|
|
5768
5834
|
children: [
|
|
5769
|
-
!hasImageSrc && status === "idle" && /* @__PURE__ */ (0,
|
|
5835
|
+
!hasImageSrc && status === "idle" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5770
5836
|
ImageStatusLabel,
|
|
5771
5837
|
{
|
|
5772
5838
|
status: "idle",
|
|
@@ -5774,11 +5840,11 @@ function ImageView(props) {
|
|
|
5774
5840
|
isDropZone: isDroppable
|
|
5775
5841
|
}
|
|
5776
5842
|
),
|
|
5777
|
-
!hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
5778
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0,
|
|
5779
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
5780
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
5781
|
-
isDroppable && /* @__PURE__ */ (0,
|
|
5843
|
+
!hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageStatusLabel, { status: "loading", minHeight: height }),
|
|
5844
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageStatusLabel, { status: "variable", minHeight: height }),
|
|
5845
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageStatusLabel, { status: "loading", minHeight: height }),
|
|
5846
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageStatusLabel, { status: "error", minHeight: height }),
|
|
5847
|
+
isDroppable && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5782
5848
|
"input",
|
|
5783
5849
|
{
|
|
5784
5850
|
type: "file",
|
|
@@ -5788,8 +5854,8 @@ function ImageView(props) {
|
|
|
5788
5854
|
multiple: false
|
|
5789
5855
|
}
|
|
5790
5856
|
),
|
|
5791
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
5792
|
-
/* @__PURE__ */ (0,
|
|
5857
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
5858
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5793
5859
|
"img",
|
|
5794
5860
|
__spreadProps(__spreadValues({}, attrs), {
|
|
5795
5861
|
ref: imgRef,
|
|
@@ -5809,13 +5875,13 @@ function ImageView(props) {
|
|
|
5809
5875
|
)
|
|
5810
5876
|
})
|
|
5811
5877
|
),
|
|
5812
|
-
selected && editor.isEditable && !isPlaceholderImage && /* @__PURE__ */ (0,
|
|
5878
|
+
selected && editor.isEditable && !isPlaceholderImage && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
5813
5879
|
[
|
|
5814
5880
|
{ left: 0, top: 0, height: "100%", width: "1px" },
|
|
5815
5881
|
{ right: 0, top: 0, height: "100%", width: "1px" },
|
|
5816
5882
|
{ top: 0, left: 0, width: "100%", height: "1px" },
|
|
5817
5883
|
{ bottom: 0, left: 0, width: "100%", height: "1px" }
|
|
5818
|
-
].map((style, i) => /* @__PURE__ */ (0,
|
|
5884
|
+
].map((style, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5819
5885
|
"div",
|
|
5820
5886
|
{
|
|
5821
5887
|
className: "mly:bg-rose-500",
|
|
@@ -5839,7 +5905,7 @@ function ImageStatusLabel(props) {
|
|
|
5839
5905
|
const _a = props, { status, minHeight, className, style, isDropZone } = _a, rest = __objRest(_a, ["status", "minHeight", "className", "style", "isDropZone"]);
|
|
5840
5906
|
const resolvedMinHeight = minHeight != null ? minHeight : isDropZone ? 36 : void 0;
|
|
5841
5907
|
const resolvedPaddingY = isDropZone ? 8 : void 0;
|
|
5842
|
-
return /* @__PURE__ */ (0,
|
|
5908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
5843
5909
|
"div",
|
|
5844
5910
|
__spreadProps(__spreadValues({}, rest), {
|
|
5845
5911
|
className: cn(
|
|
@@ -5857,25 +5923,25 @@ function ImageStatusLabel(props) {
|
|
|
5857
5923
|
paddingBottom: resolvedPaddingY
|
|
5858
5924
|
} : {}), style),
|
|
5859
5925
|
children: [
|
|
5860
|
-
status === "idle" && !isDropZone && /* @__PURE__ */ (0,
|
|
5861
|
-
/* @__PURE__ */ (0,
|
|
5862
|
-
/* @__PURE__ */ (0,
|
|
5926
|
+
status === "idle" && !isDropZone && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
5927
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.ImageOffIcon, { className: "mly:size-4 mly:stroke-[2.5]" }),
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "No image selected" })
|
|
5863
5929
|
] }),
|
|
5864
|
-
status === "idle" && isDropZone && /* @__PURE__ */ (0,
|
|
5865
|
-
/* @__PURE__ */ (0,
|
|
5866
|
-
/* @__PURE__ */ (0,
|
|
5930
|
+
status === "idle" && isDropZone && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
5931
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.GrabIcon, { className: "mly:size-4 mly:stroke-[2.5]" }),
|
|
5932
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Click or Drop image here" })
|
|
5867
5933
|
] }),
|
|
5868
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
5869
|
-
/* @__PURE__ */ (0,
|
|
5870
|
-
/* @__PURE__ */ (0,
|
|
5934
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
5935
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.Loader2, { className: "mly:size-4 mly:animate-spin mly:stroke-[2.5]" }),
|
|
5936
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Loading image..." })
|
|
5871
5937
|
] }),
|
|
5872
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
5873
|
-
/* @__PURE__ */ (0,
|
|
5874
|
-
/* @__PURE__ */ (0,
|
|
5938
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
5939
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.Ban, { className: "mly:size-4 mly:stroke-[2.5]" }),
|
|
5940
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Error loading image" })
|
|
5875
5941
|
] }),
|
|
5876
|
-
status === "variable" && /* @__PURE__ */ (0,
|
|
5877
|
-
/* @__PURE__ */ (0,
|
|
5878
|
-
/* @__PURE__ */ (0,
|
|
5942
|
+
status === "variable" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
5943
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.BracesIcon, { className: "mly:size-4 mly:stroke-[2.5]" }),
|
|
5944
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "Variable Image URL" })
|
|
5879
5945
|
] })
|
|
5880
5946
|
]
|
|
5881
5947
|
})
|
|
@@ -5883,12 +5949,12 @@ function ImageStatusLabel(props) {
|
|
|
5883
5949
|
}
|
|
5884
5950
|
|
|
5885
5951
|
// src/editor/nodes/logo/logo-view.tsx
|
|
5886
|
-
var
|
|
5952
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5887
5953
|
function LogoView(props) {
|
|
5888
5954
|
const { node, editor, updateAttributes: updateAttributes2 } = props;
|
|
5889
|
-
const [status, setStatus] = (0,
|
|
5890
|
-
const [isPlaceholderImage, setIsPlaceholderImage] = (0,
|
|
5891
|
-
const [isDraggingOver, setIsDraggingOver] = (0,
|
|
5955
|
+
const [status, setStatus] = (0, import_react21.useState)("idle");
|
|
5956
|
+
const [isPlaceholderImage, setIsPlaceholderImage] = (0, import_react21.useState)(false);
|
|
5957
|
+
const [isDraggingOver, setIsDraggingOver] = (0, import_react21.useState)(false);
|
|
5892
5958
|
const { onImageUpload, allowedMimeTypes = [] } = useImageUploadOptions(editor);
|
|
5893
5959
|
let {
|
|
5894
5960
|
alignment = "center",
|
|
@@ -5905,7 +5971,7 @@ function LogoView(props) {
|
|
|
5905
5971
|
const file = e.target.files[0];
|
|
5906
5972
|
yield handleImageUpload(file);
|
|
5907
5973
|
});
|
|
5908
|
-
const handleImageUpload = (0,
|
|
5974
|
+
const handleImageUpload = (0, import_react20.useCallback)(
|
|
5909
5975
|
(file) => __async(this, null, function* () {
|
|
5910
5976
|
if (!isDroppable) {
|
|
5911
5977
|
return;
|
|
@@ -5923,7 +5989,7 @@ function LogoView(props) {
|
|
|
5923
5989
|
}),
|
|
5924
5990
|
[onImageUpload, updateAttributes2]
|
|
5925
5991
|
);
|
|
5926
|
-
const handleDragOver = (0,
|
|
5992
|
+
const handleDragOver = (0, import_react20.useCallback)(
|
|
5927
5993
|
(e) => {
|
|
5928
5994
|
if (!isDroppable) {
|
|
5929
5995
|
return;
|
|
@@ -5934,7 +6000,7 @@ function LogoView(props) {
|
|
|
5934
6000
|
},
|
|
5935
6001
|
[onImageUpload]
|
|
5936
6002
|
);
|
|
5937
|
-
const handleDragLeave = (0,
|
|
6003
|
+
const handleDragLeave = (0, import_react20.useCallback)(
|
|
5938
6004
|
(e) => {
|
|
5939
6005
|
if (!isDroppable) {
|
|
5940
6006
|
return;
|
|
@@ -5945,7 +6011,7 @@ function LogoView(props) {
|
|
|
5945
6011
|
},
|
|
5946
6012
|
[onImageUpload]
|
|
5947
6013
|
);
|
|
5948
|
-
const handleDrop = (0,
|
|
6014
|
+
const handleDrop = (0, import_react20.useCallback)(
|
|
5949
6015
|
(e) => __async(this, null, function* () {
|
|
5950
6016
|
var _a;
|
|
5951
6017
|
if (!isDroppable) {
|
|
@@ -5966,7 +6032,7 @@ function LogoView(props) {
|
|
|
5966
6032
|
}),
|
|
5967
6033
|
[handleImageUpload]
|
|
5968
6034
|
);
|
|
5969
|
-
(0,
|
|
6035
|
+
(0, import_react20.useEffect)(() => {
|
|
5970
6036
|
var _a, _b, _c, _d;
|
|
5971
6037
|
if (!logoSrc) {
|
|
5972
6038
|
return;
|
|
@@ -5989,8 +6055,8 @@ function LogoView(props) {
|
|
|
5989
6055
|
};
|
|
5990
6056
|
}, [logoSrc]);
|
|
5991
6057
|
const logoSize = logoSizes[size];
|
|
5992
|
-
return /* @__PURE__ */ (0,
|
|
5993
|
-
|
|
6058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6059
|
+
import_react19.NodeViewWrapper,
|
|
5994
6060
|
__spreadProps(__spreadValues({
|
|
5995
6061
|
as: "div",
|
|
5996
6062
|
draggable: editor.isEditable,
|
|
@@ -6009,7 +6075,7 @@ function LogoView(props) {
|
|
|
6009
6075
|
onDrop: handleDrop
|
|
6010
6076
|
} : {}), {
|
|
6011
6077
|
children: [
|
|
6012
|
-
!hasImageSrc && status === "idle" && /* @__PURE__ */ (0,
|
|
6078
|
+
!hasImageSrc && status === "idle" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6013
6079
|
ImageStatusLabel,
|
|
6014
6080
|
{
|
|
6015
6081
|
status: "idle",
|
|
@@ -6017,11 +6083,11 @@ function LogoView(props) {
|
|
|
6017
6083
|
isDropZone: isDroppable
|
|
6018
6084
|
}
|
|
6019
6085
|
),
|
|
6020
|
-
!hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
6021
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0,
|
|
6022
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
6023
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
6024
|
-
isDroppable && /* @__PURE__ */ (0,
|
|
6086
|
+
!hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageStatusLabel, { status: "loading", minHeight: logoSize }),
|
|
6087
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageStatusLabel, { status: "variable", minHeight: logoSize }),
|
|
6088
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageStatusLabel, { status: "loading", minHeight: logoSize }),
|
|
6089
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ImageStatusLabel, { status: "error", minHeight: logoSize }),
|
|
6090
|
+
isDroppable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6025
6091
|
"input",
|
|
6026
6092
|
{
|
|
6027
6093
|
type: "file",
|
|
@@ -6031,7 +6097,7 @@ function LogoView(props) {
|
|
|
6031
6097
|
multiple: false
|
|
6032
6098
|
}
|
|
6033
6099
|
),
|
|
6034
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
6100
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6035
6101
|
"img",
|
|
6036
6102
|
{
|
|
6037
6103
|
src: logoSrc,
|
|
@@ -6151,7 +6217,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
6151
6217
|
];
|
|
6152
6218
|
},
|
|
6153
6219
|
addNodeView() {
|
|
6154
|
-
return (0,
|
|
6220
|
+
return (0, import_react22.ReactNodeViewRenderer)(LogoView, {
|
|
6155
6221
|
className: "mly:relative"
|
|
6156
6222
|
});
|
|
6157
6223
|
}
|
|
@@ -6182,13 +6248,13 @@ var borderRadius = [
|
|
|
6182
6248
|
];
|
|
6183
6249
|
|
|
6184
6250
|
// src/editor/components/image-menu/image-bubble-menu.tsx
|
|
6185
|
-
var
|
|
6186
|
-
var
|
|
6251
|
+
var import_react24 = require("@tiptap/react");
|
|
6252
|
+
var import_lucide_react11 = require("lucide-react");
|
|
6187
6253
|
var import_tippy3 = require("tippy.js");
|
|
6188
6254
|
|
|
6189
6255
|
// src/editor/components/alignment-switch.tsx
|
|
6190
6256
|
var import_lucide_react10 = require("lucide-react");
|
|
6191
|
-
var
|
|
6257
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6192
6258
|
function AlignmentSwitch(props) {
|
|
6193
6259
|
const { alignment: rawAlignment, onAlignmentChange } = props;
|
|
6194
6260
|
const alignment = allowedLogoAlignment.includes(
|
|
@@ -6218,18 +6284,18 @@ function AlignmentSwitch(props) {
|
|
|
6218
6284
|
}
|
|
6219
6285
|
};
|
|
6220
6286
|
const activeAlignment = alignments[alignment];
|
|
6221
|
-
return /* @__PURE__ */ (0,
|
|
6222
|
-
/* @__PURE__ */ (0,
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Popover, { children: [
|
|
6288
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Tooltip, { children: [
|
|
6289
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6224
6290
|
PopoverTrigger,
|
|
6225
6291
|
{
|
|
6226
6292
|
className: cn(
|
|
6227
|
-
"mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"
|
|
6293
|
+
"menu-option mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"
|
|
6228
6294
|
),
|
|
6229
|
-
children: /* @__PURE__ */ (0,
|
|
6295
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(activeAlignment.icon, { className: "mly:h-3 mly:w-3 mly:stroke-[2.5]" })
|
|
6230
6296
|
}
|
|
6231
6297
|
) }),
|
|
6232
|
-
/* @__PURE__ */ (0,
|
|
6298
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6233
6299
|
TooltipContent,
|
|
6234
6300
|
{
|
|
6235
6301
|
sideOffset: 8,
|
|
@@ -6238,7 +6304,7 @@ function AlignmentSwitch(props) {
|
|
|
6238
6304
|
}
|
|
6239
6305
|
)
|
|
6240
6306
|
] }),
|
|
6241
|
-
/* @__PURE__ */ (0,
|
|
6307
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6242
6308
|
PopoverContent,
|
|
6243
6309
|
{
|
|
6244
6310
|
className: "mly:flex mly:w-max mly:gap-0.5 mly:rounded-lg mly:p-0.5!",
|
|
@@ -6252,7 +6318,7 @@ function AlignmentSwitch(props) {
|
|
|
6252
6318
|
e.preventDefault();
|
|
6253
6319
|
},
|
|
6254
6320
|
children: Object.entries(alignments).map(([key, value]) => {
|
|
6255
|
-
return /* @__PURE__ */ (0,
|
|
6321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6256
6322
|
BubbleMenuButton,
|
|
6257
6323
|
{
|
|
6258
6324
|
icon: value.icon,
|
|
@@ -6268,112 +6334,406 @@ function AlignmentSwitch(props) {
|
|
|
6268
6334
|
] });
|
|
6269
6335
|
}
|
|
6270
6336
|
|
|
6271
|
-
// src/editor/components/
|
|
6272
|
-
var
|
|
6273
|
-
var
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
editor.chain().focus().deleteRange(range).setLinkCard().run();
|
|
6300
|
-
},
|
|
6301
|
-
render: (editor) => {
|
|
6302
|
-
return editor.extensionManager.extensions.findIndex(
|
|
6303
|
-
(ext) => ext.name === "linkCard"
|
|
6304
|
-
) === -1 ? null : true;
|
|
6305
|
-
}
|
|
6337
|
+
// src/editor/components/image-menu/use-image-state.tsx
|
|
6338
|
+
var import_react23 = require("@tiptap/react");
|
|
6339
|
+
var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"), 1);
|
|
6340
|
+
var useImageState = (editor) => {
|
|
6341
|
+
const states = (0, import_react23.useEditorState)({
|
|
6342
|
+
editor,
|
|
6343
|
+
selector: ({ editor: editor2 }) => {
|
|
6344
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
6345
|
+
return {
|
|
6346
|
+
width: String(editor2.getAttributes("image").width),
|
|
6347
|
+
height: String(editor2.getAttributes("image").height),
|
|
6348
|
+
isImageActive: editor2.isActive("image"),
|
|
6349
|
+
isLogoActive: editor2.isActive("logo"),
|
|
6350
|
+
alignment: ((_a = editor2.getAttributes("image")) == null ? void 0 : _a.alignment) || ((_b = editor2.getAttributes("logo")) == null ? void 0 : _b.alignment),
|
|
6351
|
+
borderRadius: (_c = editor2.getAttributes("image")) == null ? void 0 : _c.borderRadius,
|
|
6352
|
+
logoSize: ((_d = editor2.getAttributes("logo")) == null ? void 0 : _d.size) || DEFAULT_LOGO_SIZE,
|
|
6353
|
+
imageSrc: ((_e = editor2.getAttributes("image")) == null ? void 0 : _e.src) || ((_f = editor2.getAttributes("logo")) == null ? void 0 : _f.src) || "",
|
|
6354
|
+
isSrcVariable: (_j = (_i = (_g = editor2.getAttributes("image")) == null ? void 0 : _g.isSrcVariable) != null ? _i : (_h = editor2.getAttributes("logo")) == null ? void 0 : _h.isSrcVariable) != null ? _j : false,
|
|
6355
|
+
imageExternalLink: ((_k = editor2.getAttributes("image")) == null ? void 0 : _k.externalLink) || "",
|
|
6356
|
+
isExternalLinkVariable: (_l = editor2.getAttributes("image")) == null ? void 0 : _l.isExternalLinkVariable,
|
|
6357
|
+
lockAspectRatio: (_m = editor2.getAttributes("image")) == null ? void 0 : _m.lockAspectRatio,
|
|
6358
|
+
aspectRatio: (_n = editor2.getAttributes("image")) == null ? void 0 : _n.aspectRatio,
|
|
6359
|
+
currentShowIfKey: ((_o = editor2.getAttributes("image")) == null ? void 0 : _o.showIfKey) || ((_p = editor2.getAttributes("logo")) == null ? void 0 : _p.showIfKey) || ""
|
|
6360
|
+
};
|
|
6361
|
+
},
|
|
6362
|
+
equalityFn: import_fast_deep_equal2.default
|
|
6363
|
+
});
|
|
6364
|
+
return states;
|
|
6306
6365
|
};
|
|
6307
6366
|
|
|
6308
|
-
// src/
|
|
6309
|
-
var import_lucide_react12 = require("lucide-react");
|
|
6367
|
+
// src/editor/components/image-menu/image-bubble-menu.tsx
|
|
6310
6368
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react12.CodeXmlIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6316
|
-
command: ({ editor, range }) => {
|
|
6317
|
-
editor.chain().focus().deleteRange(range).setHtmlCodeBlock({ language: "html" }).run();
|
|
6318
|
-
}
|
|
6319
|
-
};
|
|
6320
|
-
|
|
6321
|
-
// src/blocks/image.tsx
|
|
6322
|
-
var import_state4 = require("@tiptap/pm/state");
|
|
6323
|
-
var import_lucide_react13 = require("lucide-react");
|
|
6324
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6325
|
-
var image = {
|
|
6326
|
-
title: "Image",
|
|
6327
|
-
description: "Full width image",
|
|
6328
|
-
searchTerms: ["image"],
|
|
6329
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.ImageIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6330
|
-
command: ({ editor, range }) => {
|
|
6331
|
-
editor.chain().focus().deleteRange(range).setImage({ src: "" }).run();
|
|
6332
|
-
}
|
|
6333
|
-
};
|
|
6334
|
-
var logo = {
|
|
6335
|
-
title: "Logo",
|
|
6336
|
-
description: "Add your brand logo",
|
|
6337
|
-
searchTerms: ["image", "logo"],
|
|
6338
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.ImageIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6339
|
-
command: ({ editor, range }) => {
|
|
6340
|
-
editor.chain().focus().deleteRange(range).setLogoImage({ src: "" }).run();
|
|
6369
|
+
function ImageBubbleMenu(props) {
|
|
6370
|
+
const { editor, appendTo } = props;
|
|
6371
|
+
if (!editor) {
|
|
6372
|
+
return null;
|
|
6341
6373
|
}
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
searchTerms: ["image", "inline"],
|
|
6347
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.ImageIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6348
|
-
command: ({ editor, range }) => {
|
|
6349
|
-
editor.chain().focus().deleteRange(range).setInlineImage({
|
|
6350
|
-
src: "https://maily.to/brand/logo.png"
|
|
6351
|
-
}).command((props) => {
|
|
6352
|
-
const { tr, state, view, editor: editor2 } = props;
|
|
6353
|
-
const { from } = range;
|
|
6354
|
-
const node = state.doc.nodeAt(from);
|
|
6355
|
-
if (!node) {
|
|
6374
|
+
const state = useImageState(editor);
|
|
6375
|
+
const bubbleMenuProps = __spreadProps(__spreadValues(__spreadValues({}, props), appendTo ? { appendTo: appendTo.current } : {}), {
|
|
6376
|
+
shouldShow: ({ editor: editor2 }) => {
|
|
6377
|
+
if (!editor2.isEditable) {
|
|
6356
6378
|
return false;
|
|
6357
6379
|
}
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
}
|
|
6380
|
+
return editor2.isActive("logo") || editor2.isActive("image");
|
|
6381
|
+
},
|
|
6382
|
+
tippyOptions: {
|
|
6383
|
+
popperOptions: {
|
|
6384
|
+
modifiers: [{ name: "flip", enabled: false }]
|
|
6385
|
+
},
|
|
6386
|
+
plugins: [import_tippy3.sticky],
|
|
6387
|
+
sticky: "popper",
|
|
6388
|
+
maxWidth: "100%"
|
|
6389
|
+
}
|
|
6390
|
+
});
|
|
6391
|
+
const { lockAspectRatio } = state;
|
|
6392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6393
|
+
import_react24.BubbleMenu,
|
|
6394
|
+
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
6395
|
+
className: "menu-surface image-menu-surface mly:flex mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
6396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(TooltipProvider, { children: [
|
|
6397
|
+
state.isLogoActive && state.imageSrc && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
6398
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6399
|
+
Select,
|
|
6400
|
+
{
|
|
6401
|
+
label: "Size",
|
|
6402
|
+
tooltip: "Size",
|
|
6403
|
+
value: state.logoSize,
|
|
6404
|
+
options: allowedLogoSize.map((size) => ({
|
|
6405
|
+
value: size,
|
|
6406
|
+
label: size
|
|
6407
|
+
})),
|
|
6408
|
+
onValueChange: (value) => {
|
|
6409
|
+
editor == null ? void 0 : editor.chain().focus().setLogoAttributes({ size: value }).run();
|
|
6410
|
+
}
|
|
6411
|
+
}
|
|
6412
|
+
),
|
|
6413
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Divider, {})
|
|
6414
|
+
] }),
|
|
6415
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "menu-inline-gap mly:flex mly:gap-x-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6416
|
+
AlignmentSwitch,
|
|
6417
|
+
{
|
|
6418
|
+
alignment: state.alignment,
|
|
6419
|
+
onAlignmentChange: (alignment) => {
|
|
6420
|
+
const isCurrentNodeImage = state.isImageActive;
|
|
6421
|
+
if (!isCurrentNodeImage) {
|
|
6422
|
+
editor == null ? void 0 : editor.chain().focus().setLogoAttributes({ alignment }).run();
|
|
6423
|
+
} else {
|
|
6424
|
+
editor == null ? void 0 : editor.chain().focus().updateAttributes("image", { alignment }).run();
|
|
6425
|
+
}
|
|
6426
|
+
}
|
|
6427
|
+
}
|
|
6428
|
+
) }),
|
|
6429
|
+
state.isImageActive && state.imageSrc && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
6430
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Divider, {}),
|
|
6431
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6432
|
+
Select,
|
|
6433
|
+
{
|
|
6434
|
+
label: "Border Radius",
|
|
6435
|
+
value: state == null ? void 0 : state.borderRadius,
|
|
6436
|
+
options: borderRadius.map((value) => ({
|
|
6437
|
+
value: String(value.value),
|
|
6438
|
+
label: value.name
|
|
6439
|
+
})),
|
|
6440
|
+
onValueChange: (value) => {
|
|
6441
|
+
editor == null ? void 0 : editor.chain().updateAttributes("image", {
|
|
6442
|
+
borderRadius: Number(value)
|
|
6443
|
+
}).run();
|
|
6444
|
+
},
|
|
6445
|
+
tooltip: "Border Radius",
|
|
6446
|
+
className: "mly:capitalize"
|
|
6447
|
+
}
|
|
6448
|
+
),
|
|
6449
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "menu-inline-gap mly:flex mly:gap-x-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6450
|
+
BubbleMenuButton,
|
|
6451
|
+
{
|
|
6452
|
+
isActive: () => lockAspectRatio,
|
|
6453
|
+
command: () => {
|
|
6454
|
+
const width = Number(state.width) || 0;
|
|
6455
|
+
const height = Number(state.height) || 0;
|
|
6456
|
+
const aspectRatio = width / height;
|
|
6457
|
+
editor == null ? void 0 : editor.chain().updateAttributes("image", {
|
|
6458
|
+
lockAspectRatio: !lockAspectRatio,
|
|
6459
|
+
aspectRatio
|
|
6460
|
+
}).run();
|
|
6461
|
+
},
|
|
6462
|
+
icon: lockAspectRatio ? import_lucide_react11.LockIcon : import_lucide_react11.LockOpenIcon,
|
|
6463
|
+
tooltip: "Lock Aspect Ratio"
|
|
6464
|
+
}
|
|
6465
|
+
) })
|
|
6466
|
+
] })
|
|
6467
|
+
] })
|
|
6468
|
+
})
|
|
6469
|
+
);
|
|
6470
|
+
}
|
|
6368
6471
|
|
|
6369
|
-
// src/
|
|
6370
|
-
var
|
|
6472
|
+
// src/editor/components/inline-image-menu/inline-image-bubble-menu.tsx
|
|
6473
|
+
var import_react33 = require("@tiptap/react");
|
|
6474
|
+
var import_tippy4 = require("tippy.js");
|
|
6475
|
+
|
|
6476
|
+
// src/editor/components/image-menu/image-size.tsx
|
|
6477
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6478
|
+
function ImageSize(props) {
|
|
6479
|
+
const { value, onValueChange, dimension } = props;
|
|
6480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "menu-option image-size-control mly:relative mly:flex mly:items-center", children: [
|
|
6481
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "mly:absolute mly:inset-y-0 mly:left-2 mly:flex mly:items-center mly:text-xs mly:leading-none mly:text-gray-400", children: dimension === "width" ? "W" : "H" }),
|
|
6482
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6483
|
+
"input",
|
|
6484
|
+
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
6485
|
+
className: "hide-number-controls image-size-input mly:h-auto mly:max-w-20 mly:appearance-none mly:border-0 mly:border-none mly:p-1 mly:px-[26px] mly:text-sm mly:uppercase mly:tabular-nums mly:outline-hidden mly:focus-visible:outline-hidden",
|
|
6486
|
+
type: "number",
|
|
6487
|
+
value,
|
|
6488
|
+
onChange: (e) => onValueChange(e.target.value)
|
|
6489
|
+
})
|
|
6490
|
+
),
|
|
6491
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "mly:absolute mly:inset-y-0 mly:right-1 mly:flex mly:items-center mly:text-xs mly:leading-none mly:text-gray-400", children: "PX" })
|
|
6492
|
+
] });
|
|
6493
|
+
}
|
|
6494
|
+
|
|
6495
|
+
// src/editor/nodes/inline-image/inline-image.tsx
|
|
6496
|
+
var import_core7 = require("@tiptap/core");
|
|
6497
|
+
var import_state4 = require("@tiptap/pm/state");
|
|
6498
|
+
var DEFAULT_INLINE_IMAGE_HEIGHT = 20;
|
|
6499
|
+
var DEFAULT_INLINE_IMAGE_WIDTH = 20;
|
|
6500
|
+
var InlineImageExtension = import_core7.Node.create({
|
|
6501
|
+
name: "inlineImage",
|
|
6502
|
+
inline: true,
|
|
6503
|
+
group: "inline",
|
|
6504
|
+
selectable: false,
|
|
6505
|
+
addOptions() {
|
|
6506
|
+
return {
|
|
6507
|
+
HTMLAttributes: {}
|
|
6508
|
+
};
|
|
6509
|
+
},
|
|
6510
|
+
addAttributes() {
|
|
6511
|
+
return {
|
|
6512
|
+
height: {
|
|
6513
|
+
default: DEFAULT_INLINE_IMAGE_HEIGHT
|
|
6514
|
+
},
|
|
6515
|
+
width: {
|
|
6516
|
+
default: DEFAULT_INLINE_IMAGE_WIDTH
|
|
6517
|
+
},
|
|
6518
|
+
src: {
|
|
6519
|
+
default: null
|
|
6520
|
+
},
|
|
6521
|
+
isSrcVariable: {
|
|
6522
|
+
default: false,
|
|
6523
|
+
renderHTML(attributes) {
|
|
6524
|
+
if (!attributes.isSrcVariable) {
|
|
6525
|
+
return {};
|
|
6526
|
+
}
|
|
6527
|
+
return {
|
|
6528
|
+
"data-is-src-variable": "true"
|
|
6529
|
+
};
|
|
6530
|
+
}
|
|
6531
|
+
},
|
|
6532
|
+
alt: {
|
|
6533
|
+
default: null
|
|
6534
|
+
},
|
|
6535
|
+
title: {
|
|
6536
|
+
default: null
|
|
6537
|
+
},
|
|
6538
|
+
externalLink: {
|
|
6539
|
+
default: null,
|
|
6540
|
+
renderHTML(attributes) {
|
|
6541
|
+
if (!attributes.externalLink) {
|
|
6542
|
+
return {};
|
|
6543
|
+
}
|
|
6544
|
+
return {
|
|
6545
|
+
"data-external-link": attributes.externalLink
|
|
6546
|
+
};
|
|
6547
|
+
}
|
|
6548
|
+
},
|
|
6549
|
+
isExternalLinkVariable: {
|
|
6550
|
+
default: false,
|
|
6551
|
+
renderHTML(attributes) {
|
|
6552
|
+
if (!attributes.isExternalLinkVariable) {
|
|
6553
|
+
return {};
|
|
6554
|
+
}
|
|
6555
|
+
return {
|
|
6556
|
+
"data-is-external-link-variable": "true"
|
|
6557
|
+
};
|
|
6558
|
+
}
|
|
6559
|
+
}
|
|
6560
|
+
};
|
|
6561
|
+
},
|
|
6562
|
+
parseHTML() {
|
|
6563
|
+
return [
|
|
6564
|
+
{
|
|
6565
|
+
tag: `img[data-type="${this.name}"]`
|
|
6566
|
+
}
|
|
6567
|
+
];
|
|
6568
|
+
},
|
|
6569
|
+
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
6570
|
+
const attrs = (0, import_core7.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
6571
|
+
"data-type": this.name,
|
|
6572
|
+
class: "mly:relative",
|
|
6573
|
+
style: `display: inline; --mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
|
|
6574
|
+
draggable: "false",
|
|
6575
|
+
loading: "lazy"
|
|
6576
|
+
});
|
|
6577
|
+
return ["img", attrs];
|
|
6578
|
+
},
|
|
6579
|
+
addCommands() {
|
|
6580
|
+
return {
|
|
6581
|
+
setInlineImage: (options) => ({ commands }) => {
|
|
6582
|
+
return commands.insertContent({
|
|
6583
|
+
type: this.name,
|
|
6584
|
+
attrs: options
|
|
6585
|
+
});
|
|
6586
|
+
}
|
|
6587
|
+
};
|
|
6588
|
+
},
|
|
6589
|
+
addProseMirrorPlugins() {
|
|
6590
|
+
return [
|
|
6591
|
+
new import_state4.Plugin({
|
|
6592
|
+
key: new import_state4.PluginKey("inlineImage"),
|
|
6593
|
+
props: {
|
|
6594
|
+
handleClickOn: (_, pos, node) => {
|
|
6595
|
+
if (node.type !== this.type) {
|
|
6596
|
+
return false;
|
|
6597
|
+
}
|
|
6598
|
+
const from = pos;
|
|
6599
|
+
const to = pos + node.nodeSize;
|
|
6600
|
+
this.editor.commands.setTextSelection({ from, to });
|
|
6601
|
+
return true;
|
|
6602
|
+
}
|
|
6603
|
+
}
|
|
6604
|
+
})
|
|
6605
|
+
];
|
|
6606
|
+
}
|
|
6607
|
+
});
|
|
6608
|
+
|
|
6609
|
+
// src/editor/components/inline-image-menu/use-inline-image-state.tsx
|
|
6610
|
+
var import_react25 = require("@tiptap/react");
|
|
6611
|
+
var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"), 1);
|
|
6612
|
+
var useInlineImageState = (editor) => {
|
|
6613
|
+
const states = (0, import_react25.useEditorState)({
|
|
6614
|
+
editor,
|
|
6615
|
+
selector: ({ editor: editor2 }) => {
|
|
6616
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6617
|
+
return {
|
|
6618
|
+
height: ((_a = editor2.getAttributes("inlineImage")) == null ? void 0 : _a.height) || DEFAULT_INLINE_IMAGE_HEIGHT,
|
|
6619
|
+
width: ((_b = editor2.getAttributes("inlineImage")) == null ? void 0 : _b.width) || DEFAULT_INLINE_IMAGE_WIDTH,
|
|
6620
|
+
src: ((_c = editor2.getAttributes("inlineImage")) == null ? void 0 : _c.src) || "",
|
|
6621
|
+
isSrcVariable: (_e = (_d = editor2.getAttributes("inlineImage")) == null ? void 0 : _d.isSrcVariable) != null ? _e : false,
|
|
6622
|
+
imageExternalLink: ((_f = editor2.getAttributes("inlineImage")) == null ? void 0 : _f.externalLink) || "",
|
|
6623
|
+
isExternalLinkVariable: (_h = (_g = editor2.getAttributes("inlineImage")) == null ? void 0 : _g.isExternalLinkVariable) != null ? _h : false
|
|
6624
|
+
};
|
|
6625
|
+
},
|
|
6626
|
+
equalityFn: import_fast_deep_equal3.default
|
|
6627
|
+
});
|
|
6628
|
+
return states;
|
|
6629
|
+
};
|
|
6630
|
+
|
|
6631
|
+
// src/editor/components/ui/link-input-popover.tsx
|
|
6632
|
+
var import_lucide_react22 = require("lucide-react");
|
|
6633
|
+
var import_react31 = require("react");
|
|
6634
|
+
|
|
6635
|
+
// src/editor/provider.tsx
|
|
6636
|
+
var import_react26 = require("react");
|
|
6637
|
+
|
|
6638
|
+
// src/editor/extensions/slash-command/default-slash-commands.tsx
|
|
6639
|
+
var import_lucide_react19 = require("lucide-react");
|
|
6640
|
+
|
|
6641
|
+
// src/blocks/button.tsx
|
|
6642
|
+
var import_lucide_react12 = require("lucide-react");
|
|
6371
6643
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6644
|
+
var button = {
|
|
6645
|
+
title: "Button",
|
|
6646
|
+
description: "Add a call to action button to email.",
|
|
6647
|
+
searchTerms: ["link", "button", "cta"],
|
|
6648
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.MousePointer, { className: "mly:h-4 mly:w-4" }),
|
|
6649
|
+
command: ({ editor, range }) => {
|
|
6650
|
+
editor.chain().focus().deleteRange(range).setButton().run();
|
|
6651
|
+
}
|
|
6652
|
+
};
|
|
6653
|
+
var linkCard = {
|
|
6654
|
+
title: "Link Card",
|
|
6655
|
+
description: "Add a link card to email.",
|
|
6656
|
+
searchTerms: ["link", "button", "image"],
|
|
6657
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.ArrowUpRightSquare, { className: "mly:h-4 mly:w-4" }),
|
|
6658
|
+
command: ({ editor, range }) => {
|
|
6659
|
+
editor.chain().focus().deleteRange(range).setLinkCard().run();
|
|
6660
|
+
},
|
|
6661
|
+
render: (editor) => {
|
|
6662
|
+
return editor.extensionManager.extensions.findIndex(
|
|
6663
|
+
(ext) => ext.name === "linkCard"
|
|
6664
|
+
) === -1 ? null : true;
|
|
6665
|
+
}
|
|
6666
|
+
};
|
|
6667
|
+
|
|
6668
|
+
// src/blocks/code.tsx
|
|
6669
|
+
var import_lucide_react13 = require("lucide-react");
|
|
6670
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
6671
|
+
var htmlCodeBlock = {
|
|
6672
|
+
title: "Custom HTML",
|
|
6673
|
+
description: "Insert a custom HTML block",
|
|
6674
|
+
searchTerms: ["html", "code", "custom"],
|
|
6675
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.CodeXmlIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6676
|
+
command: ({ editor, range }) => {
|
|
6677
|
+
editor.chain().focus().deleteRange(range).setHtmlCodeBlock({ language: "html" }).run();
|
|
6678
|
+
}
|
|
6679
|
+
};
|
|
6680
|
+
|
|
6681
|
+
// src/blocks/image.tsx
|
|
6682
|
+
var import_state5 = require("@tiptap/pm/state");
|
|
6683
|
+
var import_lucide_react14 = require("lucide-react");
|
|
6684
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
6685
|
+
var image = {
|
|
6686
|
+
title: "Image",
|
|
6687
|
+
description: "Full width image",
|
|
6688
|
+
searchTerms: ["image"],
|
|
6689
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.ImageIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6690
|
+
command: ({ editor, range }) => {
|
|
6691
|
+
editor.chain().focus().deleteRange(range).setImage({ src: "" }).run();
|
|
6692
|
+
}
|
|
6693
|
+
};
|
|
6694
|
+
var logo = {
|
|
6695
|
+
title: "Logo",
|
|
6696
|
+
description: "Add your brand logo",
|
|
6697
|
+
searchTerms: ["image", "logo"],
|
|
6698
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.ImageIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6699
|
+
command: ({ editor, range }) => {
|
|
6700
|
+
editor.chain().focus().deleteRange(range).setLogoImage({ src: "" }).run();
|
|
6701
|
+
}
|
|
6702
|
+
};
|
|
6703
|
+
var inlineImage = {
|
|
6704
|
+
title: "Inline Image",
|
|
6705
|
+
description: "Inline image",
|
|
6706
|
+
searchTerms: ["image", "inline"],
|
|
6707
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.ImageIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6708
|
+
command: ({ editor, range }) => {
|
|
6709
|
+
editor.chain().focus().deleteRange(range).setInlineImage({
|
|
6710
|
+
src: "https://maily.to/brand/logo.png"
|
|
6711
|
+
}).command((props) => {
|
|
6712
|
+
const { tr, state, view, editor: editor2 } = props;
|
|
6713
|
+
const { from } = range;
|
|
6714
|
+
const node = state.doc.nodeAt(from);
|
|
6715
|
+
if (!node) {
|
|
6716
|
+
return false;
|
|
6717
|
+
}
|
|
6718
|
+
const selection = import_state5.TextSelection.create(
|
|
6719
|
+
tr.doc,
|
|
6720
|
+
from,
|
|
6721
|
+
from + node.nodeSize
|
|
6722
|
+
);
|
|
6723
|
+
tr.setSelection(selection);
|
|
6724
|
+
return true;
|
|
6725
|
+
}).run();
|
|
6726
|
+
}
|
|
6727
|
+
};
|
|
6728
|
+
|
|
6729
|
+
// src/blocks/layout.tsx
|
|
6730
|
+
var import_lucide_react15 = require("lucide-react");
|
|
6731
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6372
6732
|
var columns = {
|
|
6373
6733
|
title: "Columns",
|
|
6374
6734
|
description: "Add columns to email.",
|
|
6375
6735
|
searchTerms: ["layout", "columns"],
|
|
6376
|
-
icon: /* @__PURE__ */ (0,
|
|
6736
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.ColumnsIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6377
6737
|
command: ({ editor, range }) => {
|
|
6378
6738
|
editor.chain().focus().deleteRange(range).setColumns().focus(editor.state.selection.head - 2).run();
|
|
6379
6739
|
}
|
|
@@ -6382,7 +6742,7 @@ var section = {
|
|
|
6382
6742
|
title: "Section",
|
|
6383
6743
|
description: "Add a section to email.",
|
|
6384
6744
|
searchTerms: ["layout", "section"],
|
|
6385
|
-
icon: /* @__PURE__ */ (0,
|
|
6745
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.RectangleHorizontal, { className: "mly:h-4 mly:w-4" }),
|
|
6386
6746
|
command: ({ editor, range }) => {
|
|
6387
6747
|
editor.chain().focus().deleteRange(range).setSection().run();
|
|
6388
6748
|
}
|
|
@@ -6391,7 +6751,7 @@ var repeat = {
|
|
|
6391
6751
|
title: "Repeat",
|
|
6392
6752
|
description: "Loop over an array of items.",
|
|
6393
6753
|
searchTerms: ["repeat", "for", "loop"],
|
|
6394
|
-
icon: /* @__PURE__ */ (0,
|
|
6754
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.Repeat2, { className: "mly:h-4 mly:w-4" }),
|
|
6395
6755
|
command: ({ editor, range }) => {
|
|
6396
6756
|
editor.chain().focus().deleteRange(range).setRepeat().run();
|
|
6397
6757
|
}
|
|
@@ -6400,7 +6760,7 @@ var spacer = {
|
|
|
6400
6760
|
title: "Spacer",
|
|
6401
6761
|
description: "Add space between blocks.",
|
|
6402
6762
|
searchTerms: ["space", "gap", "divider"],
|
|
6403
|
-
icon: /* @__PURE__ */ (0,
|
|
6763
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.MoveVertical, { className: "mly:h-4 mly:w-4" }),
|
|
6404
6764
|
command: ({ editor, range }) => {
|
|
6405
6765
|
editor.chain().focus().deleteRange(range).setSpacer({ height: "sm" }).run();
|
|
6406
6766
|
}
|
|
@@ -6409,20 +6769,32 @@ var divider = {
|
|
|
6409
6769
|
title: "Divider",
|
|
6410
6770
|
description: "Add a horizontal divider.",
|
|
6411
6771
|
searchTerms: ["divider", "line"],
|
|
6412
|
-
icon: /* @__PURE__ */ (0,
|
|
6772
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.Minus, { className: "mly:h-4 mly:w-4" }),
|
|
6413
6773
|
command: ({ editor, range }) => {
|
|
6414
6774
|
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
6775
|
+
const { from } = editor.state.selection;
|
|
6776
|
+
const nearbyPositions = [from, from - 1, from - 2, from + 1];
|
|
6777
|
+
const dividerPos = nearbyPositions.find((pos) => {
|
|
6778
|
+
var _a;
|
|
6779
|
+
if (pos < 0) {
|
|
6780
|
+
return false;
|
|
6781
|
+
}
|
|
6782
|
+
return ((_a = editor.state.doc.nodeAt(pos)) == null ? void 0 : _a.type.name) === "horizontalRule";
|
|
6783
|
+
});
|
|
6784
|
+
if (dividerPos != null) {
|
|
6785
|
+
editor.chain().focus().setNodeSelection(dividerPos).run();
|
|
6786
|
+
}
|
|
6415
6787
|
}
|
|
6416
6788
|
};
|
|
6417
6789
|
|
|
6418
6790
|
// src/blocks/list.tsx
|
|
6419
|
-
var
|
|
6420
|
-
var
|
|
6791
|
+
var import_lucide_react16 = require("lucide-react");
|
|
6792
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
6421
6793
|
var bulletList = {
|
|
6422
6794
|
title: "Bullet List",
|
|
6423
6795
|
description: "Create a simple bullet list.",
|
|
6424
6796
|
searchTerms: ["unordered", "point"],
|
|
6425
|
-
icon: /* @__PURE__ */ (0,
|
|
6797
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react16.List, { className: "mly:h-4 mly:w-4" }),
|
|
6426
6798
|
command: ({ editor, range }) => {
|
|
6427
6799
|
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
6428
6800
|
}
|
|
@@ -6431,20 +6803,20 @@ var orderedList = {
|
|
|
6431
6803
|
title: "Numbered List",
|
|
6432
6804
|
description: "Create a list with numbering.",
|
|
6433
6805
|
searchTerms: ["ordered"],
|
|
6434
|
-
icon: /* @__PURE__ */ (0,
|
|
6806
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react16.ListOrdered, { className: "mly:h-4 mly:w-4" }),
|
|
6435
6807
|
command: ({ editor, range }) => {
|
|
6436
6808
|
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
6437
6809
|
}
|
|
6438
6810
|
};
|
|
6439
6811
|
|
|
6440
6812
|
// src/blocks/typography.tsx
|
|
6441
|
-
var
|
|
6442
|
-
var
|
|
6813
|
+
var import_lucide_react17 = require("lucide-react");
|
|
6814
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
6443
6815
|
var text = {
|
|
6444
6816
|
title: "Text",
|
|
6445
6817
|
description: "Just start typing with plain text.",
|
|
6446
6818
|
searchTerms: ["p", "paragraph"],
|
|
6447
|
-
icon: /* @__PURE__ */ (0,
|
|
6819
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.Text, { className: "mly:h-4 mly:w-4" }),
|
|
6448
6820
|
command: ({ editor, range }) => {
|
|
6449
6821
|
editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
|
|
6450
6822
|
}
|
|
@@ -6453,7 +6825,7 @@ var heading1 = {
|
|
|
6453
6825
|
title: "Heading 1",
|
|
6454
6826
|
description: "Big heading.",
|
|
6455
6827
|
searchTerms: ["h1", "title", "big", "large"],
|
|
6456
|
-
icon: /* @__PURE__ */ (0,
|
|
6828
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.Heading1, { className: "mly:h-4 mly:w-4" }),
|
|
6457
6829
|
command: ({ editor, range }) => {
|
|
6458
6830
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
|
|
6459
6831
|
}
|
|
@@ -6462,7 +6834,7 @@ var heading2 = {
|
|
|
6462
6834
|
title: "Heading 2",
|
|
6463
6835
|
description: "Medium heading.",
|
|
6464
6836
|
searchTerms: ["h2", "subtitle", "medium"],
|
|
6465
|
-
icon: /* @__PURE__ */ (0,
|
|
6837
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.Heading2, { className: "mly:h-4 mly:w-4" }),
|
|
6466
6838
|
command: ({ editor, range }) => {
|
|
6467
6839
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
|
|
6468
6840
|
}
|
|
@@ -6471,7 +6843,7 @@ var heading3 = {
|
|
|
6471
6843
|
title: "Heading 3",
|
|
6472
6844
|
description: "Small heading.",
|
|
6473
6845
|
searchTerms: ["h3", "subtitle", "small"],
|
|
6474
|
-
icon: /* @__PURE__ */ (0,
|
|
6846
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.Heading3, { className: "mly:h-4 mly:w-4" }),
|
|
6475
6847
|
command: ({ editor, range }) => {
|
|
6476
6848
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
|
|
6477
6849
|
}
|
|
@@ -6480,7 +6852,7 @@ var hardBreak = {
|
|
|
6480
6852
|
title: "Hard Break",
|
|
6481
6853
|
description: "Add a break between lines.",
|
|
6482
6854
|
searchTerms: ["break", "line"],
|
|
6483
|
-
icon: /* @__PURE__ */ (0,
|
|
6855
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.DivideIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6484
6856
|
command: ({ editor, range }) => {
|
|
6485
6857
|
editor.chain().focus().deleteRange(range).setHardBreak().run();
|
|
6486
6858
|
}
|
|
@@ -6489,7 +6861,7 @@ var blockquote = {
|
|
|
6489
6861
|
title: "Blockquote",
|
|
6490
6862
|
description: "Add blockquote.",
|
|
6491
6863
|
searchTerms: ["quote", "blockquote"],
|
|
6492
|
-
icon: /* @__PURE__ */ (0,
|
|
6864
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.TextQuote, { className: "mly:h-4 mly:w-4" }),
|
|
6493
6865
|
command: ({ editor, range }) => {
|
|
6494
6866
|
editor.chain().focus().deleteRange(range).toggleBlockquote().run();
|
|
6495
6867
|
}
|
|
@@ -6498,7 +6870,7 @@ var footer = {
|
|
|
6498
6870
|
title: "Footer",
|
|
6499
6871
|
description: "Add a footer text to email.",
|
|
6500
6872
|
searchTerms: ["footer", "text"],
|
|
6501
|
-
icon: /* @__PURE__ */ (0,
|
|
6873
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.FootprintsIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6502
6874
|
command: ({ editor, range }) => {
|
|
6503
6875
|
editor.chain().focus().deleteRange(range).setFooter().run();
|
|
6504
6876
|
}
|
|
@@ -6507,16 +6879,16 @@ var clearLine = {
|
|
|
6507
6879
|
title: "Clear Line",
|
|
6508
6880
|
description: "Clear the current line.",
|
|
6509
6881
|
searchTerms: ["clear", "line"],
|
|
6510
|
-
icon: /* @__PURE__ */ (0,
|
|
6882
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.EraserIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6511
6883
|
command: ({ editor, range }) => {
|
|
6512
6884
|
editor.chain().focus().selectParentNode().deleteSelection().run();
|
|
6513
6885
|
}
|
|
6514
6886
|
};
|
|
6515
6887
|
|
|
6516
6888
|
// src/editor/components/icons/logo-with-cover-image.tsx
|
|
6517
|
-
var
|
|
6889
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6518
6890
|
function LogoWithCoverImageIcon(props) {
|
|
6519
|
-
return /* @__PURE__ */ (0,
|
|
6891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
6520
6892
|
"svg",
|
|
6521
6893
|
__spreadProps(__spreadValues({
|
|
6522
6894
|
width: "14",
|
|
@@ -6526,7 +6898,7 @@ function LogoWithCoverImageIcon(props) {
|
|
|
6526
6898
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6527
6899
|
}, props), {
|
|
6528
6900
|
children: [
|
|
6529
|
-
/* @__PURE__ */ (0,
|
|
6901
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6530
6902
|
"path",
|
|
6531
6903
|
{
|
|
6532
6904
|
fillRule: "evenodd",
|
|
@@ -6535,7 +6907,7 @@ function LogoWithCoverImageIcon(props) {
|
|
|
6535
6907
|
fill: "currentColor"
|
|
6536
6908
|
}
|
|
6537
6909
|
),
|
|
6538
|
-
/* @__PURE__ */ (0,
|
|
6910
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6539
6911
|
"path",
|
|
6540
6912
|
{
|
|
6541
6913
|
fillRule: "evenodd",
|
|
@@ -6544,7 +6916,7 @@ function LogoWithCoverImageIcon(props) {
|
|
|
6544
6916
|
fill: "currentColor"
|
|
6545
6917
|
}
|
|
6546
6918
|
),
|
|
6547
|
-
/* @__PURE__ */ (0,
|
|
6919
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6548
6920
|
"path",
|
|
6549
6921
|
{
|
|
6550
6922
|
fillRule: "evenodd",
|
|
@@ -6553,8 +6925,8 @@ function LogoWithCoverImageIcon(props) {
|
|
|
6553
6925
|
fill: "currentColor"
|
|
6554
6926
|
}
|
|
6555
6927
|
),
|
|
6556
|
-
/* @__PURE__ */ (0,
|
|
6557
|
-
/* @__PURE__ */ (0,
|
|
6928
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("mask", { id: "path-4-inside-1_1046_19527", fill: "white", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("rect", { x: "3", y: "4", width: "8", height: "3", rx: "0.5" }) }),
|
|
6929
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6558
6930
|
"rect",
|
|
6559
6931
|
{
|
|
6560
6932
|
x: "3",
|
|
@@ -6567,7 +6939,7 @@ function LogoWithCoverImageIcon(props) {
|
|
|
6567
6939
|
mask: "url(#path-4-inside-1_1046_19527)"
|
|
6568
6940
|
}
|
|
6569
6941
|
),
|
|
6570
|
-
/* @__PURE__ */ (0,
|
|
6942
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6571
6943
|
"rect",
|
|
6572
6944
|
{
|
|
6573
6945
|
x: "6.25",
|
|
@@ -6579,16 +6951,16 @@ function LogoWithCoverImageIcon(props) {
|
|
|
6579
6951
|
strokeWidth: "0.5"
|
|
6580
6952
|
}
|
|
6581
6953
|
),
|
|
6582
|
-
/* @__PURE__ */ (0,
|
|
6954
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("rect", { x: "3", y: "8", width: "2", height: "1", rx: "0.5", fill: "currentColor" })
|
|
6583
6955
|
]
|
|
6584
6956
|
})
|
|
6585
6957
|
);
|
|
6586
6958
|
}
|
|
6587
6959
|
|
|
6588
6960
|
// src/editor/components/icons/logo-with-text-horizon.tsx
|
|
6589
|
-
var
|
|
6961
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6590
6962
|
function LogoWithTextHorizonIcon(props) {
|
|
6591
|
-
return /* @__PURE__ */ (0,
|
|
6963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
6592
6964
|
"svg",
|
|
6593
6965
|
__spreadProps(__spreadValues({
|
|
6594
6966
|
width: "14",
|
|
@@ -6598,7 +6970,7 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
6598
6970
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6599
6971
|
}, props), {
|
|
6600
6972
|
children: [
|
|
6601
|
-
/* @__PURE__ */ (0,
|
|
6973
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6602
6974
|
"path",
|
|
6603
6975
|
{
|
|
6604
6976
|
fillRule: "evenodd",
|
|
@@ -6607,7 +6979,7 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
6607
6979
|
fill: "currentColor"
|
|
6608
6980
|
}
|
|
6609
6981
|
),
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6982
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6611
6983
|
"rect",
|
|
6612
6984
|
{
|
|
6613
6985
|
x: "6.25",
|
|
@@ -6619,8 +6991,8 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
6619
6991
|
strokeWidth: "0.5"
|
|
6620
6992
|
}
|
|
6621
6993
|
),
|
|
6622
|
-
/* @__PURE__ */ (0,
|
|
6623
|
-
/* @__PURE__ */ (0,
|
|
6994
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("rect", { x: "3", y: "6.5", width: "2", height: "1", rx: "0.5", fill: "currentColor" }),
|
|
6995
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6624
6996
|
"path",
|
|
6625
6997
|
{
|
|
6626
6998
|
fillRule: "evenodd",
|
|
@@ -6629,7 +7001,7 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
6629
7001
|
fill: "currentColor"
|
|
6630
7002
|
}
|
|
6631
7003
|
),
|
|
6632
|
-
/* @__PURE__ */ (0,
|
|
7004
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6633
7005
|
"path",
|
|
6634
7006
|
{
|
|
6635
7007
|
fillRule: "evenodd",
|
|
@@ -6644,9 +7016,9 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
6644
7016
|
}
|
|
6645
7017
|
|
|
6646
7018
|
// src/editor/components/icons/logo-with-text-vertical.tsx
|
|
6647
|
-
var
|
|
7019
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6648
7020
|
function LogoWithTextVerticalIcon(props) {
|
|
6649
|
-
return /* @__PURE__ */ (0,
|
|
7021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6650
7022
|
"svg",
|
|
6651
7023
|
__spreadProps(__spreadValues({
|
|
6652
7024
|
width: "14",
|
|
@@ -6656,7 +7028,7 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
6656
7028
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6657
7029
|
}, props), {
|
|
6658
7030
|
children: [
|
|
6659
|
-
/* @__PURE__ */ (0,
|
|
7031
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6660
7032
|
"path",
|
|
6661
7033
|
{
|
|
6662
7034
|
fillRule: "evenodd",
|
|
@@ -6665,7 +7037,7 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
6665
7037
|
fill: "currentColor"
|
|
6666
7038
|
}
|
|
6667
7039
|
),
|
|
6668
|
-
/* @__PURE__ */ (0,
|
|
7040
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6669
7041
|
"rect",
|
|
6670
7042
|
{
|
|
6671
7043
|
x: "4.25",
|
|
@@ -6677,8 +7049,8 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
6677
7049
|
strokeWidth: "0.5"
|
|
6678
7050
|
}
|
|
6679
7051
|
),
|
|
6680
|
-
/* @__PURE__ */ (0,
|
|
6681
|
-
/* @__PURE__ */ (0,
|
|
7052
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("rect", { x: "6", y: "6", width: "2", height: "1", rx: "0.5", fill: "currentColor" }),
|
|
7053
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6682
7054
|
"path",
|
|
6683
7055
|
{
|
|
6684
7056
|
fillRule: "evenodd",
|
|
@@ -6687,7 +7059,7 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
6687
7059
|
fill: "currentColor"
|
|
6688
7060
|
}
|
|
6689
7061
|
),
|
|
6690
|
-
/* @__PURE__ */ (0,
|
|
7062
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6691
7063
|
"path",
|
|
6692
7064
|
{
|
|
6693
7065
|
fillRule: "evenodd",
|
|
@@ -6702,12 +7074,12 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
6702
7074
|
}
|
|
6703
7075
|
|
|
6704
7076
|
// src/blocks/headers.tsx
|
|
6705
|
-
var
|
|
7077
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6706
7078
|
var headerLogoWithTextHorizontal = {
|
|
6707
7079
|
title: "Logo with Text (Horizontal)",
|
|
6708
7080
|
description: "Logo and a text horizontally",
|
|
6709
7081
|
searchTerms: ["logo", "text"],
|
|
6710
|
-
icon: /* @__PURE__ */ (0,
|
|
7082
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LogoWithTextHorizonIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6711
7083
|
command: ({ editor, range }) => {
|
|
6712
7084
|
editor.chain().deleteRange(range).insertContent({
|
|
6713
7085
|
type: "columns",
|
|
@@ -6771,7 +7143,7 @@ var headerLogoWithTextVertical = {
|
|
|
6771
7143
|
title: "Logo with Text (Vertical)",
|
|
6772
7144
|
description: "Logo and a text vertically",
|
|
6773
7145
|
searchTerms: ["logo", "text"],
|
|
6774
|
-
icon: /* @__PURE__ */ (0,
|
|
7146
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LogoWithTextVerticalIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6775
7147
|
command: ({ editor, range }) => {
|
|
6776
7148
|
editor.chain().deleteRange(range).insertContent([
|
|
6777
7149
|
{
|
|
@@ -6802,7 +7174,7 @@ var headerLogoWithCoverImage = {
|
|
|
6802
7174
|
title: "Logo with Cover Image",
|
|
6803
7175
|
description: "Logo and a cover image",
|
|
6804
7176
|
searchTerms: ["logo", "cover", "image"],
|
|
6805
|
-
icon: /* @__PURE__ */ (0,
|
|
7177
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LogoWithCoverImageIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6806
7178
|
command: ({ editor, range }) => {
|
|
6807
7179
|
const todayFormatted = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
6808
7180
|
year: "numeric",
|
|
@@ -6890,13 +7262,13 @@ var headerLogoWithCoverImage = {
|
|
|
6890
7262
|
};
|
|
6891
7263
|
|
|
6892
7264
|
// src/blocks/footers.tsx
|
|
6893
|
-
var
|
|
6894
|
-
var
|
|
7265
|
+
var import_lucide_react18 = require("lucide-react");
|
|
7266
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6895
7267
|
var footerCopyrightText = {
|
|
6896
7268
|
title: "Footer Copyright",
|
|
6897
7269
|
description: "Copyright text for the footer.",
|
|
6898
7270
|
searchTerms: ["footer", "copyright"],
|
|
6899
|
-
icon: /* @__PURE__ */ (0,
|
|
7271
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react18.CopyrightIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6900
7272
|
command: ({ editor, range }) => {
|
|
6901
7273
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
6902
7274
|
editor.chain().focus().deleteRange(range).insertContent({
|
|
@@ -6916,7 +7288,7 @@ var footerCommunityFeedbackCta = {
|
|
|
6916
7288
|
title: "Footer Community Feedback CTA",
|
|
6917
7289
|
description: "Community feedback CTA for the footer.",
|
|
6918
7290
|
searchTerms: ["footer", "community", "feedback", "cta"],
|
|
6919
|
-
icon: /* @__PURE__ */ (0,
|
|
7291
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react18.RectangleHorizontalIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6920
7292
|
command: ({ editor, range }) => {
|
|
6921
7293
|
editor.chain().focus().deleteRange(range).insertContent([
|
|
6922
7294
|
{
|
|
@@ -6959,7 +7331,7 @@ var footerCompanySignature = {
|
|
|
6959
7331
|
title: "Footer Company Signature",
|
|
6960
7332
|
description: "Company signature for the footer.",
|
|
6961
7333
|
searchTerms: ["footer", "company", "signature"],
|
|
6962
|
-
icon: /* @__PURE__ */ (0,
|
|
7334
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react18.LayoutTemplateIcon, { className: "mly:h-4 mly:w-4" }),
|
|
6963
7335
|
command: ({ editor, range }) => {
|
|
6964
7336
|
editor.chain().focus().deleteRange(range).insertContent([
|
|
6965
7337
|
{ type: "horizontalRule" },
|
|
@@ -7113,7 +7485,7 @@ var footerCompanySignature = {
|
|
|
7113
7485
|
};
|
|
7114
7486
|
|
|
7115
7487
|
// src/editor/extensions/slash-command/default-slash-commands.tsx
|
|
7116
|
-
var
|
|
7488
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7117
7489
|
var DEFAULT_SLASH_COMMANDS = [
|
|
7118
7490
|
{
|
|
7119
7491
|
title: "Blocks",
|
|
@@ -7148,7 +7520,7 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
7148
7520
|
title: "Headers",
|
|
7149
7521
|
description: "Add pre-designed headers block",
|
|
7150
7522
|
searchTerms: ["header", "headers"],
|
|
7151
|
-
icon: /* @__PURE__ */ (0,
|
|
7523
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react19.Heading1, { className: "mly:h-4 mly:w-4" }),
|
|
7152
7524
|
preview: "https://cdn.usemaily.com/previews/header-preview-xyz.png",
|
|
7153
7525
|
commands: [
|
|
7154
7526
|
headerLogoWithTextVertical,
|
|
@@ -7161,7 +7533,7 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
7161
7533
|
title: "Footers",
|
|
7162
7534
|
description: "Add pre-designed footers block",
|
|
7163
7535
|
searchTerms: ["footers"],
|
|
7164
|
-
icon: /* @__PURE__ */ (0,
|
|
7536
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react19.FootprintsIcon, { className: "mly:h-4 mly:w-4" }),
|
|
7165
7537
|
commands: [
|
|
7166
7538
|
footerCopyrightText,
|
|
7167
7539
|
footerCommunityFeedbackCta,
|
|
@@ -7174,18 +7546,18 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
7174
7546
|
];
|
|
7175
7547
|
|
|
7176
7548
|
// src/editor/provider.tsx
|
|
7177
|
-
var
|
|
7549
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7178
7550
|
var DEFAULT_PLACEHOLDER_URL = "https://maily.to/";
|
|
7179
|
-
var MailyContext = (0,
|
|
7551
|
+
var MailyContext = (0, import_react26.createContext)({
|
|
7180
7552
|
placeholderUrl: DEFAULT_PLACEHOLDER_URL,
|
|
7181
7553
|
blocks: DEFAULT_SLASH_COMMANDS
|
|
7182
7554
|
});
|
|
7183
7555
|
function MailyProvider(props) {
|
|
7184
7556
|
const _a = props, { children } = _a, defaultValues = __objRest(_a, ["children"]);
|
|
7185
|
-
return /* @__PURE__ */ (0,
|
|
7557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(MailyContext.Provider, { value: defaultValues, children });
|
|
7186
7558
|
}
|
|
7187
7559
|
function useMailyContext() {
|
|
7188
|
-
const values = (0,
|
|
7560
|
+
const values = (0, import_react26.useContext)(MailyContext);
|
|
7189
7561
|
if (!values) {
|
|
7190
7562
|
throw new Error("Missing MailyContext.Provider in the component tree");
|
|
7191
7563
|
}
|
|
@@ -7193,23 +7565,23 @@ function useMailyContext() {
|
|
|
7193
7565
|
}
|
|
7194
7566
|
|
|
7195
7567
|
// src/editor/components/ui/link-input-popover.tsx
|
|
7196
|
-
var
|
|
7568
|
+
var import_react32 = require("react");
|
|
7197
7569
|
|
|
7198
7570
|
// src/editor/nodes/variable/variable.ts
|
|
7199
|
-
var
|
|
7200
|
-
var
|
|
7201
|
-
var
|
|
7571
|
+
var import_core8 = require("@tiptap/core");
|
|
7572
|
+
var import_state6 = require("@tiptap/pm/state");
|
|
7573
|
+
var import_react30 = require("@tiptap/react");
|
|
7202
7574
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
7203
7575
|
|
|
7204
7576
|
// src/editor/nodes/variable/variable-suggestions-popover.tsx
|
|
7205
|
-
var
|
|
7206
|
-
var
|
|
7207
|
-
var
|
|
7208
|
-
var VariableSuggestionsPopover = (0,
|
|
7577
|
+
var import_lucide_react20 = require("lucide-react");
|
|
7578
|
+
var import_react27 = require("react");
|
|
7579
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
7580
|
+
var VariableSuggestionsPopover = (0, import_react27.forwardRef)((props, ref) => {
|
|
7209
7581
|
const { items, onSelectItem } = props;
|
|
7210
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
7211
|
-
const scrollContainerRef = (0,
|
|
7212
|
-
const itemRefs = (0,
|
|
7582
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react27.useState)(0);
|
|
7583
|
+
const scrollContainerRef = (0, import_react27.useRef)(null);
|
|
7584
|
+
const itemRefs = (0, import_react27.useRef)([]);
|
|
7213
7585
|
const scrollSelectedIntoView = (index) => {
|
|
7214
7586
|
const container = scrollContainerRef.current;
|
|
7215
7587
|
const selectedItem = itemRefs.current[index];
|
|
@@ -7225,17 +7597,17 @@ var VariableSuggestionsPopover = (0, import_react22.forwardRef)((props, ref) =>
|
|
|
7225
7597
|
container.scrollTop += itemRect.top - containerRect.top - padding;
|
|
7226
7598
|
}
|
|
7227
7599
|
};
|
|
7228
|
-
(0,
|
|
7600
|
+
(0, import_react27.useEffect)(() => {
|
|
7229
7601
|
setSelectedIndex(0);
|
|
7230
7602
|
if (scrollContainerRef.current) {
|
|
7231
7603
|
scrollContainerRef.current.scrollTop = 0;
|
|
7232
7604
|
}
|
|
7233
7605
|
itemRefs.current = items.map(() => null);
|
|
7234
7606
|
}, [items]);
|
|
7235
|
-
(0,
|
|
7607
|
+
(0, import_react27.useEffect)(() => {
|
|
7236
7608
|
scrollSelectedIntoView(selectedIndex);
|
|
7237
7609
|
}, [selectedIndex]);
|
|
7238
|
-
(0,
|
|
7610
|
+
(0, import_react27.useImperativeHandle)(ref, () => ({
|
|
7239
7611
|
moveUp: () => {
|
|
7240
7612
|
setSelectedIndex((selectedIndex + items.length - 1) % items.length);
|
|
7241
7613
|
},
|
|
@@ -7250,17 +7622,17 @@ var VariableSuggestionsPopover = (0, import_react22.forwardRef)((props, ref) =>
|
|
|
7250
7622
|
onSelectItem(item);
|
|
7251
7623
|
}
|
|
7252
7624
|
}));
|
|
7253
|
-
return /* @__PURE__ */ (0,
|
|
7254
|
-
/* @__PURE__ */ (0,
|
|
7255
|
-
/* @__PURE__ */ (0,
|
|
7256
|
-
/* @__PURE__ */ (0,
|
|
7625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly:z-50 mly:w-64 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:shadow-md mly:transition-all", children: [
|
|
7626
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly:flex mly:items-center mly:justify-between mly:gap-2 mly:border-b mly:border-gray-200 mly:bg-soft-gray/40 mly:px-1 mly:py-1.5 mly:text-gray-500", children: [
|
|
7627
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "mly:text-xs mly:uppercase", children: "Variables" }),
|
|
7628
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react20.Braces, { className: "mly:size-3 mly:stroke-[2.5]" }) })
|
|
7257
7629
|
] }),
|
|
7258
|
-
/* @__PURE__ */ (0,
|
|
7630
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7259
7631
|
"div",
|
|
7260
7632
|
{
|
|
7261
7633
|
ref: scrollContainerRef,
|
|
7262
7634
|
className: "mly:max-h-52 mly:overflow-y-auto mly:scrollbar-thin mly:scrollbar-track-transparent mly:scrollbar-thumb-gray-200",
|
|
7263
|
-
children: /* @__PURE__ */ (0,
|
|
7635
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly:flex mly:w-fit mly:min-w-full mly:flex-col mly:gap-0.5 mly:p-1", children: (items == null ? void 0 : items.length) ? items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7264
7636
|
"button",
|
|
7265
7637
|
{
|
|
7266
7638
|
ref: (el) => itemRefs.current[index] = el,
|
|
@@ -7270,27 +7642,27 @@ var VariableSuggestionsPopover = (0, import_react22.forwardRef)((props, ref) =>
|
|
|
7270
7642
|
index === selectedIndex ? "mly:bg-soft-gray" : "mly:bg-white"
|
|
7271
7643
|
),
|
|
7272
7644
|
children: [
|
|
7273
|
-
/* @__PURE__ */ (0,
|
|
7645
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react20.Braces, { className: "mly:size-3 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7274
7646
|
(item == null ? void 0 : item.label) || item.name
|
|
7275
7647
|
]
|
|
7276
7648
|
},
|
|
7277
7649
|
index
|
|
7278
|
-
)) : /* @__PURE__ */ (0,
|
|
7650
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly:flex mly:h-7 mly:w-full mly:items-center mly:gap-2 mly:rounded-md mly:px-2 mly:py-1 mly:text-left mly:font-mono mly:text-[13px] mly:text-gray-900 mly:hover:bg-soft-gray", children: "No result" }) })
|
|
7279
7651
|
}
|
|
7280
7652
|
),
|
|
7281
|
-
/* @__PURE__ */ (0,
|
|
7282
|
-
/* @__PURE__ */ (0,
|
|
7283
|
-
/* @__PURE__ */ (0,
|
|
7284
|
-
/* @__PURE__ */ (0,
|
|
7285
|
-
/* @__PURE__ */ (0,
|
|
7653
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly:flex mly:items-center mly:justify-between mly:gap-2 mly:border-t mly:border-gray-200 mly:px-1 mly:py-1.5 mly:text-gray-500", children: [
|
|
7654
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly:flex mly:items-center mly:gap-1", children: [
|
|
7655
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react20.ArrowDownIcon, { className: "mly:size-3 mly:stroke-[2.5]" }) }),
|
|
7656
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react20.ArrowUpIcon, { className: "mly:size-3 mly:stroke-[2.5]" }) }),
|
|
7657
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "mly:text-xs mly:text-gray-500", children: "Navigate" })
|
|
7286
7658
|
] }),
|
|
7287
|
-
/* @__PURE__ */ (0,
|
|
7659
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react20.CornerDownLeftIcon, { className: "mly:size-3 mly:stroke-[2.5]" }) })
|
|
7288
7660
|
] })
|
|
7289
7661
|
] });
|
|
7290
7662
|
});
|
|
7291
7663
|
function VariableIcon(props) {
|
|
7292
7664
|
const { className, children } = props;
|
|
7293
|
-
return /* @__PURE__ */ (0,
|
|
7665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7294
7666
|
"div",
|
|
7295
7667
|
{
|
|
7296
7668
|
className: cn(
|
|
@@ -7303,10 +7675,10 @@ function VariableIcon(props) {
|
|
|
7303
7675
|
}
|
|
7304
7676
|
|
|
7305
7677
|
// src/editor/nodes/variable/variable-view.tsx
|
|
7306
|
-
var
|
|
7307
|
-
var
|
|
7308
|
-
var
|
|
7309
|
-
var
|
|
7678
|
+
var import_react28 = require("@tiptap/react");
|
|
7679
|
+
var import_lucide_react21 = require("lucide-react");
|
|
7680
|
+
var import_react29 = require("react");
|
|
7681
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7310
7682
|
function VariableView(props) {
|
|
7311
7683
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
7312
7684
|
const {
|
|
@@ -7316,24 +7688,24 @@ function VariableView(props) {
|
|
|
7316
7688
|
hideDefaultValue = false,
|
|
7317
7689
|
label
|
|
7318
7690
|
} = node.attrs;
|
|
7319
|
-
const renderVariable = (0,
|
|
7691
|
+
const renderVariable = (0, import_react29.useMemo)(() => {
|
|
7320
7692
|
var _a, _b;
|
|
7321
7693
|
const variableRender = (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.renderVariable) != null ? _b : DEFAULT_RENDER_VARIABLE_FUNCTION;
|
|
7322
7694
|
return variableRender;
|
|
7323
7695
|
}, [editor]);
|
|
7324
|
-
return /* @__PURE__ */ (0,
|
|
7325
|
-
|
|
7696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7697
|
+
import_react28.NodeViewWrapper,
|
|
7326
7698
|
{
|
|
7327
7699
|
className: "react-component mly:inline-block mly:leading-none",
|
|
7328
7700
|
draggable: "false",
|
|
7329
|
-
children: /* @__PURE__ */ (0,
|
|
7701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7330
7702
|
Popover,
|
|
7331
7703
|
{
|
|
7332
7704
|
onOpenChange: (open) => {
|
|
7333
7705
|
editor.storage.variable.popover = open;
|
|
7334
7706
|
},
|
|
7335
7707
|
children: [
|
|
7336
|
-
/* @__PURE__ */ (0,
|
|
7708
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PopoverTrigger, { children: renderVariable({
|
|
7337
7709
|
variable: {
|
|
7338
7710
|
name: id,
|
|
7339
7711
|
required,
|
|
@@ -7344,7 +7716,7 @@ function VariableView(props) {
|
|
|
7344
7716
|
editor,
|
|
7345
7717
|
from: "content-variable"
|
|
7346
7718
|
}) }),
|
|
7347
|
-
/* @__PURE__ */ (0,
|
|
7719
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7348
7720
|
PopoverContent,
|
|
7349
7721
|
{
|
|
7350
7722
|
align: "start",
|
|
@@ -7353,10 +7725,10 @@ function VariableView(props) {
|
|
|
7353
7725
|
sideOffset: 8,
|
|
7354
7726
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
7355
7727
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
7356
|
-
children: /* @__PURE__ */ (0,
|
|
7357
|
-
/* @__PURE__ */ (0,
|
|
7358
|
-
/* @__PURE__ */ (0,
|
|
7359
|
-
/* @__PURE__ */ (0,
|
|
7728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mly:flex mly:items-stretch mly:text-midnight-gray", children: [
|
|
7729
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "mly:relative", children: [
|
|
7730
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "mly:inline-block mly:px-2 mly:text-xs mly:text-midnight-gray", children: "Variable" }),
|
|
7731
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7360
7732
|
"input",
|
|
7361
7733
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
7362
7734
|
value: id != null ? id : "",
|
|
@@ -7370,11 +7742,11 @@ function VariableView(props) {
|
|
|
7370
7742
|
})
|
|
7371
7743
|
)
|
|
7372
7744
|
] }),
|
|
7373
|
-
!hideDefaultValue && /* @__PURE__ */ (0,
|
|
7374
|
-
/* @__PURE__ */ (0,
|
|
7375
|
-
/* @__PURE__ */ (0,
|
|
7376
|
-
/* @__PURE__ */ (0,
|
|
7377
|
-
/* @__PURE__ */ (0,
|
|
7745
|
+
!hideDefaultValue && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
7746
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Divider, { className: "mly:mx-1.5" }),
|
|
7747
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "mly:relative", children: [
|
|
7748
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "mly:inline-block mly:px-2 mly:pl-1 mly:text-xs mly:text-midnight-gray", children: "Default" }),
|
|
7749
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7378
7750
|
"input",
|
|
7379
7751
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
7380
7752
|
value: fallback != null ? fallback : "",
|
|
@@ -7387,7 +7759,7 @@ function VariableView(props) {
|
|
|
7387
7759
|
className: "mly:h-7 mly:w-32 mly:rounded-md mly:bg-soft-gray mly:px-2 mly:pr-6 mly:text-sm mly:text-midnight-gray mly:focus:bg-soft-gray mly:focus:outline-none"
|
|
7388
7760
|
})
|
|
7389
7761
|
),
|
|
7390
|
-
/* @__PURE__ */ (0,
|
|
7762
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mly:absolute mly:inset-y-0 mly:right-1 mly:flex mly:items-center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react21.Pencil, { className: "mly:h-3 mly:w-3 mly:stroke-[2.5] mly:text-midnight-gray" }) })
|
|
7391
7763
|
] })
|
|
7392
7764
|
] })
|
|
7393
7765
|
] }) })
|
|
@@ -7404,13 +7776,13 @@ var DefaultRenderVariable = (props) => {
|
|
|
7404
7776
|
const { name, required, valid, label } = variable;
|
|
7405
7777
|
const variableLabel = label || name;
|
|
7406
7778
|
if (from === "button-variable") {
|
|
7407
|
-
return /* @__PURE__ */ (0,
|
|
7408
|
-
/* @__PURE__ */ (0,
|
|
7409
|
-
/* @__PURE__ */ (0,
|
|
7779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mly:inline-grid mly:max-w-xs mly:grid-cols-[12px_1fr] mly:items-center mly:gap-1.5 mly:rounded-md mly:border mly:border-(--button-var-border-color) mly:px-2 mly:py-px mly:font-mono mly:text-xs", children: [
|
|
7780
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react21.Braces, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
|
|
7781
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
|
|
7410
7782
|
] });
|
|
7411
7783
|
}
|
|
7412
7784
|
if (from === "bubble-variable") {
|
|
7413
|
-
return /* @__PURE__ */ (0,
|
|
7785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7414
7786
|
"div",
|
|
7415
7787
|
{
|
|
7416
7788
|
className: cn(
|
|
@@ -7418,21 +7790,21 @@ var DefaultRenderVariable = (props) => {
|
|
|
7418
7790
|
!valid && "mly:border-rose-400 mly:bg-rose-50 mly:text-rose-600 mly:hover:bg-rose-100"
|
|
7419
7791
|
),
|
|
7420
7792
|
children: [
|
|
7421
|
-
/* @__PURE__ */ (0,
|
|
7422
|
-
/* @__PURE__ */ (0,
|
|
7793
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react21.Braces, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7794
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "mly:min-w-0 mly:truncate mly:text-left", children: variableLabel })
|
|
7423
7795
|
]
|
|
7424
7796
|
}
|
|
7425
7797
|
);
|
|
7426
7798
|
}
|
|
7427
|
-
return /* @__PURE__ */ (0,
|
|
7799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7428
7800
|
"span",
|
|
7429
7801
|
{
|
|
7430
7802
|
tabIndex: -1,
|
|
7431
7803
|
className: "mly:inline-flex mly:items-center mly:gap-(--variable-icon-gap) mly:rounded-full mly:border mly:border-gray-200 mly:px-1.5 mly:py-0.5 mly:leading-none",
|
|
7432
7804
|
children: [
|
|
7433
|
-
/* @__PURE__ */ (0,
|
|
7805
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react21.Braces, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5] mly:text-rose-600" }),
|
|
7434
7806
|
variableLabel,
|
|
7435
|
-
required && !fallback && /* @__PURE__ */ (0,
|
|
7807
|
+
required && !fallback && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react21.AlertTriangle, { className: "mly:size-[var(--variable-icon-size)] mly:shrink-0 mly:stroke-[2.5]" })
|
|
7436
7808
|
]
|
|
7437
7809
|
}
|
|
7438
7810
|
);
|
|
@@ -7443,8 +7815,8 @@ var DEFAULT_VARIABLE_TRIGGER_CHAR = "@";
|
|
|
7443
7815
|
var DEFAULT_VARIABLES = [];
|
|
7444
7816
|
var DEFAULT_RENDER_VARIABLE_FUNCTION = DefaultRenderVariable;
|
|
7445
7817
|
var DEFAULT_VARIABLE_SUGGESTION_POPOVER = VariableSuggestionsPopover;
|
|
7446
|
-
var VariablePluginKey = new
|
|
7447
|
-
var VariableExtension =
|
|
7818
|
+
var VariablePluginKey = new import_state6.PluginKey("variable");
|
|
7819
|
+
var VariableExtension = import_core8.Node.create({
|
|
7448
7820
|
name: "variable",
|
|
7449
7821
|
group: "inline",
|
|
7450
7822
|
inline: true,
|
|
@@ -7560,7 +7932,7 @@ var VariableExtension = import_core7.Node.create({
|
|
|
7560
7932
|
renderHTML({ node, HTMLAttributes: HTMLAttributes2 }) {
|
|
7561
7933
|
return [
|
|
7562
7934
|
"div",
|
|
7563
|
-
(0,
|
|
7935
|
+
(0, import_core8.mergeAttributes)({ "data-type": this.name }, HTMLAttributes2),
|
|
7564
7936
|
this.options.renderLabel({
|
|
7565
7937
|
options: this.options,
|
|
7566
7938
|
node
|
|
@@ -7605,7 +7977,7 @@ var VariableExtension = import_core7.Node.create({
|
|
|
7605
7977
|
];
|
|
7606
7978
|
},
|
|
7607
7979
|
addNodeView() {
|
|
7608
|
-
return (0,
|
|
7980
|
+
return (0, import_react30.ReactNodeViewRenderer)(VariableView, {
|
|
7609
7981
|
className: "mly:relative mly:inline-block",
|
|
7610
7982
|
as: "div"
|
|
7611
7983
|
});
|
|
@@ -7613,26 +7985,26 @@ var VariableExtension = import_core7.Node.create({
|
|
|
7613
7985
|
});
|
|
7614
7986
|
|
|
7615
7987
|
// src/editor/components/ui/link-input-popover.tsx
|
|
7616
|
-
var
|
|
7988
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
7617
7989
|
function LinkInputPopover(props) {
|
|
7618
7990
|
var _a, _b;
|
|
7619
7991
|
const {
|
|
7620
7992
|
defaultValue = "",
|
|
7621
7993
|
onValueChange,
|
|
7622
7994
|
tooltip,
|
|
7623
|
-
icon: Icon =
|
|
7995
|
+
icon: Icon = import_lucide_react22.Link,
|
|
7624
7996
|
editor,
|
|
7625
7997
|
isVariable
|
|
7626
7998
|
} = props;
|
|
7627
|
-
const [isOpen, setIsOpen] = (0,
|
|
7628
|
-
const [isEditing, setIsEditing] = (0,
|
|
7629
|
-
const linkInputRef = (0,
|
|
7999
|
+
const [isOpen, setIsOpen] = (0, import_react31.useState)(false);
|
|
8000
|
+
const [isEditing, setIsEditing] = (0, import_react31.useState)(!isVariable);
|
|
8001
|
+
const linkInputRef = (0, import_react31.useRef)(null);
|
|
7630
8002
|
const { placeholderUrl = DEFAULT_PLACEHOLDER_URL } = useMailyContext();
|
|
7631
8003
|
const options = useVariableOptions(editor);
|
|
7632
8004
|
const renderVariable = options == null ? void 0 : options.renderVariable;
|
|
7633
8005
|
const variables = options == null ? void 0 : options.variables;
|
|
7634
8006
|
const variableTriggerCharacter = (_b = (_a = options == null ? void 0 : options.suggestion) == null ? void 0 : _a.char) != null ? _b : DEFAULT_VARIABLE_TRIGGER_CHAR;
|
|
7635
|
-
const autoCompleteOptions = (0,
|
|
8007
|
+
const autoCompleteOptions = (0, import_react32.useMemo)(() => {
|
|
7636
8008
|
const withoutTrigger = defaultValue.replace(
|
|
7637
8009
|
new RegExp(variableTriggerCharacter, "g"),
|
|
7638
8010
|
""
|
|
@@ -7643,18 +8015,18 @@ function LinkInputPopover(props) {
|
|
|
7643
8015
|
editor
|
|
7644
8016
|
}).map((variable) => variable.name);
|
|
7645
8017
|
}, [variables, variableTriggerCharacter, defaultValue, editor]);
|
|
7646
|
-
const popoverButton = /* @__PURE__ */ (0,
|
|
8018
|
+
const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
7647
8019
|
BaseButton,
|
|
7648
8020
|
{
|
|
7649
8021
|
variant: "ghost",
|
|
7650
8022
|
size: "sm",
|
|
7651
8023
|
type: "button",
|
|
7652
|
-
className: "mly:h-7! mly:w-7!",
|
|
8024
|
+
className: "menu-option mly:h-7! mly:w-7!",
|
|
7653
8025
|
"data-state": !!defaultValue,
|
|
7654
|
-
children: /* @__PURE__ */ (0,
|
|
8026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5] mly:text-midnight-gray" })
|
|
7655
8027
|
}
|
|
7656
8028
|
) });
|
|
7657
|
-
return /* @__PURE__ */ (0,
|
|
8029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
7658
8030
|
Popover,
|
|
7659
8031
|
{
|
|
7660
8032
|
open: isOpen,
|
|
@@ -7668,9 +8040,9 @@ function LinkInputPopover(props) {
|
|
|
7668
8040
|
}
|
|
7669
8041
|
},
|
|
7670
8042
|
children: [
|
|
7671
|
-
tooltip ? /* @__PURE__ */ (0,
|
|
7672
|
-
/* @__PURE__ */ (0,
|
|
7673
|
-
/* @__PURE__ */ (0,
|
|
8043
|
+
tooltip ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Tooltip, { children: [
|
|
8044
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
8045
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
7674
8046
|
TooltipContent,
|
|
7675
8047
|
{
|
|
7676
8048
|
sideOffset: 8,
|
|
@@ -7679,7 +8051,7 @@ function LinkInputPopover(props) {
|
|
|
7679
8051
|
}
|
|
7680
8052
|
)
|
|
7681
8053
|
] }) : popoverButton,
|
|
7682
|
-
/* @__PURE__ */ (0,
|
|
8054
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
7683
8055
|
PopoverContent,
|
|
7684
8056
|
{
|
|
7685
8057
|
align: "end",
|
|
@@ -7687,7 +8059,7 @@ function LinkInputPopover(props) {
|
|
|
7687
8059
|
className: "mly:w-max mly:rounded-none mly:border-none mly:bg-transparent mly:p-0! mly:shadow-none",
|
|
7688
8060
|
sideOffset: 8,
|
|
7689
8061
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
7690
|
-
children: /* @__PURE__ */ (0,
|
|
8062
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
7691
8063
|
"form",
|
|
7692
8064
|
{
|
|
7693
8065
|
onSubmit: (e) => {
|
|
@@ -7699,445 +8071,68 @@ function LinkInputPopover(props) {
|
|
|
7699
8071
|
onValueChange == null ? void 0 : onValueChange(input.value);
|
|
7700
8072
|
setIsOpen(false);
|
|
7701
8073
|
},
|
|
7702
|
-
children: /* @__PURE__ */ (0,
|
|
7703
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
8074
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mly:isolate mly:flex mly:rounded-lg", children: [
|
|
8075
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "mly:flex mly:h-8 mly:items-center mly:rounded-lg mly:border mly:border-gray-300 mly:bg-white mly:px-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
7704
8076
|
"button",
|
|
7705
8077
|
{
|
|
7706
8078
|
onClick: () => {
|
|
7707
|
-
setIsEditing(true);
|
|
7708
|
-
setTimeout(() => {
|
|
7709
|
-
var _a2;
|
|
7710
|
-
(_a2 = linkInputRef.current) == null ? void 0 : _a2.focus();
|
|
7711
|
-
}, 0);
|
|
7712
|
-
},
|
|
7713
|
-
children: renderVariable({
|
|
7714
|
-
variable: {
|
|
7715
|
-
name: defaultValue,
|
|
7716
|
-
valid: true
|
|
7717
|
-
},
|
|
7718
|
-
fallback: "",
|
|
7719
|
-
from: "bubble-variable",
|
|
7720
|
-
editor
|
|
7721
|
-
})
|
|
7722
|
-
}
|
|
7723
|
-
) }),
|
|
7724
|
-
isEditing && /* @__PURE__ */ (0,
|
|
7725
|
-
/* @__PURE__ */ (0,
|
|
7726
|
-
/* @__PURE__ */ (0,
|
|
7727
|
-
InputAutocomplete,
|
|
7728
|
-
{
|
|
7729
|
-
editor,
|
|
7730
|
-
value: defaultValue,
|
|
7731
|
-
onValueChange: (value) => {
|
|
7732
|
-
onValueChange == null ? void 0 : onValueChange(value);
|
|
7733
|
-
},
|
|
7734
|
-
autoCompleteOptions,
|
|
7735
|
-
ref: linkInputRef,
|
|
7736
|
-
placeholder: placeholderUrl,
|
|
7737
|
-
className: "-mly:ms-px mly-link-input-padding mly:block mly:h-8 mly:w-56 mly:rounded-lg mly:border mly:border-gray-300 mly:text-sm mly:shadow-sm mly:outline-hidden mly:placeholder:text-gray-400",
|
|
7738
|
-
triggerChar: variableTriggerCharacter,
|
|
7739
|
-
onSelectOption: (value) => {
|
|
7740
|
-
var _a2;
|
|
7741
|
-
const isVariable2 = (_a2 = autoCompleteOptions.includes(value)) != null ? _a2 : false;
|
|
7742
|
-
if (isVariable2) {
|
|
7743
|
-
setIsEditing(false);
|
|
7744
|
-
}
|
|
7745
|
-
onValueChange == null ? void 0 : onValueChange(value, isVariable2);
|
|
7746
|
-
setIsOpen(false);
|
|
7747
|
-
}
|
|
7748
|
-
}
|
|
7749
|
-
)
|
|
7750
|
-
] })
|
|
7751
|
-
] })
|
|
7752
|
-
}
|
|
7753
|
-
)
|
|
7754
|
-
}
|
|
7755
|
-
)
|
|
7756
|
-
]
|
|
7757
|
-
}
|
|
7758
|
-
);
|
|
7759
|
-
}
|
|
7760
|
-
|
|
7761
|
-
// src/editor/components/image-menu/image-size.tsx
|
|
7762
|
-
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
7763
|
-
function ImageSize(props) {
|
|
7764
|
-
const { value, onValueChange, dimension } = props;
|
|
7765
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "mly:relative mly:flex mly:items-center", children: [
|
|
7766
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "mly:absolute mly:inset-y-0 mly:left-2 mly:flex mly:items-center mly:text-xs mly:leading-none mly:text-gray-400", children: dimension === "width" ? "W" : "H" }),
|
|
7767
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7768
|
-
"input",
|
|
7769
|
-
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
7770
|
-
className: "hide-number-controls mly:h-auto mly:max-w-20 mly:appearance-none mly:border-0 mly:border-none mly:p-1 mly:px-[26px] mly:text-sm mly:uppercase mly:tabular-nums mly:outline-hidden mly:focus-visible:outline-hidden",
|
|
7771
|
-
type: "number",
|
|
7772
|
-
value,
|
|
7773
|
-
onChange: (e) => onValueChange(e.target.value)
|
|
7774
|
-
})
|
|
7775
|
-
),
|
|
7776
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "mly:absolute mly:inset-y-0 mly:right-1 mly:flex mly:items-center mly:text-xs mly:leading-none mly:text-gray-400", children: "PX" })
|
|
7777
|
-
] });
|
|
7778
|
-
}
|
|
7779
|
-
|
|
7780
|
-
// src/editor/components/image-menu/use-image-state.tsx
|
|
7781
|
-
var import_react28 = require("@tiptap/react");
|
|
7782
|
-
var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"), 1);
|
|
7783
|
-
var useImageState = (editor) => {
|
|
7784
|
-
const states = (0, import_react28.useEditorState)({
|
|
7785
|
-
editor,
|
|
7786
|
-
selector: ({ editor: editor2 }) => {
|
|
7787
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
7788
|
-
return {
|
|
7789
|
-
width: String(editor2.getAttributes("image").width),
|
|
7790
|
-
height: String(editor2.getAttributes("image").height),
|
|
7791
|
-
isImageActive: editor2.isActive("image"),
|
|
7792
|
-
isLogoActive: editor2.isActive("logo"),
|
|
7793
|
-
alignment: ((_a = editor2.getAttributes("image")) == null ? void 0 : _a.alignment) || ((_b = editor2.getAttributes("logo")) == null ? void 0 : _b.alignment),
|
|
7794
|
-
borderRadius: (_c = editor2.getAttributes("image")) == null ? void 0 : _c.borderRadius,
|
|
7795
|
-
logoSize: ((_d = editor2.getAttributes("logo")) == null ? void 0 : _d.size) || DEFAULT_LOGO_SIZE,
|
|
7796
|
-
imageSrc: ((_e = editor2.getAttributes("image")) == null ? void 0 : _e.src) || ((_f = editor2.getAttributes("logo")) == null ? void 0 : _f.src) || "",
|
|
7797
|
-
isSrcVariable: (_j = (_i = (_g = editor2.getAttributes("image")) == null ? void 0 : _g.isSrcVariable) != null ? _i : (_h = editor2.getAttributes("logo")) == null ? void 0 : _h.isSrcVariable) != null ? _j : false,
|
|
7798
|
-
imageExternalLink: ((_k = editor2.getAttributes("image")) == null ? void 0 : _k.externalLink) || "",
|
|
7799
|
-
isExternalLinkVariable: (_l = editor2.getAttributes("image")) == null ? void 0 : _l.isExternalLinkVariable,
|
|
7800
|
-
lockAspectRatio: (_m = editor2.getAttributes("image")) == null ? void 0 : _m.lockAspectRatio,
|
|
7801
|
-
aspectRatio: (_n = editor2.getAttributes("image")) == null ? void 0 : _n.aspectRatio,
|
|
7802
|
-
currentShowIfKey: ((_o = editor2.getAttributes("image")) == null ? void 0 : _o.showIfKey) || ((_p = editor2.getAttributes("logo")) == null ? void 0 : _p.showIfKey) || ""
|
|
7803
|
-
};
|
|
7804
|
-
},
|
|
7805
|
-
equalityFn: import_fast_deep_equal2.default
|
|
7806
|
-
});
|
|
7807
|
-
return states;
|
|
7808
|
-
};
|
|
7809
|
-
|
|
7810
|
-
// src/editor/components/image-menu/image-bubble-menu.tsx
|
|
7811
|
-
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7812
|
-
function ImageBubbleMenu(props) {
|
|
7813
|
-
var _a, _b, _c, _d;
|
|
7814
|
-
const { editor, appendTo } = props;
|
|
7815
|
-
if (!editor) {
|
|
7816
|
-
return null;
|
|
7817
|
-
}
|
|
7818
|
-
const state = useImageState(editor);
|
|
7819
|
-
const bubbleMenuProps = __spreadProps(__spreadValues(__spreadValues({}, props), appendTo ? { appendTo: appendTo.current } : {}), {
|
|
7820
|
-
shouldShow: ({ editor: editor2 }) => {
|
|
7821
|
-
if (!editor2.isEditable) {
|
|
7822
|
-
return false;
|
|
7823
|
-
}
|
|
7824
|
-
return editor2.isActive("logo") || editor2.isActive("image");
|
|
7825
|
-
},
|
|
7826
|
-
tippyOptions: {
|
|
7827
|
-
popperOptions: {
|
|
7828
|
-
modifiers: [{ name: "flip", enabled: false }]
|
|
7829
|
-
},
|
|
7830
|
-
plugins: [import_tippy3.sticky],
|
|
7831
|
-
sticky: "popper",
|
|
7832
|
-
maxWidth: "100%"
|
|
7833
|
-
}
|
|
7834
|
-
});
|
|
7835
|
-
const { lockAspectRatio } = state;
|
|
7836
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7837
|
-
import_react29.BubbleMenu,
|
|
7838
|
-
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
7839
|
-
className: "mly:flex mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
7840
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(TooltipProvider, { children: [
|
|
7841
|
-
state.isLogoActive && state.imageSrc && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
7842
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7843
|
-
Select,
|
|
7844
|
-
{
|
|
7845
|
-
label: "Size",
|
|
7846
|
-
tooltip: "Size",
|
|
7847
|
-
value: state.logoSize,
|
|
7848
|
-
options: allowedLogoSize.map((size) => ({
|
|
7849
|
-
value: size,
|
|
7850
|
-
label: size
|
|
7851
|
-
})),
|
|
7852
|
-
onValueChange: (value) => {
|
|
7853
|
-
editor == null ? void 0 : editor.chain().focus().setLogoAttributes({ size: value }).run();
|
|
7854
|
-
}
|
|
7855
|
-
}
|
|
7856
|
-
),
|
|
7857
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Divider, {})
|
|
7858
|
-
] }),
|
|
7859
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mly:flex mly:gap-x-0.5", children: [
|
|
7860
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7861
|
-
AlignmentSwitch,
|
|
7862
|
-
{
|
|
7863
|
-
alignment: state.alignment,
|
|
7864
|
-
onAlignmentChange: (alignment) => {
|
|
7865
|
-
const isCurrentNodeImage = state.isImageActive;
|
|
7866
|
-
if (!isCurrentNodeImage) {
|
|
7867
|
-
editor == null ? void 0 : editor.chain().focus().setLogoAttributes({ alignment }).run();
|
|
7868
|
-
} else {
|
|
7869
|
-
editor == null ? void 0 : editor.chain().focus().updateAttributes("image", { alignment }).run();
|
|
7870
|
-
}
|
|
7871
|
-
}
|
|
7872
|
-
}
|
|
7873
|
-
),
|
|
7874
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7875
|
-
LinkInputPopover,
|
|
7876
|
-
{
|
|
7877
|
-
defaultValue: (_a = state == null ? void 0 : state.imageSrc) != null ? _a : "",
|
|
7878
|
-
onValueChange: (value, isVariable) => {
|
|
7879
|
-
if (state.isLogoActive) {
|
|
7880
|
-
editor == null ? void 0 : editor.chain().setLogoAttributes({
|
|
7881
|
-
src: value,
|
|
7882
|
-
isSrcVariable: isVariable != null ? isVariable : false
|
|
7883
|
-
}).run();
|
|
7884
|
-
} else {
|
|
7885
|
-
editor == null ? void 0 : editor.chain().updateAttributes("image", {
|
|
7886
|
-
src: value,
|
|
7887
|
-
isSrcVariable: isVariable != null ? isVariable : false
|
|
7888
|
-
}).run();
|
|
7889
|
-
}
|
|
7890
|
-
},
|
|
7891
|
-
tooltip: "Source URL",
|
|
7892
|
-
icon: import_lucide_react22.ImageDown,
|
|
7893
|
-
editor,
|
|
7894
|
-
isVariable: state.isSrcVariable
|
|
7895
|
-
}
|
|
7896
|
-
),
|
|
7897
|
-
state.isImageActive && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7898
|
-
LinkInputPopover,
|
|
7899
|
-
{
|
|
7900
|
-
defaultValue: (_b = state == null ? void 0 : state.imageExternalLink) != null ? _b : "",
|
|
7901
|
-
onValueChange: (value, isVariable) => {
|
|
7902
|
-
editor == null ? void 0 : editor.chain().updateAttributes("image", {
|
|
7903
|
-
externalLink: value,
|
|
7904
|
-
isExternalLinkVariable: isVariable != null ? isVariable : false
|
|
7905
|
-
}).run();
|
|
7906
|
-
},
|
|
7907
|
-
tooltip: "External URL",
|
|
7908
|
-
editor,
|
|
7909
|
-
isVariable: state.isExternalLinkVariable
|
|
7910
|
-
}
|
|
7911
|
-
)
|
|
7912
|
-
] }),
|
|
7913
|
-
state.isImageActive && state.imageSrc && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
7914
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Divider, {}),
|
|
7915
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7916
|
-
Select,
|
|
7917
|
-
{
|
|
7918
|
-
label: "Border Radius",
|
|
7919
|
-
value: state == null ? void 0 : state.borderRadius,
|
|
7920
|
-
options: borderRadius.map((value) => ({
|
|
7921
|
-
value: String(value.value),
|
|
7922
|
-
label: value.name
|
|
7923
|
-
})),
|
|
7924
|
-
onValueChange: (value) => {
|
|
7925
|
-
editor == null ? void 0 : editor.chain().updateAttributes("image", {
|
|
7926
|
-
borderRadius: Number(value)
|
|
7927
|
-
}).run();
|
|
7928
|
-
},
|
|
7929
|
-
tooltip: "Border Radius",
|
|
7930
|
-
className: "mly:capitalize"
|
|
7931
|
-
}
|
|
7932
|
-
),
|
|
7933
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mly:flex mly:gap-x-0.5", children: [
|
|
7934
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7935
|
-
ImageSize,
|
|
7936
|
-
{
|
|
7937
|
-
dimension: "width",
|
|
7938
|
-
value: (_c = state == null ? void 0 : state.width) != null ? _c : "",
|
|
7939
|
-
onValueChange: (value) => {
|
|
7940
|
-
const width = Math.min(Number(value) || 0, IMAGE_MAX_WIDTH);
|
|
7941
|
-
const currentHeight = Number(state.height) || 0;
|
|
7942
|
-
const currentWidth = Number(state.width) || 0;
|
|
7943
|
-
const currentAspectRatio = state.aspectRatio || currentWidth / currentHeight || 1;
|
|
7944
|
-
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
7945
|
-
width: String(width)
|
|
7946
|
-
}, lockAspectRatio && value ? {
|
|
7947
|
-
height: String(
|
|
7948
|
-
getNewHeight(width, currentAspectRatio)
|
|
7949
|
-
)
|
|
7950
|
-
} : {})).run();
|
|
7951
|
-
}
|
|
7952
|
-
}
|
|
7953
|
-
),
|
|
7954
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7955
|
-
ImageSize,
|
|
7956
|
-
{
|
|
7957
|
-
dimension: "height",
|
|
7958
|
-
value: (_d = state == null ? void 0 : state.height) != null ? _d : "",
|
|
7959
|
-
onValueChange: (value) => {
|
|
7960
|
-
const height = Number(value) || 0;
|
|
7961
|
-
const currentHeight = Number(state.height) || 0;
|
|
7962
|
-
const currentWidth = Number(state.width) || 0;
|
|
7963
|
-
const currentAspectRatio = state.aspectRatio || currentWidth / currentHeight || 1;
|
|
7964
|
-
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
7965
|
-
height: String(height)
|
|
7966
|
-
}, lockAspectRatio && value ? {
|
|
7967
|
-
width: String(
|
|
7968
|
-
getNewWidth(height, currentAspectRatio)
|
|
7969
|
-
)
|
|
7970
|
-
} : {})).run();
|
|
7971
|
-
}
|
|
7972
|
-
}
|
|
7973
|
-
),
|
|
7974
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7975
|
-
BubbleMenuButton,
|
|
7976
|
-
{
|
|
7977
|
-
isActive: () => lockAspectRatio,
|
|
7978
|
-
command: () => {
|
|
7979
|
-
const width = Number(state.width) || 0;
|
|
7980
|
-
const height = Number(state.height) || 0;
|
|
7981
|
-
const aspectRatio = width / height;
|
|
7982
|
-
editor == null ? void 0 : editor.chain().updateAttributes("image", {
|
|
7983
|
-
lockAspectRatio: !lockAspectRatio,
|
|
7984
|
-
aspectRatio
|
|
7985
|
-
}).run();
|
|
7986
|
-
},
|
|
7987
|
-
icon: lockAspectRatio ? import_lucide_react22.LockIcon : import_lucide_react22.LockOpenIcon,
|
|
7988
|
-
tooltip: "Lock Aspect Ratio"
|
|
7989
|
-
}
|
|
7990
|
-
)
|
|
7991
|
-
] })
|
|
7992
|
-
] })
|
|
7993
|
-
] })
|
|
7994
|
-
})
|
|
7995
|
-
);
|
|
7996
|
-
}
|
|
7997
|
-
|
|
7998
|
-
// src/editor/components/inline-image-menu/inline-image-bubble-menu.tsx
|
|
7999
|
-
var import_react31 = require("@tiptap/react");
|
|
8000
|
-
var import_tippy4 = require("tippy.js");
|
|
8001
|
-
|
|
8002
|
-
// src/editor/nodes/inline-image/inline-image.tsx
|
|
8003
|
-
var import_core8 = require("@tiptap/core");
|
|
8004
|
-
var import_state6 = require("@tiptap/pm/state");
|
|
8005
|
-
var DEFAULT_INLINE_IMAGE_HEIGHT = 20;
|
|
8006
|
-
var DEFAULT_INLINE_IMAGE_WIDTH = 20;
|
|
8007
|
-
var InlineImageExtension = import_core8.Node.create({
|
|
8008
|
-
name: "inlineImage",
|
|
8009
|
-
inline: true,
|
|
8010
|
-
group: "inline",
|
|
8011
|
-
selectable: false,
|
|
8012
|
-
addOptions() {
|
|
8013
|
-
return {
|
|
8014
|
-
HTMLAttributes: {}
|
|
8015
|
-
};
|
|
8016
|
-
},
|
|
8017
|
-
addAttributes() {
|
|
8018
|
-
return {
|
|
8019
|
-
height: {
|
|
8020
|
-
default: DEFAULT_INLINE_IMAGE_HEIGHT
|
|
8021
|
-
},
|
|
8022
|
-
width: {
|
|
8023
|
-
default: DEFAULT_INLINE_IMAGE_WIDTH
|
|
8024
|
-
},
|
|
8025
|
-
src: {
|
|
8026
|
-
default: null
|
|
8027
|
-
},
|
|
8028
|
-
isSrcVariable: {
|
|
8029
|
-
default: false,
|
|
8030
|
-
renderHTML(attributes) {
|
|
8031
|
-
if (!attributes.isSrcVariable) {
|
|
8032
|
-
return {};
|
|
8033
|
-
}
|
|
8034
|
-
return {
|
|
8035
|
-
"data-is-src-variable": "true"
|
|
8036
|
-
};
|
|
8037
|
-
}
|
|
8038
|
-
},
|
|
8039
|
-
alt: {
|
|
8040
|
-
default: null
|
|
8041
|
-
},
|
|
8042
|
-
title: {
|
|
8043
|
-
default: null
|
|
8044
|
-
},
|
|
8045
|
-
externalLink: {
|
|
8046
|
-
default: null,
|
|
8047
|
-
renderHTML(attributes) {
|
|
8048
|
-
if (!attributes.externalLink) {
|
|
8049
|
-
return {};
|
|
8050
|
-
}
|
|
8051
|
-
return {
|
|
8052
|
-
"data-external-link": attributes.externalLink
|
|
8053
|
-
};
|
|
8054
|
-
}
|
|
8055
|
-
},
|
|
8056
|
-
isExternalLinkVariable: {
|
|
8057
|
-
default: false,
|
|
8058
|
-
renderHTML(attributes) {
|
|
8059
|
-
if (!attributes.isExternalLinkVariable) {
|
|
8060
|
-
return {};
|
|
8061
|
-
}
|
|
8062
|
-
return {
|
|
8063
|
-
"data-is-external-link-variable": "true"
|
|
8064
|
-
};
|
|
8065
|
-
}
|
|
8066
|
-
}
|
|
8067
|
-
};
|
|
8068
|
-
},
|
|
8069
|
-
parseHTML() {
|
|
8070
|
-
return [
|
|
8071
|
-
{
|
|
8072
|
-
tag: `img[data-type="${this.name}"]`
|
|
8073
|
-
}
|
|
8074
|
-
];
|
|
8075
|
-
},
|
|
8076
|
-
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
8077
|
-
const attrs = (0, import_core8.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
8078
|
-
"data-type": this.name,
|
|
8079
|
-
class: "mly:relative",
|
|
8080
|
-
style: `display: inline; --mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
|
|
8081
|
-
draggable: "false",
|
|
8082
|
-
loading: "lazy"
|
|
8083
|
-
});
|
|
8084
|
-
return ["img", attrs];
|
|
8085
|
-
},
|
|
8086
|
-
addCommands() {
|
|
8087
|
-
return {
|
|
8088
|
-
setInlineImage: (options) => ({ commands }) => {
|
|
8089
|
-
return commands.insertContent({
|
|
8090
|
-
type: this.name,
|
|
8091
|
-
attrs: options
|
|
8092
|
-
});
|
|
8093
|
-
}
|
|
8094
|
-
};
|
|
8095
|
-
},
|
|
8096
|
-
addProseMirrorPlugins() {
|
|
8097
|
-
return [
|
|
8098
|
-
new import_state6.Plugin({
|
|
8099
|
-
key: new import_state6.PluginKey("inlineImage"),
|
|
8100
|
-
props: {
|
|
8101
|
-
handleClickOn: (_, pos, node) => {
|
|
8102
|
-
if (node.type !== this.type) {
|
|
8103
|
-
return false;
|
|
8104
|
-
}
|
|
8105
|
-
const from = pos;
|
|
8106
|
-
const to = pos + node.nodeSize;
|
|
8107
|
-
this.editor.commands.setTextSelection({ from, to });
|
|
8108
|
-
return true;
|
|
8079
|
+
setIsEditing(true);
|
|
8080
|
+
setTimeout(() => {
|
|
8081
|
+
var _a2;
|
|
8082
|
+
(_a2 = linkInputRef.current) == null ? void 0 : _a2.focus();
|
|
8083
|
+
}, 0);
|
|
8084
|
+
},
|
|
8085
|
+
children: renderVariable({
|
|
8086
|
+
variable: {
|
|
8087
|
+
name: defaultValue,
|
|
8088
|
+
valid: true
|
|
8089
|
+
},
|
|
8090
|
+
fallback: "",
|
|
8091
|
+
from: "bubble-variable",
|
|
8092
|
+
editor
|
|
8093
|
+
})
|
|
8094
|
+
}
|
|
8095
|
+
) }),
|
|
8096
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mly:relative", children: [
|
|
8097
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "mly:absolute mly:inset-y-0 mly:left-1.5 mly:z-10 mly:flex mly:items-center", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react22.LinkIcon, { className: "mly:h-3 mly:w-3 mly:stroke-[2.5] mly:text-midnight-gray" }) }),
|
|
8098
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8099
|
+
InputAutocomplete,
|
|
8100
|
+
{
|
|
8101
|
+
editor,
|
|
8102
|
+
value: defaultValue,
|
|
8103
|
+
onValueChange: (value) => {
|
|
8104
|
+
onValueChange == null ? void 0 : onValueChange(value);
|
|
8105
|
+
},
|
|
8106
|
+
autoCompleteOptions,
|
|
8107
|
+
ref: linkInputRef,
|
|
8108
|
+
placeholder: placeholderUrl,
|
|
8109
|
+
className: "-mly:ms-px mly-link-input-padding mly:block mly:h-8 mly:w-56 mly:rounded-lg mly:border mly:border-gray-300 mly:text-sm mly:shadow-sm mly:outline-hidden mly:placeholder:text-gray-400",
|
|
8110
|
+
triggerChar: variableTriggerCharacter,
|
|
8111
|
+
onSelectOption: (value) => {
|
|
8112
|
+
var _a2;
|
|
8113
|
+
const isVariable2 = (_a2 = autoCompleteOptions.includes(value)) != null ? _a2 : false;
|
|
8114
|
+
if (isVariable2) {
|
|
8115
|
+
setIsEditing(false);
|
|
8116
|
+
}
|
|
8117
|
+
onValueChange == null ? void 0 : onValueChange(value, isVariable2);
|
|
8118
|
+
setIsOpen(false);
|
|
8119
|
+
}
|
|
8120
|
+
}
|
|
8121
|
+
)
|
|
8122
|
+
] })
|
|
8123
|
+
] })
|
|
8124
|
+
}
|
|
8125
|
+
)
|
|
8109
8126
|
}
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
}
|
|
8115
|
-
|
|
8116
|
-
// src/editor/components/inline-image-menu/use-inline-image-state.tsx
|
|
8117
|
-
var import_react30 = require("@tiptap/react");
|
|
8118
|
-
var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"), 1);
|
|
8119
|
-
var useInlineImageState = (editor) => {
|
|
8120
|
-
const states = (0, import_react30.useEditorState)({
|
|
8121
|
-
editor,
|
|
8122
|
-
selector: ({ editor: editor2 }) => {
|
|
8123
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8124
|
-
return {
|
|
8125
|
-
height: ((_a = editor2.getAttributes("inlineImage")) == null ? void 0 : _a.height) || DEFAULT_INLINE_IMAGE_HEIGHT,
|
|
8126
|
-
width: ((_b = editor2.getAttributes("inlineImage")) == null ? void 0 : _b.width) || DEFAULT_INLINE_IMAGE_WIDTH,
|
|
8127
|
-
src: ((_c = editor2.getAttributes("inlineImage")) == null ? void 0 : _c.src) || "",
|
|
8128
|
-
isSrcVariable: (_e = (_d = editor2.getAttributes("inlineImage")) == null ? void 0 : _d.isSrcVariable) != null ? _e : false,
|
|
8129
|
-
imageExternalLink: ((_f = editor2.getAttributes("inlineImage")) == null ? void 0 : _f.externalLink) || "",
|
|
8130
|
-
isExternalLinkVariable: (_h = (_g = editor2.getAttributes("inlineImage")) == null ? void 0 : _g.isExternalLinkVariable) != null ? _h : false
|
|
8131
|
-
};
|
|
8132
|
-
},
|
|
8133
|
-
equalityFn: import_fast_deep_equal3.default
|
|
8134
|
-
});
|
|
8135
|
-
return states;
|
|
8136
|
-
};
|
|
8127
|
+
)
|
|
8128
|
+
]
|
|
8129
|
+
}
|
|
8130
|
+
);
|
|
8131
|
+
}
|
|
8137
8132
|
|
|
8138
8133
|
// src/editor/components/inline-image-menu/inline-image-bubble-menu.tsx
|
|
8139
8134
|
var import_lucide_react23 = require("lucide-react");
|
|
8140
|
-
var
|
|
8135
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8141
8136
|
function InlineImageBubbleMenu(props) {
|
|
8142
8137
|
var _a, _b;
|
|
8143
8138
|
const { editor, appendTo } = props;
|
|
@@ -8161,12 +8156,12 @@ function InlineImageBubbleMenu(props) {
|
|
|
8161
8156
|
maxWidth: "100%"
|
|
8162
8157
|
}
|
|
8163
8158
|
});
|
|
8164
|
-
return /* @__PURE__ */ (0,
|
|
8165
|
-
|
|
8159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8160
|
+
import_react33.BubbleMenu,
|
|
8166
8161
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
8167
8162
|
className: "mly:flex mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
8168
|
-
children: /* @__PURE__ */ (0,
|
|
8169
|
-
/* @__PURE__ */ (0,
|
|
8163
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mly:flex mly:gap-x-0.5", children: [
|
|
8164
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8170
8165
|
LinkInputPopover,
|
|
8171
8166
|
{
|
|
8172
8167
|
defaultValue: (_a = state == null ? void 0 : state.src) != null ? _a : "",
|
|
@@ -8182,7 +8177,7 @@ function InlineImageBubbleMenu(props) {
|
|
|
8182
8177
|
isVariable: state.isSrcVariable
|
|
8183
8178
|
}
|
|
8184
8179
|
),
|
|
8185
|
-
/* @__PURE__ */ (0,
|
|
8180
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8186
8181
|
LinkInputPopover,
|
|
8187
8182
|
{
|
|
8188
8183
|
defaultValue: (_b = state == null ? void 0 : state.imageExternalLink) != null ? _b : "",
|
|
@@ -8197,7 +8192,7 @@ function InlineImageBubbleMenu(props) {
|
|
|
8197
8192
|
isVariable: state.isExternalLinkVariable
|
|
8198
8193
|
}
|
|
8199
8194
|
),
|
|
8200
|
-
/* @__PURE__ */ (0,
|
|
8195
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8201
8196
|
ImageSize,
|
|
8202
8197
|
{
|
|
8203
8198
|
dimension: "height",
|
|
@@ -8216,16 +8211,16 @@ function InlineImageBubbleMenu(props) {
|
|
|
8216
8211
|
}
|
|
8217
8212
|
|
|
8218
8213
|
// src/editor/components/repeat-menu/repeat-bubble-menu.tsx
|
|
8219
|
-
var
|
|
8214
|
+
var import_react35 = require("@tiptap/react");
|
|
8220
8215
|
var import_lucide_react24 = require("lucide-react");
|
|
8221
|
-
var
|
|
8216
|
+
var import_react36 = require("react");
|
|
8222
8217
|
var import_tippy5 = require("tippy.js");
|
|
8223
8218
|
|
|
8224
8219
|
// src/editor/components/repeat-menu/use-repeat-state.ts
|
|
8225
|
-
var
|
|
8220
|
+
var import_react34 = require("@tiptap/react");
|
|
8226
8221
|
var import_fast_deep_equal4 = __toESM(require("fast-deep-equal"), 1);
|
|
8227
8222
|
var useRepeatState = (editor) => {
|
|
8228
|
-
const states = (0,
|
|
8223
|
+
const states = (0, import_react34.useEditorState)({
|
|
8229
8224
|
editor,
|
|
8230
8225
|
selector: (ctx) => {
|
|
8231
8226
|
var _a, _b;
|
|
@@ -8241,14 +8236,14 @@ var useRepeatState = (editor) => {
|
|
|
8241
8236
|
};
|
|
8242
8237
|
|
|
8243
8238
|
// src/editor/components/repeat-menu/repeat-bubble-menu.tsx
|
|
8244
|
-
var
|
|
8239
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
8245
8240
|
function RepeatBubbleMenu(props) {
|
|
8246
8241
|
const { appendTo, editor } = props;
|
|
8247
8242
|
if (!editor) {
|
|
8248
8243
|
return null;
|
|
8249
8244
|
}
|
|
8250
8245
|
const state = useRepeatState(editor);
|
|
8251
|
-
const getReferenceClientRect = (0,
|
|
8246
|
+
const getReferenceClientRect = (0, import_react36.useCallback)(() => {
|
|
8252
8247
|
const renderContainer = getRenderContainer(editor, "repeat");
|
|
8253
8248
|
const rect = (renderContainer == null ? void 0 : renderContainer.getBoundingClientRect()) || new DOMRect(-1e3, -1e3, 0, 0);
|
|
8254
8249
|
return rect;
|
|
@@ -8257,7 +8252,7 @@ function RepeatBubbleMenu(props) {
|
|
|
8257
8252
|
shouldShow: ({ editor: editor2 }) => {
|
|
8258
8253
|
var _a;
|
|
8259
8254
|
const activeForNode = getClosestNodeByName(editor2, "repeat");
|
|
8260
|
-
const sectionNodeChildren = activeForNode ? (_a = (0,
|
|
8255
|
+
const sectionNodeChildren = activeForNode ? (_a = (0, import_react35.findChildren)(activeForNode == null ? void 0 : activeForNode.node, (node) => {
|
|
8261
8256
|
return node.type.name === "section";
|
|
8262
8257
|
})) == null ? void 0 : _a[0] : null;
|
|
8263
8258
|
const hasActiveSectionNodeChildren = sectionNodeChildren && editor2.isActive("section");
|
|
@@ -8282,10 +8277,10 @@ function RepeatBubbleMenu(props) {
|
|
|
8282
8277
|
const opts = useVariableOptions(editor);
|
|
8283
8278
|
const variables = opts == null ? void 0 : opts.variables;
|
|
8284
8279
|
const renderVariable = opts == null ? void 0 : opts.renderVariable;
|
|
8285
|
-
const inputRef = (0,
|
|
8286
|
-
const [isUpdatingKey, setIsUpdatingKey] = (0,
|
|
8280
|
+
const inputRef = (0, import_react36.useRef)(null);
|
|
8281
|
+
const [isUpdatingKey, setIsUpdatingKey] = (0, import_react36.useState)(false);
|
|
8287
8282
|
const eachKey = (state == null ? void 0 : state.each) || "";
|
|
8288
|
-
const autoCompleteOptions = (0,
|
|
8283
|
+
const autoCompleteOptions = (0, import_react36.useMemo)(() => {
|
|
8289
8284
|
return processVariables(variables, {
|
|
8290
8285
|
query: eachKey || "",
|
|
8291
8286
|
editor,
|
|
@@ -8293,21 +8288,21 @@ function RepeatBubbleMenu(props) {
|
|
|
8293
8288
|
}).map((variable) => variable.name);
|
|
8294
8289
|
}, [variables, eachKey, editor]);
|
|
8295
8290
|
const isValidEachKey = eachKey;
|
|
8296
|
-
return /* @__PURE__ */ (0,
|
|
8297
|
-
|
|
8291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8292
|
+
import_react35.BubbleMenu,
|
|
8298
8293
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
8299
8294
|
className: "mly:flex mly:items-stretch mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
8300
|
-
children: /* @__PURE__ */ (0,
|
|
8301
|
-
/* @__PURE__ */ (0,
|
|
8295
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(TooltipProvider, { children: [
|
|
8296
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "mly:flex mly:items-center mly:gap-1.5 mly:px-1.5 mly:text-sm mly:leading-none", children: [
|
|
8302
8297
|
"Repeat",
|
|
8303
|
-
/* @__PURE__ */ (0,
|
|
8304
|
-
/* @__PURE__ */ (0,
|
|
8298
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
|
|
8299
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8305
8300
|
import_lucide_react24.InfoIcon,
|
|
8306
8301
|
{
|
|
8307
8302
|
className: cn("mly:size-3 mly:stroke-[2.5] mly:text-gray-500")
|
|
8308
8303
|
}
|
|
8309
8304
|
) }),
|
|
8310
|
-
/* @__PURE__ */ (0,
|
|
8305
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8311
8306
|
TooltipContent,
|
|
8312
8307
|
{
|
|
8313
8308
|
sideOffset: 14,
|
|
@@ -8318,7 +8313,7 @@ function RepeatBubbleMenu(props) {
|
|
|
8318
8313
|
)
|
|
8319
8314
|
] })
|
|
8320
8315
|
] }),
|
|
8321
|
-
!isUpdatingKey && /* @__PURE__ */ (0,
|
|
8316
|
+
!isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8322
8317
|
"button",
|
|
8323
8318
|
{
|
|
8324
8319
|
onClick: () => {
|
|
@@ -8339,7 +8334,7 @@ function RepeatBubbleMenu(props) {
|
|
|
8339
8334
|
})
|
|
8340
8335
|
}
|
|
8341
8336
|
),
|
|
8342
|
-
isUpdatingKey && /* @__PURE__ */ (0,
|
|
8337
|
+
isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8343
8338
|
"form",
|
|
8344
8339
|
{
|
|
8345
8340
|
onSubmit: (e) => {
|
|
@@ -8351,7 +8346,7 @@ function RepeatBubbleMenu(props) {
|
|
|
8351
8346
|
setIsUpdatingKey(false);
|
|
8352
8347
|
}
|
|
8353
8348
|
},
|
|
8354
|
-
children: /* @__PURE__ */ (0,
|
|
8349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8355
8350
|
InputAutocomplete,
|
|
8356
8351
|
{
|
|
8357
8352
|
editor,
|
|
@@ -8377,8 +8372,8 @@ function RepeatBubbleMenu(props) {
|
|
|
8377
8372
|
)
|
|
8378
8373
|
}
|
|
8379
8374
|
),
|
|
8380
|
-
/* @__PURE__ */ (0,
|
|
8381
|
-
/* @__PURE__ */ (0,
|
|
8375
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Divider, {}),
|
|
8376
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8382
8377
|
ShowPopover,
|
|
8383
8378
|
{
|
|
8384
8379
|
showIfKey: state.currentShowIfKey,
|
|
@@ -8396,16 +8391,16 @@ function RepeatBubbleMenu(props) {
|
|
|
8396
8391
|
}
|
|
8397
8392
|
|
|
8398
8393
|
// src/editor/components/section-menu/section-bubble-menu.tsx
|
|
8399
|
-
var
|
|
8394
|
+
var import_react38 = require("@tiptap/react");
|
|
8400
8395
|
var import_lucide_react25 = require("lucide-react");
|
|
8401
|
-
var
|
|
8396
|
+
var import_react39 = require("react");
|
|
8402
8397
|
var import_tippy6 = require("tippy.js");
|
|
8403
8398
|
|
|
8404
8399
|
// src/editor/components/icons/border-color.tsx
|
|
8405
|
-
var
|
|
8400
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8406
8401
|
function BorderColor(props) {
|
|
8407
8402
|
const _a = props, { topBarClassName } = _a, rest = __objRest(_a, ["topBarClassName"]);
|
|
8408
|
-
return /* @__PURE__ */ (0,
|
|
8403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
8409
8404
|
"svg",
|
|
8410
8405
|
__spreadProps(__spreadValues({
|
|
8411
8406
|
width: 11,
|
|
@@ -8415,8 +8410,8 @@ function BorderColor(props) {
|
|
|
8415
8410
|
xmlns: "http://www.w3.org/2000/svg"
|
|
8416
8411
|
}, rest), {
|
|
8417
8412
|
children: [
|
|
8418
|
-
/* @__PURE__ */ (0,
|
|
8419
|
-
/* @__PURE__ */ (0,
|
|
8413
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("path", { d: "M0 11H10.6667", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
8414
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8420
8415
|
"path",
|
|
8421
8416
|
{
|
|
8422
8417
|
d: "M0.666504 9V6.33333C0.666504 3.38781 3.05432 1 5.99984 1H10.6665",
|
|
@@ -8430,9 +8425,9 @@ function BorderColor(props) {
|
|
|
8430
8425
|
}
|
|
8431
8426
|
|
|
8432
8427
|
// src/editor/components/icons/margin-icon.tsx
|
|
8433
|
-
var
|
|
8428
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
8434
8429
|
function MarginIcon(props) {
|
|
8435
|
-
return /* @__PURE__ */ (0,
|
|
8430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8436
8431
|
"svg",
|
|
8437
8432
|
__spreadProps(__spreadValues({
|
|
8438
8433
|
width: 12,
|
|
@@ -8441,7 +8436,7 @@ function MarginIcon(props) {
|
|
|
8441
8436
|
fill: "none",
|
|
8442
8437
|
xmlns: "http://www.w3.org/2000/svg"
|
|
8443
8438
|
}, props), {
|
|
8444
|
-
children: /* @__PURE__ */ (0,
|
|
8439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8445
8440
|
"path",
|
|
8446
8441
|
{
|
|
8447
8442
|
d: "M10.5 10.499V1.49902M1.5 10.499V1.49902M4.5 5.99902C4.5 5.53308 4.5 5.30011 4.57612 5.11634C4.67761 4.87131 4.87229 4.67664 5.11732 4.57514C5.30109 4.49902 5.53406 4.49902 6 4.49902C6.46594 4.49902 6.69891 4.49902 6.88268 4.57514C7.12771 4.67664 7.32239 4.87131 7.42388 5.11634C7.5 5.30011 7.5 5.53308 7.5 5.99902C7.5 6.46496 7.5 6.69794 7.42388 6.88171C7.32239 7.12673 7.12771 7.32141 6.88268 7.4229C6.69891 7.49902 6.46594 7.49902 6 7.49902C5.53406 7.49902 5.30109 7.49902 5.11732 7.4229C4.87229 7.32141 4.67761 7.12673 4.57612 6.88171C4.5 6.69794 4.5 6.46496 4.5 5.99902Z",
|
|
@@ -8455,9 +8450,9 @@ function MarginIcon(props) {
|
|
|
8455
8450
|
}
|
|
8456
8451
|
|
|
8457
8452
|
// src/editor/components/icons/padding-icon.tsx
|
|
8458
|
-
var
|
|
8453
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
8459
8454
|
function PaddingIcon(props) {
|
|
8460
|
-
return /* @__PURE__ */ (0,
|
|
8455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8461
8456
|
"svg",
|
|
8462
8457
|
__spreadProps(__spreadValues({
|
|
8463
8458
|
width: 10,
|
|
@@ -8466,7 +8461,7 @@ function PaddingIcon(props) {
|
|
|
8466
8461
|
fill: "none",
|
|
8467
8462
|
xmlns: "http://www.w3.org/2000/svg"
|
|
8468
8463
|
}, props), {
|
|
8469
|
-
children: /* @__PURE__ */ (0,
|
|
8464
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8470
8465
|
"path",
|
|
8471
8466
|
{
|
|
8472
8467
|
d: "M9.50244 0.501526L9.10244 0.501526C8.54239 0.501526 8.26236 0.501526 8.04845 0.610519C7.86029 0.706392 7.70731 0.859373 7.61144 1.04754C7.50244 1.26145 7.50244 1.54147 7.50244 2.10153V7.90153C7.50244 8.46158 7.50244 8.74161 7.61144 8.95552C7.70731 9.14368 7.86029 9.29666 8.04845 9.39253C8.26236 9.50153 8.54239 9.50153 9.10244 9.50153H9.50244M0.502441 0.501527L0.902441 0.501527C1.46249 0.501527 1.74252 0.501527 1.95643 0.61052C2.14459 0.706393 2.29757 0.859374 2.39345 1.04754C2.50244 1.26145 2.50244 1.54147 2.50244 2.10153L2.50244 7.90153C2.50244 8.46158 2.50244 8.74161 2.39345 8.95552C2.29757 9.14368 2.14459 9.29666 1.95643 9.39253C1.74252 9.50153 1.46249 9.50153 0.902442 9.50153H0.502442M4.99994 7.99903V1.99903",
|
|
@@ -8481,7 +8476,7 @@ function PaddingIcon(props) {
|
|
|
8481
8476
|
|
|
8482
8477
|
// src/editor/components/ui/color-picker.tsx
|
|
8483
8478
|
var import_react_colorful = require("react-colorful");
|
|
8484
|
-
var
|
|
8479
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
8485
8480
|
function ColorPicker(props) {
|
|
8486
8481
|
const {
|
|
8487
8482
|
color,
|
|
@@ -8499,14 +8494,14 @@ function ColorPicker(props) {
|
|
|
8499
8494
|
onColorChange(color2);
|
|
8500
8495
|
});
|
|
8501
8496
|
};
|
|
8502
|
-
const popoverButton = /* @__PURE__ */ (0,
|
|
8497
|
+
const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PopoverTrigger, { asChild: true, children: children || /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8503
8498
|
BaseButton,
|
|
8504
8499
|
{
|
|
8505
8500
|
variant: "ghost",
|
|
8506
|
-
className: "mly:h-7 mly:w-7 mly:shrink-0",
|
|
8501
|
+
className: "menu-option mly:h-7 mly:w-7 mly:shrink-0",
|
|
8507
8502
|
size: "sm",
|
|
8508
8503
|
type: "button",
|
|
8509
|
-
children: /* @__PURE__ */ (0,
|
|
8504
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8510
8505
|
"div",
|
|
8511
8506
|
{
|
|
8512
8507
|
className: cn(
|
|
@@ -8520,7 +8515,7 @@ function ColorPicker(props) {
|
|
|
8520
8515
|
)
|
|
8521
8516
|
}
|
|
8522
8517
|
) });
|
|
8523
|
-
return /* @__PURE__ */ (0,
|
|
8518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
8524
8519
|
Popover,
|
|
8525
8520
|
{
|
|
8526
8521
|
onOpenChange: (open) => {
|
|
@@ -8529,9 +8524,9 @@ function ColorPicker(props) {
|
|
|
8529
8524
|
}
|
|
8530
8525
|
},
|
|
8531
8526
|
children: [
|
|
8532
|
-
tooltip ? /* @__PURE__ */ (0,
|
|
8533
|
-
/* @__PURE__ */ (0,
|
|
8534
|
-
/* @__PURE__ */ (0,
|
|
8527
|
+
tooltip ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Tooltip, { children: [
|
|
8528
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
8529
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8535
8530
|
TooltipContent,
|
|
8536
8531
|
{
|
|
8537
8532
|
sideOffset: 8,
|
|
@@ -8540,13 +8535,13 @@ function ColorPicker(props) {
|
|
|
8540
8535
|
}
|
|
8541
8536
|
)
|
|
8542
8537
|
] }) : popoverButton,
|
|
8543
|
-
/* @__PURE__ */ (0,
|
|
8538
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8544
8539
|
PopoverContent,
|
|
8545
8540
|
{
|
|
8546
|
-
className: "mly:w-full mly:rounded-none mly:border-0 mly:bg-transparent! mly:p-0! mly:shadow-none mly:drop-shadow-md",
|
|
8541
|
+
className: "menu-color-popover mly:w-full mly:rounded-none mly:border-0 mly:bg-transparent! mly:p-0! mly:shadow-none mly:drop-shadow-md",
|
|
8547
8542
|
sideOffset: 8,
|
|
8548
|
-
children: /* @__PURE__ */ (0,
|
|
8549
|
-
/* @__PURE__ */ (0,
|
|
8543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "menu-color-panel mly:min-w-[260px] mly:rounded-xl mly:border mly:border-gray-200 mly:bg-white mly:p-4", children: [
|
|
8544
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8550
8545
|
import_react_colorful.HexColorPicker,
|
|
8551
8546
|
{
|
|
8552
8547
|
color,
|
|
@@ -8554,20 +8549,20 @@ function ColorPicker(props) {
|
|
|
8554
8549
|
className: "mly:flex mly:w-full! mly:flex-col mly:gap-4"
|
|
8555
8550
|
}
|
|
8556
8551
|
),
|
|
8557
|
-
/* @__PURE__ */ (0,
|
|
8552
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8558
8553
|
import_react_colorful.HexColorInput,
|
|
8559
8554
|
{
|
|
8560
8555
|
alpha: true,
|
|
8561
8556
|
color,
|
|
8562
8557
|
onChange: handleColorChange,
|
|
8563
|
-
className: "mly:mt-4 mly:w-full mly:min-w-0 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:px-2 mly:py-1.5 mly:text-sm mly:uppercase mly:focus-visible:border-gray-400 mly:focus-visible:outline-hidden",
|
|
8558
|
+
className: "menu-color-hex-input mly:mt-4 mly:w-full mly:min-w-0 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:px-2 mly:py-1.5 mly:text-sm mly:uppercase mly:focus-visible:border-gray-400 mly:focus-visible:outline-hidden",
|
|
8564
8559
|
prefixed: true
|
|
8565
8560
|
}
|
|
8566
8561
|
),
|
|
8567
|
-
suggestedColors.length > 0 && /* @__PURE__ */ (0,
|
|
8568
|
-
/* @__PURE__ */ (0,
|
|
8569
|
-
/* @__PURE__ */ (0,
|
|
8570
|
-
/* @__PURE__ */ (0,
|
|
8562
|
+
suggestedColors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
8563
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "-mly:mx-4 mly:my-4 mly:h-px mly:bg-gray-200" }),
|
|
8564
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h2", { className: "mly:text-xs mly:text-gray-500", children: "Recently used" }),
|
|
8565
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "mly:mt-2 mly:flex mly:flex-wrap mly:gap-0.5", children: suggestedColors.map((suggestedColor) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8571
8566
|
BaseButton,
|
|
8572
8567
|
{
|
|
8573
8568
|
variant: "ghost",
|
|
@@ -8575,7 +8570,7 @@ function ColorPicker(props) {
|
|
|
8575
8570
|
className: "!mly:size-7 mly:shrink-0",
|
|
8576
8571
|
type: "button",
|
|
8577
8572
|
onClick: () => handleColorChange(suggestedColor),
|
|
8578
|
-
children: /* @__PURE__ */ (0,
|
|
8573
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8579
8574
|
"div",
|
|
8580
8575
|
{
|
|
8581
8576
|
className: "mly:h-4 mly:w-4 mly:shrink-0 mly:rounded",
|
|
@@ -8597,10 +8592,10 @@ function ColorPicker(props) {
|
|
|
8597
8592
|
}
|
|
8598
8593
|
|
|
8599
8594
|
// src/editor/components/section-menu/use-section-state.tsx
|
|
8600
|
-
var
|
|
8595
|
+
var import_react37 = require("@tiptap/react");
|
|
8601
8596
|
var import_fast_deep_equal5 = __toESM(require("fast-deep-equal"), 1);
|
|
8602
8597
|
var useSectionState = (editor) => {
|
|
8603
|
-
const states = (0,
|
|
8598
|
+
const states = (0, import_react37.useEditorState)({
|
|
8604
8599
|
editor,
|
|
8605
8600
|
selector: (ctx) => {
|
|
8606
8601
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
@@ -8628,13 +8623,13 @@ var useSectionState = (editor) => {
|
|
|
8628
8623
|
};
|
|
8629
8624
|
|
|
8630
8625
|
// src/editor/components/section-menu/section-bubble-menu.tsx
|
|
8631
|
-
var
|
|
8626
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
8632
8627
|
function SectionBubbleMenu(props) {
|
|
8633
8628
|
const { appendTo, editor } = props;
|
|
8634
8629
|
if (!editor) {
|
|
8635
8630
|
return null;
|
|
8636
8631
|
}
|
|
8637
|
-
const getReferenceClientRect = (0,
|
|
8632
|
+
const getReferenceClientRect = (0, import_react39.useCallback)(() => {
|
|
8638
8633
|
const renderContainer = getRenderContainer(editor, "section");
|
|
8639
8634
|
const rect = (renderContainer == null ? void 0 : renderContainer.getBoundingClientRect()) || new DOMRect(-1e3, -1e3, 0, 0);
|
|
8640
8635
|
return rect;
|
|
@@ -8643,10 +8638,10 @@ function SectionBubbleMenu(props) {
|
|
|
8643
8638
|
shouldShow: ({ editor: editor2 }) => {
|
|
8644
8639
|
var _a, _b;
|
|
8645
8640
|
const activeSectionNode = getClosestNodeByName(editor2, "section");
|
|
8646
|
-
const repeatNodeChildren = activeSectionNode ? (_a = (0,
|
|
8641
|
+
const repeatNodeChildren = activeSectionNode ? (_a = (0, import_react38.findChildren)(activeSectionNode == null ? void 0 : activeSectionNode.node, (node) => {
|
|
8647
8642
|
return node.type.name === "repeat";
|
|
8648
8643
|
})) == null ? void 0 : _a[0] : null;
|
|
8649
|
-
const inlineImageNodeChildren = activeSectionNode ? (_b = (0,
|
|
8644
|
+
const inlineImageNodeChildren = activeSectionNode ? (_b = (0, import_react38.findChildren)(activeSectionNode == null ? void 0 : activeSectionNode.node, (node) => {
|
|
8650
8645
|
return node.type.name === "inlineImage";
|
|
8651
8646
|
})) == null ? void 0 : _b[0] : null;
|
|
8652
8647
|
const hasActiveRepeatNodeChildren = repeatNodeChildren && editor2.isActive("repeat");
|
|
@@ -8675,12 +8670,12 @@ function SectionBubbleMenu(props) {
|
|
|
8675
8670
|
{ value: "6", label: "Smooth" },
|
|
8676
8671
|
{ value: "9999", label: "Round" }
|
|
8677
8672
|
];
|
|
8678
|
-
return /* @__PURE__ */ (0,
|
|
8679
|
-
|
|
8673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8674
|
+
import_react38.BubbleMenu,
|
|
8680
8675
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
8681
|
-
className: "mly:flex mly:items-stretch mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
8682
|
-
children: /* @__PURE__ */ (0,
|
|
8683
|
-
/* @__PURE__ */ (0,
|
|
8676
|
+
className: "menu-surface menu-inline-gap mly:flex mly:items-stretch mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
8677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(TooltipProvider, { children: [
|
|
8678
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8684
8679
|
AlignmentSwitch,
|
|
8685
8680
|
{
|
|
8686
8681
|
alignment: state.currentAlignment,
|
|
@@ -8692,9 +8687,9 @@ function SectionBubbleMenu(props) {
|
|
|
8692
8687
|
}
|
|
8693
8688
|
}
|
|
8694
8689
|
),
|
|
8695
|
-
/* @__PURE__ */ (0,
|
|
8696
|
-
/* @__PURE__ */ (0,
|
|
8697
|
-
/* @__PURE__ */ (0,
|
|
8690
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Divider, {}),
|
|
8691
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "menu-inline-gap mly:flex mly:gap-x-0.5", children: [
|
|
8692
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8698
8693
|
Select,
|
|
8699
8694
|
{
|
|
8700
8695
|
label: "Border Radius",
|
|
@@ -8710,7 +8705,7 @@ function SectionBubbleMenu(props) {
|
|
|
8710
8705
|
className: "mly:capitalize"
|
|
8711
8706
|
}
|
|
8712
8707
|
),
|
|
8713
|
-
/* @__PURE__ */ (0,
|
|
8708
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8714
8709
|
Select,
|
|
8715
8710
|
{
|
|
8716
8711
|
label: "Border Width",
|
|
@@ -8732,8 +8727,8 @@ function SectionBubbleMenu(props) {
|
|
|
8732
8727
|
}
|
|
8733
8728
|
)
|
|
8734
8729
|
] }),
|
|
8735
|
-
/* @__PURE__ */ (0,
|
|
8736
|
-
/* @__PURE__ */ (0,
|
|
8730
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Divider, {}),
|
|
8731
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8737
8732
|
Select,
|
|
8738
8733
|
{
|
|
8739
8734
|
icon: MarginIcon,
|
|
@@ -8761,8 +8756,8 @@ function SectionBubbleMenu(props) {
|
|
|
8761
8756
|
className: "mly:capitalize"
|
|
8762
8757
|
}
|
|
8763
8758
|
),
|
|
8764
|
-
/* @__PURE__ */ (0,
|
|
8765
|
-
/* @__PURE__ */ (0,
|
|
8759
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Divider, {}),
|
|
8760
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8766
8761
|
Select,
|
|
8767
8762
|
{
|
|
8768
8763
|
icon: PaddingIcon,
|
|
@@ -8790,9 +8785,9 @@ function SectionBubbleMenu(props) {
|
|
|
8790
8785
|
className: "mly:capitalize"
|
|
8791
8786
|
}
|
|
8792
8787
|
),
|
|
8793
|
-
/* @__PURE__ */ (0,
|
|
8794
|
-
/* @__PURE__ */ (0,
|
|
8795
|
-
/* @__PURE__ */ (0,
|
|
8788
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Divider, {}),
|
|
8789
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "menu-inline-gap mly:flex mly:gap-x-0.5", children: [
|
|
8790
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8796
8791
|
ColorPicker,
|
|
8797
8792
|
{
|
|
8798
8793
|
color: state.currentBorderColor,
|
|
@@ -8803,14 +8798,14 @@ function SectionBubbleMenu(props) {
|
|
|
8803
8798
|
});
|
|
8804
8799
|
},
|
|
8805
8800
|
tooltip: "Border Color",
|
|
8806
|
-
children: /* @__PURE__ */ (0,
|
|
8801
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8807
8802
|
BaseButton,
|
|
8808
8803
|
{
|
|
8809
8804
|
variant: "ghost",
|
|
8810
|
-
className: "mly:h-7 mly:w-7 mly:shrink-0",
|
|
8805
|
+
className: "menu-option mly:h-7 mly:w-7 mly:shrink-0",
|
|
8811
8806
|
size: "sm",
|
|
8812
8807
|
type: "button",
|
|
8813
|
-
children: /* @__PURE__ */ (0,
|
|
8808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8814
8809
|
BorderColor,
|
|
8815
8810
|
{
|
|
8816
8811
|
className: "mly:size-3 mly:shrink-0",
|
|
@@ -8824,7 +8819,7 @@ function SectionBubbleMenu(props) {
|
|
|
8824
8819
|
)
|
|
8825
8820
|
}
|
|
8826
8821
|
),
|
|
8827
|
-
/* @__PURE__ */ (0,
|
|
8822
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8828
8823
|
ColorPicker,
|
|
8829
8824
|
{
|
|
8830
8825
|
color: state.currentBackgroundColor,
|
|
@@ -8840,8 +8835,8 @@ function SectionBubbleMenu(props) {
|
|
|
8840
8835
|
}
|
|
8841
8836
|
)
|
|
8842
8837
|
] }),
|
|
8843
|
-
/* @__PURE__ */ (0,
|
|
8844
|
-
/* @__PURE__ */ (0,
|
|
8838
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Divider, {}),
|
|
8839
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8845
8840
|
BubbleMenuButton,
|
|
8846
8841
|
{
|
|
8847
8842
|
icon: import_lucide_react25.Trash,
|
|
@@ -8851,17 +8846,17 @@ function SectionBubbleMenu(props) {
|
|
|
8851
8846
|
}
|
|
8852
8847
|
}
|
|
8853
8848
|
),
|
|
8854
|
-
state.isColumnsActive && /* @__PURE__ */ (0,
|
|
8855
|
-
/* @__PURE__ */ (0,
|
|
8856
|
-
/* @__PURE__ */ (0,
|
|
8857
|
-
/* @__PURE__ */ (0,
|
|
8849
|
+
state.isColumnsActive && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
8850
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Divider, {}),
|
|
8851
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Popover, { children: [
|
|
8852
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(PopoverTrigger, { className: "menu-option mly:flex mly:items-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray", children: [
|
|
8858
8853
|
"Column",
|
|
8859
|
-
/* @__PURE__ */ (0,
|
|
8854
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.ChevronUp, { className: "mly:h-3 mly:w-3" })
|
|
8860
8855
|
] }),
|
|
8861
|
-
/* @__PURE__ */ (0,
|
|
8856
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8862
8857
|
PopoverContent,
|
|
8863
8858
|
{
|
|
8864
|
-
className: "mly:w-max mly:rounded-lg mly:p-0.5!",
|
|
8859
|
+
className: "menu-dropdown-surface mly:w-max mly:rounded-lg mly:p-0.5!",
|
|
8865
8860
|
side: "top",
|
|
8866
8861
|
sideOffset: 8,
|
|
8867
8862
|
align: "end",
|
|
@@ -8871,7 +8866,7 @@ function SectionBubbleMenu(props) {
|
|
|
8871
8866
|
onCloseAutoFocus: (e) => {
|
|
8872
8867
|
e.preventDefault();
|
|
8873
8868
|
},
|
|
8874
|
-
children: /* @__PURE__ */ (0,
|
|
8869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ColumnsBubbleMenuContent, { editor })
|
|
8875
8870
|
}
|
|
8876
8871
|
)
|
|
8877
8872
|
] })
|
|
@@ -8882,13 +8877,13 @@ function SectionBubbleMenu(props) {
|
|
|
8882
8877
|
}
|
|
8883
8878
|
|
|
8884
8879
|
// src/editor/components/spacer-menu/spacer-bubble-menu.tsx
|
|
8885
|
-
var
|
|
8880
|
+
var import_react41 = require("@tiptap/react");
|
|
8886
8881
|
|
|
8887
8882
|
// src/editor/components/spacer-menu/use-spacer-state.ts
|
|
8888
|
-
var
|
|
8883
|
+
var import_react40 = require("@tiptap/react");
|
|
8889
8884
|
var import_fast_deep_equal6 = __toESM(require("fast-deep-equal"), 1);
|
|
8890
8885
|
var useSpacerState = (editor) => {
|
|
8891
|
-
const states = (0,
|
|
8886
|
+
const states = (0, import_react40.useEditorState)({
|
|
8892
8887
|
editor,
|
|
8893
8888
|
selector: (ctx) => {
|
|
8894
8889
|
var _a;
|
|
@@ -8902,14 +8897,14 @@ var useSpacerState = (editor) => {
|
|
|
8902
8897
|
};
|
|
8903
8898
|
|
|
8904
8899
|
// src/editor/components/spacer-menu/spacer-bubble-menu.tsx
|
|
8905
|
-
var
|
|
8906
|
-
var
|
|
8900
|
+
var import_react42 = require("react");
|
|
8901
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
8907
8902
|
function SpacerBubbleMenu(props) {
|
|
8908
8903
|
const { editor, appendTo } = props;
|
|
8909
8904
|
if (!editor) {
|
|
8910
8905
|
return null;
|
|
8911
8906
|
}
|
|
8912
|
-
const items = (0,
|
|
8907
|
+
const items = (0, import_react42.useMemo)(
|
|
8913
8908
|
() => spacing.map((space) => {
|
|
8914
8909
|
const { value: height, short: name } = space;
|
|
8915
8910
|
return {
|
|
@@ -8935,11 +8930,11 @@ function SpacerBubbleMenu(props) {
|
|
|
8935
8930
|
}
|
|
8936
8931
|
});
|
|
8937
8932
|
const state = useSpacerState(editor);
|
|
8938
|
-
return /* @__PURE__ */ (0,
|
|
8939
|
-
|
|
8933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
8934
|
+
import_react41.BubbleMenu,
|
|
8940
8935
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
8941
|
-
className: "mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
8942
|
-
children: /* @__PURE__ */ (0,
|
|
8936
|
+
className: "menu-surface mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
8937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TooltipProvider, { children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
8943
8938
|
BubbleMenuButton,
|
|
8944
8939
|
__spreadValues({
|
|
8945
8940
|
className: "!mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",
|
|
@@ -9063,6 +9058,17 @@ var ColumnsExtension = import_core10.Node.create({
|
|
|
9063
9058
|
var import_core11 = require("@tiptap/core");
|
|
9064
9059
|
var import_extension_horizontal_rule = require("@tiptap/extension-horizontal-rule");
|
|
9065
9060
|
var HorizontalRule = import_extension_horizontal_rule.HorizontalRule.extend({
|
|
9061
|
+
addAttributes() {
|
|
9062
|
+
return {
|
|
9063
|
+
size: {
|
|
9064
|
+
default: 32,
|
|
9065
|
+
parseHTML: (element) => Number(element.getAttribute("data-size") || 32),
|
|
9066
|
+
renderHTML: (attributes) => ({
|
|
9067
|
+
"data-size": attributes.size
|
|
9068
|
+
})
|
|
9069
|
+
}
|
|
9070
|
+
};
|
|
9071
|
+
},
|
|
9066
9072
|
addInputRules() {
|
|
9067
9073
|
return [
|
|
9068
9074
|
new import_core11.InputRule({
|
|
@@ -9083,7 +9089,7 @@ var HorizontalRule = import_extension_horizontal_rule.HorizontalRule.extend({
|
|
|
9083
9089
|
addOptions() {
|
|
9084
9090
|
return {
|
|
9085
9091
|
HTMLAttributes: {
|
|
9086
|
-
class: "mly:relative"
|
|
9092
|
+
class: "mly:relative mly-divider-node"
|
|
9087
9093
|
}
|
|
9088
9094
|
};
|
|
9089
9095
|
}
|
|
@@ -9173,18 +9179,18 @@ var Spacer = import_core12.Node.create({
|
|
|
9173
9179
|
|
|
9174
9180
|
// src/editor/extensions/link-card.ts
|
|
9175
9181
|
var import_core13 = require("@tiptap/core");
|
|
9176
|
-
var
|
|
9182
|
+
var import_react44 = require("@tiptap/react");
|
|
9177
9183
|
|
|
9178
9184
|
// src/editor/nodes/link-card.tsx
|
|
9179
|
-
var
|
|
9185
|
+
var import_react43 = require("@tiptap/react");
|
|
9180
9186
|
|
|
9181
9187
|
// src/editor/components/input.tsx
|
|
9182
9188
|
var React5 = __toESM(require("react"), 1);
|
|
9183
|
-
var
|
|
9189
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
9184
9190
|
var Input = React5.forwardRef(
|
|
9185
9191
|
(_a, ref) => {
|
|
9186
9192
|
var _b = _a, { className, type } = _b, props = __objRest(_b, ["className", "type"]);
|
|
9187
|
-
return /* @__PURE__ */ (0,
|
|
9193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
9188
9194
|
"input",
|
|
9189
9195
|
__spreadValues(__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
9190
9196
|
type,
|
|
@@ -9202,11 +9208,11 @@ Input.displayName = "Input";
|
|
|
9202
9208
|
|
|
9203
9209
|
// src/editor/components/textarea.tsx
|
|
9204
9210
|
var React6 = __toESM(require("react"), 1);
|
|
9205
|
-
var
|
|
9211
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
9206
9212
|
var Textarea = React6.forwardRef(
|
|
9207
9213
|
(_a, ref) => {
|
|
9208
9214
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
9209
|
-
return /* @__PURE__ */ (0,
|
|
9215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9210
9216
|
"textarea",
|
|
9211
9217
|
__spreadValues({
|
|
9212
9218
|
className: cn(
|
|
@@ -9222,18 +9228,18 @@ var Textarea = React6.forwardRef(
|
|
|
9222
9228
|
Textarea.displayName = "Textarea";
|
|
9223
9229
|
|
|
9224
9230
|
// src/editor/nodes/link-card.tsx
|
|
9225
|
-
var
|
|
9231
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
9226
9232
|
function LinkCardComponent(props) {
|
|
9227
9233
|
const { title, description, link, linkTitle, image: image2, badgeText, subTitle } = props.node.attrs;
|
|
9228
9234
|
const { getPos, editor } = props;
|
|
9229
|
-
return /* @__PURE__ */ (0,
|
|
9230
|
-
|
|
9235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9236
|
+
import_react43.NodeViewWrapper,
|
|
9231
9237
|
{
|
|
9232
9238
|
className: `react-component ${props.selected && "ProseMirror-selectednode"}`,
|
|
9233
9239
|
draggable: editor.isEditable,
|
|
9234
9240
|
"data-drag-handle": editor.isEditable,
|
|
9235
|
-
children: /* @__PURE__ */ (0,
|
|
9236
|
-
/* @__PURE__ */ (0,
|
|
9241
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Popover, { open: props.selected, children: [
|
|
9242
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9237
9243
|
"div",
|
|
9238
9244
|
{
|
|
9239
9245
|
tabIndex: -1,
|
|
@@ -9242,8 +9248,8 @@ function LinkCardComponent(props) {
|
|
|
9242
9248
|
const pos = getPos();
|
|
9243
9249
|
editor.commands.setNodeSelection(pos);
|
|
9244
9250
|
},
|
|
9245
|
-
children: /* @__PURE__ */ (0,
|
|
9246
|
-
image2 && /* @__PURE__ */ (0,
|
|
9251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "mly:no-prose mly:flex mly:flex-col mly:rounded-lg mly:border mly:border-gray-300", children: [
|
|
9252
|
+
image2 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mly:relative mly:mb-1.5 mly:w-full mly:shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9247
9253
|
"img",
|
|
9248
9254
|
{
|
|
9249
9255
|
src: image2,
|
|
@@ -9252,23 +9258,23 @@ function LinkCardComponent(props) {
|
|
|
9252
9258
|
draggable: editor.isEditable
|
|
9253
9259
|
}
|
|
9254
9260
|
) }),
|
|
9255
|
-
/* @__PURE__ */ (0,
|
|
9256
|
-
/* @__PURE__ */ (0,
|
|
9257
|
-
/* @__PURE__ */ (0,
|
|
9258
|
-
badgeText && /* @__PURE__ */ (0,
|
|
9261
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "mly:flex mly:items-stretch mly:p-3", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: cn("mly:flex mly:flex-col"), children: [
|
|
9262
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "!mly:mb-1.5 mly:flex mly:items-center mly:gap-1.5", children: [
|
|
9263
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h2", { className: "!mly:mb-0 mly:text-lg! mly:font-semibold", children: title }),
|
|
9264
|
+
badgeText && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "!mly:font-base mly:rounded-md mly:bg-yellow-200 mly:px-2 mly:py-1 mly:font-semibold mly:leading-none text-xs", children: badgeText }),
|
|
9259
9265
|
" ",
|
|
9260
|
-
subTitle && !badgeText && /* @__PURE__ */ (0,
|
|
9266
|
+
subTitle && !badgeText && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "!mly:font-base mly:font-regular mly:rounded-md mly:leading-none mly:text-gray-400 text-xs", children: subTitle })
|
|
9261
9267
|
] }),
|
|
9262
|
-
/* @__PURE__ */ (0,
|
|
9268
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "!mly:my-0 mly:text-base! mly:text-gray-500", children: [
|
|
9263
9269
|
description,
|
|
9264
9270
|
" ",
|
|
9265
|
-
linkTitle ? /* @__PURE__ */ (0,
|
|
9271
|
+
linkTitle ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("a", { href: link, className: "mly:font-semibold", children: linkTitle }) : null
|
|
9266
9272
|
] })
|
|
9267
9273
|
] }) })
|
|
9268
9274
|
] })
|
|
9269
9275
|
}
|
|
9270
9276
|
) }),
|
|
9271
|
-
/* @__PURE__ */ (0,
|
|
9277
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
9272
9278
|
PopoverContent,
|
|
9273
9279
|
{
|
|
9274
9280
|
align: "end",
|
|
@@ -9277,9 +9283,9 @@ function LinkCardComponent(props) {
|
|
|
9277
9283
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
9278
9284
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
9279
9285
|
children: [
|
|
9280
|
-
/* @__PURE__ */ (0,
|
|
9281
|
-
/* @__PURE__ */ (0,
|
|
9282
|
-
/* @__PURE__ */ (0,
|
|
9286
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "mly:w-full mly:space-y-1", children: [
|
|
9287
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mly:text-xs mly:font-normal mly:text-slate-400", children: "Image" }),
|
|
9288
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9283
9289
|
Input,
|
|
9284
9290
|
{
|
|
9285
9291
|
placeholder: "Add Image",
|
|
@@ -9293,9 +9299,9 @@ function LinkCardComponent(props) {
|
|
|
9293
9299
|
}
|
|
9294
9300
|
)
|
|
9295
9301
|
] }),
|
|
9296
|
-
/* @__PURE__ */ (0,
|
|
9297
|
-
/* @__PURE__ */ (0,
|
|
9298
|
-
/* @__PURE__ */ (0,
|
|
9302
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "mly:w-full mly:space-y-1", children: [
|
|
9303
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mly:text-xs mly:font-normal mly:text-slate-400", children: "Title" }),
|
|
9304
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9299
9305
|
Input,
|
|
9300
9306
|
{
|
|
9301
9307
|
placeholder: "Add title",
|
|
@@ -9308,9 +9314,9 @@ function LinkCardComponent(props) {
|
|
|
9308
9314
|
}
|
|
9309
9315
|
)
|
|
9310
9316
|
] }),
|
|
9311
|
-
/* @__PURE__ */ (0,
|
|
9312
|
-
/* @__PURE__ */ (0,
|
|
9313
|
-
/* @__PURE__ */ (0,
|
|
9317
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "mly:w-full mly:space-y-1", children: [
|
|
9318
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mly:text-xs mly:font-normal mly:text-slate-400", children: "Description" }),
|
|
9319
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9314
9320
|
Textarea,
|
|
9315
9321
|
{
|
|
9316
9322
|
placeholder: "Add description here",
|
|
@@ -9323,10 +9329,10 @@ function LinkCardComponent(props) {
|
|
|
9323
9329
|
}
|
|
9324
9330
|
)
|
|
9325
9331
|
] }),
|
|
9326
|
-
/* @__PURE__ */ (0,
|
|
9327
|
-
/* @__PURE__ */ (0,
|
|
9328
|
-
/* @__PURE__ */ (0,
|
|
9329
|
-
/* @__PURE__ */ (0,
|
|
9332
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "mly:grid mly:grid-cols-2 mly:gap-2", children: [
|
|
9333
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "mly:w-full mly:space-y-1", children: [
|
|
9334
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mly:text-xs mly:font-normal mly:text-slate-400", children: "Link Title" }),
|
|
9335
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9330
9336
|
Input,
|
|
9331
9337
|
{
|
|
9332
9338
|
placeholder: "Add link title here",
|
|
@@ -9339,9 +9345,9 @@ function LinkCardComponent(props) {
|
|
|
9339
9345
|
}
|
|
9340
9346
|
)
|
|
9341
9347
|
] }),
|
|
9342
|
-
/* @__PURE__ */ (0,
|
|
9343
|
-
/* @__PURE__ */ (0,
|
|
9344
|
-
/* @__PURE__ */ (0,
|
|
9348
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "mly:w-full mly:space-y-1", children: [
|
|
9349
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mly:text-xs mly:font-normal mly:text-slate-400", children: "Link" }),
|
|
9350
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9345
9351
|
Input,
|
|
9346
9352
|
{
|
|
9347
9353
|
placeholder: "Add link here",
|
|
@@ -9355,10 +9361,10 @@ function LinkCardComponent(props) {
|
|
|
9355
9361
|
)
|
|
9356
9362
|
] })
|
|
9357
9363
|
] }),
|
|
9358
|
-
/* @__PURE__ */ (0,
|
|
9359
|
-
/* @__PURE__ */ (0,
|
|
9360
|
-
/* @__PURE__ */ (0,
|
|
9361
|
-
/* @__PURE__ */ (0,
|
|
9364
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "mly:grid mly:grid-cols-2 mly:gap-2", children: [
|
|
9365
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "mly:w-full mly:space-y-1", children: [
|
|
9366
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mly:text-xs mly:font-normal mly:text-slate-400", children: "Badge Text" }),
|
|
9367
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9362
9368
|
Input,
|
|
9363
9369
|
{
|
|
9364
9370
|
placeholder: "Add badge text here",
|
|
@@ -9371,9 +9377,9 @@ function LinkCardComponent(props) {
|
|
|
9371
9377
|
}
|
|
9372
9378
|
)
|
|
9373
9379
|
] }),
|
|
9374
|
-
/* @__PURE__ */ (0,
|
|
9375
|
-
/* @__PURE__ */ (0,
|
|
9376
|
-
/* @__PURE__ */ (0,
|
|
9380
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "mly:w-full mly:space-y-1", children: [
|
|
9381
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "mly:text-xs mly:font-normal mly:text-slate-400", children: "Sub Title" }),
|
|
9382
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9377
9383
|
Input,
|
|
9378
9384
|
{
|
|
9379
9385
|
placeholder: "Add sub title here",
|
|
@@ -9460,7 +9466,7 @@ var LinkCardExtension = import_core13.Node.create({
|
|
|
9460
9466
|
};
|
|
9461
9467
|
},
|
|
9462
9468
|
addNodeView() {
|
|
9463
|
-
return (0,
|
|
9469
|
+
return (0, import_react44.ReactNodeViewRenderer)(LinkCardComponent, {
|
|
9464
9470
|
className: "mly:relative"
|
|
9465
9471
|
});
|
|
9466
9472
|
}
|
|
@@ -9468,26 +9474,27 @@ var LinkCardExtension = import_core13.Node.create({
|
|
|
9468
9474
|
|
|
9469
9475
|
// src/editor/nodes/button/button.tsx
|
|
9470
9476
|
var import_core14 = require("@tiptap/core");
|
|
9471
|
-
var
|
|
9477
|
+
var import_react48 = require("@tiptap/react");
|
|
9472
9478
|
|
|
9473
9479
|
// src/editor/nodes/button/button-view.tsx
|
|
9474
|
-
var
|
|
9475
|
-
var
|
|
9480
|
+
var import_react46 = require("@tiptap/react");
|
|
9481
|
+
var import_lucide_react26 = require("lucide-react");
|
|
9482
|
+
var import_react47 = require("react");
|
|
9476
9483
|
|
|
9477
9484
|
// src/editor/nodes/button/button-label-input.tsx
|
|
9478
|
-
var
|
|
9479
|
-
var
|
|
9485
|
+
var import_react45 = require("react");
|
|
9486
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
9480
9487
|
function ButtonLabelInput(props) {
|
|
9481
9488
|
var _a, _b;
|
|
9482
9489
|
const { value, onValueChange, isVariable, editor } = props;
|
|
9483
|
-
const linkInputRef = (0,
|
|
9484
|
-
const [isEditing, setIsEditing] = (0,
|
|
9490
|
+
const linkInputRef = (0, import_react45.useRef)(null);
|
|
9491
|
+
const [isEditing, setIsEditing] = (0, import_react45.useState)(!isVariable);
|
|
9485
9492
|
const { placeholderUrl = DEFAULT_PLACEHOLDER_URL } = useMailyContext();
|
|
9486
9493
|
const otps = useVariableOptions(editor);
|
|
9487
9494
|
const variables = otps == null ? void 0 : otps.variables;
|
|
9488
9495
|
const variableTriggerCharacter = (_b = (_a = otps == null ? void 0 : otps.suggestion) == null ? void 0 : _a.char) != null ? _b : DEFAULT_VARIABLE_TRIGGER_CHAR;
|
|
9489
9496
|
const renderVariable = otps == null ? void 0 : otps.renderVariable;
|
|
9490
|
-
const autoCompleteOptions = (0,
|
|
9497
|
+
const autoCompleteOptions = (0, import_react45.useMemo)(() => {
|
|
9491
9498
|
const withoutTrigger = value.replace(
|
|
9492
9499
|
new RegExp(variableTriggerCharacter, "g"),
|
|
9493
9500
|
""
|
|
@@ -9498,8 +9505,8 @@ function ButtonLabelInput(props) {
|
|
|
9498
9505
|
editor
|
|
9499
9506
|
}).map((variable) => variable.name);
|
|
9500
9507
|
}, [variables, value, editor]);
|
|
9501
|
-
return /* @__PURE__ */ (0,
|
|
9502
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
9508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "mly:isolate mly:flex mly:items-center mly:rounded-lg", children: [
|
|
9509
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9503
9510
|
"button",
|
|
9504
9511
|
{
|
|
9505
9512
|
onClick: () => {
|
|
@@ -9520,7 +9527,7 @@ function ButtonLabelInput(props) {
|
|
|
9520
9527
|
})
|
|
9521
9528
|
}
|
|
9522
9529
|
),
|
|
9523
|
-
isEditing && /* @__PURE__ */ (0,
|
|
9530
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9524
9531
|
InputAutocomplete,
|
|
9525
9532
|
{
|
|
9526
9533
|
editor,
|
|
@@ -9531,7 +9538,7 @@ function ButtonLabelInput(props) {
|
|
|
9531
9538
|
autoCompleteOptions,
|
|
9532
9539
|
ref: linkInputRef,
|
|
9533
9540
|
placeholder: placeholderUrl,
|
|
9534
|
-
className: "mly:h-7 mly:w-40 mly:rounded-md mly:px-2 mly:pr-6 mly:text-sm mly:text-midnight-gray mly:hover:bg-soft-gray mly:focus:bg-soft-gray mly:focus:outline-hidden",
|
|
9541
|
+
className: "menu-option mly:h-7 mly:w-40 mly:rounded-md mly:px-2 mly:pr-6 mly:text-sm mly:text-midnight-gray mly:hover:bg-soft-gray mly:focus:bg-soft-gray mly:focus:outline-hidden",
|
|
9535
9542
|
triggerChar: variableTriggerCharacter,
|
|
9536
9543
|
onSelectOption: (value2) => {
|
|
9537
9544
|
var _a2;
|
|
@@ -9547,7 +9554,7 @@ function ButtonLabelInput(props) {
|
|
|
9547
9554
|
}
|
|
9548
9555
|
|
|
9549
9556
|
// src/editor/nodes/button/button-view.tsx
|
|
9550
|
-
var
|
|
9557
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9551
9558
|
function ButtonView(props) {
|
|
9552
9559
|
const { node, editor, getPos, updateAttributes: updateAttributes2 } = props;
|
|
9553
9560
|
const {
|
|
@@ -9556,6 +9563,7 @@ function ButtonView(props) {
|
|
|
9556
9563
|
alignment,
|
|
9557
9564
|
variant,
|
|
9558
9565
|
borderRadius: _radius,
|
|
9566
|
+
size: rawSize,
|
|
9559
9567
|
buttonColor,
|
|
9560
9568
|
textColor,
|
|
9561
9569
|
url: externalLink,
|
|
@@ -9567,7 +9575,7 @@ function ButtonView(props) {
|
|
|
9567
9575
|
} = node.attrs;
|
|
9568
9576
|
const opts = useVariableOptions(editor);
|
|
9569
9577
|
const renderVariable = opts == null ? void 0 : opts.renderVariable;
|
|
9570
|
-
const sizes = (0,
|
|
9578
|
+
const sizes = (0, import_react47.useMemo)(
|
|
9571
9579
|
() => ({
|
|
9572
9580
|
small: {
|
|
9573
9581
|
paddingX: 24,
|
|
@@ -9584,14 +9592,17 @@ function ButtonView(props) {
|
|
|
9584
9592
|
}),
|
|
9585
9593
|
[]
|
|
9586
9594
|
);
|
|
9587
|
-
const size = (0,
|
|
9595
|
+
const size = (0, import_react47.useMemo)(() => {
|
|
9588
9596
|
var _a;
|
|
9589
|
-
|
|
9597
|
+
if (allowedButtonSize.includes(rawSize)) {
|
|
9598
|
+
return rawSize;
|
|
9599
|
+
}
|
|
9600
|
+
return ((_a = Object.entries(sizes).find(
|
|
9590
9601
|
([, { paddingX, paddingY }]) => paddingRight === paddingX && paddingTop === paddingY
|
|
9591
|
-
)) == null ? void 0 : _a[0];
|
|
9592
|
-
}, [paddingRight, paddingTop, sizes]);
|
|
9593
|
-
return /* @__PURE__ */ (0,
|
|
9594
|
-
|
|
9602
|
+
)) == null ? void 0 : _a[0]) || "medium";
|
|
9603
|
+
}, [rawSize, paddingRight, paddingTop, sizes]);
|
|
9604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9605
|
+
import_react46.NodeViewWrapper,
|
|
9595
9606
|
{
|
|
9596
9607
|
draggable: editor.isEditable,
|
|
9597
9608
|
"data-drag-handle": editor.isEditable,
|
|
@@ -9599,8 +9610,8 @@ function ButtonView(props) {
|
|
|
9599
9610
|
style: {
|
|
9600
9611
|
textAlign: alignment
|
|
9601
9612
|
},
|
|
9602
|
-
children: /* @__PURE__ */ (0,
|
|
9603
|
-
/* @__PURE__ */ (0,
|
|
9613
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Popover, { open: props.selected && editor.isEditable, children: [
|
|
9614
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9604
9615
|
"button",
|
|
9605
9616
|
{
|
|
9606
9617
|
className: cn(
|
|
@@ -9643,17 +9654,17 @@ function ButtonView(props) {
|
|
|
9643
9654
|
}) : text2
|
|
9644
9655
|
}
|
|
9645
9656
|
) }) }),
|
|
9646
|
-
/* @__PURE__ */ (0,
|
|
9657
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9647
9658
|
PopoverContent,
|
|
9648
9659
|
{
|
|
9649
9660
|
align: "end",
|
|
9650
9661
|
side: "top",
|
|
9651
|
-
className: "mly:w-max mly:rounded-lg mly:p-0.5!",
|
|
9662
|
+
className: "menu-dropdown-surface button-menu-surface mly:w-max mly:rounded-lg mly:p-0.5!",
|
|
9652
9663
|
sideOffset: 8,
|
|
9653
9664
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
9654
9665
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
9655
|
-
children: /* @__PURE__ */ (0,
|
|
9656
|
-
/* @__PURE__ */ (0,
|
|
9666
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "menu-surface menu-inline-gap mly:flex mly:items-stretch mly:text-midnight-gray", children: [
|
|
9667
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9657
9668
|
ButtonLabelInput,
|
|
9658
9669
|
{
|
|
9659
9670
|
value: text2,
|
|
@@ -9667,9 +9678,9 @@ function ButtonView(props) {
|
|
|
9667
9678
|
editor
|
|
9668
9679
|
}
|
|
9669
9680
|
),
|
|
9670
|
-
/* @__PURE__ */ (0,
|
|
9671
|
-
/* @__PURE__ */ (0,
|
|
9672
|
-
/* @__PURE__ */ (0,
|
|
9681
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Divider, {}),
|
|
9682
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "menu-inline-gap mly:flex mly:gap-x-0.5", children: [
|
|
9683
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9673
9684
|
Select,
|
|
9674
9685
|
{
|
|
9675
9686
|
label: "Border Radius",
|
|
@@ -9687,7 +9698,7 @@ function ButtonView(props) {
|
|
|
9687
9698
|
className: "mly:capitalize"
|
|
9688
9699
|
}
|
|
9689
9700
|
),
|
|
9690
|
-
/* @__PURE__ */ (0,
|
|
9701
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9691
9702
|
Select,
|
|
9692
9703
|
{
|
|
9693
9704
|
label: "Style",
|
|
@@ -9705,7 +9716,7 @@ function ButtonView(props) {
|
|
|
9705
9716
|
className: "mly:capitalize"
|
|
9706
9717
|
}
|
|
9707
9718
|
),
|
|
9708
|
-
/* @__PURE__ */ (0,
|
|
9719
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9709
9720
|
Select,
|
|
9710
9721
|
{
|
|
9711
9722
|
label: "Size",
|
|
@@ -9718,6 +9729,7 @@ function ButtonView(props) {
|
|
|
9718
9729
|
onValueChange: (value) => {
|
|
9719
9730
|
const { paddingX, paddingY } = sizes[value];
|
|
9720
9731
|
updateAttributes2({
|
|
9732
|
+
size: value,
|
|
9721
9733
|
paddingTop: paddingY,
|
|
9722
9734
|
paddingRight: paddingX,
|
|
9723
9735
|
paddingBottom: paddingY,
|
|
@@ -9729,20 +9741,48 @@ function ButtonView(props) {
|
|
|
9729
9741
|
}
|
|
9730
9742
|
)
|
|
9731
9743
|
] }),
|
|
9732
|
-
/* @__PURE__ */ (0,
|
|
9733
|
-
/* @__PURE__ */ (0,
|
|
9734
|
-
/* @__PURE__ */ (0,
|
|
9735
|
-
|
|
9744
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Divider, {}),
|
|
9745
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "menu-inline-gap mly:flex mly:gap-x-0.5", children: [
|
|
9746
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9747
|
+
BubbleMenuButton,
|
|
9736
9748
|
{
|
|
9737
|
-
|
|
9738
|
-
|
|
9749
|
+
icon: import_lucide_react26.AlignLeft,
|
|
9750
|
+
tooltip: "Align Left",
|
|
9751
|
+
command: () => {
|
|
9739
9752
|
updateAttributes2({
|
|
9740
|
-
alignment:
|
|
9753
|
+
alignment: "left"
|
|
9741
9754
|
});
|
|
9742
|
-
}
|
|
9755
|
+
},
|
|
9756
|
+
isActive: () => alignment === "left"
|
|
9757
|
+
}
|
|
9758
|
+
),
|
|
9759
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9760
|
+
BubbleMenuButton,
|
|
9761
|
+
{
|
|
9762
|
+
icon: import_lucide_react26.AlignCenter,
|
|
9763
|
+
tooltip: "Align Center",
|
|
9764
|
+
command: () => {
|
|
9765
|
+
updateAttributes2({
|
|
9766
|
+
alignment: "center"
|
|
9767
|
+
});
|
|
9768
|
+
},
|
|
9769
|
+
isActive: () => alignment === "center"
|
|
9770
|
+
}
|
|
9771
|
+
),
|
|
9772
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9773
|
+
BubbleMenuButton,
|
|
9774
|
+
{
|
|
9775
|
+
icon: import_lucide_react26.AlignRight,
|
|
9776
|
+
tooltip: "Align Right",
|
|
9777
|
+
command: () => {
|
|
9778
|
+
updateAttributes2({
|
|
9779
|
+
alignment: "right"
|
|
9780
|
+
});
|
|
9781
|
+
},
|
|
9782
|
+
isActive: () => alignment === "right"
|
|
9743
9783
|
}
|
|
9744
9784
|
),
|
|
9745
|
-
/* @__PURE__ */ (0,
|
|
9785
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9746
9786
|
LinkInputPopover,
|
|
9747
9787
|
{
|
|
9748
9788
|
defaultValue: externalLink || "",
|
|
@@ -9758,13 +9798,13 @@ function ButtonView(props) {
|
|
|
9758
9798
|
}
|
|
9759
9799
|
)
|
|
9760
9800
|
] }),
|
|
9761
|
-
/* @__PURE__ */ (0,
|
|
9762
|
-
/* @__PURE__ */ (0,
|
|
9763
|
-
/* @__PURE__ */ (0,
|
|
9801
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Divider, {}),
|
|
9802
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "menu-inline-gap mly:flex mly:gap-x-0.5", children: [
|
|
9803
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9764
9804
|
BackgroundColorPickerPopup,
|
|
9765
9805
|
{
|
|
9766
9806
|
variant,
|
|
9767
|
-
color: buttonColor ||
|
|
9807
|
+
color: buttonColor || DEFAULT_BUTTON_BACKGROUND_COLOR,
|
|
9768
9808
|
onChange: (color) => {
|
|
9769
9809
|
updateAttributes2({
|
|
9770
9810
|
buttonColor: color
|
|
@@ -9772,10 +9812,10 @@ function ButtonView(props) {
|
|
|
9772
9812
|
}
|
|
9773
9813
|
}
|
|
9774
9814
|
),
|
|
9775
|
-
/* @__PURE__ */ (0,
|
|
9815
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9776
9816
|
TextColorPickerPopup,
|
|
9777
9817
|
{
|
|
9778
|
-
color: textColor ||
|
|
9818
|
+
color: textColor || DEFAULT_BUTTON_TEXT_COLOR,
|
|
9779
9819
|
onChange: (color) => {
|
|
9780
9820
|
updateAttributes2({
|
|
9781
9821
|
textColor: color
|
|
@@ -9793,20 +9833,20 @@ function ButtonView(props) {
|
|
|
9793
9833
|
}
|
|
9794
9834
|
function BackgroundColorPickerPopup(props) {
|
|
9795
9835
|
const { color, onChange, variant } = props;
|
|
9796
|
-
return /* @__PURE__ */ (0,
|
|
9836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9797
9837
|
ColorPicker,
|
|
9798
9838
|
{
|
|
9799
9839
|
color,
|
|
9800
9840
|
onColorChange: onChange,
|
|
9801
9841
|
tooltip: "Background Color",
|
|
9802
|
-
children: /* @__PURE__ */ (0,
|
|
9842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9803
9843
|
BaseButton,
|
|
9804
9844
|
{
|
|
9805
9845
|
variant: "ghost",
|
|
9806
9846
|
size: "sm",
|
|
9807
9847
|
type: "button",
|
|
9808
|
-
className: "mly:size-7",
|
|
9809
|
-
children: /* @__PURE__ */ (0,
|
|
9848
|
+
className: "menu-option mly:size-7",
|
|
9849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9810
9850
|
"div",
|
|
9811
9851
|
{
|
|
9812
9852
|
className: "mly:h-4 mly:w-4 mly:shrink-0 mly:rounded-full mly:shadow",
|
|
@@ -9825,16 +9865,16 @@ function BackgroundColorPickerPopup(props) {
|
|
|
9825
9865
|
}
|
|
9826
9866
|
function TextColorPickerPopup(props) {
|
|
9827
9867
|
const { color, onChange } = props;
|
|
9828
|
-
return /* @__PURE__ */ (0,
|
|
9868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorPicker, { color, onColorChange: onChange, tooltip: "Text Color", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9829
9869
|
BaseButton,
|
|
9830
9870
|
{
|
|
9831
9871
|
variant: "ghost",
|
|
9832
9872
|
size: "sm",
|
|
9833
9873
|
type: "button",
|
|
9834
|
-
className: "mly:size-7",
|
|
9835
|
-
children: /* @__PURE__ */ (0,
|
|
9836
|
-
/* @__PURE__ */ (0,
|
|
9837
|
-
/* @__PURE__ */ (0,
|
|
9874
|
+
className: "menu-option mly:size-7",
|
|
9875
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "mly:flex mly:flex-col mly:items-center mly:justify-center mly:gap-px", children: [
|
|
9876
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "mly:font-bolder mly:font-mono mly:text-xs mly:text-midnight-gray", children: "A" }),
|
|
9877
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9838
9878
|
"div",
|
|
9839
9879
|
{
|
|
9840
9880
|
className: "mly:h-[2px] mly:w-3 mly:shrink-0 mly:rounded-md mly:shadow",
|
|
@@ -9850,14 +9890,15 @@ function TextColorPickerPopup(props) {
|
|
|
9850
9890
|
var DEFAULT_BUTTON_ALIGNMENT = "left";
|
|
9851
9891
|
var DEFAULT_BUTTON_VARIANT = "filled";
|
|
9852
9892
|
var DEFAULT_BUTTON_BORDER_RADIUS = "smooth";
|
|
9853
|
-
var DEFAULT_BUTTON_BACKGROUND_COLOR =
|
|
9854
|
-
var DEFAULT_BUTTON_TEXT_COLOR =
|
|
9893
|
+
var DEFAULT_BUTTON_BACKGROUND_COLOR = "#000000";
|
|
9894
|
+
var DEFAULT_BUTTON_TEXT_COLOR = "#ffffff";
|
|
9855
9895
|
var DEFAULT_BUTTON_PADDING_TOP = null;
|
|
9856
9896
|
var DEFAULT_BUTTON_PADDING_RIGHT = null;
|
|
9857
9897
|
var DEFAULT_BUTTON_PADDING_BOTTOM = null;
|
|
9858
9898
|
var DEFAULT_BUTTON_PADDING_LEFT = null;
|
|
9859
9899
|
var allowedButtonVariant = ["filled", "outline"];
|
|
9860
9900
|
var allowedButtonBorderRadius = ["sharp", "smooth", "round"];
|
|
9901
|
+
var allowedButtonSize = ["small", "medium", "large"];
|
|
9861
9902
|
var ButtonExtension = import_core14.Node.create({
|
|
9862
9903
|
name: "button",
|
|
9863
9904
|
group: "block",
|
|
@@ -9951,6 +9992,18 @@ var ButtonExtension = import_core14.Node.create({
|
|
|
9951
9992
|
};
|
|
9952
9993
|
}
|
|
9953
9994
|
},
|
|
9995
|
+
size: {
|
|
9996
|
+
default: "medium",
|
|
9997
|
+
parseHTML: (element) => {
|
|
9998
|
+
const value = element.getAttribute("data-size");
|
|
9999
|
+
return allowedButtonSize.includes(value) ? value : "medium";
|
|
10000
|
+
},
|
|
10001
|
+
renderHTML: (attributes) => {
|
|
10002
|
+
return {
|
|
10003
|
+
"data-size": attributes.size
|
|
10004
|
+
};
|
|
10005
|
+
}
|
|
10006
|
+
},
|
|
9954
10007
|
showIfKey: {
|
|
9955
10008
|
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
9956
10009
|
parseHTML: (element) => {
|
|
@@ -9993,7 +10046,10 @@ var ButtonExtension = import_core14.Node.create({
|
|
|
9993
10046
|
setButton: () => ({ commands }) => {
|
|
9994
10047
|
return commands.insertContent({
|
|
9995
10048
|
type: this.name,
|
|
9996
|
-
attrs: {
|
|
10049
|
+
attrs: {
|
|
10050
|
+
buttonColor: DEFAULT_BUTTON_BACKGROUND_COLOR,
|
|
10051
|
+
textColor: DEFAULT_BUTTON_TEXT_COLOR
|
|
10052
|
+
},
|
|
9997
10053
|
content: []
|
|
9998
10054
|
});
|
|
9999
10055
|
},
|
|
@@ -10001,7 +10057,7 @@ var ButtonExtension = import_core14.Node.create({
|
|
|
10001
10057
|
};
|
|
10002
10058
|
},
|
|
10003
10059
|
addNodeView() {
|
|
10004
|
-
return (0,
|
|
10060
|
+
return (0, import_react48.ReactNodeViewRenderer)(ButtonView, {
|
|
10005
10061
|
contentDOMElementTag: "div",
|
|
10006
10062
|
className: "mly:relative"
|
|
10007
10063
|
});
|
|
@@ -10010,7 +10066,7 @@ var ButtonExtension = import_core14.Node.create({
|
|
|
10010
10066
|
|
|
10011
10067
|
// src/editor/nodes/image/image.ts
|
|
10012
10068
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"), 1);
|
|
10013
|
-
var
|
|
10069
|
+
var import_react49 = require("@tiptap/react");
|
|
10014
10070
|
var DEFAULT_IMAGE_BORDER_RADIUS = 0;
|
|
10015
10071
|
var ImageExtension = import_extension_image2.default.extend({
|
|
10016
10072
|
addAttributes() {
|
|
@@ -10148,7 +10204,7 @@ var ImageExtension = import_extension_image2.default.extend({
|
|
|
10148
10204
|
});
|
|
10149
10205
|
},
|
|
10150
10206
|
addNodeView() {
|
|
10151
|
-
return (0,
|
|
10207
|
+
return (0, import_react49.ReactNodeViewRenderer)(ImageView, {
|
|
10152
10208
|
className: "mly:relative"
|
|
10153
10209
|
});
|
|
10154
10210
|
}
|
|
@@ -10157,25 +10213,25 @@ var ImageExtension = import_extension_image2.default.extend({
|
|
|
10157
10213
|
// src/editor/nodes/html/html.tsx
|
|
10158
10214
|
var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"), 1);
|
|
10159
10215
|
var import_state7 = require("@tiptap/pm/state");
|
|
10160
|
-
var
|
|
10216
|
+
var import_react58 = require("@tiptap/react");
|
|
10161
10217
|
var import_xml = __toESM(require("highlight.js/lib/languages/xml"), 1);
|
|
10162
10218
|
var import_lowlight = require("lowlight");
|
|
10163
10219
|
|
|
10164
10220
|
// src/editor/nodes/html/html-view.tsx
|
|
10165
|
-
var
|
|
10166
|
-
var
|
|
10221
|
+
var import_react50 = require("@tiptap/react");
|
|
10222
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
10167
10223
|
function HTMLCodeBlockView(props) {
|
|
10168
10224
|
const { node } = props;
|
|
10169
10225
|
const { language } = node.attrs;
|
|
10170
10226
|
const languageClass = language ? `language-${language}` : "";
|
|
10171
|
-
return /* @__PURE__ */ (0,
|
|
10172
|
-
|
|
10227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10228
|
+
import_react50.NodeViewWrapper,
|
|
10173
10229
|
{
|
|
10174
10230
|
draggable: false,
|
|
10175
10231
|
"data-drag-handle": false,
|
|
10176
10232
|
"data-type": "htmlCodeBlock",
|
|
10177
|
-
children: /* @__PURE__ */ (0,
|
|
10178
|
-
|
|
10233
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("pre", { className: "mly-html-code-pre", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10234
|
+
import_react50.NodeViewContent,
|
|
10179
10235
|
{
|
|
10180
10236
|
as: "code",
|
|
10181
10237
|
className: cn("is-editable", languageClass)
|
|
@@ -10319,24 +10375,24 @@ var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
|
10319
10375
|
|
|
10320
10376
|
// src/editor/nodes/repeat/repeat.ts
|
|
10321
10377
|
var import_core16 = require("@tiptap/core");
|
|
10322
|
-
var
|
|
10378
|
+
var import_react52 = require("@tiptap/react");
|
|
10323
10379
|
|
|
10324
10380
|
// src/editor/nodes/repeat/repeat-view.tsx
|
|
10325
|
-
var
|
|
10326
|
-
var
|
|
10327
|
-
var
|
|
10381
|
+
var import_react51 = require("@tiptap/react");
|
|
10382
|
+
var import_lucide_react27 = require("lucide-react");
|
|
10383
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10328
10384
|
function RepeatView(props) {
|
|
10329
10385
|
const { editor, getPos } = props;
|
|
10330
|
-
return /* @__PURE__ */ (0,
|
|
10331
|
-
|
|
10386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
10387
|
+
import_react51.NodeViewWrapper,
|
|
10332
10388
|
{
|
|
10333
10389
|
"data-type": "repeat",
|
|
10334
10390
|
draggable: editor.isEditable,
|
|
10335
10391
|
"data-drag-handle": editor.isEditable,
|
|
10336
10392
|
className: "mly:relative",
|
|
10337
10393
|
children: [
|
|
10338
|
-
/* @__PURE__ */ (0,
|
|
10339
|
-
/* @__PURE__ */ (0,
|
|
10394
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react51.NodeViewContent, { className: "is-editable" }),
|
|
10395
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
10340
10396
|
"div",
|
|
10341
10397
|
{
|
|
10342
10398
|
role: "button",
|
|
@@ -10347,8 +10403,8 @@ function RepeatView(props) {
|
|
|
10347
10403
|
editor.commands.setNodeSelection(getPos());
|
|
10348
10404
|
},
|
|
10349
10405
|
children: [
|
|
10350
|
-
/* @__PURE__ */ (0,
|
|
10351
|
-
/* @__PURE__ */ (0,
|
|
10406
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react27.Repeat2, { className: "mly:size-3 mly:stroke-[2.5] mly:text-midnight-gray" }),
|
|
10407
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "mly:w-[1.5px] mly:grow mly:rounded-full mly:bg-rose-300" })
|
|
10352
10408
|
]
|
|
10353
10409
|
}
|
|
10354
10410
|
)
|
|
@@ -10432,7 +10488,7 @@ var RepeatExtension = import_core16.Node.create({
|
|
|
10432
10488
|
};
|
|
10433
10489
|
},
|
|
10434
10490
|
addNodeView() {
|
|
10435
|
-
return (0,
|
|
10491
|
+
return (0, import_react52.ReactNodeViewRenderer)(RepeatView, {
|
|
10436
10492
|
contentDOMElementTag: "div",
|
|
10437
10493
|
className: "mly:relative"
|
|
10438
10494
|
});
|
|
@@ -10589,14 +10645,14 @@ var SlashCommandExtension = import_core18.Extension.create({
|
|
|
10589
10645
|
});
|
|
10590
10646
|
|
|
10591
10647
|
// src/editor/extensions/slash-command/slash-command-view.tsx
|
|
10592
|
-
var
|
|
10593
|
-
var
|
|
10648
|
+
var import_react54 = require("@tiptap/react");
|
|
10649
|
+
var import_react55 = require("react");
|
|
10594
10650
|
var import_tippy7 = __toESM(require("tippy.js"), 1);
|
|
10595
10651
|
|
|
10596
10652
|
// src/editor/extensions/slash-command/slash-command-item.tsx
|
|
10597
|
-
var
|
|
10598
|
-
var
|
|
10599
|
-
var
|
|
10653
|
+
var import_lucide_react28 = require("lucide-react");
|
|
10654
|
+
var import_react53 = require("react");
|
|
10655
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10600
10656
|
function SlashCommandItem(props) {
|
|
10601
10657
|
var _a;
|
|
10602
10658
|
const {
|
|
@@ -10611,7 +10667,7 @@ function SlashCommandItem(props) {
|
|
|
10611
10667
|
hoveredItemKey,
|
|
10612
10668
|
onHover
|
|
10613
10669
|
} = props;
|
|
10614
|
-
const [open, setOpen] = (0,
|
|
10670
|
+
const [open, setOpen] = (0, import_react53.useState)(false);
|
|
10615
10671
|
const isActive = groupIndex === selectedGroupIndex && commandIndex === selectedCommandIndex;
|
|
10616
10672
|
const itemKey = `${groupIndex}-${commandIndex}`;
|
|
10617
10673
|
const isHovered = hoveredItemKey === itemKey;
|
|
@@ -10619,19 +10675,19 @@ function SlashCommandItem(props) {
|
|
|
10619
10675
|
const shouldOpenTooltip = !!(item == null ? void 0 : item.preview) && (isHovered || isActive && !hoveredItemKey);
|
|
10620
10676
|
const hasRenderFunction = typeof item.render === "function";
|
|
10621
10677
|
const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
|
|
10622
|
-
let value = /* @__PURE__ */ (0,
|
|
10623
|
-
/* @__PURE__ */ (0,
|
|
10624
|
-
/* @__PURE__ */ (0,
|
|
10625
|
-
/* @__PURE__ */ (0,
|
|
10626
|
-
/* @__PURE__ */ (0,
|
|
10678
|
+
let value = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
10679
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "mly:flex mly:h-6 mly:w-6 mly:shrink-0 mly:items-center mly:justify-center", children: item.icon }),
|
|
10680
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "mly:grow", children: [
|
|
10681
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly:font-medium", children: item.title }),
|
|
10682
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly:text-xs mly:text-gray-400", children: item.description })
|
|
10627
10683
|
] }),
|
|
10628
|
-
isSubCommand2 && /* @__PURE__ */ (0,
|
|
10684
|
+
isSubCommand2 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "mly:block mly:px-1 mly:text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.ChevronRightIcon, { className: "mly:size-3.5 mly:stroke-[2.5]" }) })
|
|
10629
10685
|
] });
|
|
10630
10686
|
if (renderFunctionValue !== null && renderFunctionValue !== true) {
|
|
10631
10687
|
value = renderFunctionValue;
|
|
10632
10688
|
}
|
|
10633
|
-
const openTimerRef = (0,
|
|
10634
|
-
const handleDelayedOpen = (0,
|
|
10689
|
+
const openTimerRef = (0, import_react53.useRef)(0);
|
|
10690
|
+
const handleDelayedOpen = (0, import_react53.useCallback)(() => {
|
|
10635
10691
|
window.clearTimeout(openTimerRef.current);
|
|
10636
10692
|
const delay = 200;
|
|
10637
10693
|
openTimerRef.current = window.setTimeout(() => {
|
|
@@ -10639,7 +10695,7 @@ function SlashCommandItem(props) {
|
|
|
10639
10695
|
openTimerRef.current = 0;
|
|
10640
10696
|
}, delay);
|
|
10641
10697
|
}, [setOpen]);
|
|
10642
|
-
(0,
|
|
10698
|
+
(0, import_react53.useEffect)(() => {
|
|
10643
10699
|
if (shouldOpenTooltip) {
|
|
10644
10700
|
handleDelayedOpen();
|
|
10645
10701
|
} else {
|
|
@@ -10648,7 +10704,7 @@ function SlashCommandItem(props) {
|
|
|
10648
10704
|
setOpen(false);
|
|
10649
10705
|
}
|
|
10650
10706
|
}, [shouldOpenTooltip]);
|
|
10651
|
-
(0,
|
|
10707
|
+
(0, import_react53.useEffect)(() => {
|
|
10652
10708
|
return () => {
|
|
10653
10709
|
if (openTimerRef.current) {
|
|
10654
10710
|
window.clearTimeout(openTimerRef.current);
|
|
@@ -10656,8 +10712,8 @@ function SlashCommandItem(props) {
|
|
|
10656
10712
|
}
|
|
10657
10713
|
};
|
|
10658
10714
|
}, []);
|
|
10659
|
-
return /* @__PURE__ */ (0,
|
|
10660
|
-
/* @__PURE__ */ (0,
|
|
10715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Tooltip, { open, children: [
|
|
10716
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10661
10717
|
"button",
|
|
10662
10718
|
{
|
|
10663
10719
|
className: cn(
|
|
@@ -10672,14 +10728,14 @@ function SlashCommandItem(props) {
|
|
|
10672
10728
|
children: value
|
|
10673
10729
|
}
|
|
10674
10730
|
) }),
|
|
10675
|
-
/* @__PURE__ */ (0,
|
|
10731
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10676
10732
|
TooltipContent,
|
|
10677
10733
|
{
|
|
10678
10734
|
side: "right",
|
|
10679
10735
|
sideOffset: 10,
|
|
10680
10736
|
className: "mly:w-52 mly:rounded-lg mly:border-none mly:p-1 mly:shadow",
|
|
10681
|
-
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0,
|
|
10682
|
-
/* @__PURE__ */ (0,
|
|
10737
|
+
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
10738
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("figure", { className: "mly:relative mly:aspect-[2.5] mly:w-full mly:overflow-hidden mly:rounded-md mly:border mly:border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10683
10739
|
"img",
|
|
10684
10740
|
{
|
|
10685
10741
|
src: item == null ? void 0 : item.preview,
|
|
@@ -10687,7 +10743,7 @@ function SlashCommandItem(props) {
|
|
|
10687
10743
|
className: "mly:absolute mly:inset-0 mly:h-full mly:w-full mly:object-cover"
|
|
10688
10744
|
}
|
|
10689
10745
|
) }),
|
|
10690
|
-
/* @__PURE__ */ (0,
|
|
10746
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly:mt-2 mly:px-0.5 mly:text-gray-500", children: item.description })
|
|
10691
10747
|
] })
|
|
10692
10748
|
}
|
|
10693
10749
|
)
|
|
@@ -10776,16 +10832,16 @@ function processCommand(options) {
|
|
|
10776
10832
|
}
|
|
10777
10833
|
|
|
10778
10834
|
// src/editor/extensions/slash-command/slash-command-view.tsx
|
|
10779
|
-
var
|
|
10780
|
-
var CommandList = (0,
|
|
10835
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
10836
|
+
var CommandList = (0, import_react55.forwardRef)((props, ref) => {
|
|
10781
10837
|
const { items: groups, command, editor, range, query } = props;
|
|
10782
|
-
const [selectedGroupIndex, setSelectedGroupIndex] = (0,
|
|
10783
|
-
const [selectedCommandIndex, setSelectedCommandIndex] = (0,
|
|
10784
|
-
const [hoveredItemKey, setHoveredItemKey] = (0,
|
|
10785
|
-
const prevQuery = (0,
|
|
10786
|
-
const prevSelectedGroupIndex = (0,
|
|
10787
|
-
const prevSelectedCommandIndex = (0,
|
|
10788
|
-
const selectItem = (0,
|
|
10838
|
+
const [selectedGroupIndex, setSelectedGroupIndex] = (0, import_react55.useState)(0);
|
|
10839
|
+
const [selectedCommandIndex, setSelectedCommandIndex] = (0, import_react55.useState)(0);
|
|
10840
|
+
const [hoveredItemKey, setHoveredItemKey] = (0, import_react55.useState)(null);
|
|
10841
|
+
const prevQuery = (0, import_react55.useRef)("");
|
|
10842
|
+
const prevSelectedGroupIndex = (0, import_react55.useRef)(0);
|
|
10843
|
+
const prevSelectedCommandIndex = (0, import_react55.useRef)(0);
|
|
10844
|
+
const selectItem = (0, import_react55.useCallback)(
|
|
10789
10845
|
(groupIndex, commandIndex) => {
|
|
10790
10846
|
const item = groups[groupIndex].commands[commandIndex];
|
|
10791
10847
|
if (!item) {
|
|
@@ -10795,7 +10851,7 @@ var CommandList = (0, import_react53.forwardRef)((props, ref) => {
|
|
|
10795
10851
|
},
|
|
10796
10852
|
[command]
|
|
10797
10853
|
);
|
|
10798
|
-
(0,
|
|
10854
|
+
(0, import_react55.useImperativeHandle)(ref, () => ({
|
|
10799
10855
|
onKeyDown: ({ event }) => {
|
|
10800
10856
|
var _a, _b, _c, _d;
|
|
10801
10857
|
const navigationKeys = [
|
|
@@ -10883,9 +10939,9 @@ var CommandList = (0, import_react53.forwardRef)((props, ref) => {
|
|
|
10883
10939
|
}
|
|
10884
10940
|
}
|
|
10885
10941
|
}));
|
|
10886
|
-
const commandListContainer = (0,
|
|
10887
|
-
const activeCommandRef = (0,
|
|
10888
|
-
(0,
|
|
10942
|
+
const commandListContainer = (0, import_react55.useRef)(null);
|
|
10943
|
+
const activeCommandRef = (0, import_react55.useRef)(null);
|
|
10944
|
+
(0, import_react55.useLayoutEffect)(() => {
|
|
10889
10945
|
const container = commandListContainer == null ? void 0 : commandListContainer.current;
|
|
10890
10946
|
const activeCommandContainer = activeCommandRef == null ? void 0 : activeCommandRef.current;
|
|
10891
10947
|
if (!container || !activeCommandContainer) {
|
|
@@ -10900,11 +10956,11 @@ var CommandList = (0, import_react53.forwardRef)((props, ref) => {
|
|
|
10900
10956
|
commandListContainer,
|
|
10901
10957
|
activeCommandRef
|
|
10902
10958
|
]);
|
|
10903
|
-
(0,
|
|
10959
|
+
(0, import_react55.useEffect)(() => {
|
|
10904
10960
|
setSelectedGroupIndex(0);
|
|
10905
10961
|
setSelectedCommandIndex(0);
|
|
10906
10962
|
}, [groups]);
|
|
10907
|
-
(0,
|
|
10963
|
+
(0, import_react55.useEffect)(() => {
|
|
10908
10964
|
return () => {
|
|
10909
10965
|
prevQuery.current = "";
|
|
10910
10966
|
prevSelectedGroupIndex.current = 0;
|
|
@@ -10914,15 +10970,15 @@ var CommandList = (0, import_react53.forwardRef)((props, ref) => {
|
|
|
10914
10970
|
if (!groups || groups.length === 0) {
|
|
10915
10971
|
return null;
|
|
10916
10972
|
}
|
|
10917
|
-
return /* @__PURE__ */ (0,
|
|
10918
|
-
/* @__PURE__ */ (0,
|
|
10973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mly:z-50 mly:w-72 mly:overflow-hidden mly:rounded-md mly:border mly:border-gray-200 mly:bg-white mly:shadow-md mly:transition-all", children: [
|
|
10974
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10919
10975
|
"div",
|
|
10920
10976
|
{
|
|
10921
10977
|
id: "slash-command",
|
|
10922
10978
|
ref: commandListContainer,
|
|
10923
10979
|
className: "mly:no-scrollbar mly:h-auto mly:max-h-[330px] mly:overflow-y-auto",
|
|
10924
|
-
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0,
|
|
10925
|
-
/* @__PURE__ */ (0,
|
|
10980
|
+
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react55.Fragment, { children: [
|
|
10981
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10926
10982
|
"span",
|
|
10927
10983
|
{
|
|
10928
10984
|
className: cn(
|
|
@@ -10932,9 +10988,9 @@ var CommandList = (0, import_react53.forwardRef)((props, ref) => {
|
|
|
10932
10988
|
children: group.title
|
|
10933
10989
|
}
|
|
10934
10990
|
),
|
|
10935
|
-
/* @__PURE__ */ (0,
|
|
10991
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mly:space-y-0.5 mly:p-1", children: group.commands.map((item, commandIndex) => {
|
|
10936
10992
|
const itemKey = `${groupIndex}-${commandIndex}`;
|
|
10937
|
-
return /* @__PURE__ */ (0,
|
|
10993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10938
10994
|
SlashCommandItem,
|
|
10939
10995
|
{
|
|
10940
10996
|
item,
|
|
@@ -10954,16 +11010,16 @@ var CommandList = (0, import_react53.forwardRef)((props, ref) => {
|
|
|
10954
11010
|
] }, groupIndex))
|
|
10955
11011
|
}
|
|
10956
11012
|
),
|
|
10957
|
-
/* @__PURE__ */ (0,
|
|
10958
|
-
/* @__PURE__ */ (0,
|
|
10959
|
-
/* @__PURE__ */ (0,
|
|
10960
|
-
/* @__PURE__ */ (0,
|
|
11013
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mly:border-t mly:border-gray-200 mly:px-1 mly:py-3 mly:pl-4", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mly:flex mly:items-center", children: [
|
|
11014
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("p", { className: "mly:text-center mly:text-xs mly:text-gray-400", children: [
|
|
11015
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("kbd", { className: "mly:rounded mly:border mly:border-gray-200 mly:p-1 mly:px-2 mly:font-medium", children: "\u2191" }),
|
|
11016
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("kbd", { className: "mly:ml-1 mly:rounded mly:border mly:border-gray-200 mly:p-1 mly:px-2 mly:font-medium", children: "\u2193" }),
|
|
10961
11017
|
" ",
|
|
10962
11018
|
"to navigate"
|
|
10963
11019
|
] }),
|
|
10964
|
-
/* @__PURE__ */ (0,
|
|
10965
|
-
/* @__PURE__ */ (0,
|
|
10966
|
-
/* @__PURE__ */ (0,
|
|
11020
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": "true", className: "mly:select-none mly:px-1", children: "\xB7" }),
|
|
11021
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("p", { className: "mly:text-center mly:text-xs mly:text-gray-400", children: [
|
|
11022
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("kbd", { className: "mly:rounded mly:border mly:border-gray-200 mly:p-1 mly:px-1.5 mly:font-medium", children: "Enter" }),
|
|
10967
11023
|
" ",
|
|
10968
11024
|
"to select"
|
|
10969
11025
|
] })
|
|
@@ -10987,7 +11043,7 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
|
|
|
10987
11043
|
let popup = null;
|
|
10988
11044
|
return {
|
|
10989
11045
|
onStart: (props) => {
|
|
10990
|
-
component = new
|
|
11046
|
+
component = new import_react54.ReactRenderer(CommandList, {
|
|
10991
11047
|
props,
|
|
10992
11048
|
editor: props.editor
|
|
10993
11049
|
});
|
|
@@ -11040,16 +11096,16 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
|
|
|
11040
11096
|
}
|
|
11041
11097
|
|
|
11042
11098
|
// src/editor/nodes/variable/variable-suggestions.tsx
|
|
11043
|
-
var
|
|
11044
|
-
var
|
|
11099
|
+
var import_react56 = require("@tiptap/react");
|
|
11100
|
+
var import_react57 = require("react");
|
|
11045
11101
|
var import_tippy8 = __toESM(require("tippy.js"), 1);
|
|
11046
|
-
var
|
|
11047
|
-
var VariableList = (0,
|
|
11102
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
11103
|
+
var VariableList = (0, import_react57.forwardRef)((props, ref) => {
|
|
11048
11104
|
var _a;
|
|
11049
11105
|
const { items = [], editor } = props;
|
|
11050
|
-
const popoverRef = (0,
|
|
11106
|
+
const popoverRef = (0, import_react57.useRef)(null);
|
|
11051
11107
|
const VariableSuggestionPopoverComponent = (_a = useVariableOptions(editor)) == null ? void 0 : _a.variableSuggestionsPopover;
|
|
11052
|
-
(0,
|
|
11108
|
+
(0, import_react57.useImperativeHandle)(ref, () => ({
|
|
11053
11109
|
onKeyDown: ({ event }) => {
|
|
11054
11110
|
if (!popoverRef.current) {
|
|
11055
11111
|
return false;
|
|
@@ -11072,7 +11128,7 @@ var VariableList = (0, import_react55.forwardRef)((props, ref) => {
|
|
|
11072
11128
|
return false;
|
|
11073
11129
|
}
|
|
11074
11130
|
}));
|
|
11075
|
-
return /* @__PURE__ */ (0,
|
|
11131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11076
11132
|
VariableSuggestionPopoverComponent,
|
|
11077
11133
|
{
|
|
11078
11134
|
items,
|
|
@@ -11107,7 +11163,7 @@ function getVariableSuggestions(char = DEFAULT_VARIABLE_TRIGGER_CHAR) {
|
|
|
11107
11163
|
let popup = null;
|
|
11108
11164
|
return {
|
|
11109
11165
|
onStart: (props) => {
|
|
11110
|
-
component = new
|
|
11166
|
+
component = new import_react56.ReactRenderer(VariableList, {
|
|
11111
11167
|
props,
|
|
11112
11168
|
editor: props.editor
|
|
11113
11169
|
});
|
|
@@ -11181,7 +11237,7 @@ var HTMLCodeBlockExtension = import_extension_code_block_lowlight.default.extend
|
|
|
11181
11237
|
});
|
|
11182
11238
|
},
|
|
11183
11239
|
addNodeView() {
|
|
11184
|
-
return (0,
|
|
11240
|
+
return (0, import_react58.ReactNodeViewRenderer)(HTMLCodeBlockView, {
|
|
11185
11241
|
className: "mly:relative",
|
|
11186
11242
|
attrs: ({ node }) => {
|
|
11187
11243
|
var _a;
|
|
@@ -11256,17 +11312,17 @@ var isCustomNodeSelected = (editor, node) => {
|
|
|
11256
11312
|
};
|
|
11257
11313
|
|
|
11258
11314
|
// src/editor/components/text-menu/text-bubble-menu.tsx
|
|
11259
|
-
var
|
|
11315
|
+
var import_react62 = require("@tiptap/react");
|
|
11260
11316
|
|
|
11261
11317
|
// src/editor/components/text-menu/text-bubble-content.tsx
|
|
11262
|
-
var
|
|
11318
|
+
var import_lucide_react29 = require("lucide-react");
|
|
11263
11319
|
|
|
11264
11320
|
// src/editor/components/text-menu/use-text-menu-state.tsx
|
|
11265
|
-
var
|
|
11321
|
+
var import_react59 = require("@tiptap/react");
|
|
11266
11322
|
var import_fast_deep_equal7 = __toESM(require("fast-deep-equal"), 1);
|
|
11267
11323
|
var DEFAULT_TEXT_COLOR = "#374151";
|
|
11268
11324
|
var useTextMenuState = (editor) => {
|
|
11269
|
-
const states = (0,
|
|
11325
|
+
const states = (0, import_react59.useEditorState)({
|
|
11270
11326
|
editor,
|
|
11271
11327
|
selector: (ctx) => {
|
|
11272
11328
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -11288,7 +11344,7 @@ var useTextMenuState = (editor) => {
|
|
|
11288
11344
|
};
|
|
11289
11345
|
|
|
11290
11346
|
// src/editor/components/text-menu/text-bubble-content.tsx
|
|
11291
|
-
var
|
|
11347
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
11292
11348
|
function TextBubbleContent(props) {
|
|
11293
11349
|
var _a, _b, _c, _d;
|
|
11294
11350
|
const { editor, showListMenu = true } = props;
|
|
@@ -11300,41 +11356,41 @@ function TextBubbleContent(props) {
|
|
|
11300
11356
|
name: "bold",
|
|
11301
11357
|
isActive: () => editor == null ? void 0 : editor.isActive("bold"),
|
|
11302
11358
|
command: () => editor == null ? void 0 : editor.chain().focus().toggleBold().run(),
|
|
11303
|
-
icon:
|
|
11359
|
+
icon: import_lucide_react29.BoldIcon,
|
|
11304
11360
|
tooltip: "Bold"
|
|
11305
11361
|
},
|
|
11306
11362
|
{
|
|
11307
11363
|
name: "italic",
|
|
11308
11364
|
isActive: () => editor == null ? void 0 : editor.isActive("italic"),
|
|
11309
11365
|
command: () => editor == null ? void 0 : editor.chain().focus().toggleItalic().run(),
|
|
11310
|
-
icon:
|
|
11366
|
+
icon: import_lucide_react29.ItalicIcon,
|
|
11311
11367
|
tooltip: "Italic"
|
|
11312
11368
|
},
|
|
11313
11369
|
{
|
|
11314
11370
|
name: "underline",
|
|
11315
11371
|
isActive: () => editor == null ? void 0 : editor.isActive("underline"),
|
|
11316
11372
|
command: () => editor == null ? void 0 : editor.chain().focus().toggleUnderline().run(),
|
|
11317
|
-
icon:
|
|
11373
|
+
icon: import_lucide_react29.UnderlineIcon,
|
|
11318
11374
|
tooltip: "Underline"
|
|
11319
11375
|
},
|
|
11320
11376
|
{
|
|
11321
11377
|
name: "strike",
|
|
11322
11378
|
isActive: () => editor == null ? void 0 : editor.isActive("strike"),
|
|
11323
11379
|
command: () => editor == null ? void 0 : editor.chain().focus().toggleStrike().run(),
|
|
11324
|
-
icon:
|
|
11380
|
+
icon: import_lucide_react29.StrikethroughIcon,
|
|
11325
11381
|
tooltip: "Strikethrough"
|
|
11326
11382
|
},
|
|
11327
11383
|
{
|
|
11328
11384
|
name: "code",
|
|
11329
11385
|
isActive: () => editor == null ? void 0 : editor.isActive("code"),
|
|
11330
11386
|
command: () => editor == null ? void 0 : editor.chain().focus().toggleCode().run(),
|
|
11331
|
-
icon:
|
|
11387
|
+
icon: import_lucide_react29.CodeIcon,
|
|
11332
11388
|
tooltip: "Code"
|
|
11333
11389
|
}
|
|
11334
11390
|
];
|
|
11335
|
-
return /* @__PURE__ */ (0,
|
|
11336
|
-
items.map((item, index) => /* @__PURE__ */ (0,
|
|
11337
|
-
/* @__PURE__ */ (0,
|
|
11391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
11392
|
+
items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(BubbleMenuButton, __spreadValues({}, item), index)),
|
|
11393
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11338
11394
|
AlignmentSwitch,
|
|
11339
11395
|
{
|
|
11340
11396
|
alignment: state.textAlign,
|
|
@@ -11343,21 +11399,21 @@ function TextBubbleContent(props) {
|
|
|
11343
11399
|
}
|
|
11344
11400
|
}
|
|
11345
11401
|
),
|
|
11346
|
-
!state.isListActive && showListMenu && /* @__PURE__ */ (0,
|
|
11347
|
-
/* @__PURE__ */ (0,
|
|
11402
|
+
!state.isListActive && showListMenu && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
11403
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11348
11404
|
BubbleMenuButton,
|
|
11349
11405
|
{
|
|
11350
|
-
icon:
|
|
11406
|
+
icon: import_lucide_react29.List,
|
|
11351
11407
|
command: () => {
|
|
11352
11408
|
editor.chain().focus().toggleBulletList().run();
|
|
11353
11409
|
},
|
|
11354
11410
|
tooltip: "Bullet List"
|
|
11355
11411
|
}
|
|
11356
11412
|
),
|
|
11357
|
-
/* @__PURE__ */ (0,
|
|
11413
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11358
11414
|
BubbleMenuButton,
|
|
11359
11415
|
{
|
|
11360
|
-
icon:
|
|
11416
|
+
icon: import_lucide_react29.ListOrdered,
|
|
11361
11417
|
command: () => {
|
|
11362
11418
|
editor.chain().focus().toggleOrderedList().run();
|
|
11363
11419
|
},
|
|
@@ -11365,7 +11421,7 @@ function TextBubbleContent(props) {
|
|
|
11365
11421
|
}
|
|
11366
11422
|
)
|
|
11367
11423
|
] }),
|
|
11368
|
-
/* @__PURE__ */ (0,
|
|
11424
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11369
11425
|
LinkInputPopover,
|
|
11370
11426
|
{
|
|
11371
11427
|
defaultValue: (_d = state == null ? void 0 : state.linkUrl) != null ? _d : "",
|
|
@@ -11381,8 +11437,8 @@ function TextBubbleContent(props) {
|
|
|
11381
11437
|
isVariable: state.isUrlVariable
|
|
11382
11438
|
}
|
|
11383
11439
|
),
|
|
11384
|
-
/* @__PURE__ */ (0,
|
|
11385
|
-
/* @__PURE__ */ (0,
|
|
11440
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Divider, {}),
|
|
11441
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11386
11442
|
ColorPicker,
|
|
11387
11443
|
{
|
|
11388
11444
|
color: state.currentTextColor,
|
|
@@ -11391,16 +11447,16 @@ function TextBubbleContent(props) {
|
|
|
11391
11447
|
},
|
|
11392
11448
|
tooltip: "Text Color",
|
|
11393
11449
|
suggestedColors,
|
|
11394
|
-
children: /* @__PURE__ */ (0,
|
|
11450
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11395
11451
|
BaseButton,
|
|
11396
11452
|
{
|
|
11397
11453
|
variant: "ghost",
|
|
11398
11454
|
size: "sm",
|
|
11399
11455
|
type: "button",
|
|
11400
|
-
className: "mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",
|
|
11401
|
-
children: /* @__PURE__ */ (0,
|
|
11402
|
-
/* @__PURE__ */ (0,
|
|
11403
|
-
/* @__PURE__ */ (0,
|
|
11456
|
+
className: "menu-option mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",
|
|
11457
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "mly:flex mly:flex-col mly:items-center mly:justify-center mly:gap-px", children: [
|
|
11458
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "mly:font-bolder mly:font-mono mly:text-xs mly:text-slate-700", children: "A" }),
|
|
11459
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11404
11460
|
"div",
|
|
11405
11461
|
{
|
|
11406
11462
|
className: "mly:h-[2px] mly:w-3",
|
|
@@ -11416,33 +11472,33 @@ function TextBubbleContent(props) {
|
|
|
11416
11472
|
}
|
|
11417
11473
|
|
|
11418
11474
|
// src/editor/components/text-menu/turn-into-block.tsx
|
|
11419
|
-
var
|
|
11420
|
-
var
|
|
11421
|
-
var
|
|
11475
|
+
var import_lucide_react30 = require("lucide-react");
|
|
11476
|
+
var import_react60 = require("react");
|
|
11477
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
11422
11478
|
var isOption = (option) => option.type === "option";
|
|
11423
11479
|
var isCategory = (option) => option.type === "category";
|
|
11424
11480
|
function TurnIntoBlock(props) {
|
|
11425
11481
|
const { options } = props;
|
|
11426
|
-
const activeItem = (0,
|
|
11482
|
+
const activeItem = (0, import_react60.useMemo)(
|
|
11427
11483
|
() => options.find((option) => option.type === "option" && option.isActive()),
|
|
11428
11484
|
[options]
|
|
11429
11485
|
);
|
|
11430
|
-
const { icon: ActiveIcon =
|
|
11431
|
-
return /* @__PURE__ */ (0,
|
|
11432
|
-
/* @__PURE__ */ (0,
|
|
11433
|
-
/* @__PURE__ */ (0,
|
|
11486
|
+
const { icon: ActiveIcon = import_lucide_react30.PilcrowIcon } = activeItem || {};
|
|
11487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Popover, { children: [
|
|
11488
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Tooltip, { children: [
|
|
11489
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
11434
11490
|
PopoverTrigger,
|
|
11435
11491
|
{
|
|
11436
11492
|
className: cn(
|
|
11437
|
-
"mly:flex mly:aspect-square mly:h-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"
|
|
11493
|
+
"menu-option mly:flex mly:aspect-square mly:h-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"
|
|
11438
11494
|
),
|
|
11439
11495
|
children: [
|
|
11440
|
-
/* @__PURE__ */ (0,
|
|
11441
|
-
/* @__PURE__ */ (0,
|
|
11496
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ActiveIcon, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
|
|
11497
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react30.ChevronDownIcon, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" })
|
|
11442
11498
|
]
|
|
11443
11499
|
}
|
|
11444
11500
|
) }),
|
|
11445
|
-
/* @__PURE__ */ (0,
|
|
11501
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
11446
11502
|
TooltipContent,
|
|
11447
11503
|
{
|
|
11448
11504
|
sideOffset: 8,
|
|
@@ -11451,34 +11507,37 @@ function TurnIntoBlock(props) {
|
|
|
11451
11507
|
}
|
|
11452
11508
|
)
|
|
11453
11509
|
] }),
|
|
11454
|
-
/* @__PURE__ */ (0,
|
|
11510
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
11455
11511
|
PopoverContent,
|
|
11456
11512
|
{
|
|
11457
11513
|
align: "start",
|
|
11458
11514
|
side: "bottom",
|
|
11459
11515
|
sideOffset: 8,
|
|
11460
|
-
className: "mly:flex mly:w-[160px] mly:flex-col mly:rounded-md mly:p-1",
|
|
11516
|
+
className: "menu-dropdown-surface mly:flex mly:w-[160px] mly:flex-col mly:rounded-md mly:p-1",
|
|
11461
11517
|
children: options.map((option, index) => {
|
|
11462
11518
|
if (isOption(option)) {
|
|
11463
|
-
return /* @__PURE__ */ (0,
|
|
11519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
11464
11520
|
BaseButton,
|
|
11465
11521
|
{
|
|
11466
11522
|
onClick: option.onClick,
|
|
11467
11523
|
variant: "ghost",
|
|
11468
|
-
className:
|
|
11524
|
+
className: cn(
|
|
11525
|
+
"menu-option menu-dropdown-option mly:mb-0.5 mly:h-auto mly:justify-start mly:gap-2 mly:rounded! mly:!px-2.5 mly:py-1 mly:!pl-3.5 mly:text-sm mly:font-normal mly:text-midnight-gray",
|
|
11526
|
+
option.isActive() && "menu-active-option"
|
|
11527
|
+
),
|
|
11469
11528
|
children: [
|
|
11470
|
-
/* @__PURE__ */ (0,
|
|
11529
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(option.icon, { className: "mly:size-[15px] mly:shrink-0" }),
|
|
11471
11530
|
option.label
|
|
11472
11531
|
]
|
|
11473
11532
|
},
|
|
11474
11533
|
option.id
|
|
11475
11534
|
);
|
|
11476
11535
|
} else if (isCategory(option)) {
|
|
11477
|
-
return /* @__PURE__ */ (0,
|
|
11536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
11478
11537
|
"label",
|
|
11479
11538
|
{
|
|
11480
11539
|
className: cn(
|
|
11481
|
-
"mly:!px-2.5 mly:!pl-3.5 mly:text-xs mly:font-medium mly:text-midnight-gray/60",
|
|
11540
|
+
"menu-dropdown-category mly:!px-2.5 mly:!pl-3.5 mly:text-xs mly:font-medium mly:text-midnight-gray/60",
|
|
11482
11541
|
index === 0 ? "mly:mb-2 mly:mt-1" : "mly:my-2"
|
|
11483
11542
|
),
|
|
11484
11543
|
children: option.label
|
|
@@ -11493,10 +11552,10 @@ function TurnIntoBlock(props) {
|
|
|
11493
11552
|
}
|
|
11494
11553
|
|
|
11495
11554
|
// src/editor/components/text-menu/use-turn-into-block-options.tsx
|
|
11496
|
-
var
|
|
11497
|
-
var
|
|
11555
|
+
var import_react61 = require("@tiptap/react");
|
|
11556
|
+
var import_lucide_react31 = require("lucide-react");
|
|
11498
11557
|
function useTurnIntoBlockOptions(editor) {
|
|
11499
|
-
return (0,
|
|
11558
|
+
return (0, import_react61.useEditorState)({
|
|
11500
11559
|
editor,
|
|
11501
11560
|
selector: ({ editor: editor2 }) => [
|
|
11502
11561
|
{
|
|
@@ -11505,7 +11564,7 @@ function useTurnIntoBlockOptions(editor) {
|
|
|
11505
11564
|
id: "hierarchy"
|
|
11506
11565
|
},
|
|
11507
11566
|
{
|
|
11508
|
-
icon:
|
|
11567
|
+
icon: import_lucide_react31.PilcrowIcon,
|
|
11509
11568
|
onClick: () => editor2.chain().focus().liftListItem("listItem").setParagraph().run(),
|
|
11510
11569
|
id: "paragraph",
|
|
11511
11570
|
disabled: () => !editor2.can().setParagraph(),
|
|
@@ -11514,7 +11573,7 @@ function useTurnIntoBlockOptions(editor) {
|
|
|
11514
11573
|
type: "option"
|
|
11515
11574
|
},
|
|
11516
11575
|
{
|
|
11517
|
-
icon:
|
|
11576
|
+
icon: import_lucide_react31.Heading1Icon,
|
|
11518
11577
|
onClick: () => editor2.chain().focus().liftListItem("listItem").setHeading({ level: 1 }).run(),
|
|
11519
11578
|
id: "heading1",
|
|
11520
11579
|
disabled: () => !editor2.can().setHeading({ level: 1 }),
|
|
@@ -11523,7 +11582,7 @@ function useTurnIntoBlockOptions(editor) {
|
|
|
11523
11582
|
type: "option"
|
|
11524
11583
|
},
|
|
11525
11584
|
{
|
|
11526
|
-
icon:
|
|
11585
|
+
icon: import_lucide_react31.Heading2Icon,
|
|
11527
11586
|
onClick: () => editor2.chain().focus().liftListItem("listItem").setHeading({ level: 2 }).run(),
|
|
11528
11587
|
id: "heading2",
|
|
11529
11588
|
disabled: () => !editor2.can().setHeading({ level: 2 }),
|
|
@@ -11532,7 +11591,7 @@ function useTurnIntoBlockOptions(editor) {
|
|
|
11532
11591
|
type: "option"
|
|
11533
11592
|
},
|
|
11534
11593
|
{
|
|
11535
|
-
icon:
|
|
11594
|
+
icon: import_lucide_react31.Heading3Icon,
|
|
11536
11595
|
onClick: () => editor2.chain().focus().liftListItem("listItem").setHeading({ level: 3 }).run(),
|
|
11537
11596
|
id: "heading3",
|
|
11538
11597
|
disabled: () => !editor2.can().setHeading({ level: 3 }),
|
|
@@ -11546,7 +11605,7 @@ function useTurnIntoBlockOptions(editor) {
|
|
|
11546
11605
|
id: "lists"
|
|
11547
11606
|
},
|
|
11548
11607
|
{
|
|
11549
|
-
icon:
|
|
11608
|
+
icon: import_lucide_react31.ListIcon,
|
|
11550
11609
|
onClick: () => editor2.chain().focus().toggleBulletList().run(),
|
|
11551
11610
|
id: "bulletList",
|
|
11552
11611
|
disabled: () => !editor2.can().toggleBulletList(),
|
|
@@ -11555,7 +11614,7 @@ function useTurnIntoBlockOptions(editor) {
|
|
|
11555
11614
|
type: "option"
|
|
11556
11615
|
},
|
|
11557
11616
|
{
|
|
11558
|
-
icon:
|
|
11617
|
+
icon: import_lucide_react31.ListOrderedIcon,
|
|
11559
11618
|
onClick: () => editor2.chain().focus().toggleOrderedList().run(),
|
|
11560
11619
|
id: "orderedList",
|
|
11561
11620
|
disabled: () => !editor2.can().toggleOrderedList(),
|
|
@@ -11568,7 +11627,7 @@ function useTurnIntoBlockOptions(editor) {
|
|
|
11568
11627
|
}
|
|
11569
11628
|
|
|
11570
11629
|
// src/editor/components/text-menu/text-bubble-menu.tsx
|
|
11571
|
-
var
|
|
11630
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
11572
11631
|
function TextBubbleMenu(props) {
|
|
11573
11632
|
const { editor, appendTo } = props;
|
|
11574
11633
|
if (!editor) {
|
|
@@ -11619,23 +11678,23 @@ function TextBubbleMenu(props) {
|
|
|
11619
11678
|
}
|
|
11620
11679
|
});
|
|
11621
11680
|
const turnIntoBlockOptions = useTurnIntoBlockOptions(editor);
|
|
11622
|
-
return /* @__PURE__ */ (0,
|
|
11623
|
-
|
|
11681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
11682
|
+
import_react62.BubbleMenu,
|
|
11624
11683
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
11625
|
-
className: "mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
11626
|
-
children: /* @__PURE__ */ (0,
|
|
11627
|
-
/* @__PURE__ */ (0,
|
|
11628
|
-
/* @__PURE__ */ (0,
|
|
11629
|
-
/* @__PURE__ */ (0,
|
|
11684
|
+
className: "menu-surface mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-gray-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
11685
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(TooltipProvider, { children: [
|
|
11686
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TurnIntoBlock, { options: turnIntoBlockOptions }),
|
|
11687
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Divider, { className: "mly:mx-0" }),
|
|
11688
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TextBubbleContent, { editor })
|
|
11630
11689
|
] })
|
|
11631
11690
|
})
|
|
11632
11691
|
);
|
|
11633
11692
|
}
|
|
11634
11693
|
|
|
11635
11694
|
// src/editor/components/variable-menu/variable-bubble-menu.tsx
|
|
11636
|
-
var
|
|
11695
|
+
var import_react63 = require("@tiptap/react");
|
|
11637
11696
|
var import_tippy9 = require("tippy.js");
|
|
11638
|
-
var
|
|
11697
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
11639
11698
|
function VariableBubbleMenu(props) {
|
|
11640
11699
|
const { editor, appendTo } = props;
|
|
11641
11700
|
if (!editor) {
|
|
@@ -11658,11 +11717,11 @@ function VariableBubbleMenu(props) {
|
|
|
11658
11717
|
placement: "top-start"
|
|
11659
11718
|
}
|
|
11660
11719
|
});
|
|
11661
|
-
return /* @__PURE__ */ (0,
|
|
11662
|
-
|
|
11720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
11721
|
+
import_react63.BubbleMenu,
|
|
11663
11722
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
11664
11723
|
className: "mly:flex mly:gap-0.5 mly:rounded-lg mly:border mly:border-slate-200 mly:bg-white mly:p-0.5 mly:shadow-md",
|
|
11665
|
-
children: /* @__PURE__ */ (0,
|
|
11724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TextBubbleContent, { showListMenu: false, editor }) })
|
|
11666
11725
|
})
|
|
11667
11726
|
);
|
|
11668
11727
|
}
|
|
@@ -11748,7 +11807,7 @@ function replaceDeprecatedNode(json) {
|
|
|
11748
11807
|
}
|
|
11749
11808
|
|
|
11750
11809
|
// src/editor/index.tsx
|
|
11751
|
-
var
|
|
11810
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
11752
11811
|
function Editor12(props) {
|
|
11753
11812
|
const {
|
|
11754
11813
|
config: {
|
|
@@ -11772,7 +11831,7 @@ function Editor12(props) {
|
|
|
11772
11831
|
scrollThreshold = 40,
|
|
11773
11832
|
scrollMargin = 40
|
|
11774
11833
|
} = props;
|
|
11775
|
-
const formattedContent = (0,
|
|
11834
|
+
const formattedContent = (0, import_react65.useMemo)(() => {
|
|
11776
11835
|
if (contentJson) {
|
|
11777
11836
|
const json = (contentJson == null ? void 0 : contentJson.type) === "doc" ? contentJson : {
|
|
11778
11837
|
type: "doc",
|
|
@@ -11793,8 +11852,8 @@ function Editor12(props) {
|
|
|
11793
11852
|
};
|
|
11794
11853
|
}
|
|
11795
11854
|
}, [contentHtml, contentJson, replaceDeprecatedNode]);
|
|
11796
|
-
const menuContainerRef = (0,
|
|
11797
|
-
const editor = (0,
|
|
11855
|
+
const menuContainerRef = (0, import_react65.useRef)(null);
|
|
11856
|
+
const editor = (0, import_react64.useEditor)({
|
|
11798
11857
|
editorProps: {
|
|
11799
11858
|
scrollThreshold,
|
|
11800
11859
|
scrollMargin,
|
|
@@ -11821,7 +11880,7 @@ function Editor12(props) {
|
|
|
11821
11880
|
if (!editor) {
|
|
11822
11881
|
return null;
|
|
11823
11882
|
}
|
|
11824
|
-
return /* @__PURE__ */ (0,
|
|
11883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(MailyProvider, { placeholderUrl, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
11825
11884
|
"div",
|
|
11826
11885
|
{
|
|
11827
11886
|
id: "mly-editor",
|
|
@@ -11832,8 +11891,8 @@ function Editor12(props) {
|
|
|
11832
11891
|
),
|
|
11833
11892
|
ref: menuContainerRef,
|
|
11834
11893
|
children: [
|
|
11835
|
-
hasMenuBar && /* @__PURE__ */ (0,
|
|
11836
|
-
/* @__PURE__ */ (0,
|
|
11894
|
+
hasMenuBar && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(EditorMenuBar, { config: props.config, editor }),
|
|
11895
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
11837
11896
|
"div",
|
|
11838
11897
|
{
|
|
11839
11898
|
className: cn(
|
|
@@ -11841,16 +11900,17 @@ function Editor12(props) {
|
|
|
11841
11900
|
bodyClassName
|
|
11842
11901
|
),
|
|
11843
11902
|
children: [
|
|
11844
|
-
/* @__PURE__ */ (0,
|
|
11845
|
-
/* @__PURE__ */ (0,
|
|
11846
|
-
/* @__PURE__ */ (0,
|
|
11847
|
-
/* @__PURE__ */ (0,
|
|
11848
|
-
/* @__PURE__ */ (0,
|
|
11849
|
-
/* @__PURE__ */ (0,
|
|
11850
|
-
|
|
11851
|
-
/* @__PURE__ */ (0,
|
|
11852
|
-
/* @__PURE__ */ (0,
|
|
11853
|
-
/* @__PURE__ */ (0,
|
|
11903
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TextBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
11904
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ImageBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
11905
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SpacerBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
11906
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DividerBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
11907
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react64.EditorContent, { editor }),
|
|
11908
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
11909
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
11910
|
+
!hideContextMenu && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ContentMenu, { editor }),
|
|
11911
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(VariableBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
11912
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(RepeatBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
11913
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(InlineImageBubbleMenu, { editor, appendTo: menuContainerRef })
|
|
11854
11914
|
]
|
|
11855
11915
|
}
|
|
11856
11916
|
)
|