reactjs-tiptap-editor 1.0.20 → 1.0.22
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/lib/{ActionMenuButton-CMXWxvWu.js → ActionMenuButton-B1067mIC.js} +1 -1
- package/lib/{ActionMenuButton-BPgqKDXT.cjs → ActionMenuButton-BBDqKvKg.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +24 -24
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +1 -1
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +1 -1
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +1 -1
- package/lib/Callout-V2mO6s2Y.js +340 -0
- package/lib/Callout-lBlBlK_w.cjs +1 -0
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +8 -222
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +1 -1
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +1 -1
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +2 -2
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +1 -1
- package/lib/{Drawer-BivLAzMN.cjs → Drawer-BeYo9jAG.cjs} +1 -1
- package/lib/{Drawer-BmVmgJsc.js → Drawer-Cyv27orn.js} +19 -19
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +9 -9
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +5 -5
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +4 -4
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +4 -4
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +9 -9
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +2 -2
- package/lib/History.cjs +1 -1
- package/lib/History.js +1 -1
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +1 -1
- package/lib/{Iframe-hwg9FxhU.cjs → Iframe-Bx-VDxSB.cjs} +1 -1
- package/lib/{Iframe-CAUrccA0.js → Iframe-D9JVKzO0.js} +5 -5
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +4 -4
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +36 -36
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +13 -13
- package/lib/{Indent-3MoIatX1.js → Indent-B5tQ5Wfg.js} +1 -1
- package/lib/{Indent-MuSU0kXz.cjs → Indent-CCLO0KpG.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +1 -1
- package/lib/Katex-rtfVV2pl.cjs +4 -0
- package/lib/{Katex-xS-XZKQc.js → Katex-w_c6vAMd.js} +5 -4
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +1 -1
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +3 -3
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-Dhvz7DCA.js → LinkEditBlock-CTlU8YnO.js} +25 -25
- package/lib/{LinkEditBlock-DLDY-8Ax.cjs → LinkEditBlock-_41zgSyl.cjs} +1 -1
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +44 -43
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +4 -4
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +1 -1
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +7 -7
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +3 -3
- package/lib/{SlashCommandNodeView-CavaOSwo.cjs → SlashCommandNodeView-CVKjpS6r.cjs} +1 -1
- package/lib/{SlashCommandNodeView-RnDRm4Z1.js → SlashCommandNodeView-DNkpJuM3.js} +6 -6
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-m32ZhtxF.cjs → Table-BFiU40iW.cjs} +1 -1
- package/lib/{Table-DN4TuDz1.js → Table-yZtD5Qo1.js} +3 -3
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +1 -1
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +2 -2
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +1 -1
- package/lib/{Twitter-CJhQLKYS.cjs → Twitter-BJjt8vv_.cjs} +1 -1
- package/lib/{Twitter-B2FDarxE.js → Twitter-CKm0M53B.js} +7 -7
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +4 -4
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +678 -643
- package/lib/{dropdown-menu-CWd8VVRO.js → dropdown-menu-AhMKS9PQ.js} +1 -1
- package/lib/{dropdown-menu-C0VlKIZC.cjs → dropdown-menu-Dre693DD.cjs} +1 -1
- package/lib/index-83hp1lZH.cjs +1 -0
- package/lib/{index-B2a7NqnN.js → index-BfHAqkoX.js} +1020 -1149
- package/lib/index-C4aGVY2E.cjs +1 -0
- package/lib/{index-BlXGgvT-.js → index-DtVRewGA.js} +26 -14
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/en.d.ts +2 -0
- package/lib/locales/fi.d.ts +2 -0
- package/lib/locales/hu.d.ts +2 -0
- package/lib/locales/index.d.ts +12 -0
- package/lib/locales/pt-br.d.ts +2 -0
- package/lib/locales/vi.d.ts +2 -0
- package/lib/locales/zh-cn.d.ts +2 -0
- package/lib/{popover-BrSDMb_n.js → popover-B1ptDngu.js} +1 -1
- package/lib/{popover-UUKfPWue.cjs → popover-D7w_FVSV.cjs} +1 -1
- package/lib/{separator-fpWkZkoh.js → separator-CDoF4Z4Z.js} +14 -14
- package/lib/{separator-LH5EzF0T.cjs → separator-C_7KkuoG.cjs} +1 -1
- package/lib/style.css +1 -1
- package/lib/textarea-CEtXap1b.cjs +1 -0
- package/lib/textarea-CNzZnjjW.js +20 -0
- package/package.json +1 -1
- package/lib/Katex-BPQ7_A3w.cjs +0 -4
- package/lib/index-BqL4vAWE.cjs +0 -1
- package/lib/index-czmcFIW7.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { Slot as n } from "@radix-ui/react-slot";
|
|
3
3
|
import r from "react";
|
|
4
|
-
import { i as d, T as m, a as f, B as s, b as u, g } from "./index-
|
|
4
|
+
import { i as d, T as m, a as f, B as s, b as u, g } from "./index-BfHAqkoX.js";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
const C = r.forwardRef(
|
|
7
7
|
({ asChild: x = !1, tooltip: i, ...t }, l) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),d=require("react"),i=require("./index-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),d=require("react"),i=require("./index-83hp1lZH.cjs");require("./theme.cjs");const s=d.forwardRef(({asChild:h=!1,tooltip:c,...t},l)=>{var n;const x=i.icons[t.icon],r=h?a.Slot:i.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(r,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0","data-state":t!=null&&t.dataState?"on":"off",disabled:t==null?void 0:t.disabled,ref:l,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),x&&e.jsx(x,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),c&&e.jsx(i.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[c&&e.jsx("div",{children:c}),e.jsx("div",{className:"richtext-flex",children:!!((n=t==null?void 0:t.shortcutKeys)!=null&&n.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=s;
|
package/lib/Attachment.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-C4WLt4NA.cjs"),u=require("./clsx-DSAWW32g.cjs"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-C4WLt4NA.cjs"),u=require("./clsx-DSAWW32g.cjs"),s=require("./index-83hp1lZH.cjs"),e=require("react/jsx-runtime"),v=require("react");require("./theme.cjs");const x=require("lucide-react"),S=require("./index-C4aGVY2E.cjs"),d=require("./dom-dataset-BqoJhJXt.cjs"),B={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
|
|
2
2
|
<path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
|
|
3
3
|
<path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
|
|
4
4
|
</svg>`,word:`<svg
|
package/lib/Attachment.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { N as j, m as
|
|
2
|
-
import { N as x, c as y, a as
|
|
3
|
-
import {
|
|
1
|
+
import { N as j, m as P } from "./index-D0EmqTpe.js";
|
|
2
|
+
import { N as x, c as y, a as D } from "./clsx-Bg-2aTKh.js";
|
|
3
|
+
import { P as R, Q as $, U as I, F as O, V as W, W as Z, X as N, A as T, u as K, d as Q } from "./index-BfHAqkoX.js";
|
|
4
4
|
import { jsx as e, Fragment as L, jsxs as f } from "react/jsx-runtime";
|
|
5
|
-
import { useRef as
|
|
5
|
+
import { useRef as U, useState as X, useCallback as k, useEffect as q } from "react";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { LucideTableProperties as
|
|
8
|
-
import { u as ie } from "./index-
|
|
7
|
+
import { LucideTableProperties as G, LucideSheet as J, LucideImage as Y, LucideFile as ee, LucideVideo as te, LucideAudioLines as re } from "lucide-react";
|
|
8
|
+
import { u as ie } from "./index-DtVRewGA.js";
|
|
9
9
|
import { g as c } from "./dom-dataset-CIEeltF6.js";
|
|
10
10
|
const oe = {
|
|
11
11
|
audio: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',
|
|
@@ -56,14 +56,14 @@ const ae = {
|
|
|
56
56
|
audio: /* @__PURE__ */ e(re, {}),
|
|
57
57
|
video: /* @__PURE__ */ e(te, {}),
|
|
58
58
|
file: /* @__PURE__ */ e(ee, {}),
|
|
59
|
-
image: /* @__PURE__ */ e(
|
|
59
|
+
image: /* @__PURE__ */ e(Y, {}),
|
|
60
60
|
pdf: /* @__PURE__ */ e(I, {}),
|
|
61
|
-
word: /* @__PURE__ */ e(
|
|
62
|
-
excel: /* @__PURE__ */ e(
|
|
63
|
-
ppt: /* @__PURE__ */ e(
|
|
61
|
+
word: /* @__PURE__ */ e($, {}),
|
|
62
|
+
excel: /* @__PURE__ */ e(J, {}),
|
|
63
|
+
ppt: /* @__PURE__ */ e(G, {})
|
|
64
64
|
};
|
|
65
65
|
function b(t, o = !1) {
|
|
66
|
-
const r =
|
|
66
|
+
const r = R(t), l = ae[r] || /* @__PURE__ */ e(L, {});
|
|
67
67
|
return o ? ne(r) : l;
|
|
68
68
|
}
|
|
69
69
|
const se = "_wrap_15oj2_2", M = {
|
|
@@ -71,22 +71,22 @@ const se = "_wrap_15oj2_2", M = {
|
|
|
71
71
|
};
|
|
72
72
|
function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension: s }) {
|
|
73
73
|
var A;
|
|
74
|
-
const n =
|
|
74
|
+
const n = U(null), i = O(), { hasTrigger: a, fileName: d, fileSize: h, fileExt: z, fileType: E, url: u, error: H } = o.attrs, [F, v] = X(!1), { t: w } = ie(), V = (A = s == null ? void 0 : s.options) == null ? void 0 : A.upload, m = k(() => {
|
|
75
75
|
!i || u || n.current.click();
|
|
76
|
-
}, [u, i]),
|
|
76
|
+
}, [u, i]), B = k(
|
|
77
77
|
async (C) => {
|
|
78
78
|
const p = C.target.files && C.target.files[0];
|
|
79
79
|
if (!p) return;
|
|
80
|
-
const
|
|
81
|
-
fileName:
|
|
80
|
+
const _ = {
|
|
81
|
+
fileName: Z(p.name),
|
|
82
82
|
fileSize: p.size,
|
|
83
83
|
fileType: p.type,
|
|
84
|
-
fileExt:
|
|
84
|
+
fileExt: W(p.name)
|
|
85
85
|
};
|
|
86
86
|
v(!0);
|
|
87
87
|
try {
|
|
88
88
|
const g = await V(p);
|
|
89
|
-
r({ ...
|
|
89
|
+
r({ ..._, url: g }), v(!1);
|
|
90
90
|
} catch (g) {
|
|
91
91
|
r({
|
|
92
92
|
error: `File upload fail: ${g && g.message}`
|
|
@@ -95,13 +95,13 @@ function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension:
|
|
|
95
95
|
},
|
|
96
96
|
[v, r]
|
|
97
97
|
);
|
|
98
|
-
|
|
98
|
+
q(() => {
|
|
99
99
|
!u && !a && (m(), r({ hasTrigger: !0 }));
|
|
100
100
|
}, [u, a, m, r]);
|
|
101
|
-
const
|
|
101
|
+
const S = k(() => l(), [t]);
|
|
102
102
|
return i && !u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f("div", { className: y(M.wrap, "render-wrapper"), children: [
|
|
103
103
|
/* @__PURE__ */ e("p", { onClick: m, style: { cursor: "pointer" }, children: F ? /* @__PURE__ */ e("span", { children: w("editor.attachment.uploading") }) : /* @__PURE__ */ e("span", { children: w("editor.attachment.please_upload") }) }),
|
|
104
|
-
/* @__PURE__ */ e("input", { hidden: !0, onChange:
|
|
104
|
+
/* @__PURE__ */ e("input", { hidden: !0, onChange: B, ref: n, type: "file" })
|
|
105
105
|
] }) }) : u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f("div", { className: y(M.wrap, "render-wrapper"), onClick: m, children: [
|
|
106
106
|
/* @__PURE__ */ f("div", { className: "richtext-flex richtext-items-center richtext-gap-[4px]", children: [
|
|
107
107
|
/* @__PURE__ */ e("span", { children: b(E) }),
|
|
@@ -116,7 +116,7 @@ function le({ editor: t, node: o, updateAttributes: r, deleteNode: l, extension:
|
|
|
116
116
|
")"
|
|
117
117
|
] })
|
|
118
118
|
] }),
|
|
119
|
-
/* @__PURE__ */ e(T, { action:
|
|
119
|
+
/* @__PURE__ */ e(T, { action: S, icon: "Trash2", tooltip: w("editor.delete") })
|
|
120
120
|
] }) }) : H !== "null" ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e("div", { className: y(M.wrap, "render-wrapper"), onClick: m, children: /* @__PURE__ */ e("p", { children: H }) }) }) : /* @__PURE__ */ e(L, {});
|
|
121
121
|
}
|
|
122
122
|
function xe() {
|
|
@@ -127,7 +127,7 @@ function xe() {
|
|
|
127
127
|
tooltipOptions: s = {},
|
|
128
128
|
action: n = void 0,
|
|
129
129
|
isActive: i = void 0
|
|
130
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: a, update: d } =
|
|
130
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: a, update: d } = Q(i), h = () => {
|
|
131
131
|
a || n && (n(), d());
|
|
132
132
|
};
|
|
133
133
|
return t ? /* @__PURE__ */ e(
|
|
@@ -183,7 +183,7 @@ const ce = /* @__PURE__ */ j.create({
|
|
|
183
183
|
} = t || {};
|
|
184
184
|
return [
|
|
185
185
|
"div",
|
|
186
|
-
|
|
186
|
+
P(
|
|
187
187
|
// @ts-expect-error
|
|
188
188
|
this.options.HTMLAttributes || {},
|
|
189
189
|
t || {}
|
|
@@ -238,7 +238,7 @@ const ce = /* @__PURE__ */ j.create({
|
|
|
238
238
|
};
|
|
239
239
|
},
|
|
240
240
|
addNodeView() {
|
|
241
|
-
return
|
|
241
|
+
return D(le);
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
244
|
export {
|
package/lib/Blockquote.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-C4WLt4NA.cjs"),h=require("./jsx-runtime-C_NLcKys.cjs"),d=require("react/jsx-runtime"),p=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-C4WLt4NA.cjs"),h=require("./jsx-runtime-C_NLcKys.cjs"),d=require("react/jsx-runtime"),p=require("./index-83hp1lZH.cjs");require("react");require("./theme.cjs");var m=/^\s*>\s$/,b=a.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return h.h("blockquote",{...a.mergeAttributes(this.options.HTMLAttributes,t),children:h.h("slot",{})})},parseMarkdown:(t,e)=>{var o;const n=(o=e.parseBlockChildren)!=null?o:e.parseChildren;return e.createNode("blockquote",void 0,n(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const o=">",n=[];return t.content.forEach((r,i)=>{var s,u;const l=((u=(s=e.renderChild)==null?void 0:s.call(e,r,i))!=null?u:e.renderChildren([r])).split(`
|
|
2
2
|
`).map(q=>q.trim()===""?o:`${o} ${q}`);n.push(l.join(`
|
|
3
3
|
`))}),n.join(`
|
|
4
4
|
${o}
|
package/lib/Blockquote.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { N as k, w as h, m as g } from "./index-D0EmqTpe.js";
|
|
2
2
|
import { h as p } from "./jsx-runtime-CT7Pcg-t.js";
|
|
3
3
|
import { jsx as m, Fragment as b } from "react/jsx-runtime";
|
|
4
|
-
import { u as f, d as q, A as v } from "./index-
|
|
4
|
+
import { u as f, d as q, A as v } from "./index-BfHAqkoX.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
|
7
7
|
var B = /^\s*>\s$/, A = k.create({
|
package/lib/Bold.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-C4WLt4NA.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),n=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-C4WLt4NA.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),n=require("./index-83hp1lZH.cjs"),i=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,v=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return u.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:u.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:y,type:this.type}),o.markInputRule({find:B,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:k,type:this.type})]}});function M(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:d=void 0,isActive:p=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:g,disabled:a,update:m}=n.useToggleActive(p),h=()=>{a||d&&(d(),m())};return t?i.jsx(n.ActionButton,{action:h,dataState:g,disabled:a,icon:e,shortcutKeys:s,tooltip:r,tooltipOptions:c}):i.jsx(i.Fragment,{})}const l=v.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:r,extension:s})=>({component:n.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:s.options.shortcutKeys??["mod","B"],tooltip:r("editor.bold.tooltip")}})}}});exports.Bold=l;exports.RichTextBold=M;
|
package/lib/Bold.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as _, f as a, h as i, m as y } from "./index-D0EmqTpe.js";
|
|
2
2
|
import { h as d } from "./jsx-runtime-CT7Pcg-t.js";
|
|
3
|
-
import { u as f, d as M, A as u } from "./index-
|
|
3
|
+
import { u as f, d as M, A as u } from "./index-BfHAqkoX.js";
|
|
4
4
|
import { jsx as l, Fragment as k } from "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
package/lib/BulletList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-fbGGohBT.cjs"),s=require("react/jsx-runtime"),n=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-fbGGohBT.cjs"),s=require("react/jsx-runtime"),n=require("./index-83hp1lZH.cjs");require("react");require("./theme.cjs");function g(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:c=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:u,update:p}=n.useToggleActive(d),m=()=>{u||c&&(c(),p())};return t?s.jsx(n.ActionButton,{action:m,dataState:a,disabled:u,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:i("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=g;
|
package/lib/BulletList.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as d } from "./index-DXtVL0al.js";
|
|
2
2
|
import { jsx as c, Fragment as m } from "react/jsx-runtime";
|
|
3
|
-
import { u as f, d as v, A } from "./index-
|
|
3
|
+
import { u as f, d as v, A } from "./index-BfHAqkoX.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
function y() {
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { N as U, m as E } from "./index-D0EmqTpe.js";
|
|
2
|
+
import { N as W, c as N, a as F } from "./clsx-Bg-2aTKh.js";
|
|
3
|
+
import { c as l, h as Y, u as _, d as $, D as K, r as q, A as S, s as G, v as J, L as p, j as C, w as Q, B as w } from "./index-BfHAqkoX.js";
|
|
4
|
+
import { jsxs as c, jsx as e, Fragment as X } from "react/jsx-runtime";
|
|
5
|
+
import * as d from "react";
|
|
6
|
+
import { useState as x } from "react";
|
|
7
|
+
import "./theme.js";
|
|
8
|
+
import { ChevronDown as A, Check as Z, ChevronUp as tt, Info as et, Lightbulb as rt, AlertCircle as it, TriangleAlert as at, OctagonAlert as ct } from "lucide-react";
|
|
9
|
+
import * as a from "@radix-ui/react-select";
|
|
10
|
+
import { u as ot } from "./index-DtVRewGA.js";
|
|
11
|
+
const lt = a.Root, nt = a.Value, L = d.forwardRef(({ className: t, children: r, ...i }, o) => /* @__PURE__ */ c(
|
|
12
|
+
a.Trigger,
|
|
13
|
+
{
|
|
14
|
+
ref: o,
|
|
15
|
+
className: l(
|
|
16
|
+
"richtext-flex richtext-h-10 richtext-w-full richtext-items-center richtext-justify-between richtext-rounded-md richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-text-foreground richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-1 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 [&>span]:richtext-line-clamp-1",
|
|
17
|
+
t
|
|
18
|
+
),
|
|
19
|
+
...i,
|
|
20
|
+
children: [
|
|
21
|
+
r,
|
|
22
|
+
/* @__PURE__ */ e(a.Icon, { asChild: !0, children: /* @__PURE__ */ e(A, { className: "richtext-size-4 richtext-opacity-50" }) })
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
));
|
|
26
|
+
L.displayName = a.Trigger.displayName;
|
|
27
|
+
const I = d.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ e(
|
|
28
|
+
a.ScrollUpButton,
|
|
29
|
+
{
|
|
30
|
+
ref: i,
|
|
31
|
+
className: l(
|
|
32
|
+
"richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",
|
|
33
|
+
t
|
|
34
|
+
),
|
|
35
|
+
...r,
|
|
36
|
+
children: /* @__PURE__ */ e(tt, { className: "richtext-size-4" })
|
|
37
|
+
}
|
|
38
|
+
));
|
|
39
|
+
I.displayName = a.ScrollUpButton.displayName;
|
|
40
|
+
const R = d.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ e(
|
|
41
|
+
a.ScrollDownButton,
|
|
42
|
+
{
|
|
43
|
+
ref: i,
|
|
44
|
+
className: l(
|
|
45
|
+
"richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",
|
|
46
|
+
t
|
|
47
|
+
),
|
|
48
|
+
...r,
|
|
49
|
+
children: /* @__PURE__ */ e(A, { className: "richtext-size-4" })
|
|
50
|
+
}
|
|
51
|
+
));
|
|
52
|
+
R.displayName = a.ScrollDownButton.displayName;
|
|
53
|
+
const B = d.forwardRef(({ className: t, children: r, position: i = "popper", ...o }, n) => /* @__PURE__ */ e(a.Portal, { children: /* @__PURE__ */ c(
|
|
54
|
+
a.Content,
|
|
55
|
+
{
|
|
56
|
+
"data-richtext-portal": !0,
|
|
57
|
+
position: i,
|
|
58
|
+
ref: n,
|
|
59
|
+
className: l(
|
|
60
|
+
"richtext-relative richtext-z-50 richtext-max-h-60 richtext-min-w-[8rem] richtext-overflow-hidden richtext-overflow-y-auto richtext-rounded-md richtext-border !richtext-border-border richtext-bg-popover richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",
|
|
61
|
+
i === "popper" && "data-[side=bottom]:richtext-translate-y-1 data-[side=left]:richtext--translate-x-1 data-[side=right]:richtext-translate-x-1 data-[side=top]:richtext--translate-y-1",
|
|
62
|
+
t
|
|
63
|
+
),
|
|
64
|
+
...o,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ e(I, {}),
|
|
67
|
+
/* @__PURE__ */ e(
|
|
68
|
+
a.Viewport,
|
|
69
|
+
{
|
|
70
|
+
className: l(
|
|
71
|
+
"richtext-p-1",
|
|
72
|
+
i === "popper" && "richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]"
|
|
73
|
+
),
|
|
74
|
+
children: r
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ e(R, {})
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
) }));
|
|
81
|
+
B.displayName = a.Content.displayName;
|
|
82
|
+
const st = d.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ e(
|
|
83
|
+
a.Label,
|
|
84
|
+
{
|
|
85
|
+
className: l(
|
|
86
|
+
"richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold",
|
|
87
|
+
t
|
|
88
|
+
),
|
|
89
|
+
ref: i,
|
|
90
|
+
...r
|
|
91
|
+
}
|
|
92
|
+
));
|
|
93
|
+
st.displayName = a.Label.displayName;
|
|
94
|
+
const k = d.forwardRef(({ className: t, children: r, ...i }, o) => /* @__PURE__ */ c(
|
|
95
|
+
a.Item,
|
|
96
|
+
{
|
|
97
|
+
ref: o,
|
|
98
|
+
className: l(
|
|
99
|
+
"richtext-relative richtext-flex richtext-w-full richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",
|
|
100
|
+
t
|
|
101
|
+
),
|
|
102
|
+
...i,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ e("span", { className: "richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center", children: /* @__PURE__ */ e(a.ItemIndicator, { children: /* @__PURE__ */ e(Z, { className: "richtext-size-4" }) }) }),
|
|
105
|
+
/* @__PURE__ */ e(a.ItemText, { children: r })
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
));
|
|
109
|
+
k.displayName = a.Item.displayName;
|
|
110
|
+
const dt = d.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ e(
|
|
111
|
+
a.Separator,
|
|
112
|
+
{
|
|
113
|
+
className: l("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted", t),
|
|
114
|
+
ref: i,
|
|
115
|
+
...r
|
|
116
|
+
}
|
|
117
|
+
));
|
|
118
|
+
dt.displayName = a.Separator.displayName;
|
|
119
|
+
const T = [
|
|
120
|
+
{
|
|
121
|
+
value: "note",
|
|
122
|
+
label: "Note",
|
|
123
|
+
icon: et,
|
|
124
|
+
color: "#1f6feb",
|
|
125
|
+
background: "#1f6feb1f"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
value: "tip",
|
|
129
|
+
label: "Tip",
|
|
130
|
+
icon: rt,
|
|
131
|
+
color: "#238636",
|
|
132
|
+
background: "#2386361f"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
value: "important",
|
|
136
|
+
label: "Important",
|
|
137
|
+
icon: it,
|
|
138
|
+
color: "#ab7df8",
|
|
139
|
+
background: "#ab7df81f"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
value: "warning",
|
|
143
|
+
label: "Warning",
|
|
144
|
+
icon: at,
|
|
145
|
+
color: "#d29922",
|
|
146
|
+
background: "#d299221f"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
value: "caution",
|
|
150
|
+
label: "Caution",
|
|
151
|
+
icon: ct,
|
|
152
|
+
color: "#f85149",
|
|
153
|
+
background: "#f851491f"
|
|
154
|
+
}
|
|
155
|
+
];
|
|
156
|
+
function ht({ node: t }) {
|
|
157
|
+
const { type: r = "note", title: i = "", body: o = "" } = t.attrs, h = (T.find((u) => u.value === r) || T[0]).icon;
|
|
158
|
+
return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ c(
|
|
159
|
+
"div",
|
|
160
|
+
{
|
|
161
|
+
className: N(
|
|
162
|
+
"richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",
|
|
163
|
+
{
|
|
164
|
+
"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]": r === "note",
|
|
165
|
+
"richtext-bg-[#2386361f] richtext-border-[#238636]": r === "tip",
|
|
166
|
+
"richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]": r === "important",
|
|
167
|
+
"richtext-bg-[#d299221f] richtext-border-[#d29922]": r === "warning",
|
|
168
|
+
"richtext-bg-[#f851491f] richtext-border-[#f85149]": r === "caution"
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ c(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
className: N("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2", {
|
|
176
|
+
"richtext-text-[#1f6feb]": r === "note",
|
|
177
|
+
"richtext-text-[#238636]": r === "tip",
|
|
178
|
+
"richtext-text-[#ab7df8]": r === "important",
|
|
179
|
+
"richtext-text-[#d29922]": r === "warning",
|
|
180
|
+
"richtext-text-[#f85149]": r === "caution"
|
|
181
|
+
}),
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ e(h, { className: "richtext-size-5" }),
|
|
184
|
+
/* @__PURE__ */ e("span", { className: "richtext-font-semibold", children: i })
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
o && /* @__PURE__ */ e("p", { className: "richtext-pl-[28px]", children: o })
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
) });
|
|
192
|
+
}
|
|
193
|
+
const ut = [
|
|
194
|
+
{ value: "note", label: "Note", icon: "Info" },
|
|
195
|
+
{ value: "tip", label: "Tip", icon: "Lightbulb" },
|
|
196
|
+
{ value: "important", label: "Important", icon: "AlertCircle" },
|
|
197
|
+
{ value: "warning", label: "Warning", icon: "TriangleAlert" },
|
|
198
|
+
{ value: "caution", label: "Caution", icon: "OctagonAlert" }
|
|
199
|
+
];
|
|
200
|
+
function Ct() {
|
|
201
|
+
const { t } = ot(), r = Y(), i = _(xt.name), [o, n] = x(!1), [h, u] = x("note"), [f, b] = x(""), [g, y] = x(""), {
|
|
202
|
+
icon: D = void 0,
|
|
203
|
+
tooltip: z = void 0,
|
|
204
|
+
shortcutKeys: O = void 0,
|
|
205
|
+
tooltipOptions: V = {},
|
|
206
|
+
isActive: j = void 0
|
|
207
|
+
} = (i == null ? void 0 : i.componentProps) ?? {}, { dataState: H, disabled: v } = $(j), M = () => {
|
|
208
|
+
r && (r.chain().focus().setCallout({ type: h, title: f, body: g }).run(), n(!1), u("note"), b(""), y(""));
|
|
209
|
+
}, P = () => {
|
|
210
|
+
v || n(!0);
|
|
211
|
+
};
|
|
212
|
+
return i ? /* @__PURE__ */ c(K, { onOpenChange: n, open: o, children: [
|
|
213
|
+
/* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
|
|
214
|
+
S,
|
|
215
|
+
{
|
|
216
|
+
action: P,
|
|
217
|
+
dataState: H,
|
|
218
|
+
disabled: v,
|
|
219
|
+
icon: D,
|
|
220
|
+
shortcutKeys: O,
|
|
221
|
+
tooltip: z,
|
|
222
|
+
tooltipOptions: V
|
|
223
|
+
}
|
|
224
|
+
) }),
|
|
225
|
+
/* @__PURE__ */ c(G, { children: [
|
|
226
|
+
/* @__PURE__ */ e(J, { children: t("editor.callout.dialog.title") }),
|
|
227
|
+
/* @__PURE__ */ c("div", { className: "richtext-space-y-4 richtext-py-4", children: [
|
|
228
|
+
/* @__PURE__ */ c("div", { className: "richtext-space-y-2", children: [
|
|
229
|
+
/* @__PURE__ */ e(p, { children: t("editor.callout.dialog.type") }),
|
|
230
|
+
/* @__PURE__ */ c(lt, { onValueChange: u, value: h, children: [
|
|
231
|
+
/* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(nt, { placeholder: t("editor.callout.dialog.type.placeholder") }) }),
|
|
232
|
+
/* @__PURE__ */ e(B, { children: ut.map((s) => /* @__PURE__ */ e(k, { value: s.value, children: t(`editor.callout.type.${s.value}`) }, s.value)) })
|
|
233
|
+
] })
|
|
234
|
+
] }),
|
|
235
|
+
/* @__PURE__ */ c("div", { className: "richtext-space-y-2", children: [
|
|
236
|
+
/* @__PURE__ */ e(p, { children: t("editor.callout.dialog.title.label") }),
|
|
237
|
+
/* @__PURE__ */ e(
|
|
238
|
+
C,
|
|
239
|
+
{
|
|
240
|
+
onChange: (s) => b(s.target.value),
|
|
241
|
+
placeholder: t("editor.callout.dialog.title.placeholder"),
|
|
242
|
+
value: f
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
] }),
|
|
246
|
+
/* @__PURE__ */ c("div", { className: "richtext-space-y-2", children: [
|
|
247
|
+
/* @__PURE__ */ e(p, { children: t("editor.callout.dialog.body.label") }),
|
|
248
|
+
/* @__PURE__ */ e(
|
|
249
|
+
C,
|
|
250
|
+
{
|
|
251
|
+
onChange: (s) => y(s.target.value),
|
|
252
|
+
placeholder: t("editor.callout.dialog.body.placeholder"),
|
|
253
|
+
value: g
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] })
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ c(Q, { children: [
|
|
259
|
+
/* @__PURE__ */ e(w, { onClick: () => n(!1), variant: "outline", children: t("editor.callout.dialog.button.cancel") }),
|
|
260
|
+
/* @__PURE__ */ e(w, { onClick: M, children: t("editor.callout.dialog.button.apply") })
|
|
261
|
+
] })
|
|
262
|
+
] })
|
|
263
|
+
] }) : /* @__PURE__ */ e(X, {});
|
|
264
|
+
}
|
|
265
|
+
function m(t) {
|
|
266
|
+
return (r) => r.getAttribute(t);
|
|
267
|
+
}
|
|
268
|
+
const xt = /* @__PURE__ */ U.create({
|
|
269
|
+
name: "callout",
|
|
270
|
+
group: "block",
|
|
271
|
+
selectable: !0,
|
|
272
|
+
atom: !0,
|
|
273
|
+
draggable: !0,
|
|
274
|
+
inline: !1,
|
|
275
|
+
//@ts-expect-error
|
|
276
|
+
addOptions() {
|
|
277
|
+
var t;
|
|
278
|
+
return {
|
|
279
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
280
|
+
HTMLAttributes: {
|
|
281
|
+
class: "callout"
|
|
282
|
+
},
|
|
283
|
+
button: ({ editor: r, t: i }) => ({
|
|
284
|
+
component: S,
|
|
285
|
+
componentProps: {
|
|
286
|
+
action: () => !0,
|
|
287
|
+
isActive: () => r.isActive("callout"),
|
|
288
|
+
disabled: !1,
|
|
289
|
+
icon: "Callout",
|
|
290
|
+
tooltip: i("editor.callout.tooltip")
|
|
291
|
+
}
|
|
292
|
+
})
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
parseHTML() {
|
|
296
|
+
return [{ tag: "div.callout" }];
|
|
297
|
+
},
|
|
298
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
299
|
+
return [
|
|
300
|
+
"div",
|
|
301
|
+
E(this.options && this.options.HTMLAttributes || {}, t)
|
|
302
|
+
];
|
|
303
|
+
},
|
|
304
|
+
addAttributes() {
|
|
305
|
+
return {
|
|
306
|
+
type: {
|
|
307
|
+
default: "",
|
|
308
|
+
parseHTML: m("type")
|
|
309
|
+
},
|
|
310
|
+
title: {
|
|
311
|
+
default: "",
|
|
312
|
+
parseHTML: m("title")
|
|
313
|
+
},
|
|
314
|
+
body: {
|
|
315
|
+
default: "",
|
|
316
|
+
parseHTML: m("body")
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
},
|
|
320
|
+
addCommands() {
|
|
321
|
+
return {
|
|
322
|
+
setCallout: (t) => ({ chain: r }) => r().insertContent({
|
|
323
|
+
type: this.name,
|
|
324
|
+
attrs: t
|
|
325
|
+
}).run()
|
|
326
|
+
};
|
|
327
|
+
},
|
|
328
|
+
addNodeView() {
|
|
329
|
+
return F(ht);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
export {
|
|
333
|
+
xt as C,
|
|
334
|
+
Ct as R,
|
|
335
|
+
lt as S,
|
|
336
|
+
L as a,
|
|
337
|
+
nt as b,
|
|
338
|
+
B as c,
|
|
339
|
+
k as d
|
|
340
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const S=require("./index-C4WLt4NA.cjs"),p=require("./clsx-DSAWW32g.cjs"),c=require("./index-83hp1lZH.cjs"),t=require("react/jsx-runtime"),x=require("react");require("./theme.cjs");const l=require("lucide-react"),H=require("@radix-ui/react-select"),_=require("./index-C4aGVY2E.cjs");function T(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:()=>e[i]})}}return r.default=e,Object.freeze(r)}const d=T(x),a=T(H),A=a.Root,L=a.Value,m=d.forwardRef(({className:e,children:r,...i},o)=>t.jsxs(a.Trigger,{ref:o,className:c.cn("richtext-flex richtext-h-10 richtext-w-full richtext-items-center richtext-justify-between richtext-rounded-md richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-text-foreground richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-1 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 [&>span]:richtext-line-clamp-1",e),...i,children:[r,t.jsx(a.Icon,{asChild:!0,children:t.jsx(l.ChevronDown,{className:"richtext-size-4 richtext-opacity-50"})})]}));m.displayName=a.Trigger.displayName;const I=d.forwardRef(({className:e,...r},i)=>t.jsx(a.ScrollUpButton,{ref:i,className:c.cn("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...r,children:t.jsx(l.ChevronUp,{className:"richtext-size-4"})}));I.displayName=a.ScrollUpButton.displayName;const R=d.forwardRef(({className:e,...r},i)=>t.jsx(a.ScrollDownButton,{ref:i,className:c.cn("richtext-flex richtext-cursor-default richtext-items-center richtext-justify-center richtext-py-1",e),...r,children:t.jsx(l.ChevronDown,{className:"richtext-size-4"})}));R.displayName=a.ScrollDownButton.displayName;const b=d.forwardRef(({className:e,children:r,position:i="popper",...o},n)=>t.jsx(a.Portal,{children:t.jsxs(a.Content,{"data-richtext-portal":!0,position:i,ref:n,className:c.cn("richtext-relative richtext-z-50 richtext-max-h-60 richtext-min-w-[8rem] richtext-overflow-hidden richtext-overflow-y-auto richtext-rounded-md richtext-border !richtext-border-border richtext-bg-popover richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",i==="popper"&&"data-[side=bottom]:richtext-translate-y-1 data-[side=left]:richtext--translate-x-1 data-[side=right]:richtext-translate-x-1 data-[side=top]:richtext--translate-y-1",e),...o,children:[t.jsx(I,{}),t.jsx(a.Viewport,{className:c.cn("richtext-p-1",i==="popper"&&"richtext-h-[var(--radix-select-trigger-height)] richtext-w-full richtext-min-w-[var(--radix-select-trigger-width)]"),children:r}),t.jsx(R,{})]})}));b.displayName=a.Content.displayName;const U=d.forwardRef(({className:e,...r},i)=>t.jsx(a.Label,{className:c.cn("richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-font-semibold",e),ref:i,...r}));U.displayName=a.Label.displayName;const g=d.forwardRef(({className:e,children:r,...i},o)=>t.jsxs(a.Item,{ref:o,className:c.cn("richtext-relative richtext-flex richtext-w-full richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),...i,children:[t.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center",children:t.jsx(a.ItemIndicator,{children:t.jsx(l.Check,{className:"richtext-size-4"})})}),t.jsx(a.ItemText,{children:r})]}));g.displayName=a.Item.displayName;const E=d.forwardRef(({className:e,...r},i)=>t.jsx(a.Separator,{className:c.cn("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),ref:i,...r}));E.displayName=a.Separator.displayName;const w=[{value:"note",label:"Note",icon:l.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:l.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:l.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:l.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:l.OctagonAlert,color:"#f85149",background:"#f851491f"}];function W({node:e}){const{type:r="note",title:i="",body:o=""}=e.attrs,h=(w.find(u=>u.value===r)||w[0]).icon;return t.jsx(p.NodeViewWrapper,{children:t.jsxs("div",{className:p.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":r==="note","richtext-bg-[#2386361f] richtext-border-[#238636]":r==="tip","richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":r==="important","richtext-bg-[#d299221f] richtext-border-[#d29922]":r==="warning","richtext-bg-[#f851491f] richtext-border-[#f85149]":r==="caution"}),children:[t.jsxs("div",{className:p.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":r==="note","richtext-text-[#238636]":r==="tip","richtext-text-[#ab7df8]":r==="important","richtext-text-[#d29922]":r==="warning","richtext-text-[#f85149]":r==="caution"}),children:[t.jsx(h,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:i})]}),o&&t.jsx("p",{className:"richtext-pl-[28px]",children:o})]})})}const $=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function F(){const{t:e}=_.useLocale(),r=c.useEditorInstance(),i=c.useButtonProps(B.name),[o,n]=x.useState(!1),[h,u]=x.useState("note"),[y,j]=x.useState(""),[v,N]=x.useState(""),{icon:D=void 0,tooltip:O=void 0,shortcutKeys:k=void 0,tooltipOptions:z={},isActive:q=void 0}=(i==null?void 0:i.componentProps)??{},{dataState:P,disabled:C}=c.useToggleActive(q),V=()=>{r&&(r.chain().focus().setCallout({type:h,title:y,body:v}).run(),n(!1),u("note"),j(""),N(""))},M=()=>{C||n(!0)};return i?t.jsxs(c.Dialog,{onOpenChange:n,open:o,children:[t.jsx(c.DialogTrigger,{asChild:!0,children:t.jsx(c.ActionButton,{action:M,dataState:P,disabled:C,icon:D,shortcutKeys:k,tooltip:O,tooltipOptions:z})}),t.jsxs(c.DialogContent,{children:[t.jsx(c.DialogTitle,{children:e("editor.callout.dialog.title")}),t.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(c.Label,{children:e("editor.callout.dialog.type")}),t.jsxs(A,{onValueChange:u,value:h,children:[t.jsx(m,{children:t.jsx(L,{placeholder:e("editor.callout.dialog.type.placeholder")})}),t.jsx(b,{children:$.map(s=>t.jsx(g,{value:s.value,children:e(`editor.callout.type.${s.value}`)},s.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(c.Label,{children:e("editor.callout.dialog.title.label")}),t.jsx(c.Input,{onChange:s=>j(s.target.value),placeholder:e("editor.callout.dialog.title.placeholder"),value:y})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(c.Label,{children:e("editor.callout.dialog.body.label")}),t.jsx(c.Input,{onChange:s=>N(s.target.value),placeholder:e("editor.callout.dialog.body.placeholder"),value:v})]})]}),t.jsxs(c.DialogFooter,{children:[t.jsx(c.Button,{onClick:()=>n(!1),variant:"outline",children:e("editor.callout.dialog.button.cancel")}),t.jsx(c.Button,{onClick:V,children:e("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function f(e){return r=>r.getAttribute(e)}const B=S.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"callout"},button:({editor:r,t:i})=>({component:c.ActionButton,componentProps:{action:()=>!0,isActive:()=>r.isActive("callout"),disabled:!1,icon:"Callout",tooltip:i("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:e}){return["div",S.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addAttributes(){return{type:{default:"",parseHTML:f("type")},title:{default:"",parseHTML:f("title")},body:{default:"",parseHTML:f("body")}}},addCommands(){return{setCallout:e=>({chain:r})=>r().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return p.ReactNodeViewRenderer(W)}});exports.Callout=B;exports.RichTextCallout=F;exports.Select=A;exports.SelectContent=b;exports.SelectItem=g;exports.SelectTrigger=m;exports.SelectValue=L;
|
package/lib/Callout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-C4WLt4NA.cjs");require("./clsx-DSAWW32g.cjs");require("./index-83hp1lZH.cjs");require("react/jsx-runtime");require("react");require("./theme.cjs");const e=require("./Callout-lBlBlK_w.cjs");exports.Callout=e.Callout;exports.RichTextCallout=e.RichTextCallout;
|