reactjs-tiptap-editor 1.0.21 → 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-Cpla3oSm.js → ActionMenuButton-B1067mIC.js} +1 -1
- package/lib/{ActionMenuButton-BVaZBdL3.cjs → ActionMenuButton-BBDqKvKg.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +2 -2
- 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-mb31jDcR.js → Callout-V2mO6s2Y.js} +2 -2
- package/lib/{Callout-JL3mm4GU.cjs → Callout-lBlBlK_w.cjs} +1 -1
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +2 -2
- 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-94nAoli4.cjs → Drawer-BeYo9jAG.cjs} +1 -1
- package/lib/{Drawer-d9e69c7G.js → Drawer-Cyv27orn.js} +2 -2
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +3 -3
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +1 -1
- 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 +4 -4
- 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-qCivhCR5.cjs → Iframe-Bx-VDxSB.cjs} +1 -1
- package/lib/{Iframe-CkUClxtI.js → Iframe-D9JVKzO0.js} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +1 -1
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +1 -1
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +3 -3
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +2 -2
- package/lib/{Indent-BTzj50Sf.js → Indent-B5tQ5Wfg.js} +1 -1
- package/lib/{Indent-DtgugDpq.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-RcbH2O5p.cjs → Katex-rtfVV2pl.cjs} +1 -1
- package/lib/{Katex-BuFwL_MA.js → Katex-w_c6vAMd.js} +3 -3
- 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-DYOmu7jQ.js → LinkEditBlock-CTlU8YnO.js} +3 -3
- package/lib/{LinkEditBlock-CSKh_5n7.cjs → LinkEditBlock-_41zgSyl.cjs} +1 -1
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +3 -3
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +1 -1
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +3 -3
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +3 -3
- package/lib/{SlashCommandNodeView-CYdYVjeb.cjs → SlashCommandNodeView-CVKjpS6r.cjs} +1 -1
- package/lib/{SlashCommandNodeView-CT_-28t6.js → SlashCommandNodeView-DNkpJuM3.js} +2 -2
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-DOl6C6To.cjs → Table-BFiU40iW.cjs} +1 -1
- package/lib/{Table-CEHV8gmO.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-DDuJwWdF.cjs → Twitter-BJjt8vv_.cjs} +1 -1
- package/lib/{Twitter-DxqKzo3U.js → Twitter-CKm0M53B.js} +3 -3
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +2 -2
- package/lib/bubble.cjs +2 -2
- package/lib/bubble.js +25 -17
- package/lib/{dropdown-menu-BYbds8yQ.js → dropdown-menu-AhMKS9PQ.js} +1 -1
- package/lib/{dropdown-menu-CoZZaqv5.cjs → dropdown-menu-Dre693DD.cjs} +1 -1
- package/lib/{index-DirFiHQ6.cjs → index-83hp1lZH.cjs} +1 -1
- package/lib/{index-B1SzsIsE.js → index-BfHAqkoX.js} +1 -1
- 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 +1 -1
- 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-CK54Ip2N.js → popover-B1ptDngu.js} +1 -1
- package/lib/{popover-BaAurWOZ.cjs → popover-D7w_FVSV.cjs} +1 -1
- package/lib/{separator-XZA3-egy.js → separator-CDoF4Z4Z.js} +3 -3
- package/lib/{separator-ByK1SKWn.cjs → separator-C_7KkuoG.cjs} +1 -1
- package/lib/{textarea-mwHtiXJV.cjs → textarea-CEtXap1b.cjs} +1 -1
- package/lib/{textarea--IMIy9VF.js → textarea-CNzZnjjW.js} +1 -1
- package/package.json +1 -1
- package/lib/index-BqL4vAWE.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
1
|
import { N as j, m as P } from "./index-D0EmqTpe.js";
|
|
2
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-
|
|
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
5
|
import { useRef as U, useState as X, useCallback as k, useEffect as q } from "react";
|
|
6
6
|
import "./theme.js";
|
|
7
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-
|
|
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>',
|
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() {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { N as U, m as E } from "./index-D0EmqTpe.js";
|
|
2
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-
|
|
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
4
|
import { jsxs as c, jsx as e, Fragment as X } from "react/jsx-runtime";
|
|
5
5
|
import * as d from "react";
|
|
6
6
|
import { useState as x } from "react";
|
|
7
7
|
import "./theme.js";
|
|
8
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
9
|
import * as a from "@radix-ui/react-select";
|
|
10
|
-
import { u as ot } from "./index-
|
|
10
|
+
import { u as ot } from "./index-DtVRewGA.js";
|
|
11
11
|
const lt = a.Root, nt = a.Value, L = d.forwardRef(({ className: t, children: r, ...i }, o) => /* @__PURE__ */ c(
|
|
12
12
|
a.Trigger,
|
|
13
13
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const S=require("./index-C4WLt4NA.cjs"),p=require("./clsx-DSAWW32g.cjs"),c=require("./index-
|
|
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"});require("./index-C4WLt4NA.cjs");require("./clsx-DSAWW32g.cjs");require("./index-
|
|
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;
|
package/lib/Callout.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./index-D0EmqTpe.js";
|
|
2
2
|
import "./clsx-Bg-2aTKh.js";
|
|
3
|
-
import "./index-
|
|
3
|
+
import "./index-BfHAqkoX.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { C, R as e } from "./Callout-
|
|
7
|
+
import { C, R as e } from "./Callout-V2mO6s2Y.js";
|
|
8
8
|
export {
|
|
9
9
|
C as Callout,
|
|
10
10
|
e as RichTextCallout
|
package/lib/Clear.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-C4WLt4NA.cjs"),n=require("react/jsx-runtime"),i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-C4WLt4NA.cjs"),n=require("react/jsx-runtime"),i=require("./index-83hp1lZH.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;
|
package/lib/Clear.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { N as l } from "./index-D0EmqTpe.js";
|
|
2
2
|
import { jsx as r, Fragment as p } from "react/jsx-runtime";
|
|
3
|
-
import { u as d, e as m, A as f } from "./index-
|
|
3
|
+
import { u as d, e as m, A as f } from "./index-BfHAqkoX.js";
|
|
4
4
|
function x() {
|
|
5
5
|
const o = d(v.name), {
|
|
6
6
|
icon: t = void 0,
|
package/lib/Code.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-C4WLt4NA.cjs"),i=require("react/jsx-runtime"),d=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-C4WLt4NA.cjs"),i=require("react/jsx-runtime"),d=require("./index-83hp1lZH.cjs");require("react");require("./theme.cjs");var h=/(^|[^`])`([^`]+)`(?!`)$/,x=/(^|[^`])`([^`]+)`(?!`)/g,C=o.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",o.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[o.markInputRule({find:h,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:x,type:this.type})]}});function v(){const e=d.useButtonProps(u.name),{icon:t=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:c={},action:s=void 0,isActive:p=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:l,disabled:a,update:m}=d.useToggleActive(p),g=()=>{a||s&&(s(),m())};return e?i.jsx(d.ActionButton,{action:g,dataState:l,disabled:a,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:c}):i.jsx(i.Fragment,{})}const u=C.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:r,extension:n})=>({componentProps:{action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code"),disabled:!t.can().toggleCode(),icon:"Code",shortcutKeys:n.options.shortcutKeys??["mod","E"],tooltip:r("editor.code.tooltip")}})}}});exports.Code=u;exports.RichTextCode=v;
|
package/lib/Code.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as m, f as l, h as g, m as h } from "./index-D0EmqTpe.js";
|
|
2
2
|
import { jsx as a, Fragment as M } from "react/jsx-runtime";
|
|
3
|
-
import { u as v, d as C, A as f } from "./index-
|
|
3
|
+
import { u as v, d as C, A as f } from "./index-BfHAqkoX.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
package/lib/CodeBlock.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("./index-C4WLt4NA.cjs"),J=require("@tiptap/pm/state"),qe=require("@tiptap/pm/view"),Qt=require("./_commonjsHelpers-BTDuMlIz.cjs"),Oe=require("react/jsx-runtime"),Ae=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("./index-C4WLt4NA.cjs"),J=require("@tiptap/pm/state"),qe=require("@tiptap/pm/view"),Qt=require("./_commonjsHelpers-BTDuMlIz.cjs"),Oe=require("react/jsx-runtime"),Ae=require("./index-83hp1lZH.cjs");require("react");require("./theme.cjs");var Ne=4,en=/^```([a-z]+)?[\s\n]$/,tn=/^~~~([a-z]+)?[\s\n]$/,nn=V.Node3.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ne,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:i=>{var f;const{languageClassPrefix:h}=this.options;if(!h)return null;const _=[...((f=i.firstElementChild)==null?void 0:f.classList)||[]].filter(y=>y.startsWith(h)).map(y=>y.replace(h,""))[0];return _||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:i,HTMLAttributes:f}){return["pre",V.mergeAttributes(this.options.HTMLAttributes,f),["code",{class:i.attrs.language?this.options.languageClassPrefix+i.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(i,f)=>{var h,u;return((h=i.raw)==null?void 0:h.startsWith("```"))===!1&&((u=i.raw)==null?void 0:u.startsWith("~~~"))===!1&&i.codeBlockStyle!=="indented"?[]:f.createNode("codeBlock",{language:i.lang||null},i.text?[f.createTextNode(i.text)]:[])},renderMarkdown:(i,f)=>{var h;let u="";const E=((h=i.attrs)==null?void 0:h.language)||"";return i.content?u=[`\`\`\`${E}`,f.renderChildren(i.content),"```"].join(`
|
|
2
2
|
`):u=`\`\`\`${E}
|
|
3
3
|
|
|
4
4
|
\`\`\``,u},addCommands(){return{setCodeBlock:i=>({commands:f})=>f.setNode(this.name,i),toggleCodeBlock:i=>({commands:f})=>f.toggleNode(this.name,"paragraph",i)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:i,$anchor:f}=this.editor.state.selection,h=f.pos===1;return!i||f.parent.type.name!==this.name?!1:h||!f.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:i})=>{var f;if(!this.options.enableTabIndentation)return!1;const h=(f=this.options.tabSize)!=null?f:Ne,{state:u}=i,{selection:E}=u,{$from:_,empty:y}=E;if(_.parent.type!==this.type)return!1;const M=" ".repeat(h);return y?i.commands.insertContent(M):i.commands.command(({tr:A})=>{const{from:v,to:P}=E,B=u.doc.textBetween(v,P,`
|
package/lib/CodeBlock.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Plugin as Ve, PluginKey as qe, TextSelection as Ke, Selection as tn } f
|
|
|
3
3
|
import { Decoration as nn, DecorationSet as rn } from "@tiptap/pm/view";
|
|
4
4
|
import { g as sn } from "./_commonjsHelpers-B4e78b8K.js";
|
|
5
5
|
import { jsx as Xe, Fragment as on } from "react/jsx-runtime";
|
|
6
|
-
import { u as an, d as cn, A as ln } from "./index-
|
|
6
|
+
import { u as an, d as cn, A as ln } from "./index-BfHAqkoX.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "./theme.js";
|
|
9
9
|
var ye = 4, un = /^```([a-z]+)?[\s\n]$/, fn = /^~~~([a-z]+)?[\s\n]$/, gn = Qt.create({
|
package/lib/CodeView.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-C4WLt4NA.cjs"),n=require("react/jsx-runtime"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-C4WLt4NA.cjs"),n=require("react/jsx-runtime"),c=require("./index-83hp1lZH.cjs");require("react");require("./theme.cjs");function v(){const e=c.useButtonProps(a.name),{icon:t=void 0,tooltip:o=void 0,shortcutKeys:i=void 0,tooltipOptions:d={},action:s=void 0,isActive:u=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:l,disabled:r,update:p}=c.useToggleActive(u),g=()=>{r||s&&(s(),p())};return e?n.jsx(c.ActionButton,{action:g,dataState:l,disabled:r,icon:t,shortcutKeys:i,tooltip:o,tooltipOptions:d}):n.jsx(n.Fragment,{})}const a=m.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const i=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${i}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=a;exports.RichTextCodeView=v;
|
package/lib/CodeView.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { E as l } from "./index-D0EmqTpe.js";
|
|
2
2
|
import { jsx as c, Fragment as g } from "react/jsx-runtime";
|
|
3
|
-
import { u, d as v, A as w } from "./index-
|
|
3
|
+
import { u, d as v, A as w } from "./index-BfHAqkoX.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
function h() {
|
package/lib/Color.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-DlxZt4_j.cjs"),t=require("react/jsx-runtime"),h=require("react"),l=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-DlxZt4_j.cjs"),t=require("react/jsx-runtime"),h=require("react"),l=require("./index-83hp1lZH.cjs"),g=require("./separator-C_7KkuoG.cjs");require("./theme.cjs");function v({fill:e}){return t.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 240 240",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:t.jsx("g",{transform:"translate(0.000000, 0.500000)",children:t.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[t.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:typeof e=="string"?e:"#000",fillRule:"evenodd"}),t.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor",fillRule:"nonzero"}),t.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor",fillRule:"nonzero"})]})})})})}function j(){const e=l.useButtonProps(C.name),{tooltip:o=void 0,isActive:s=void 0,defaultColor:r=void 0,colors:n,action:i}=(e==null?void 0:e.componentProps)??{},{disabled:c,dataState:u}=l.useActive(s),[f,a]=h.useState(r);h.useEffect(()=>{a(u)},[u]);function x(d){c||i&&(i==null||i(d),a(d))}return e?t.jsx(g.ColorPicker,{colors:n,disabled:c,onChange:x,value:f,children:t.jsx(l.ActionButton,{disabled:c,tooltip:o,children:t.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[t.jsx(v,{fill:u}),t.jsx(l.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):t.jsx(t.Fragment,{})}const C=p.Color.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:o,t:s,extension:r}){return{componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{if(typeof n=="string"){o.storage.color.currentColor=n,o.chain().focus().setColor(n).run();return}o.chain().focus().unsetColor().run()},isActive:()=>{const{color:n}=o.getAttributes("textStyle");return n},disabled:!1,shortcutKeys:r.options.shortcutKeys??["⇧","alt","C"],tooltip:s("editor.color.tooltip")}}}}},addKeyboardShortcuts(){var e;return{...(e=this.parent)==null?void 0:e.call(this),"Alt-Shift-c":()=>{const o=this.storage.currentColor||this.options.defaultColor;if(!o){const{color:r}=this.editor.getAttributes("textStyle");return r?this.editor.chain().focus().unsetColor().run():!1}return this.editor.isActive("textStyle",{color:o})?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().setColor(o).run()}}}});exports.Color=C;exports.RichTextColor=j;
|
package/lib/Color.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { C as d } from "./index-CbkpBnTX.js";
|
|
2
2
|
import { jsx as o, jsxs as h, Fragment as p } from "react/jsx-runtime";
|
|
3
3
|
import { useState as x, useEffect as m } from "react";
|
|
4
|
-
import { u as g, e as v, A as L, I as A } from "./index-
|
|
5
|
-
import { C as y } from "./separator-
|
|
4
|
+
import { u as g, e as v, A as L, I as A } from "./index-BfHAqkoX.js";
|
|
5
|
+
import { C as y } from "./separator-CDoF4Z4Z.js";
|
|
6
6
|
import "./theme.js";
|
|
7
7
|
function S({ fill: t }) {
|
|
8
8
|
return /* @__PURE__ */ o(
|
package/lib/Column.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-C4WLt4NA.cjs"),x=require("@tiptap/pm/state"),A=require("@tiptap/pm/model"),f=require("react/jsx-runtime"),h=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-C4WLt4NA.cjs"),x=require("@tiptap/pm/state"),A=require("@tiptap/pm/model"),f=require("react/jsx-runtime"),h=require("./index-83hp1lZH.cjs");require("react");require("./theme.cjs");function v(e,t,r=null){return r?e.createChecked({index:t},r):e.createAndFill({index:t})}function M(e){if(e.cached.columnsNodeTypes)return e.cached.columnsNodeTypes;const t={columns:e.nodes.columns,column:e.nodes.column};return e.cached.columnsNodeTypes=t,t}function H(e,t,r=null){const n=M(e),c=[];for(let o=0;o<t;o+=1){const s=v(n.column,o,r);s&&c.push(s)}return n.columns.createChecked({cols:t},c)}function C({state:e,dispatch:t,type:r}){const n=u.findParentNode(o=>o.type.name===b.name)(e.selection),c=u.findParentNode(o=>o.type.name===T.name)(e.selection);if(t&&n&&c){const o=n.node,s=c.node.attrs.index,i=o.toJSON();let l=s;r==="delete"?(l=s-1,i.content.splice(s,1)):(l=r==="addBefore"?s:s+1,i.content.splice(l,0,{type:"column",attrs:{index:s},content:[{type:"paragraph"}]})),i.attrs.cols=i.content.length,i.content.forEach((m,y)=>{m.attrs.index=y});const d=A.Node.fromJSON(e.schema,i);let a=n.pos;d.content.forEach((m,y,N)=>{N<l&&(a+=m.nodeSize)});const p=e.tr.setTime(Date.now());p.replaceWith(n.pos,n.pos+n.node.nodeSize,d).setSelection(x.TextSelection.near(p.doc.resolve(a))),t(p)}return!0}function S({state:e,dispatch:t,type:r}){const n=u.findParentNode(o=>o.type.name===b.name)(e.selection),c=u.findParentNode(o=>o.type.name===T.name)(e.selection);if(t&&n&&c){const o=n.node,s=c.node.attrs.index;let i=0;r==="before"?i=(s-1+o.attrs.cols)%o.attrs.cols:i=(s+1)%o.attrs.cols;let l=n.pos;o.content.forEach((a,p,m)=>{m<i&&(l+=a.nodeSize)});const d=e.tr.setTime(Date.now());return d.setSelection(x.TextSelection.near(d.doc.resolve(l))),t(d),!0}return!1}function O(){const e=h.useButtonProps(g.name),{icon:t=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:c={},action:o=void 0,isActive:s=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:i,disabled:l,update:d}=h.useToggleActive(s),a=()=>{l||o&&(o(),d())};return e?f.jsx(h.ActionButton,{action:a,dataState:i,disabled:l,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:c}):f.jsx(f.Fragment,{})}const I=200,g=u.Extension.create({name:"richtextColumnExtension",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:r})=>({componentProps:{action:()=>{t.chain().focus().insertColumns({cols:2}).run()},icon:"Columns",tooltip:r("editor.columns.tooltip")}})}}}),T=u.Node3.create({name:"column",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"column"}}},addAttributes(){return{index:{default:0,parseHTML:e=>e.getAttribute("index")}}},parseHTML(){return[{tag:"div[class=column]"}]},renderHTML({HTMLAttributes:e}){return["div",u.mergeAttributes(this.options.HTMLAttributes,e),0]}}),b=u.Node3.create({name:"columns",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"column{1,}",priority:I,addOptions(){return{HTMLAttributes:{class:"columns"}}},addAttributes(){return{cols:{default:2,parseHTML:e=>e.getAttribute("cols")}}},parseHTML(){return[{tag:"div[class=grid]"}]},renderHTML({HTMLAttributes:e}){return["div",u.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{insertColumns:e=>({tr:t,dispatch:r,editor:n})=>{const c=H(n.schema,e&&e.cols||3);if(r){const o=t.selection.anchor+1;t.replaceSelectionWith(c).scrollIntoView().setSelection(x.TextSelection.near(t.doc.resolve(o)))}return!0},addColBefore:()=>({dispatch:e,state:t})=>C({dispatch:e,state:t,type:"addBefore"}),addColAfter:()=>({dispatch:e,state:t})=>C({dispatch:e,state:t,type:"addAfter"}),deleteCol:()=>({dispatch:e,state:t})=>C({dispatch:e,state:t,type:"delete"})}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertColumns(),Tab:()=>S({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"after"}),"Shift-Tab":()=>S({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"before"})}}});exports.Column=g;exports.ColumnNode=T;exports.MultipleColumnNode=b;exports.RichTextColumn=O;
|
package/lib/Column.js
CHANGED
|
@@ -2,7 +2,7 @@ import { j as p, E as v, N as b, m as y } from "./index-D0EmqTpe.js";
|
|
|
2
2
|
import { TextSelection as h } from "@tiptap/pm/state";
|
|
3
3
|
import { Node as N } from "@tiptap/pm/model";
|
|
4
4
|
import { jsx as T, Fragment as H } from "react/jsx-runtime";
|
|
5
|
-
import { u as M, d as L, A as O } from "./index-
|
|
5
|
+
import { u as M, d as L, A as O } from "./index-BfHAqkoX.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "./theme.js";
|
|
8
8
|
function E(e, t, r = null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const F=require("./index-C4WLt4NA.cjs"),i=require("./index-DirFiHQ6.cjs"),U=require("./clsx-DSAWW32g.cjs"),e=require("react/jsx-runtime"),g=require("react"),B=require("./index-BqL4vAWE.cjs"),m=require("easydrawer"),G=require("./shortId-Bfj8TyNr.cjs"),R={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Q({editor:t,node:o,updateAttributes:r,getPos:s,selected:f}){const[M,H]=g.useState({width:B.IMAGE_MAX_SIZE,height:B.IMAGE_MAX_SIZE}),[w,u]=g.useState({width:0,height:0}),[k]=g.useState([R.TOP_LEFT,R.TOP_RIGHT,R.BOTTOM_LEFT,R.BOTTOM_RIGHT]),[j,A]=g.useState(!1),[c,h]=g.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=o==null?void 0:o.attrs,C=g.useMemo(()=>{const{src:d,alt:y,width:S,height:N}=o==null?void 0:o.attrs,_=F.isNumber(S)?`${S}px`:S,v=F.isNumber(N)?`${N}px`:N;return{src:d||void 0,alt:y||void 0,style:{width:_||void 0,height:v||void 0}}},[o==null?void 0:o.attrs]),n=g.useMemo(()=>{const{style:{width:d}}=C;return{width:d==="100%"?d:void 0}},[C]);function D(d){u({width:d.target.width,height:d.target.height})}const z=g.useCallback(()=>{t.commands.setNodeSelection(s())},[]),I=g.useCallback(i.throttle(()=>{const{width:d}=getComputedStyle(t.view.dom);H(y=>({...y,width:Number.parseInt(d,10)}))},B.IMAGE_THROTTLE_WAIT_TIME),[t]);function W(d,y){d.preventDefault(),d.stopPropagation();const S=w.width,N=w.height,_=S/N;let v=Number(o.attrs.width),E=Number(o.attrs.height);const b=M.width;v&&!E?(v=v>b?b:v,E=Math.round(v/_)):E&&!v?(v=Math.round(E*_),v=v>b?b:v):!v&&!E?(v=S>b?b:S,E=Math.round(v/_)):v=v>b?b:v,A(!0),h({x:d.clientX,y:d.clientY,w:v,h:E,dir:y})}const p=g.useCallback(i.throttle(d=>{if(d.preventDefault(),d.stopPropagation(),!j)return;const{x:y,w:S,dir:N}=c,_=(d.clientX-y)*(/l/.test(N)?-1:1),{width:v,height:E}=o==null?void 0:o.attrs,b=v/E,V=i.clamp(S+_,B.IMAGE_MIN_SIZE,M.width),K=Math.round(V/b);r({width:V,height:K})},B.IMAGE_THROTTLE_WAIT_TIME),[j,c,M,r,o==null?void 0:o.attrs]),a=g.useCallback(d=>{d.preventDefault(),d.stopPropagation(),j&&(h({x:0,y:0,w:0,h:0,dir:""}),A(!1),z())},[j,z]),x=g.useCallback(()=>{document==null||document.addEventListener("mousemove",p,!0),document==null||document.addEventListener("mouseup",a,!0)},[p,a]),L=g.useCallback(()=>{document==null||document.removeEventListener("mousemove",p,!0),document==null||document.removeEventListener("mouseup",a,!0)},[p,a]);g.useEffect(()=>(j?x():L(),()=>{L()}),[j,x,L]);const q=g.useMemo(()=>new ResizeObserver(()=>I()),[I]);return g.useEffect(()=>(q.observe(t.view.dom),()=>{q.disconnect()}),[t.view.dom,q]),e.jsx(U.NodeViewWrapper,{className:"image-view",style:{...n,width:"100%",textAlign:T},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...n,background:"#fff"},className:`image-view__body ${f?"image-view__body--focused":""} ${j?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:C.alt,className:"image-view__body__image block",height:"auto",onClick:z,onLoad:D,src:C.src,style:C.style}),t.view.editable&&(f||j)&&e.jsx("div",{className:"image-resizer",children:k==null?void 0:k.map(d=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${d}`,onMouseDown:y=>W(y,d)},`image-dir-${d}`))})]})})}function Y(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function J(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function ee(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function oe(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function re(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function le(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function ie(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function ae(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function he(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function ue(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function pe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const ve="_wrapper_pva9d_1",Ce="_tool_pva9d_17",fe="_active_pva9d_37",Te="_pen_pva9d_41",je="_line_pva9d_48",be="_options_pva9d_56",Me="_colorWrap_pva9d_66",ye="_color_pva9d_66",Se="_colorActive_pva9d_83",l={wrapper:ve,tool:Ce,active:fe,pen:Te,line:je,options:be,colorWrap:Me,color:ye,colorActive:Se},Ee=[m.Color4.blackHighlight,m.Color4.ofRGBA(166/255,81/255,167/255,.3),m.Color4.ofRGBA(247/255,78/255,158/255,.3),m.Color4.ofRGBA(166/255,83/255,88/255,.3),m.Color4.ofRGBA(246/255,130/255,28/255,.3),m.Color4.ofRGBA(166/255,198/255,0,.3),m.Color4.ofRGBA(98/255,186/255,70/255,.3)],$=[m.Color4.black,m.Color4.fromHex("#007AFF"),m.Color4.fromHex("#A651A7"),m.Color4.fromHex("#F74E9E"),m.Color4.fromHex("#FF5358"),m.Color4.fromHex("#F6821C"),m.Color4.fromHex("#FFC600"),m.Color4.fromHex("#62BA46"),m.Color4.fromHex("#E6BFE8"),m.Color4.fromHex("#FEA3D2"),m.Color4.fromHex("#FFA0A3"),m.Color4.fromHex("#FBC276"),m.Color4.fromHex("#FFFB85"),m.Color4.fromHex("#AADC99")];function He({onChange:t}){const[o,r]=g.useState(m.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:Ee.map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))})}function O({onChange:t}){const[o,r]=g.useState(m.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:$.slice(0,7).map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))}),e.jsx("div",{className:l.colorWrap,children:$.slice(7).map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))})]})}function ke({setColorPen:t,setThicknessPen:o}){const[r,s]=g.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(O,{onChange:f=>t(f)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:r,onChange:f=>{o(Number.parseFloat(f.target.value)),s(Number.parseFloat(f.target.value))}})})]})}function Le({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(He,{onChange:o=>t(o)})})}function Ne({changeColorShape:t,changeBorderColorShape:o,onThicknessChange:r}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(O,{onChange:s=>t(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx(O,{onChange:s=>o(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:s=>{r(Number.parseFloat(s.target.value))}})})]})}function Z(t){const{setColorPen:o,refEditor:r,setThicknessPen:s,setColorHighlight:f,changeBorderColorShape:M,onUndo:H,changeColorShape:w,changeShape:u,onThicknessChange:k,onRedo:j,onClear:A}=t,[c,h]=g.useState(null),[T,C]=g.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="select"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="select"){h(null),n[0].setEnabled(!1);return}h("select"),n[0].setEnabled(!0)},children:e.jsx(Y,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="text"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(r.current.toolController.setToolEnabled(n[1]),c==="text"){n[1].setEnabled(!1),h(null);return}h("text"),n[1].setEnabled(!0)},children:e.jsx(J,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="pencil"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="pencil"){h(null),n[2].setEnabled(!1);return}h("pencil"),n[2].setEnabled(!0)},children:e.jsx(ee,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="highlighter"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="highlighter"){h(null),n[3].setEnabled(!1);return}h("highlighter"),n[3].setEnabled(!0)},children:e.jsx(te,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="eraser"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="eraser"){h(null),n[4].setEnabled(!1);return}h("eraser"),n[4].setEnabled(!0)},children:e.jsx(oe,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===0}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(0),C(0)},children:e.jsx(re,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===1}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(1),C(1)},children:e.jsx(le,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===2}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(2),C(2)},children:e.jsx(ne,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===3}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(3),C(3)},children:e.jsx(se,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===4}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(4),C(4)},children:e.jsx(ie,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===5}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(5),C(5)},children:e.jsx(ae,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===6}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(6),C(6)},children:e.jsx(ce,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===7}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(7),C(7)},children:e.jsx(ge,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===8}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(8),C(8)},children:e.jsx(me,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===9}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(9),C(9)},children:e.jsx(pe,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===10}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(10),C(10)},children:e.jsx(xe,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===11}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(11),C(11)},children:e.jsx(we,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool),onClick:H,children:e.jsx(he,{})}),e.jsx("button",{className:i.cn(l.tool),onClick:j,children:e.jsx(ue,{})}),e.jsx("button",{className:i.cn(l.tool),onClick:A,children:e.jsx(de,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[c==="pencil"&&e.jsx(ke,{setColorPen:o,setThicknessPen:s}),c==="highlighter"&&e.jsx(Le,{setColorHighlight:f}),c==="shapes"&&e.jsx(Ne,{changeBorderColorShape:M,changeColorShape:w,changeShape:u,onThicknessChange:k})]})]})})}let P=!1;function _e(){const t=i.useEditorInstance(),o=i.useButtonProps(X.name),{isActive:r=void 0,upload:s}=(o==null?void 0:o.componentProps)??{},{editorDisabled:f}=i.useToggleActive(r),[M,H]=g.useState(!1),w=g.useRef(null),u=g.useRef(null),k=()=>{(async()=>{const a=document.querySelector("#easydrawer");a&&(w.current=new m.Editor(a,{wheelEventsEnabled:!1,disableZoom:!0}),u.current=m.makeDropdownToolbar(w.current),u.current.addDefaultToolWidgets())})()};g.useEffect(()=>{M&&setTimeout(()=>{k()},200)},[M]);const j=async()=>{if(w.current){const p=w.current.toSVG(),a=p.outerHTML,x=`drawer-${G.shortId()}.svg`;let L=G.i(p.outerHTML);if(s){const q=i.dataURLtoFile(L,x);L=await s(q)}t==null||t.chain().focus().setDrawer({type:"drawer",src:L,alt:encodeURIComponent(a),width:426,height:212},!!a).run()}H(!1)},A=p=>{const a=w.current.toolController.getPrimaryTools()[2],x=u.current.getWidgetById("pen-1");a&&x&&(a.setColor(p),x.serializeState())},c=p=>{const a=w.current.toolController.getPrimaryTools()[2],x=u.current.getWidgetById("pen-1");a&&x&&(a.setThickness(p),x.serializeState())},h=p=>{const a=w.current.toolController.getPrimaryTools()[3],x=u.current.getWidgetById("pen-2");a&&x&&(a.setColor(p),x.serializeState())},T=p=>{const a=u.current.getWidgetById("shape");a&&a.setShapeType(p)},C=p=>{const a=w.current.toolController.getPrimaryTools()[5],x=u.current.getWidgetById("shape");a&&x&&(a.setColor(p),x.serializeState())},n=p=>{const a=w.current.toolController.getPrimaryTools()[5],x=u.current.getWidgetById("shape");a&&x&&(a.setThickness(p),x.serializeState())},D=p=>{const a=w.current.toolController.getPrimaryTools()[5],x=u.current.getWidgetById("shape");a&&x&&(a.setBorderColor(p),x.serializeState())},z=()=>{if(P){for(;w.current.history.redoStackSize>0;)w.current.history.redo();P=!1;return}w.current.history.undo()},I=()=>{P||w.current.history.redo()},W=()=>{if(!P){for(;w.current.history.undoStackSize>0;)z();P=!0}};return o?e.jsxs(i.Dialog,{onOpenChange:H,open:M,children:[e.jsx(i.DialogTrigger,{asChild:!0,children:e.jsx(i.ActionButton,{disabled:f,action:()=>{f||H(!0)},icon:"PencilRuler",tooltip:"Drawer"})}),e.jsxs(i.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(i.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(Z,{changeBorderColorShape:D,changeColorShape:C,changeShape:T,onClear:W,onRedo:I,onThicknessChange:n,onUndo:z,refEditor:w,setColorHighlight:h,setColorPen:A,setThicknessPen:c})]}),e.jsx(i.DialogFooter,{children:e.jsx(i.Button,{onClick:j,type:"button",children:"Save changes"})})]})]}):e.jsx(e.Fragment,{})}const X=i.index_default.extend({name:"richTextDrawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({t:o,extension:r})=>{var s;return{componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,icon:"PencilRuler",tooltip:o("editor.drawer.tooltip"),upload:(s=r==null?void 0:r.options)==null?void 0:s.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("width");return s?Number.parseInt(s,10):320},renderHTML:o=>({width:o.width})},height:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("height");return s?Number.parseInt(s,10):212},renderHTML:o=>({height:o.height})},align:{default:"center",parseHTML:o=>o.getAttribute("align"),renderHTML:o=>({align:o.align})}}},addNodeView(){return U.ReactNodeViewRenderer(Q)},addCommands(){return{setDrawer:(t,o)=>({commands:r,editor:s})=>o?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(s.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:o})=>o.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:o}=t;return["div",{style:o?`text-align: ${o};`:"",class:"imageDrawer"},["img",F.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const o=t.querySelector("img"),r=o==null?void 0:o.getAttribute("width"),s=o==null?void 0:o.getAttribute("height");return{src:o==null?void 0:o.getAttribute("src"),alt:o==null?void 0:o.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:s?Number.parseInt(s,10):null,align:(o==null?void 0:o.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=Z;exports.Drawer=X;exports.RichTextDrawer=_e;
|
|
1
|
+
"use strict";const F=require("./index-C4WLt4NA.cjs"),i=require("./index-83hp1lZH.cjs"),U=require("./clsx-DSAWW32g.cjs"),e=require("react/jsx-runtime"),g=require("react"),B=require("./index-C4aGVY2E.cjs"),m=require("easydrawer"),G=require("./shortId-Bfj8TyNr.cjs"),R={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Q({editor:t,node:o,updateAttributes:r,getPos:s,selected:f}){const[M,H]=g.useState({width:B.IMAGE_MAX_SIZE,height:B.IMAGE_MAX_SIZE}),[w,u]=g.useState({width:0,height:0}),[k]=g.useState([R.TOP_LEFT,R.TOP_RIGHT,R.BOTTOM_LEFT,R.BOTTOM_RIGHT]),[j,A]=g.useState(!1),[c,h]=g.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=o==null?void 0:o.attrs,C=g.useMemo(()=>{const{src:d,alt:y,width:S,height:N}=o==null?void 0:o.attrs,_=F.isNumber(S)?`${S}px`:S,v=F.isNumber(N)?`${N}px`:N;return{src:d||void 0,alt:y||void 0,style:{width:_||void 0,height:v||void 0}}},[o==null?void 0:o.attrs]),n=g.useMemo(()=>{const{style:{width:d}}=C;return{width:d==="100%"?d:void 0}},[C]);function D(d){u({width:d.target.width,height:d.target.height})}const z=g.useCallback(()=>{t.commands.setNodeSelection(s())},[]),I=g.useCallback(i.throttle(()=>{const{width:d}=getComputedStyle(t.view.dom);H(y=>({...y,width:Number.parseInt(d,10)}))},B.IMAGE_THROTTLE_WAIT_TIME),[t]);function W(d,y){d.preventDefault(),d.stopPropagation();const S=w.width,N=w.height,_=S/N;let v=Number(o.attrs.width),E=Number(o.attrs.height);const b=M.width;v&&!E?(v=v>b?b:v,E=Math.round(v/_)):E&&!v?(v=Math.round(E*_),v=v>b?b:v):!v&&!E?(v=S>b?b:S,E=Math.round(v/_)):v=v>b?b:v,A(!0),h({x:d.clientX,y:d.clientY,w:v,h:E,dir:y})}const p=g.useCallback(i.throttle(d=>{if(d.preventDefault(),d.stopPropagation(),!j)return;const{x:y,w:S,dir:N}=c,_=(d.clientX-y)*(/l/.test(N)?-1:1),{width:v,height:E}=o==null?void 0:o.attrs,b=v/E,V=i.clamp(S+_,B.IMAGE_MIN_SIZE,M.width),K=Math.round(V/b);r({width:V,height:K})},B.IMAGE_THROTTLE_WAIT_TIME),[j,c,M,r,o==null?void 0:o.attrs]),a=g.useCallback(d=>{d.preventDefault(),d.stopPropagation(),j&&(h({x:0,y:0,w:0,h:0,dir:""}),A(!1),z())},[j,z]),x=g.useCallback(()=>{document==null||document.addEventListener("mousemove",p,!0),document==null||document.addEventListener("mouseup",a,!0)},[p,a]),L=g.useCallback(()=>{document==null||document.removeEventListener("mousemove",p,!0),document==null||document.removeEventListener("mouseup",a,!0)},[p,a]);g.useEffect(()=>(j?x():L(),()=>{L()}),[j,x,L]);const q=g.useMemo(()=>new ResizeObserver(()=>I()),[I]);return g.useEffect(()=>(q.observe(t.view.dom),()=>{q.disconnect()}),[t.view.dom,q]),e.jsx(U.NodeViewWrapper,{className:"image-view",style:{...n,width:"100%",textAlign:T},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...n,background:"#fff"},className:`image-view__body ${f?"image-view__body--focused":""} ${j?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:C.alt,className:"image-view__body__image block",height:"auto",onClick:z,onLoad:D,src:C.src,style:C.style}),t.view.editable&&(f||j)&&e.jsx("div",{className:"image-resizer",children:k==null?void 0:k.map(d=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${d}`,onMouseDown:y=>W(y,d)},`image-dir-${d}`))})]})})}function Y(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function J(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function ee(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function oe(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function re(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function le(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function ie(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function ae(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function he(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function ue(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function pe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const ve="_wrapper_pva9d_1",Ce="_tool_pva9d_17",fe="_active_pva9d_37",Te="_pen_pva9d_41",je="_line_pva9d_48",be="_options_pva9d_56",Me="_colorWrap_pva9d_66",ye="_color_pva9d_66",Se="_colorActive_pva9d_83",l={wrapper:ve,tool:Ce,active:fe,pen:Te,line:je,options:be,colorWrap:Me,color:ye,colorActive:Se},Ee=[m.Color4.blackHighlight,m.Color4.ofRGBA(166/255,81/255,167/255,.3),m.Color4.ofRGBA(247/255,78/255,158/255,.3),m.Color4.ofRGBA(166/255,83/255,88/255,.3),m.Color4.ofRGBA(246/255,130/255,28/255,.3),m.Color4.ofRGBA(166/255,198/255,0,.3),m.Color4.ofRGBA(98/255,186/255,70/255,.3)],$=[m.Color4.black,m.Color4.fromHex("#007AFF"),m.Color4.fromHex("#A651A7"),m.Color4.fromHex("#F74E9E"),m.Color4.fromHex("#FF5358"),m.Color4.fromHex("#F6821C"),m.Color4.fromHex("#FFC600"),m.Color4.fromHex("#62BA46"),m.Color4.fromHex("#E6BFE8"),m.Color4.fromHex("#FEA3D2"),m.Color4.fromHex("#FFA0A3"),m.Color4.fromHex("#FBC276"),m.Color4.fromHex("#FFFB85"),m.Color4.fromHex("#AADC99")];function He({onChange:t}){const[o,r]=g.useState(m.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:Ee.map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))})}function O({onChange:t}){const[o,r]=g.useState(m.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:$.slice(0,7).map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))}),e.jsx("div",{className:l.colorWrap,children:$.slice(7).map((s,f)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},f))})]})}function ke({setColorPen:t,setThicknessPen:o}){const[r,s]=g.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(O,{onChange:f=>t(f)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:r,onChange:f=>{o(Number.parseFloat(f.target.value)),s(Number.parseFloat(f.target.value))}})})]})}function Le({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(He,{onChange:o=>t(o)})})}function Ne({changeColorShape:t,changeBorderColorShape:o,onThicknessChange:r}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(O,{onChange:s=>t(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx(O,{onChange:s=>o(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:s=>{r(Number.parseFloat(s.target.value))}})})]})}function Z(t){const{setColorPen:o,refEditor:r,setThicknessPen:s,setColorHighlight:f,changeBorderColorShape:M,onUndo:H,changeColorShape:w,changeShape:u,onThicknessChange:k,onRedo:j,onClear:A}=t,[c,h]=g.useState(null),[T,C]=g.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="select"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="select"){h(null),n[0].setEnabled(!1);return}h("select"),n[0].setEnabled(!0)},children:e.jsx(Y,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="text"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(r.current.toolController.setToolEnabled(n[1]),c==="text"){n[1].setEnabled(!1),h(null);return}h("text"),n[1].setEnabled(!0)},children:e.jsx(J,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="pencil"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="pencil"){h(null),n[2].setEnabled(!1);return}h("pencil"),n[2].setEnabled(!0)},children:e.jsx(ee,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="highlighter"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="highlighter"){h(null),n[3].setEnabled(!1);return}h("highlighter"),n[3].setEnabled(!0)},children:e.jsx(te,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="eraser"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(c==="eraser"){h(null),n[4].setEnabled(!1);return}h("eraser"),n[4].setEnabled(!0)},children:e.jsx(oe,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===0}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(0),C(0)},children:e.jsx(re,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===1}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(1),C(1)},children:e.jsx(le,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===2}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(2),C(2)},children:e.jsx(ne,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===3}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(3),C(3)},children:e.jsx(se,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===4}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(4),C(4)},children:e.jsx(ie,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===5}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(5),C(5)},children:e.jsx(ae,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===6}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(6),C(6)},children:e.jsx(ce,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===7}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(7),C(7)},children:e.jsx(ge,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===8}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(8),C(8)},children:e.jsx(me,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===9}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(9),C(9)},children:e.jsx(pe,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===10}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(10),C(10)},children:e.jsx(xe,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:c==="shapes"&&T===11}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),u(11),C(11)},children:e.jsx(we,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool),onClick:H,children:e.jsx(he,{})}),e.jsx("button",{className:i.cn(l.tool),onClick:j,children:e.jsx(ue,{})}),e.jsx("button",{className:i.cn(l.tool),onClick:A,children:e.jsx(de,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[c==="pencil"&&e.jsx(ke,{setColorPen:o,setThicknessPen:s}),c==="highlighter"&&e.jsx(Le,{setColorHighlight:f}),c==="shapes"&&e.jsx(Ne,{changeBorderColorShape:M,changeColorShape:w,changeShape:u,onThicknessChange:k})]})]})})}let P=!1;function _e(){const t=i.useEditorInstance(),o=i.useButtonProps(X.name),{isActive:r=void 0,upload:s}=(o==null?void 0:o.componentProps)??{},{editorDisabled:f}=i.useToggleActive(r),[M,H]=g.useState(!1),w=g.useRef(null),u=g.useRef(null),k=()=>{(async()=>{const a=document.querySelector("#easydrawer");a&&(w.current=new m.Editor(a,{wheelEventsEnabled:!1,disableZoom:!0}),u.current=m.makeDropdownToolbar(w.current),u.current.addDefaultToolWidgets())})()};g.useEffect(()=>{M&&setTimeout(()=>{k()},200)},[M]);const j=async()=>{if(w.current){const p=w.current.toSVG(),a=p.outerHTML,x=`drawer-${G.shortId()}.svg`;let L=G.i(p.outerHTML);if(s){const q=i.dataURLtoFile(L,x);L=await s(q)}t==null||t.chain().focus().setDrawer({type:"drawer",src:L,alt:encodeURIComponent(a),width:426,height:212},!!a).run()}H(!1)},A=p=>{const a=w.current.toolController.getPrimaryTools()[2],x=u.current.getWidgetById("pen-1");a&&x&&(a.setColor(p),x.serializeState())},c=p=>{const a=w.current.toolController.getPrimaryTools()[2],x=u.current.getWidgetById("pen-1");a&&x&&(a.setThickness(p),x.serializeState())},h=p=>{const a=w.current.toolController.getPrimaryTools()[3],x=u.current.getWidgetById("pen-2");a&&x&&(a.setColor(p),x.serializeState())},T=p=>{const a=u.current.getWidgetById("shape");a&&a.setShapeType(p)},C=p=>{const a=w.current.toolController.getPrimaryTools()[5],x=u.current.getWidgetById("shape");a&&x&&(a.setColor(p),x.serializeState())},n=p=>{const a=w.current.toolController.getPrimaryTools()[5],x=u.current.getWidgetById("shape");a&&x&&(a.setThickness(p),x.serializeState())},D=p=>{const a=w.current.toolController.getPrimaryTools()[5],x=u.current.getWidgetById("shape");a&&x&&(a.setBorderColor(p),x.serializeState())},z=()=>{if(P){for(;w.current.history.redoStackSize>0;)w.current.history.redo();P=!1;return}w.current.history.undo()},I=()=>{P||w.current.history.redo()},W=()=>{if(!P){for(;w.current.history.undoStackSize>0;)z();P=!0}};return o?e.jsxs(i.Dialog,{onOpenChange:H,open:M,children:[e.jsx(i.DialogTrigger,{asChild:!0,children:e.jsx(i.ActionButton,{disabled:f,action:()=>{f||H(!0)},icon:"PencilRuler",tooltip:"Drawer"})}),e.jsxs(i.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(i.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(Z,{changeBorderColorShape:D,changeColorShape:C,changeShape:T,onClear:W,onRedo:I,onThicknessChange:n,onUndo:z,refEditor:w,setColorHighlight:h,setColorPen:A,setThicknessPen:c})]}),e.jsx(i.DialogFooter,{children:e.jsx(i.Button,{onClick:j,type:"button",children:"Save changes"})})]})]}):e.jsx(e.Fragment,{})}const X=i.index_default.extend({name:"richTextDrawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({t:o,extension:r})=>{var s;return{componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,icon:"PencilRuler",tooltip:o("editor.drawer.tooltip"),upload:(s=r==null?void 0:r.options)==null?void 0:s.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("width");return s?Number.parseInt(s,10):320},renderHTML:o=>({width:o.width})},height:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("height");return s?Number.parseInt(s,10):212},renderHTML:o=>({height:o.height})},align:{default:"center",parseHTML:o=>o.getAttribute("align"),renderHTML:o=>({align:o.align})}}},addNodeView(){return U.ReactNodeViewRenderer(Q)},addCommands(){return{setDrawer:(t,o)=>({commands:r,editor:s})=>o?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(s.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:o})=>o.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:o}=t;return["div",{style:o?`text-align: ${o};`:"",class:"imageDrawer"},["img",F.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const o=t.querySelector("img"),r=o==null?void 0:o.getAttribute("width"),s=o==null?void 0:o.getAttribute("height");return{src:o==null?void 0:o.getAttribute("src"),alt:o==null?void 0:o.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:s?Number.parseInt(s,10):null,align:(o==null?void 0:o.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=Z;exports.Drawer=X;exports.RichTextDrawer=_e;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { q as Z, m as te } from "./index-D0EmqTpe.js";
|
|
2
|
-
import { t as X, q as oe, c as d, h as re, u as le, d as ne, D as ie, r as se, A as ae, s as ce, v as he, w as ue, B as de, x as ge, y as me } from "./index-
|
|
2
|
+
import { t as X, q as oe, c as d, h as re, u as le, d as ne, D as ie, r as se, A as ae, s as ce, v as he, w as ue, B as de, x as ge, y as me } from "./index-BfHAqkoX.js";
|
|
3
3
|
import { N as pe, a as we } from "./clsx-Bg-2aTKh.js";
|
|
4
4
|
import { jsx as e, jsxs as x, Fragment as U } from "react/jsx-runtime";
|
|
5
5
|
import { useState as y, useMemo as V, useCallback as P, useEffect as G, useRef as K } from "react";
|
|
6
|
-
import { I as Q, i as Y, j as ve } from "./index-
|
|
6
|
+
import { I as Q, i as Y, j as ve } from "./index-DtVRewGA.js";
|
|
7
7
|
import { Color4 as g, Editor as fe, makeDropdownToolbar as Te } from "easydrawer";
|
|
8
8
|
import { s as Ce, i as be } from "./shortId-WJVkrvml.js";
|
|
9
9
|
const W = {
|
package/lib/Drawer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-C4WLt4NA.cjs");require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-C4WLt4NA.cjs");require("./index-83hp1lZH.cjs");require("./clsx-DSAWW32g.cjs");const e=require("./Drawer-BeYo9jAG.cjs");exports.Drawer=e.Drawer;exports.RichTextDrawer=e.RichTextDrawer;
|
package/lib/Drawer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./index-D0EmqTpe.js";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-BfHAqkoX.js";
|
|
3
3
|
import "./clsx-Bg-2aTKh.js";
|
|
4
|
-
import { D as i, R as m } from "./Drawer-
|
|
4
|
+
import { D as i, R as m } from "./Drawer-Cyv27orn.js";
|
|
5
5
|
export {
|
|
6
6
|
i as Drawer,
|
|
7
7
|
m as RichTextDrawer
|