reactjs-tiptap-editor 1.0.26 → 1.0.29
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-B4KDkZ0z.js → ActionMenuButton-BhiGvRJ7.js} +1 -1
- package/lib/{ActionMenuButton-C3Cfeza9.cjs → ActionMenuButton-qUxkZlQg.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +27 -27
- package/lib/Blockquote.cjs +3 -3
- package/lib/Blockquote.js +251 -244
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout-B9uXfbP3.js +340 -0
- package/lib/Callout-C_TXsss3.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 +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +2 -2
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +2 -2
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +2 -2
- package/lib/{Drawer-D7E9kTca.cjs → Drawer-D3B4lQJF.cjs} +1 -1
- package/lib/{Drawer-DA0FLHs9.js → Drawer-h401Yy6Y.js} +20 -20
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +168 -135
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +5 -5
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.js +2 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +10 -10
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +3 -3
- package/lib/History.cjs +2 -2
- package/lib/History.js +584 -531
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-DZ3r3QzK.js → Iframe-Dhn40BXx.js} +3 -3
- package/lib/{Iframe-OMVd0xa_.cjs → Iframe-bvGuzYwC.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +9 -6
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +19 -19
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +15 -15
- package/lib/{Indent-kI4G-clX.js → Indent-BK9DvCL7.js} +2 -2
- package/lib/{Indent-QgCoonRk.cjs → Indent-IOByomps.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-BPbXjcZQ.js → Katex-C_Ah9G9w.js} +7 -6
- package/lib/Katex-oLGrtLTf.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-Z7RRurvx.cjs → LinkEditBlock-BojxdGTm.cjs} +2 -2
- package/lib/{LinkEditBlock-BYWwH2_x.js → LinkEditBlock-DRdKXffy.js} +39 -35
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +4 -4
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +62 -61
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +8 -8
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-DPPmYEjC.cjs → SlashCommandNodeView-Dai-O3aD.cjs} +1 -1
- package/lib/{SlashCommandNodeView-C0l3Fb_3.js → SlashCommandNodeView-qwW9cuYt.js} +6 -6
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-DwseaFSD.js → Table-BKM8SvVj.js} +20 -20
- package/lib/{Table-D5G3rfwb.cjs → Table-CWI7tKme.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-q4ZGZL0i.cjs → Twitter-BfsPzA8_.cjs} +1 -1
- package/lib/{Twitter-DP26Lkn8.js → Twitter-CofLQ-zj.js} +9 -9
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -5
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +2258 -2552
- package/lib/{clsx-DRbkQ4T7.cjs → clsx-DJURdKPs.cjs} +2 -2
- package/lib/{clsx-_bq4MQQ7.js → clsx-b_2OwHLk.js} +19 -19
- package/lib/{dropdown-menu-CURWpB9o.cjs → dropdown-menu-CEMxzgnU.cjs} +1 -1
- package/lib/{dropdown-menu-BKSX4gvT.js → dropdown-menu-CKAKsyqu.js} +1 -1
- package/lib/extensions/Image/Image.d.ts +13 -1
- package/lib/index-BJQ1G8B1.js +311 -0
- package/lib/index-BO82_0q8.cjs +1 -0
- package/lib/{index-DQy9iBzV.js → index-Bn_WPziX.js} +1 -1
- package/lib/{index-BpLw6ebr.cjs → index-CwbGrQFa.cjs} +1 -1
- package/lib/{index-DtyAGMbq.js → index-DKruDABV.js} +1 -1
- package/lib/{index-SEMQrdk2.cjs → index-DN-IR-K0.cjs} +1 -1
- package/lib/{index-C52cuQ_Y.js → index-DRcwHivm.js} +1415 -1350
- package/lib/index-DUeBQoIA.cjs +1 -0
- package/lib/{index-Dbm_Mans.js → index-DeoYYWEA.js} +1 -1
- package/lib/{index-CHVV5iY-.cjs → index-Dgs2thVL.cjs} +1 -1
- package/lib/{index-BaR0Brts.js → index-DjB2kNdz.js} +171 -166
- package/lib/{index-CJMI7Fjf.js → index-DuWMq-Qs.js} +1 -1
- package/lib/{index-BGfIcDCQ.cjs → index-EoGU7W4e.cjs} +1 -1
- package/lib/{index-CDw4Eszh.cjs → index-MDz4NZcT.cjs} +9 -9
- package/lib/{index-Dx-Dh7KS.js → index-n4kM0Ll-.js} +110 -105
- package/lib/{index-BgNKVyMW.cjs → index-qZURFC5Q.cjs} +1 -1
- 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/{popover-BB-ZDnqk.js → popover-Beieacfy.js} +1 -1
- package/lib/{popover-CrywEkBR.cjs → popover-Bl1kxRJX.cjs} +1 -1
- package/lib/{renderNodeView-5h3-p80E.cjs → renderNodeView-BIgT6Ghg.cjs} +1 -1
- package/lib/{renderNodeView-DoKZ4GYy.js → renderNodeView-Bi58v3DZ.js} +2 -2
- package/lib/{separator-BGO9AZp4.cjs → separator-DMLtkcoo.cjs} +1 -1
- package/lib/{separator-DuuOJRQd.js → separator-DfvK668q.js} +14 -14
- package/lib/style.css +1 -1
- package/lib/textarea-DV9Fw3y1.cjs +1 -0
- package/lib/textarea-GXaWJbm9.js +20 -0
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +1 -1
- package/lib/{updatePosition-CFTYKYNJ.js → updatePosition-DY1jI7qb.js} +2 -2
- package/lib/{updatePosition-B1oRJE1x.cjs → updatePosition-D_D-TbEu.cjs} +1 -1
- package/package.json +59 -59
- package/lib/Katex-CUofhjB5.cjs +0 -4
- package/lib/index-BG0kQamI.js +0 -285
- package/lib/index-NsYff_Ni.cjs +0 -1
- package/lib/index-aujjnfSJ.cjs +0 -1
package/lib/Bold.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-EoGU7W4e.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),n=require("./index-BO82_0q8.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
|
-
import { M as _, h as a, j as i, m as y } from "./index-
|
|
1
|
+
import { M as _, h as a, j as i, m as y } from "./index-n4kM0Ll-.js";
|
|
2
2
|
import { h as d } from "./jsx-runtime-DE8oVoME.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-DRcwHivm.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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-MDz4NZcT.cjs"),s=require("react/jsx-runtime"),n=require("./index-BO82_0q8.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
|
-
import { B as d } from "./index-
|
|
1
|
+
import { B as d } from "./index-DjB2kNdz.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-DRcwHivm.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-n4kM0Ll-.js";
|
|
2
|
+
import { N as W, c as N, a as F } from "./clsx-b_2OwHLk.js";
|
|
3
|
+
import { c as l, h as Y, u as _, d as $, D as K, s as q, A as S, v as G, w as J, L as p, k as C, x as Q, B as w } from "./index-DRcwHivm.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-DKruDABV.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 k = 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
|
+
k.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 B = 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
|
+
B.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-border-[#1f6feb] richtext-bg-[#1f6feb1f]": r === "note",
|
|
165
|
+
"richtext-border-[#238636] richtext-bg-[#2386361f]": r === "tip",
|
|
166
|
+
"richtext-border-[#ab7df8] richtext-bg-[#ab7df81f]": r === "important",
|
|
167
|
+
"richtext-border-[#d29922] richtext-bg-[#d299221f]": r === "warning",
|
|
168
|
+
"richtext-border-[#f85149] richtext-bg-[#f851491f]": 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: H = void 0
|
|
207
|
+
} = (i == null ? void 0 : i.componentProps) ?? {}, { dataState: M, disabled: v } = $(H), j = () => {
|
|
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: M,
|
|
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(k, { children: ut.map((s) => /* @__PURE__ */ e(B, { 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: j, 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
|
+
k as c,
|
|
339
|
+
B as d
|
|
340
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const S=require("./index-EoGU7W4e.cjs"),p=require("./clsx-DJURdKPs.cjs"),c=require("./index-BO82_0q8.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-CwbGrQFa.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-border-[#1f6feb] richtext-bg-[#1f6feb1f]":r==="note","richtext-border-[#238636] richtext-bg-[#2386361f]":r==="tip","richtext-border-[#ab7df8] richtext-bg-[#ab7df81f]":r==="important","richtext-border-[#d29922] richtext-bg-[#d299221f]":r==="warning","richtext-border-[#f85149] richtext-bg-[#f851491f]":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-EoGU7W4e.cjs");require("./clsx-DJURdKPs.cjs");require("./index-BO82_0q8.cjs");require("react/jsx-runtime");require("react");require("./theme.cjs");const e=require("./Callout-C_TXsss3.cjs");exports.Callout=e.Callout;exports.RichTextCallout=e.RichTextCallout;
|
package/lib/Callout.js
CHANGED
|
@@ -1,225 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import "./index-n4kM0Ll-.js";
|
|
2
|
+
import "./clsx-b_2OwHLk.js";
|
|
3
|
+
import "./index-DRcwHivm.js";
|
|
4
|
+
import "react/jsx-runtime";
|
|
5
|
+
import "react";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import {
|
|
8
|
-
import { u as tt } from "./index-DtyAGMbq.js";
|
|
9
|
-
const y = [
|
|
10
|
-
{
|
|
11
|
-
value: "note",
|
|
12
|
-
label: "Note",
|
|
13
|
-
icon: G,
|
|
14
|
-
color: "#1f6feb",
|
|
15
|
-
background: "#1f6feb1f"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
value: "tip",
|
|
19
|
-
label: "Tip",
|
|
20
|
-
icon: J,
|
|
21
|
-
color: "#238636",
|
|
22
|
-
background: "#2386361f"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
value: "important",
|
|
26
|
-
label: "Important",
|
|
27
|
-
icon: Q,
|
|
28
|
-
color: "#ab7df8",
|
|
29
|
-
background: "#ab7df81f"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
value: "warning",
|
|
33
|
-
label: "Warning",
|
|
34
|
-
icon: X,
|
|
35
|
-
color: "#d29922",
|
|
36
|
-
background: "#d299221f"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
value: "caution",
|
|
40
|
-
label: "Caution",
|
|
41
|
-
icon: Z,
|
|
42
|
-
color: "#f85149",
|
|
43
|
-
background: "#f851491f"
|
|
44
|
-
}
|
|
45
|
-
];
|
|
46
|
-
function et({ node: t }) {
|
|
47
|
-
const { type: e = "note", title: a = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
|
|
48
|
-
return /* @__PURE__ */ o(M, { children: /* @__PURE__ */ l(
|
|
49
|
-
"div",
|
|
50
|
-
{
|
|
51
|
-
className: x(
|
|
52
|
-
"richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",
|
|
53
|
-
{
|
|
54
|
-
"richtext-border-[#1f6feb] richtext-bg-[#1f6feb1f]": e === "note",
|
|
55
|
-
"richtext-border-[#238636] richtext-bg-[#2386361f]": e === "tip",
|
|
56
|
-
"richtext-border-[#ab7df8] richtext-bg-[#ab7df81f]": e === "important",
|
|
57
|
-
"richtext-border-[#d29922] richtext-bg-[#d299221f]": e === "warning",
|
|
58
|
-
"richtext-border-[#f85149] richtext-bg-[#f851491f]": e === "caution"
|
|
59
|
-
}
|
|
60
|
-
),
|
|
61
|
-
children: [
|
|
62
|
-
/* @__PURE__ */ l(
|
|
63
|
-
"div",
|
|
64
|
-
{
|
|
65
|
-
className: x("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2", {
|
|
66
|
-
"richtext-text-[#1f6feb]": e === "note",
|
|
67
|
-
"richtext-text-[#238636]": e === "tip",
|
|
68
|
-
"richtext-text-[#ab7df8]": e === "important",
|
|
69
|
-
"richtext-text-[#d29922]": e === "warning",
|
|
70
|
-
"richtext-text-[#f85149]": e === "caution"
|
|
71
|
-
}),
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ o(c, { className: "richtext-size-5" }),
|
|
74
|
-
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: a })
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
),
|
|
78
|
-
n && /* @__PURE__ */ o("p", { className: "richtext-pl-[28px]", children: n })
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
) });
|
|
82
|
-
}
|
|
83
|
-
const ot = [
|
|
84
|
-
{ value: "note", label: "Note", icon: "Info" },
|
|
85
|
-
{ value: "tip", label: "Tip", icon: "Lightbulb" },
|
|
86
|
-
{ value: "important", label: "Important", icon: "AlertCircle" },
|
|
87
|
-
{ value: "warning", label: "Warning", icon: "TriangleAlert" },
|
|
88
|
-
{ value: "caution", label: "Caution", icon: "OctagonAlert" }
|
|
89
|
-
];
|
|
90
|
-
function pt() {
|
|
91
|
-
const { t } = tt(), e = V(), a = P(lt.name), [n, i] = s(!1), [c, d] = s("note"), [h, b] = s(""), [g, f] = s(""), {
|
|
92
|
-
icon: A = void 0,
|
|
93
|
-
tooltip: N = void 0,
|
|
94
|
-
shortcutKeys: L = void 0,
|
|
95
|
-
tooltipOptions: S = {},
|
|
96
|
-
isActive: k = void 0
|
|
97
|
-
} = (a == null ? void 0 : a.componentProps) ?? {}, { dataState: I, disabled: m } = E(k), w = () => {
|
|
98
|
-
e && (e.chain().focus().setCallout({ type: c, title: h, body: g }).run(), i(!1), d("note"), b(""), f(""));
|
|
99
|
-
}, O = () => {
|
|
100
|
-
m || i(!0);
|
|
101
|
-
};
|
|
102
|
-
return a ? /* @__PURE__ */ l(R, { onOpenChange: i, open: n, children: [
|
|
103
|
-
/* @__PURE__ */ o(W, { asChild: !0, children: /* @__PURE__ */ o(
|
|
104
|
-
T,
|
|
105
|
-
{
|
|
106
|
-
action: O,
|
|
107
|
-
dataState: I,
|
|
108
|
-
disabled: m,
|
|
109
|
-
icon: A,
|
|
110
|
-
shortcutKeys: L,
|
|
111
|
-
tooltip: N,
|
|
112
|
-
tooltipOptions: S
|
|
113
|
-
}
|
|
114
|
-
) }),
|
|
115
|
-
/* @__PURE__ */ l(j, { children: [
|
|
116
|
-
/* @__PURE__ */ o(F, { children: t("editor.callout.dialog.title") }),
|
|
117
|
-
/* @__PURE__ */ l("div", { className: "richtext-space-y-4 richtext-py-4", children: [
|
|
118
|
-
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
119
|
-
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.type") }),
|
|
120
|
-
/* @__PURE__ */ l(U, { onValueChange: d, value: c, children: [
|
|
121
|
-
/* @__PURE__ */ o(Y, { children: /* @__PURE__ */ o(_, { placeholder: t("editor.callout.dialog.type.placeholder") }) }),
|
|
122
|
-
/* @__PURE__ */ o($, { children: ot.map((r) => /* @__PURE__ */ o(q, { value: r.value, children: t(`editor.callout.type.${r.value}`) }, r.value)) })
|
|
123
|
-
] })
|
|
124
|
-
] }),
|
|
125
|
-
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
126
|
-
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.title.label") }),
|
|
127
|
-
/* @__PURE__ */ o(
|
|
128
|
-
v,
|
|
129
|
-
{
|
|
130
|
-
onChange: (r) => b(r.target.value),
|
|
131
|
-
placeholder: t("editor.callout.dialog.title.placeholder"),
|
|
132
|
-
value: h
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
] }),
|
|
136
|
-
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
137
|
-
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.body.label") }),
|
|
138
|
-
/* @__PURE__ */ o(
|
|
139
|
-
v,
|
|
140
|
-
{
|
|
141
|
-
onChange: (r) => f(r.target.value),
|
|
142
|
-
placeholder: t("editor.callout.dialog.body.placeholder"),
|
|
143
|
-
value: g
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
] })
|
|
147
|
-
] }),
|
|
148
|
-
/* @__PURE__ */ l(z, { children: [
|
|
149
|
-
/* @__PURE__ */ o(C, { onClick: () => i(!1), variant: "outline", children: t("editor.callout.dialog.button.cancel") }),
|
|
150
|
-
/* @__PURE__ */ o(C, { onClick: w, children: t("editor.callout.dialog.button.apply") })
|
|
151
|
-
] })
|
|
152
|
-
] })
|
|
153
|
-
] }) : /* @__PURE__ */ o(K, {});
|
|
154
|
-
}
|
|
155
|
-
function p(t) {
|
|
156
|
-
return (e) => e.getAttribute(t);
|
|
157
|
-
}
|
|
158
|
-
const lt = /* @__PURE__ */ D.create({
|
|
159
|
-
name: "callout",
|
|
160
|
-
group: "block",
|
|
161
|
-
selectable: !0,
|
|
162
|
-
atom: !0,
|
|
163
|
-
draggable: !0,
|
|
164
|
-
inline: !1,
|
|
165
|
-
//@ts-expect-error
|
|
166
|
-
addOptions() {
|
|
167
|
-
var t;
|
|
168
|
-
return {
|
|
169
|
-
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
170
|
-
HTMLAttributes: {
|
|
171
|
-
class: "callout"
|
|
172
|
-
},
|
|
173
|
-
button: ({ editor: e, t: a }) => ({
|
|
174
|
-
component: T,
|
|
175
|
-
componentProps: {
|
|
176
|
-
action: () => !0,
|
|
177
|
-
isActive: () => e.isActive("callout"),
|
|
178
|
-
disabled: !1,
|
|
179
|
-
icon: "Callout",
|
|
180
|
-
tooltip: a("editor.callout.tooltip")
|
|
181
|
-
}
|
|
182
|
-
})
|
|
183
|
-
};
|
|
184
|
-
},
|
|
185
|
-
parseHTML() {
|
|
186
|
-
return [{ tag: "div.callout" }];
|
|
187
|
-
},
|
|
188
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
189
|
-
return [
|
|
190
|
-
"div",
|
|
191
|
-
H(this.options && this.options.HTMLAttributes || {}, t)
|
|
192
|
-
];
|
|
193
|
-
},
|
|
194
|
-
addAttributes() {
|
|
195
|
-
return {
|
|
196
|
-
type: {
|
|
197
|
-
default: "",
|
|
198
|
-
parseHTML: p("type")
|
|
199
|
-
},
|
|
200
|
-
title: {
|
|
201
|
-
default: "",
|
|
202
|
-
parseHTML: p("title")
|
|
203
|
-
},
|
|
204
|
-
body: {
|
|
205
|
-
default: "",
|
|
206
|
-
parseHTML: p("body")
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
},
|
|
210
|
-
addCommands() {
|
|
211
|
-
return {
|
|
212
|
-
setCallout: (t) => ({ chain: e }) => e().insertContent({
|
|
213
|
-
type: this.name,
|
|
214
|
-
attrs: t
|
|
215
|
-
}).run()
|
|
216
|
-
};
|
|
217
|
-
},
|
|
218
|
-
addNodeView() {
|
|
219
|
-
return B(et);
|
|
220
|
-
}
|
|
221
|
-
});
|
|
7
|
+
import { C, R as e } from "./Callout-B9uXfbP3.js";
|
|
222
8
|
export {
|
|
223
|
-
|
|
224
|
-
|
|
9
|
+
C as Callout,
|
|
10
|
+
e as RichTextCallout
|
|
225
11
|
};
|
package/lib/Clear.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-EoGU7W4e.cjs"),n=require("react/jsx-runtime"),i=require("./index-BO82_0q8.cjs");function v(){const t=i.useButtonProps(s.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:a=void 0,tooltipOptions:u={},action:r=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:c}=i.useActive(l),d=()=>{c||r&&r()};return t?n.jsx(i.ActionButton,{action:d,disabled:c,icon:e,shortcutKeys:a,tooltip:o,tooltipOptions:u}):n.jsx(n.Fragment,{})}const s=p.Node3.create({name:"clear",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:o})=>({componentProps:{action:()=>e.chain().focus().clearNodes().unsetAllMarks().run(),isActive:()=>e.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:o("editor.clear.tooltip")}})}}});exports.Clear=s;exports.RichTextClear=v;
|