@react-email/editor 0.0.0-experimental.42 → 0.0.0-experimental.44
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/core/index.cjs +4 -3
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +3 -3
- package/dist/{create-paste-handler-CGR738bC.d.mts → create-paste-handler-DsJYKisA.d.mts} +1 -1
- package/dist/{create-paste-handler-CGR738bC.d.mts.map → create-paste-handler-DsJYKisA.d.mts.map} +1 -1
- package/dist/{event-bus-CHEzOS_O.mjs → event-bus-BFzKTuhV.mjs} +34 -3
- package/dist/event-bus-BFzKTuhV.mjs.map +1 -0
- package/dist/{event-bus-fb8U7hrl.cjs → event-bus-D-uahiao.cjs} +58 -3
- package/dist/{extension-BZsTEb_s.mjs → extension-B_ImOuII.mjs} +298 -11
- package/dist/extension-B_ImOuII.mjs.map +1 -0
- package/dist/{extension-D23sh0Nj.cjs → extension-DHsEsAaO.cjs} +298 -35
- package/dist/extensions/index.cjs +3 -3
- package/dist/extensions/index.d.cts +3 -1
- package/dist/extensions/index.d.cts.map +1 -1
- package/dist/extensions/index.d.mts +4 -2
- package/dist/extensions/index.d.mts.map +1 -1
- package/dist/extensions/index.mjs +3 -3
- package/dist/{extensions-D-VkzZTa.mjs → extensions-CLBkYvzM.mjs} +76 -45
- package/dist/extensions-CLBkYvzM.mjs.map +1 -0
- package/dist/{extensions-wGY7l1wH.cjs → extensions-ZVX3PUnH.cjs} +83 -52
- package/dist/{styles-C-cCyJCn.cjs → global-content-6jVh6L0b.mjs} +87 -17
- package/dist/global-content-6jVh6L0b.mjs.map +1 -0
- package/dist/{styles-_TMw3YxC.mjs → global-content-D3TNgSN6.cjs} +130 -2
- package/dist/{index-CxX7W63O.d.mts → index-BL2rehV8.d.mts} +68 -4
- package/dist/index-BL2rehV8.d.mts.map +1 -0
- package/dist/{index-C4KcMQ0R.d.cts → index-DJgMqa5C.d.cts} +67 -3
- package/dist/index-DJgMqa5C.d.cts.map +1 -0
- package/dist/index.cjs +5 -10
- package/dist/index.css +339 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -13
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/index.cjs +1 -5
- package/dist/plugins/index.d.cts +5 -123
- package/dist/plugins/index.d.cts.map +1 -1
- package/dist/plugins/index.d.mts +5 -123
- package/dist/plugins/index.d.mts.map +1 -1
- package/dist/plugins/index.mjs +2 -2
- package/dist/{root-Jq1R3tkX.cjs → root-CEAehvsX.cjs} +75 -88
- package/dist/{root-pS4l8bVZ.mjs → root-CJuwiIRn.mjs} +83 -84
- package/dist/root-CJuwiIRn.mjs.map +1 -0
- package/dist/{set-text-alignment-OA8IMWmO.mjs → set-text-alignment-GMXOPMlJ.mjs} +1 -1
- package/dist/{set-text-alignment-OA8IMWmO.mjs.map → set-text-alignment-GMXOPMlJ.mjs.map} +1 -1
- package/dist/types-BNEbRz-a.d.cts +47 -0
- package/dist/types-BNEbRz-a.d.cts.map +1 -0
- package/dist/types-C8k-blF7.d.mts +47 -0
- package/dist/types-C8k-blF7.d.mts.map +1 -0
- package/dist/ui/index.cjs +2970 -20
- package/dist/ui/index.d.cts +472 -160
- package/dist/ui/index.d.cts.map +1 -1
- package/dist/ui/index.d.mts +514 -202
- package/dist/ui/index.d.mts.map +1 -1
- package/dist/ui/index.mjs +2929 -3
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/inspector/inspector.css +338 -0
- package/dist/ui/themes/default.css +339 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +6 -4
- package/readme.md +69 -0
- package/dist/event-bus-CHEzOS_O.mjs.map +0 -1
- package/dist/extension-BZsTEb_s.mjs.map +0 -1
- package/dist/extensions-D-VkzZTa.mjs.map +0 -1
- package/dist/global-content-D_WYaFgX.mjs +0 -78
- package/dist/global-content-D_WYaFgX.mjs.map +0 -1
- package/dist/global-content-bJgotqmA.cjs +0 -89
- package/dist/index-C4KcMQ0R.d.cts.map +0 -1
- package/dist/index-CxX7W63O.d.mts.map +0 -1
- package/dist/root-pS4l8bVZ.mjs.map +0 -1
- package/dist/styles-_TMw3YxC.mjs.map +0 -1
- /package/dist/{set-text-alignment-Cv72txmv.cjs → set-text-alignment-aNb7Ml9N.cjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as setTextAlignment } from "./set-text-alignment-
|
|
1
|
+
import { l as getColumnsDepth, o as MAX_COLUMNS_DEPTH, t as editorEventBus } from "./event-bus-BFzKTuhV.mjs";
|
|
2
|
+
import { t as setTextAlignment } from "./set-text-alignment-GMXOPMlJ.mjs";
|
|
3
3
|
import { useCurrentEditor, useEditorState } from "@tiptap/react";
|
|
4
|
-
import * as React from "react";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
5
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { PluginKey } from "@tiptap/pm/state";
|
|
@@ -123,7 +123,7 @@ function CaseUpperIcon({ size, width, height, ...props }) {
|
|
|
123
123
|
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/ui/icons/check.tsx
|
|
126
|
-
function
|
|
126
|
+
function CheckIcon({ size, width, height, ...props }) {
|
|
127
127
|
return /* @__PURE__ */ jsx("svg", {
|
|
128
128
|
xmlns: "http://www.w3.org/2000/svg",
|
|
129
129
|
width: size ?? width ?? 24,
|
|
@@ -142,7 +142,7 @@ function Check({ size, width, height, ...props }) {
|
|
|
142
142
|
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region src/ui/icons/chevron-down.tsx
|
|
145
|
-
function
|
|
145
|
+
function ChevronDownIcon({ size, width, height, ...props }) {
|
|
146
146
|
return /* @__PURE__ */ jsx("svg", {
|
|
147
147
|
xmlns: "http://www.w3.org/2000/svg",
|
|
148
148
|
width: size ?? width ?? 24,
|
|
@@ -177,11 +177,10 @@ function CodeIcon({ size, width, height, ...props }) {
|
|
|
177
177
|
children: [/* @__PURE__ */ jsx("path", { d: "m16 18 6-6-6-6" }), /* @__PURE__ */ jsx("path", { d: "m8 6-6 6 6 6" })]
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
-
const Code = CodeIcon;
|
|
181
180
|
|
|
182
181
|
//#endregion
|
|
183
182
|
//#region src/ui/icons/columns-2.tsx
|
|
184
|
-
function
|
|
183
|
+
function Columns2Icon({ size, width, height, ...props }) {
|
|
185
184
|
return /* @__PURE__ */ jsxs("svg", {
|
|
186
185
|
xmlns: "http://www.w3.org/2000/svg",
|
|
187
186
|
width: size ?? width ?? 24,
|
|
@@ -206,7 +205,7 @@ function Columns2({ size, width, height, ...props }) {
|
|
|
206
205
|
|
|
207
206
|
//#endregion
|
|
208
207
|
//#region src/ui/icons/columns-3.tsx
|
|
209
|
-
function
|
|
208
|
+
function Columns3Icon({ size, width, height, ...props }) {
|
|
210
209
|
return /* @__PURE__ */ jsxs("svg", {
|
|
211
210
|
xmlns: "http://www.w3.org/2000/svg",
|
|
212
211
|
width: size ?? width ?? 24,
|
|
@@ -235,7 +234,7 @@ function Columns3({ size, width, height, ...props }) {
|
|
|
235
234
|
|
|
236
235
|
//#endregion
|
|
237
236
|
//#region src/ui/icons/columns-4.tsx
|
|
238
|
-
function
|
|
237
|
+
function Columns4Icon({ size, width, height, ...props }) {
|
|
239
238
|
return /* @__PURE__ */ jsxs("svg", {
|
|
240
239
|
xmlns: "http://www.w3.org/2000/svg",
|
|
241
240
|
width: size ?? width ?? 24,
|
|
@@ -288,7 +287,7 @@ function ExternalLinkIcon({ size, width, height, ...props }) {
|
|
|
288
287
|
|
|
289
288
|
//#endregion
|
|
290
289
|
//#region src/ui/icons/heading-1.tsx
|
|
291
|
-
function
|
|
290
|
+
function Heading1Icon({ size, width, height, ...props }) {
|
|
292
291
|
return /* @__PURE__ */ jsxs("svg", {
|
|
293
292
|
xmlns: "http://www.w3.org/2000/svg",
|
|
294
293
|
width: size ?? width ?? 24,
|
|
@@ -312,7 +311,7 @@ function Heading1({ size, width, height, ...props }) {
|
|
|
312
311
|
|
|
313
312
|
//#endregion
|
|
314
313
|
//#region src/ui/icons/heading-2.tsx
|
|
315
|
-
function
|
|
314
|
+
function Heading2Icon({ size, width, height, ...props }) {
|
|
316
315
|
return /* @__PURE__ */ jsxs("svg", {
|
|
317
316
|
xmlns: "http://www.w3.org/2000/svg",
|
|
318
317
|
width: size ?? width ?? 24,
|
|
@@ -336,7 +335,7 @@ function Heading2({ size, width, height, ...props }) {
|
|
|
336
335
|
|
|
337
336
|
//#endregion
|
|
338
337
|
//#region src/ui/icons/heading-3.tsx
|
|
339
|
-
function
|
|
338
|
+
function Heading3Icon({ size, width, height, ...props }) {
|
|
340
339
|
return /* @__PURE__ */ jsxs("svg", {
|
|
341
340
|
xmlns: "http://www.w3.org/2000/svg",
|
|
342
341
|
width: size ?? width ?? 24,
|
|
@@ -418,7 +417,7 @@ function LinkIcon({ size, width, height, ...props }) {
|
|
|
418
417
|
|
|
419
418
|
//#endregion
|
|
420
419
|
//#region src/ui/icons/list.tsx
|
|
421
|
-
function
|
|
420
|
+
function ListIcon({ size, width, height, ...props }) {
|
|
422
421
|
return /* @__PURE__ */ jsxs("svg", {
|
|
423
422
|
xmlns: "http://www.w3.org/2000/svg",
|
|
424
423
|
width: size ?? width ?? 24,
|
|
@@ -444,7 +443,7 @@ function List({ size, width, height, ...props }) {
|
|
|
444
443
|
|
|
445
444
|
//#endregion
|
|
446
445
|
//#region src/ui/icons/list-ordered.tsx
|
|
447
|
-
function
|
|
446
|
+
function ListOrderedIcon({ size, width, height, ...props }) {
|
|
448
447
|
return /* @__PURE__ */ jsxs("svg", {
|
|
449
448
|
xmlns: "http://www.w3.org/2000/svg",
|
|
450
449
|
width: size ?? width ?? 24,
|
|
@@ -470,7 +469,7 @@ function ListOrdered({ size, width, height, ...props }) {
|
|
|
470
469
|
|
|
471
470
|
//#endregion
|
|
472
471
|
//#region src/ui/icons/mouse-pointer.tsx
|
|
473
|
-
function
|
|
472
|
+
function MousePointerIcon({ size, width, height, ...props }) {
|
|
474
473
|
return /* @__PURE__ */ jsxs("svg", {
|
|
475
474
|
xmlns: "http://www.w3.org/2000/svg",
|
|
476
475
|
width: size ?? width ?? 24,
|
|
@@ -508,7 +507,7 @@ function PencilIcon({ size, width, height, ...props }) {
|
|
|
508
507
|
|
|
509
508
|
//#endregion
|
|
510
509
|
//#region src/ui/icons/rows-2.tsx
|
|
511
|
-
function
|
|
510
|
+
function Rows2Icon({ size, width, height, ...props }) {
|
|
512
511
|
return /* @__PURE__ */ jsxs("svg", {
|
|
513
512
|
xmlns: "http://www.w3.org/2000/svg",
|
|
514
513
|
width: size ?? width ?? 24,
|
|
@@ -533,7 +532,7 @@ function Rows2({ size, width, height, ...props }) {
|
|
|
533
532
|
|
|
534
533
|
//#endregion
|
|
535
534
|
//#region src/ui/icons/split-square-vertical.tsx
|
|
536
|
-
function
|
|
535
|
+
function SplitSquareVerticalIcon({ size, width, height, ...props }) {
|
|
537
536
|
return /* @__PURE__ */ jsxs("svg", {
|
|
538
537
|
xmlns: "http://www.w3.org/2000/svg",
|
|
539
538
|
width: size ?? width ?? 24,
|
|
@@ -561,7 +560,7 @@ function SplitSquareVertical({ size, width, height, ...props }) {
|
|
|
561
560
|
|
|
562
561
|
//#endregion
|
|
563
562
|
//#region src/ui/icons/square-code.tsx
|
|
564
|
-
function
|
|
563
|
+
function SquareCodeIcon({ size, width, height, ...props }) {
|
|
565
564
|
return /* @__PURE__ */ jsxs("svg", {
|
|
566
565
|
xmlns: "http://www.w3.org/2000/svg",
|
|
567
566
|
width: size ?? width ?? 24,
|
|
@@ -638,11 +637,10 @@ function TextIcon({ size, width, height, ...props }) {
|
|
|
638
637
|
]
|
|
639
638
|
});
|
|
640
639
|
}
|
|
641
|
-
const Text = TextIcon;
|
|
642
640
|
|
|
643
641
|
//#endregion
|
|
644
642
|
//#region src/ui/icons/text-quote.tsx
|
|
645
|
-
function
|
|
643
|
+
function TextQuoteIcon({ size, width, height, ...props }) {
|
|
646
644
|
return /* @__PURE__ */ jsxs("svg", {
|
|
647
645
|
xmlns: "http://www.w3.org/2000/svg",
|
|
648
646
|
width: size ?? width ?? 24,
|
|
@@ -736,9 +734,9 @@ function UnlinkIcon({ size, width, height, ...props }) {
|
|
|
736
734
|
|
|
737
735
|
//#endregion
|
|
738
736
|
//#region src/ui/bubble-menu/context.tsx
|
|
739
|
-
const BubbleMenuContext = React.createContext(null);
|
|
737
|
+
const BubbleMenuContext = React$1.createContext(null);
|
|
740
738
|
function useBubbleMenuContext() {
|
|
741
|
-
const context = React.useContext(BubbleMenuContext);
|
|
739
|
+
const context = React$1.useContext(BubbleMenuContext);
|
|
742
740
|
if (!context) throw new Error("BubbleMenu compound components must be used within <BubbleMenu.Root>");
|
|
743
741
|
return context;
|
|
744
742
|
}
|
|
@@ -816,12 +814,12 @@ function focusEditor(editor) {
|
|
|
816
814
|
//#region src/ui/bubble-menu/button-form.tsx
|
|
817
815
|
function BubbleMenuButtonForm({ className, validateUrl, onLinkApply, onLinkRemove }) {
|
|
818
816
|
const { editor, isEditing, setIsEditing } = useBubbleMenuContext();
|
|
819
|
-
const inputRef = React.useRef(null);
|
|
820
|
-
const formRef = React.useRef(null);
|
|
817
|
+
const inputRef = React$1.useRef(null);
|
|
818
|
+
const formRef = React$1.useRef(null);
|
|
821
819
|
const buttonHref = editor.getAttributes("button").href ?? "";
|
|
822
820
|
const displayHref = buttonHref === "#" ? "" : buttonHref;
|
|
823
|
-
const [inputValue, setInputValue] = React.useState(displayHref);
|
|
824
|
-
React.useEffect(() => {
|
|
821
|
+
const [inputValue, setInputValue] = React$1.useState(displayHref);
|
|
822
|
+
React$1.useEffect(() => {
|
|
825
823
|
if (!isEditing) return;
|
|
826
824
|
const currentHref = editor.getAttributes("button").href ?? "";
|
|
827
825
|
setInputValue(currentHref === "#" ? "" : currentHref);
|
|
@@ -830,7 +828,7 @@ function BubbleMenuButtonForm({ className, validateUrl, onLinkApply, onLinkRemov
|
|
|
830
828
|
}, 0);
|
|
831
829
|
return () => clearTimeout(timeoutId);
|
|
832
830
|
}, [isEditing, editor]);
|
|
833
|
-
React.useEffect(() => {
|
|
831
|
+
React$1.useEffect(() => {
|
|
834
832
|
if (!isEditing) return;
|
|
835
833
|
const handleKeyDown = (event) => {
|
|
836
834
|
if (event.key === "Escape") setIsEditing(false);
|
|
@@ -911,7 +909,7 @@ function BubbleMenuButtonForm({ className, validateUrl, onLinkApply, onLinkRemov
|
|
|
911
909
|
"aria-label": "Apply link",
|
|
912
910
|
"data-re-btn-bm-apply": "",
|
|
913
911
|
onMouseDown: (e) => e.stopPropagation(),
|
|
914
|
-
children: /* @__PURE__ */ jsx(
|
|
912
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
915
913
|
})]
|
|
916
914
|
});
|
|
917
915
|
}
|
|
@@ -980,7 +978,7 @@ const bubbleMenuTriggers = {
|
|
|
980
978
|
const defaultPluginKey = new PluginKey("bubbleMenu");
|
|
981
979
|
function BubbleMenuRoot({ trigger, pluginKey: pluginKey$1 = defaultPluginKey, hideWhenActiveNodes = [], hideWhenActiveMarks = [], placement = "bottom", offset: offset$1 = 8, onHide, className, children, ...rest }) {
|
|
982
980
|
const { editor } = useCurrentEditor();
|
|
983
|
-
const [isEditing, setIsEditing] = React.useState(false);
|
|
981
|
+
const [isEditing, setIsEditing] = React$1.useState(false);
|
|
984
982
|
const resolvedTrigger = trigger ?? bubbleMenuTriggers.textSelection(hideWhenActiveNodes, hideWhenActiveMarks);
|
|
985
983
|
if (!editor) return null;
|
|
986
984
|
return /* @__PURE__ */ jsx(BubbleMenu, {
|
|
@@ -1177,10 +1175,10 @@ const BubbleMenuItalic = createMarkBubbleItem({
|
|
|
1177
1175
|
//#region src/ui/bubble-menu/link-selector.tsx
|
|
1178
1176
|
function BubbleMenuLinkSelector({ className, showToggle = true, validateUrl, onLinkApply, onLinkRemove, children, open: controlledOpen, onOpenChange }) {
|
|
1179
1177
|
const { editor } = useBubbleMenuContext();
|
|
1180
|
-
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
|
|
1178
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React$1.useState(false);
|
|
1181
1179
|
const isControlled = controlledOpen !== void 0;
|
|
1182
1180
|
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
1183
|
-
const setIsOpen = React.useCallback((value) => {
|
|
1181
|
+
const setIsOpen = React$1.useCallback((value) => {
|
|
1184
1182
|
if (!isControlled) setUncontrolledOpen(value);
|
|
1185
1183
|
onOpenChange?.(value);
|
|
1186
1184
|
}, [isControlled, onOpenChange]);
|
|
@@ -1192,9 +1190,9 @@ function BubbleMenuLinkSelector({ className, showToggle = true, validateUrl, onL
|
|
|
1192
1190
|
currentHref: editor$1?.getAttributes("link").href || ""
|
|
1193
1191
|
})
|
|
1194
1192
|
});
|
|
1195
|
-
const setIsOpenRef = React.useRef(setIsOpen);
|
|
1193
|
+
const setIsOpenRef = React$1.useRef(setIsOpen);
|
|
1196
1194
|
setIsOpenRef.current = setIsOpen;
|
|
1197
|
-
React.useEffect(() => {
|
|
1195
|
+
React$1.useEffect(() => {
|
|
1198
1196
|
const subscription = editorEventBus.on("bubble-menu:add-link", () => {
|
|
1199
1197
|
setIsOpenRef.current(true);
|
|
1200
1198
|
});
|
|
@@ -1233,17 +1231,17 @@ function BubbleMenuLinkSelector({ className, showToggle = true, validateUrl, onL
|
|
|
1233
1231
|
});
|
|
1234
1232
|
}
|
|
1235
1233
|
function LinkForm({ editor, currentHref, validateUrl, onLinkApply, onLinkRemove, setIsOpen, children }) {
|
|
1236
|
-
const inputRef = React.useRef(null);
|
|
1237
|
-
const formRef = React.useRef(null);
|
|
1234
|
+
const inputRef = React$1.useRef(null);
|
|
1235
|
+
const formRef = React$1.useRef(null);
|
|
1238
1236
|
const displayHref = currentHref === "#" ? "" : currentHref;
|
|
1239
|
-
const [inputValue, setInputValue] = React.useState(displayHref);
|
|
1240
|
-
React.useEffect(() => {
|
|
1237
|
+
const [inputValue, setInputValue] = React$1.useState(displayHref);
|
|
1238
|
+
React$1.useEffect(() => {
|
|
1241
1239
|
const timeoutId = setTimeout(() => {
|
|
1242
1240
|
inputRef.current?.focus();
|
|
1243
1241
|
}, 0);
|
|
1244
1242
|
return () => clearTimeout(timeoutId);
|
|
1245
1243
|
}, []);
|
|
1246
|
-
React.useEffect(() => {
|
|
1244
|
+
React$1.useEffect(() => {
|
|
1247
1245
|
const handleKeyDown = (event) => {
|
|
1248
1246
|
if (event.key === "Escape") {
|
|
1249
1247
|
if (editor.getAttributes("link").href === "#") editor.chain().unsetLink().run();
|
|
@@ -1327,7 +1325,7 @@ function LinkForm({ editor, currentHref, validateUrl, onLinkApply, onLinkRemove,
|
|
|
1327
1325
|
"aria-label": "Apply link",
|
|
1328
1326
|
"data-re-link-selector-apply": "",
|
|
1329
1327
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1330
|
-
children: /* @__PURE__ */ jsx(
|
|
1328
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
1331
1329
|
})
|
|
1332
1330
|
]
|
|
1333
1331
|
});
|
|
@@ -1335,18 +1333,18 @@ function LinkForm({ editor, currentHref, validateUrl, onLinkApply, onLinkRemove,
|
|
|
1335
1333
|
|
|
1336
1334
|
//#endregion
|
|
1337
1335
|
//#region src/ui/bubble-menu/node-selector.tsx
|
|
1338
|
-
const NodeSelectorContext = React.createContext(null);
|
|
1336
|
+
const NodeSelectorContext = React$1.createContext(null);
|
|
1339
1337
|
function useNodeSelectorContext() {
|
|
1340
|
-
const context = React.useContext(NodeSelectorContext);
|
|
1338
|
+
const context = React$1.useContext(NodeSelectorContext);
|
|
1341
1339
|
if (!context) throw new Error("NodeSelector compound components must be used within <NodeSelector.Root>");
|
|
1342
1340
|
return context;
|
|
1343
1341
|
}
|
|
1344
1342
|
function NodeSelectorRoot({ omit = [], open: controlledOpen, onOpenChange, className, children }) {
|
|
1345
1343
|
const { editor } = useBubbleMenuContext();
|
|
1346
|
-
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);
|
|
1344
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React$1.useState(false);
|
|
1347
1345
|
const isControlled = controlledOpen !== void 0;
|
|
1348
1346
|
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
1349
|
-
const setIsOpen = React.useCallback((value) => {
|
|
1347
|
+
const setIsOpen = React$1.useCallback((value) => {
|
|
1350
1348
|
if (!isControlled) setUncontrolledOpen(value);
|
|
1351
1349
|
onOpenChange?.(value);
|
|
1352
1350
|
}, [isControlled, onOpenChange]);
|
|
@@ -1363,7 +1361,7 @@ function NodeSelectorRoot({ omit = [], open: controlledOpen, onOpenChange, class
|
|
|
1363
1361
|
isCodeBlockActive: editor$1?.isActive("codeBlock") ?? false
|
|
1364
1362
|
})
|
|
1365
1363
|
});
|
|
1366
|
-
const allItems = React.useMemo(() => [
|
|
1364
|
+
const allItems = React$1.useMemo(() => [
|
|
1367
1365
|
{
|
|
1368
1366
|
name: "Text",
|
|
1369
1367
|
icon: TextIcon,
|
|
@@ -1372,50 +1370,50 @@ function NodeSelectorRoot({ omit = [], open: controlledOpen, onOpenChange, class
|
|
|
1372
1370
|
},
|
|
1373
1371
|
{
|
|
1374
1372
|
name: "Title",
|
|
1375
|
-
icon:
|
|
1373
|
+
icon: Heading1Icon,
|
|
1376
1374
|
command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 1 }).run(),
|
|
1377
1375
|
isActive: editorState?.isHeading1Active ?? false
|
|
1378
1376
|
},
|
|
1379
1377
|
{
|
|
1380
1378
|
name: "Subtitle",
|
|
1381
|
-
icon:
|
|
1379
|
+
icon: Heading2Icon,
|
|
1382
1380
|
command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 2 }).run(),
|
|
1383
1381
|
isActive: editorState?.isHeading2Active ?? false
|
|
1384
1382
|
},
|
|
1385
1383
|
{
|
|
1386
1384
|
name: "Heading",
|
|
1387
|
-
icon:
|
|
1385
|
+
icon: Heading3Icon,
|
|
1388
1386
|
command: () => editor.chain().focus().clearNodes().toggleHeading({ level: 3 }).run(),
|
|
1389
1387
|
isActive: editorState?.isHeading3Active ?? false
|
|
1390
1388
|
},
|
|
1391
1389
|
{
|
|
1392
1390
|
name: "Bullet List",
|
|
1393
|
-
icon:
|
|
1391
|
+
icon: ListIcon,
|
|
1394
1392
|
command: () => editor.chain().focus().clearNodes().toggleBulletList().run(),
|
|
1395
1393
|
isActive: editorState?.isBulletListActive ?? false
|
|
1396
1394
|
},
|
|
1397
1395
|
{
|
|
1398
1396
|
name: "Numbered List",
|
|
1399
|
-
icon:
|
|
1397
|
+
icon: ListOrderedIcon,
|
|
1400
1398
|
command: () => editor.chain().focus().clearNodes().toggleOrderedList().run(),
|
|
1401
1399
|
isActive: editorState?.isOrderedListActive ?? false
|
|
1402
1400
|
},
|
|
1403
1401
|
{
|
|
1404
1402
|
name: "Quote",
|
|
1405
|
-
icon:
|
|
1403
|
+
icon: TextQuoteIcon,
|
|
1406
1404
|
command: () => editor.chain().focus().clearNodes().toggleNode("paragraph", "paragraph").toggleBlockquote().run(),
|
|
1407
1405
|
isActive: editorState?.isBlockquoteActive ?? false
|
|
1408
1406
|
},
|
|
1409
1407
|
{
|
|
1410
1408
|
name: "Code",
|
|
1411
|
-
icon:
|
|
1409
|
+
icon: CodeIcon,
|
|
1412
1410
|
command: () => editor.chain().focus().clearNodes().toggleCodeBlock().run(),
|
|
1413
1411
|
isActive: editorState?.isCodeBlockActive ?? false
|
|
1414
1412
|
}
|
|
1415
1413
|
], [editor, editorState]);
|
|
1416
|
-
const items = React.useMemo(() => allItems.filter((item) => !omit.includes(item.name)), [allItems, omit]);
|
|
1417
|
-
const activeItem = React.useMemo(() => items.find((item) => item.isActive) ?? { name: "Multiple" }, [items]);
|
|
1418
|
-
const contextValue = React.useMemo(() => ({
|
|
1414
|
+
const items = React$1.useMemo(() => allItems.filter((item) => !omit.includes(item.name)), [allItems, omit]);
|
|
1415
|
+
const activeItem = React$1.useMemo(() => items.find((item) => item.isActive) ?? { name: "Multiple" }, [items]);
|
|
1416
|
+
const contextValue = React$1.useMemo(() => ({
|
|
1419
1417
|
items,
|
|
1420
1418
|
activeItem,
|
|
1421
1419
|
isOpen,
|
|
@@ -1447,7 +1445,7 @@ function NodeSelectorTrigger({ className, children }) {
|
|
|
1447
1445
|
"data-re-node-selector-trigger": "",
|
|
1448
1446
|
className,
|
|
1449
1447
|
onClick: () => setIsOpen(!isOpen),
|
|
1450
|
-
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { children: activeItem.name }), /* @__PURE__ */ jsx(
|
|
1448
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { children: activeItem.name }), /* @__PURE__ */ jsx(ChevronDownIcon, {})] })
|
|
1451
1449
|
});
|
|
1452
1450
|
}
|
|
1453
1451
|
function NodeSelectorContent({ className, align = "start", children }) {
|
|
@@ -1469,7 +1467,7 @@ function NodeSelectorContent({ className, align = "start", children }) {
|
|
|
1469
1467
|
children: [
|
|
1470
1468
|
/* @__PURE__ */ jsx(Icon, {}),
|
|
1471
1469
|
/* @__PURE__ */ jsx("span", { children: item.name }),
|
|
1472
|
-
item.isActive && /* @__PURE__ */ jsx(
|
|
1470
|
+
item.isActive && /* @__PURE__ */ jsx(CheckIcon, {})
|
|
1473
1471
|
]
|
|
1474
1472
|
}, item.name);
|
|
1475
1473
|
})
|
|
@@ -1516,18 +1514,18 @@ const BubbleMenuUppercase = createMarkBubbleItem({
|
|
|
1516
1514
|
//#region src/ui/bubble-menu/default.tsx
|
|
1517
1515
|
const textPluginKey = new PluginKey("textBubbleMenu");
|
|
1518
1516
|
function BubbleMenuDefault({ excludeItems = [], hideWhenActiveNodes, hideWhenActiveMarks, placement, offset: offset$1, onHide, className, ...rest }) {
|
|
1519
|
-
const [isNodeSelectorOpen, setIsNodeSelectorOpen] = React.useState(false);
|
|
1520
|
-
const [isLinkSelectorOpen, setIsLinkSelectorOpen] = React.useState(false);
|
|
1517
|
+
const [isNodeSelectorOpen, setIsNodeSelectorOpen] = React$1.useState(false);
|
|
1518
|
+
const [isLinkSelectorOpen, setIsLinkSelectorOpen] = React$1.useState(false);
|
|
1521
1519
|
const has = (item) => !excludeItems.includes(item);
|
|
1522
|
-
const handleNodeSelectorOpenChange = React.useCallback((open) => {
|
|
1520
|
+
const handleNodeSelectorOpenChange = React$1.useCallback((open) => {
|
|
1523
1521
|
setIsNodeSelectorOpen(open);
|
|
1524
1522
|
if (open) setIsLinkSelectorOpen(false);
|
|
1525
1523
|
}, []);
|
|
1526
|
-
const handleLinkSelectorOpenChange = React.useCallback((open) => {
|
|
1524
|
+
const handleLinkSelectorOpenChange = React$1.useCallback((open) => {
|
|
1527
1525
|
setIsLinkSelectorOpen(open);
|
|
1528
1526
|
if (open) setIsNodeSelectorOpen(false);
|
|
1529
1527
|
}, []);
|
|
1530
|
-
const handleHide = React.useCallback(() => {
|
|
1528
|
+
const handleHide = React$1.useCallback(() => {
|
|
1531
1529
|
setIsNodeSelectorOpen(false);
|
|
1532
1530
|
setIsLinkSelectorOpen(false);
|
|
1533
1531
|
onHide?.();
|
|
@@ -1648,15 +1646,15 @@ function BubbleMenuLinkEditLink({ className, children, onClick, onMouseDown, ...
|
|
|
1648
1646
|
//#region src/ui/bubble-menu/link-form.tsx
|
|
1649
1647
|
function BubbleMenuLinkForm({ className, validateUrl, onLinkApply, onLinkRemove, children }) {
|
|
1650
1648
|
const { editor, isEditing, setIsEditing } = useBubbleMenuContext();
|
|
1651
|
-
const inputRef = React.useRef(null);
|
|
1652
|
-
const formRef = React.useRef(null);
|
|
1649
|
+
const inputRef = React$1.useRef(null);
|
|
1650
|
+
const formRef = React$1.useRef(null);
|
|
1653
1651
|
const linkHref = useEditorState({
|
|
1654
1652
|
editor,
|
|
1655
1653
|
selector: ({ editor: e }) => e?.getAttributes("link").href ?? ""
|
|
1656
1654
|
});
|
|
1657
1655
|
const displayHref = (linkHref ?? "") === "#" ? "" : linkHref ?? "";
|
|
1658
|
-
const [inputValue, setInputValue] = React.useState(displayHref);
|
|
1659
|
-
React.useEffect(() => {
|
|
1656
|
+
const [inputValue, setInputValue] = React$1.useState(displayHref);
|
|
1657
|
+
React$1.useEffect(() => {
|
|
1660
1658
|
if (!isEditing) return;
|
|
1661
1659
|
setInputValue(displayHref);
|
|
1662
1660
|
const timeoutId = setTimeout(() => {
|
|
@@ -1664,7 +1662,7 @@ function BubbleMenuLinkForm({ className, validateUrl, onLinkApply, onLinkRemove,
|
|
|
1664
1662
|
}, 0);
|
|
1665
1663
|
return () => clearTimeout(timeoutId);
|
|
1666
1664
|
}, [isEditing, displayHref]);
|
|
1667
|
-
React.useEffect(() => {
|
|
1665
|
+
React$1.useEffect(() => {
|
|
1668
1666
|
if (!isEditing) return;
|
|
1669
1667
|
const handleKeyDown = (event) => {
|
|
1670
1668
|
if (event.key === "Escape") setIsEditing(false);
|
|
@@ -1748,7 +1746,7 @@ function BubbleMenuLinkForm({ className, validateUrl, onLinkApply, onLinkRemove,
|
|
|
1748
1746
|
"aria-label": "Apply link",
|
|
1749
1747
|
"data-re-link-bm-apply": "",
|
|
1750
1748
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1751
|
-
children: /* @__PURE__ */ jsx(
|
|
1749
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
1752
1750
|
})
|
|
1753
1751
|
]
|
|
1754
1752
|
});
|
|
@@ -1943,7 +1941,7 @@ function CommandList({ items, query, selectedIndex, onSelect }) {
|
|
|
1943
1941
|
const TEXT = {
|
|
1944
1942
|
title: "Text",
|
|
1945
1943
|
description: "Plain text block",
|
|
1946
|
-
icon: /* @__PURE__ */ jsx(
|
|
1944
|
+
icon: /* @__PURE__ */ jsx(TextIcon, { size: 20 }),
|
|
1947
1945
|
category: "Text",
|
|
1948
1946
|
searchTerms: ["p", "paragraph"],
|
|
1949
1947
|
command: ({ editor, range }) => {
|
|
@@ -1953,7 +1951,7 @@ const TEXT = {
|
|
|
1953
1951
|
const H1 = {
|
|
1954
1952
|
title: "Title",
|
|
1955
1953
|
description: "Large heading",
|
|
1956
|
-
icon: /* @__PURE__ */ jsx(
|
|
1954
|
+
icon: /* @__PURE__ */ jsx(Heading1Icon, { size: 20 }),
|
|
1957
1955
|
category: "Text",
|
|
1958
1956
|
searchTerms: [
|
|
1959
1957
|
"title",
|
|
@@ -1968,7 +1966,7 @@ const H1 = {
|
|
|
1968
1966
|
const H2 = {
|
|
1969
1967
|
title: "Subtitle",
|
|
1970
1968
|
description: "Medium heading",
|
|
1971
|
-
icon: /* @__PURE__ */ jsx(
|
|
1969
|
+
icon: /* @__PURE__ */ jsx(Heading2Icon, { size: 20 }),
|
|
1972
1970
|
category: "Text",
|
|
1973
1971
|
searchTerms: [
|
|
1974
1972
|
"subtitle",
|
|
@@ -1982,7 +1980,7 @@ const H2 = {
|
|
|
1982
1980
|
const H3 = {
|
|
1983
1981
|
title: "Heading",
|
|
1984
1982
|
description: "Small heading",
|
|
1985
|
-
icon: /* @__PURE__ */ jsx(
|
|
1983
|
+
icon: /* @__PURE__ */ jsx(Heading3Icon, { size: 20 }),
|
|
1986
1984
|
category: "Text",
|
|
1987
1985
|
searchTerms: [
|
|
1988
1986
|
"subtitle",
|
|
@@ -1996,7 +1994,7 @@ const H3 = {
|
|
|
1996
1994
|
const BULLET_LIST = {
|
|
1997
1995
|
title: "Bullet list",
|
|
1998
1996
|
description: "Unordered list",
|
|
1999
|
-
icon: /* @__PURE__ */ jsx(
|
|
1997
|
+
icon: /* @__PURE__ */ jsx(ListIcon, { size: 20 }),
|
|
2000
1998
|
category: "Text",
|
|
2001
1999
|
searchTerms: ["unordered", "point"],
|
|
2002
2000
|
command: ({ editor, range }) => {
|
|
@@ -2006,7 +2004,7 @@ const BULLET_LIST = {
|
|
|
2006
2004
|
const NUMBERED_LIST = {
|
|
2007
2005
|
title: "Numbered list",
|
|
2008
2006
|
description: "Ordered list",
|
|
2009
|
-
icon: /* @__PURE__ */ jsx(
|
|
2007
|
+
icon: /* @__PURE__ */ jsx(ListOrderedIcon, { size: 20 }),
|
|
2010
2008
|
category: "Text",
|
|
2011
2009
|
searchTerms: ["ordered"],
|
|
2012
2010
|
command: ({ editor, range }) => {
|
|
@@ -2016,7 +2014,7 @@ const NUMBERED_LIST = {
|
|
|
2016
2014
|
const QUOTE = {
|
|
2017
2015
|
title: "Quote",
|
|
2018
2016
|
description: "Block quote",
|
|
2019
|
-
icon: /* @__PURE__ */ jsx(
|
|
2017
|
+
icon: /* @__PURE__ */ jsx(TextQuoteIcon, { size: 20 }),
|
|
2020
2018
|
category: "Text",
|
|
2021
2019
|
searchTerms: ["blockquote"],
|
|
2022
2020
|
command: ({ editor, range }) => {
|
|
@@ -2026,7 +2024,7 @@ const QUOTE = {
|
|
|
2026
2024
|
const CODE = {
|
|
2027
2025
|
title: "Code block",
|
|
2028
2026
|
description: "Code snippet",
|
|
2029
|
-
icon: /* @__PURE__ */ jsx(
|
|
2027
|
+
icon: /* @__PURE__ */ jsx(SquareCodeIcon, { size: 20 }),
|
|
2030
2028
|
category: "Text",
|
|
2031
2029
|
searchTerms: ["codeblock"],
|
|
2032
2030
|
command: ({ editor, range }) => {
|
|
@@ -2036,7 +2034,7 @@ const CODE = {
|
|
|
2036
2034
|
const BUTTON = {
|
|
2037
2035
|
title: "Button",
|
|
2038
2036
|
description: "Clickable button",
|
|
2039
|
-
icon: /* @__PURE__ */ jsx(
|
|
2037
|
+
icon: /* @__PURE__ */ jsx(MousePointerIcon, { size: 20 }),
|
|
2040
2038
|
category: "Layout",
|
|
2041
2039
|
searchTerms: ["button"],
|
|
2042
2040
|
command: ({ editor, range }) => {
|
|
@@ -2046,7 +2044,7 @@ const BUTTON = {
|
|
|
2046
2044
|
const DIVIDER = {
|
|
2047
2045
|
title: "Divider",
|
|
2048
2046
|
description: "Horizontal separator",
|
|
2049
|
-
icon: /* @__PURE__ */ jsx(
|
|
2047
|
+
icon: /* @__PURE__ */ jsx(SplitSquareVerticalIcon, { size: 20 }),
|
|
2050
2048
|
category: "Layout",
|
|
2051
2049
|
searchTerms: [
|
|
2052
2050
|
"hr",
|
|
@@ -2060,7 +2058,7 @@ const DIVIDER = {
|
|
|
2060
2058
|
const SECTION = {
|
|
2061
2059
|
title: "Section",
|
|
2062
2060
|
description: "Content section",
|
|
2063
|
-
icon: /* @__PURE__ */ jsx(
|
|
2061
|
+
icon: /* @__PURE__ */ jsx(Rows2Icon, { size: 20 }),
|
|
2064
2062
|
category: "Layout",
|
|
2065
2063
|
searchTerms: [
|
|
2066
2064
|
"section",
|
|
@@ -2074,7 +2072,7 @@ const SECTION = {
|
|
|
2074
2072
|
const TWO_COLUMNS = {
|
|
2075
2073
|
title: "2 columns",
|
|
2076
2074
|
description: "Two column layout",
|
|
2077
|
-
icon: /* @__PURE__ */ jsx(
|
|
2075
|
+
icon: /* @__PURE__ */ jsx(Columns2Icon, { size: 20 }),
|
|
2078
2076
|
category: "Layout",
|
|
2079
2077
|
searchTerms: [
|
|
2080
2078
|
"columns",
|
|
@@ -2095,7 +2093,7 @@ const TWO_COLUMNS = {
|
|
|
2095
2093
|
const THREE_COLUMNS = {
|
|
2096
2094
|
title: "3 columns",
|
|
2097
2095
|
description: "Three column layout",
|
|
2098
|
-
icon: /* @__PURE__ */ jsx(
|
|
2096
|
+
icon: /* @__PURE__ */ jsx(Columns3Icon, { size: 20 }),
|
|
2099
2097
|
category: "Layout",
|
|
2100
2098
|
searchTerms: [
|
|
2101
2099
|
"columns",
|
|
@@ -2115,7 +2113,7 @@ const THREE_COLUMNS = {
|
|
|
2115
2113
|
const FOUR_COLUMNS = {
|
|
2116
2114
|
title: "4 columns",
|
|
2117
2115
|
description: "Four column layout",
|
|
2118
|
-
icon: /* @__PURE__ */ jsx(
|
|
2116
|
+
icon: /* @__PURE__ */ jsx(Columns4Icon, { size: 20 }),
|
|
2119
2117
|
category: "Layout",
|
|
2120
2118
|
searchTerms: [
|
|
2121
2119
|
"columns",
|
|
@@ -2217,7 +2215,8 @@ function SlashCommandRoot({ items: itemsProp, filterItems: filterItemsProp, char
|
|
|
2217
2215
|
});
|
|
2218
2216
|
useEffect(() => {
|
|
2219
2217
|
if (!state.clientRect) return;
|
|
2220
|
-
|
|
2218
|
+
const clientRect = state.clientRect;
|
|
2219
|
+
refs.setReference({ getBoundingClientRect: () => clientRect() });
|
|
2221
2220
|
}, [state.clientRect, refs]);
|
|
2222
2221
|
useEffect(() => {
|
|
2223
2222
|
setSelectedIndex(0);
|
|
@@ -2312,5 +2311,5 @@ function SlashCommandRoot({ items: itemsProp, filterItems: filterItemsProp, char
|
|
|
2312
2311
|
}
|
|
2313
2312
|
|
|
2314
2313
|
//#endregion
|
|
2315
|
-
export { BubbleMenuButtonForm as $, BubbleMenuImageEditLink as A,
|
|
2316
|
-
//# sourceMappingURL=root-
|
|
2314
|
+
export { BubbleMenuButtonForm as $, BubbleMenuImageEditLink as A, AlignCenterIcon as At, BubbleMenuItalic as B, BubbleMenuLinkUnlink as C, CodeIcon as Ct, BubbleMenuLinkEditLink as D, BoldIcon as Dt, BubbleMenuLinkForm as E, CaseUpperIcon as Et, BubbleMenuNodeSelector as F, BubbleMenuAlignLeft as G, BubbleMenuCode as H, NodeSelectorContent as I, BubbleMenuButtonDefault as J, BubbleMenuAlignCenter as K, NodeSelectorRoot as L, BubbleMenuUppercase as M, BubbleMenuUnderline as N, BubbleMenuImageDefault as O, AlignRightIcon as Ot, BubbleMenuStrike as P, BubbleMenuButtonToolbar as Q, NodeSelectorTrigger as R, BubbleMenuLinkDefault as S, Columns2Icon as St, BubbleMenuLinkOpenLink as T, CheckIcon as Tt, BubbleMenuBold as U, BubbleMenuItemGroup as V, BubbleMenuAlignRight as W, bubbleMenuTriggers as X, BubbleMenuRoot as Y, BubbleMenuButtonUnlink as Z, TWO_COLUMNS as _, Heading2Icon as _t, BUTTON as a, TextIcon as at, isAtMaxColumnsDepth as b, Columns4Icon as bt, FOUR_COLUMNS as c, SplitSquareVerticalIcon as ct, H3 as d, MousePointerIcon as dt, BubbleMenuButtonEditLink as et, NUMBERED_LIST as f, ListOrderedIcon as ft, THREE_COLUMNS as g, Heading3Icon as gt, TEXT as h, ItalicIcon as ht, BULLET_LIST as i, TextQuoteIcon as it, BubbleMenuDefault as j, BubbleMenuImageToolbar as k, AlignLeftIcon as kt, H1 as l, Rows2Icon as lt, SECTION as m, LinkIcon as mt, filterAndRankItems as n, UnlinkIcon as nt, CODE as o, StrikethroughIcon as ot, QUOTE as p, ListIcon as pt, BubbleMenuItem as q, scoreItem as r, UnderlineIcon as rt, DIVIDER as s, SquareCodeIcon as st, SlashCommandRoot as t, useBubbleMenuContext as tt, H2 as u, PencilIcon as ut, defaultSlashCommands as v, Heading1Icon as vt, BubbleMenuLinkToolbar as w, ChevronDownIcon as wt, isInsideNode as x, Columns3Icon as xt, CommandList as y, ExternalLinkIcon as yt, BubbleMenuLinkSelector as z };
|
|
2315
|
+
//# sourceMappingURL=root-CJuwiIRn.mjs.map
|