reactjs-tiptap-editor 1.0.22 → 1.0.24
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-BBDqKvKg.cjs → ActionMenuButton-B8NhVw5m.cjs} +1 -1
- package/lib/{ActionMenuButton-B1067mIC.js → ActionMenuButton-HYlhmRvw.js} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +4 -4
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +2 -2
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/{Callout-lBlBlK_w.cjs → Callout-B-S2f0Qo.cjs} +1 -1
- package/lib/{Callout-V2mO6s2Y.js → Callout-CF7Y9yJ7.js} +4 -4
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +4 -4
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +6 -6
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +27 -27
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +7 -7
- package/lib/{Drawer-Cyv27orn.js → Drawer-CaXVhxo4.js} +21 -21
- package/lib/{Drawer-BeYo9jAG.cjs → Drawer-Was4hxYH.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +4312 -1860
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +3 -3
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +9 -9
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +5 -5
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +69 -46
- package/lib/History.cjs +1 -1
- package/lib/History.js +556 -418
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-Bx-VDxSB.cjs → Iframe-BI0sq6pd.cjs} +1 -1
- package/lib/{Iframe-D9JVKzO0.js → Iframe-Bp986fj0.js} +3 -3
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +47 -47
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +3 -3
- package/lib/{Indent-B5tQ5Wfg.js → Indent-E6B8DkyN.js} +4 -4
- package/lib/{Indent-CCLO0KpG.cjs → Indent-FvM52kjA.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-rtfVV2pl.cjs → Katex-DP6EjdKz.cjs} +1 -1
- package/lib/{Katex-w_c6vAMd.js → Katex-pzwyyiFJ.js} +5 -5
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-Cmkmp2fW.cjs +5 -0
- package/lib/{LinkEditBlock-CTlU8YnO.js → LinkEditBlock-OjN4F2rM.js} +222 -224
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +8 -8
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +34 -34
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +3 -3
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +4 -4
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-CVKjpS6r.cjs → SlashCommandNodeView-DarAytvt.cjs} +1 -1
- package/lib/{SlashCommandNodeView-DNkpJuM3.js → SlashCommandNodeView-o323V8li.js} +2 -2
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/Table-CC9uNHPL.js +1984 -0
- package/lib/Table-Clnz-i4l.cjs +9 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-BJjt8vv_.cjs → Twitter-0kmrijjL.cjs} +1 -1
- package/lib/{Twitter-CKm0M53B.js → Twitter-BVnXL8we.js} +5 -5
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +3 -3
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +1573 -1561
- package/lib/{clsx-Bg-2aTKh.js → clsx-0OU6n9va.js} +379 -353
- package/lib/clsx-D6gYQn3o.cjs +33 -0
- package/lib/{dropdown-menu-Dre693DD.cjs → dropdown-menu-BIGvxqiu.cjs} +1 -1
- package/lib/{dropdown-menu-AhMKS9PQ.js → dropdown-menu-BW2M6saA.js} +1 -1
- package/lib/index-BAb_UADw.cjs +1 -0
- package/lib/index-BF3EVCB1.cjs +2 -0
- package/lib/{index-D0EmqTpe.js → index-BblvcbTH.js} +1130 -1064
- package/lib/index-Bcj8cyOO.cjs +24 -0
- package/lib/{index-BfHAqkoX.js → index-BrsJsbds.js} +3 -3
- package/lib/index-CGjT-a9h.js +1377 -0
- package/lib/index-CPTpXLfX.cjs +11 -0
- package/lib/{index-C3dgmjIF.cjs → index-CUvjYuRp.cjs} +1 -1
- package/lib/{index-C4aGVY2E.cjs → index-CWw4s87s.cjs} +1 -1
- package/lib/{index-DXtVL0al.js → index-Cal5SPfB.js} +189 -134
- package/lib/{index-CjLxMm5d.js → index-D-Ouz0vF.js} +1 -1
- package/lib/{index-83hp1lZH.cjs → index-deubsx3z.cjs} +1 -1
- package/lib/{index-DtVRewGA.js → index-oj858lQO.js} +229 -31
- package/lib/{index-CbkpBnTX.js → index-zw-Kd38i.js} +47 -50
- package/lib/index.cjs +1 -1
- package/lib/index.js +2 -2
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +7 -6
- package/lib/locales/index.d.ts +199 -1
- package/lib/locales/ja.d.ts +198 -0
- package/lib/{popover-B1ptDngu.js → popover-BIVHT1W9.js} +1 -1
- package/lib/{popover-D7w_FVSV.cjs → popover-DoSfJsFS.cjs} +1 -1
- package/lib/{renderNodeView-CbxCTni3.js → renderNodeView-CfWJK4rG.js} +2 -2
- package/lib/{renderNodeView-DFVrJy0l.cjs → renderNodeView-D--fDFov.cjs} +1 -1
- package/lib/{separator-C_7KkuoG.cjs → separator-SRbPfmGa.cjs} +1 -1
- package/lib/{separator-CDoF4Z4Z.js → separator-b-qOPJmp.js} +3 -3
- package/lib/{textarea-CNzZnjjW.js → textarea-CpxXPky_.js} +1 -1
- package/lib/{textarea-CEtXap1b.cjs → textarea-DbGw9oCU.cjs} +1 -1
- package/lib/updatePosition-BwzAsiY0.js +16 -0
- package/lib/{updatePosition-CQE1ct18.cjs → updatePosition-DGPtRfWN.cjs} +1 -1
- package/package.json +60 -60
- package/lib/LinkEditBlock-_41zgSyl.cjs +0 -5
- package/lib/Table-BFiU40iW.cjs +0 -9
- package/lib/Table-yZtD5Qo1.js +0 -1945
- package/lib/clsx-DSAWW32g.cjs +0 -33
- package/lib/index-C4WLt4NA.cjs +0 -24
- package/lib/index-DlxZt4_j.cjs +0 -1
- package/lib/index-P5_MyY0i.js +0 -1362
- package/lib/index-TcJ2UKnv.cjs +0 -1
- package/lib/index-fbGGohBT.cjs +0 -12
- package/lib/updatePosition-BGD41Hbg.js +0 -16
|
@@ -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-deubsx3z.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;
|
|
@@ -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-BrsJsbds.js";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
const C = r.forwardRef(
|
|
7
7
|
({ asChild: x = !1, tooltip: i, ...t }, l) => {
|
package/lib/Attachment.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-Bcj8cyOO.cjs"),u=require("./clsx-D6gYQn3o.cjs"),s=require("./index-deubsx3z.cjs"),e=require("react/jsx-runtime"),v=require("react");require("./theme.cjs");const x=require("lucide-react"),S=require("./index-CWw4s87s.cjs"),d=require("./dom-dataset-BqoJhJXt.cjs"),B={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
|
|
2
2
|
<path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
|
|
3
3
|
<path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
|
|
4
4
|
</svg>`,word:`<svg
|
package/lib/Attachment.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { N as j, m as P } from "./index-
|
|
2
|
-
import { N as x, c as y, a as D } from "./clsx-
|
|
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-
|
|
1
|
+
import { N as j, m as P } from "./index-BblvcbTH.js";
|
|
2
|
+
import { N as x, c as y, a as D } from "./clsx-0OU6n9va.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-BrsJsbds.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-oj858lQO.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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-Bcj8cyOO.cjs"),h=require("./jsx-runtime-C_NLcKys.cjs"),d=require("react/jsx-runtime"),p=require("./index-deubsx3z.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
|
-
import { N as k, w as h, m as g } from "./index-
|
|
1
|
+
import { N as k, w as h, m as g } from "./index-BblvcbTH.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-BrsJsbds.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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-Bcj8cyOO.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),n=require("./index-deubsx3z.cjs"),i=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,v=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return u.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:u.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:y,type:this.type}),o.markInputRule({find:B,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:k,type:this.type})]}});function M(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:d=void 0,isActive:p=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:g,disabled:a,update:m}=n.useToggleActive(p),h=()=>{a||d&&(d(),m())};return t?i.jsx(n.ActionButton,{action:h,dataState:g,disabled:a,icon:e,shortcutKeys:s,tooltip:r,tooltipOptions:c}):i.jsx(i.Fragment,{})}const l=v.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:r,extension:s})=>({component:n.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:s.options.shortcutKeys??["mod","B"],tooltip:r("editor.bold.tooltip")}})}}});exports.Bold=l;exports.RichTextBold=M;
|
package/lib/Bold.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as _,
|
|
1
|
+
import { M as _, h as a, j as i, m as y } from "./index-BblvcbTH.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-BrsJsbds.js";
|
|
4
4
|
import { jsx as l, Fragment as k } from "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
package/lib/BulletList.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-CPTpXLfX.cjs"),s=require("react/jsx-runtime"),n=require("./index-deubsx3z.cjs");require("react");require("./theme.cjs");function g(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:c=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:u,update:p}=n.useToggleActive(d),m=()=>{u||c&&(c(),p())};return t?s.jsx(n.ActionButton,{action:m,dataState:a,disabled:u,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:i("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=g;
|
package/lib/BulletList.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as d } from "./index-
|
|
1
|
+
import { B as d } from "./index-Cal5SPfB.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-BrsJsbds.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
function y() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const S=require("./index-
|
|
1
|
+
"use strict";const S=require("./index-Bcj8cyOO.cjs"),p=require("./clsx-D6gYQn3o.cjs"),c=require("./index-deubsx3z.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-CWw4s87s.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;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { N as U, m as E } from "./index-
|
|
2
|
-
import { N as W, c as N, a as F } from "./clsx-
|
|
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-
|
|
1
|
+
import { N as U, m as E } from "./index-BblvcbTH.js";
|
|
2
|
+
import { N as W, c as N, a as F } from "./clsx-0OU6n9va.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-BrsJsbds.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-oj858lQO.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
|
{
|
package/lib/Callout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-Bcj8cyOO.cjs");require("./clsx-D6gYQn3o.cjs");require("./index-deubsx3z.cjs");require("react/jsx-runtime");require("react");require("./theme.cjs");const e=require("./Callout-B-S2f0Qo.cjs");exports.Callout=e.Callout;exports.RichTextCallout=e.RichTextCallout;
|
package/lib/Callout.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import "./clsx-
|
|
3
|
-
import "./index-
|
|
1
|
+
import "./index-BblvcbTH.js";
|
|
2
|
+
import "./clsx-0OU6n9va.js";
|
|
3
|
+
import "./index-BrsJsbds.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-CF7Y9yJ7.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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-Bcj8cyOO.cjs"),n=require("react/jsx-runtime"),i=require("./index-deubsx3z.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
|
-
import { N as l } from "./index-
|
|
1
|
+
import { N as l } from "./index-BblvcbTH.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-BrsJsbds.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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-Bcj8cyOO.cjs"),i=require("react/jsx-runtime"),d=require("./index-deubsx3z.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,9 +1,9 @@
|
|
|
1
|
-
import { M as m,
|
|
1
|
+
import { M as m, h as l, j as g, m as h } from "./index-BblvcbTH.js";
|
|
2
2
|
import { jsx as a, Fragment as M } from "react/jsx-runtime";
|
|
3
|
-
import { u as v, d as C, A as
|
|
3
|
+
import { u as v, d as C, A as k } from "./index-BrsJsbds.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
|
-
var
|
|
6
|
+
var x = /(^|[^`])`([^`]+)`(?!`)$/, f = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
7
7
|
name: "code",
|
|
8
8
|
addOptions() {
|
|
9
9
|
return {
|
|
@@ -37,7 +37,7 @@ var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
|
37
37
|
addInputRules() {
|
|
38
38
|
return [
|
|
39
39
|
g({
|
|
40
|
-
find:
|
|
40
|
+
find: x,
|
|
41
41
|
type: this.type
|
|
42
42
|
})
|
|
43
43
|
];
|
|
@@ -45,7 +45,7 @@ var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
|
45
45
|
addPasteRules() {
|
|
46
46
|
return [
|
|
47
47
|
l({
|
|
48
|
-
find:
|
|
48
|
+
find: f,
|
|
49
49
|
type: this.type
|
|
50
50
|
})
|
|
51
51
|
];
|
|
@@ -63,7 +63,7 @@ function L() {
|
|
|
63
63
|
s || n && (n(), c());
|
|
64
64
|
};
|
|
65
65
|
return t ? /* @__PURE__ */ a(
|
|
66
|
-
|
|
66
|
+
k,
|
|
67
67
|
{
|
|
68
68
|
action: p,
|
|
69
69
|
dataState: u,
|
package/lib/CodeBlock.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("./index-Bcj8cyOO.cjs"),J=require("@tiptap/pm/state"),qe=require("@tiptap/pm/view"),Qt=require("./_commonjsHelpers-BTDuMlIz.cjs"),Oe=require("react/jsx-runtime"),Ae=require("./index-deubsx3z.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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { N as Qt, t as
|
|
2
|
-
import { Plugin as Ve, PluginKey as qe, TextSelection as
|
|
1
|
+
import { N as Qt, t as Ke, m as en, K as Oe } from "./index-BblvcbTH.js";
|
|
2
|
+
import { Plugin as Ve, PluginKey as qe, TextSelection as Fe, Selection as tn } from "@tiptap/pm/state";
|
|
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-BrsJsbds.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({
|
|
@@ -138,7 +138,7 @@ var ye = 4, un = /^```([a-z]+)?[\s\n]$/, fn = /^~~~([a-z]+)?[\s\n]$/, gn = Qt.cr
|
|
|
138
138
|
let Y = P;
|
|
139
139
|
for (let $ = 0; $ < W; $ += 1)
|
|
140
140
|
Y += C[$].length + 1;
|
|
141
|
-
return y.delete(Y, Y + ee), v - Y <= ee && y.setSelection(
|
|
141
|
+
return y.delete(Y, Y + ee), v - Y <= ee && y.setSelection(Fe.create(y.doc, Y)), !0;
|
|
142
142
|
}) : i.commands.command(({ tr: y }) => {
|
|
143
143
|
const { from: A, to: v } = E, m = u.doc.textBetween(A, v, `
|
|
144
144
|
`, `
|
|
@@ -178,14 +178,14 @@ var ye = 4, un = /^```([a-z]+)?[\s\n]$/, fn = /^~~~([a-z]+)?[\s\n]$/, gn = Qt.cr
|
|
|
178
178
|
},
|
|
179
179
|
addInputRules() {
|
|
180
180
|
return [
|
|
181
|
-
|
|
181
|
+
Ke({
|
|
182
182
|
find: un,
|
|
183
183
|
type: this.type,
|
|
184
184
|
getAttributes: (i) => ({
|
|
185
185
|
language: i[1]
|
|
186
186
|
})
|
|
187
187
|
}),
|
|
188
|
-
|
|
188
|
+
Ke({
|
|
189
189
|
find: fn,
|
|
190
190
|
type: this.type,
|
|
191
191
|
getAttributes: (i) => ({
|
|
@@ -209,7 +209,7 @@ var ye = 4, un = /^```([a-z]+)?[\s\n]$/, fn = /^~~~([a-z]+)?[\s\n]$/, gn = Qt.cr
|
|
|
209
209
|
return !1;
|
|
210
210
|
const { tr: M, schema: y } = i.state, A = y.text(h.replace(/\r\n?/g, `
|
|
211
211
|
`));
|
|
212
|
-
return M.replaceSelectionWith(this.type.create({ language: x }, A)), M.selection.$from.parent.type !== this.type && M.setSelection(
|
|
212
|
+
return M.replaceSelectionWith(this.type.create({ language: x }, A)), M.selection.$from.parent.type !== this.type && M.setSelection(Fe.near(M.doc.resolve(Math.max(0, M.selection.from - 2)))), M.setMeta("paste", !0), i.dispatch(M), !0;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
})
|
|
@@ -887,10 +887,10 @@ function hn() {
|
|
|
887
887
|
l += n.parentNode ? n.parentNode.className : "";
|
|
888
888
|
const _ = o.languageDetectRe.exec(l);
|
|
889
889
|
if (_) {
|
|
890
|
-
const S =
|
|
890
|
+
const S = F(_[1]);
|
|
891
891
|
return S || (me(R.replace("{}", _[1])), me("Falling back to no-highlight mode for this block.", n)), S ? _[1] : "no-highlight";
|
|
892
892
|
}
|
|
893
|
-
return l.split(/\s+/).find((S) => g(S) ||
|
|
893
|
+
return l.split(/\s+/).find((S) => g(S) || F(S));
|
|
894
894
|
}
|
|
895
895
|
function T(n, l, _) {
|
|
896
896
|
let S = "", k = "";
|
|
@@ -921,11 +921,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
921
921
|
b += O.substring(s, c.index);
|
|
922
922
|
const w = G.case_insensitive ? c[0].toLowerCase() : c[0], L = U(p, w);
|
|
923
923
|
if (L) {
|
|
924
|
-
const [
|
|
925
|
-
if (I.addText(b), b = "", k[w] = (k[w] || 0) + 1, k[w] <= It && (he += Vt),
|
|
924
|
+
const [K, Vt] = L;
|
|
925
|
+
if (I.addText(b), b = "", k[w] = (k[w] || 0) + 1, k[w] <= It && (he += Vt), K.startsWith("_"))
|
|
926
926
|
b += c[0];
|
|
927
927
|
else {
|
|
928
|
-
const qt = G.classNameAliases[
|
|
928
|
+
const qt = G.classNameAliases[K] || K;
|
|
929
929
|
z(c[0], qt);
|
|
930
930
|
}
|
|
931
931
|
} else
|
|
@@ -962,8 +962,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
962
962
|
b++;
|
|
963
963
|
continue;
|
|
964
964
|
}
|
|
965
|
-
const L = G.classNameAliases[s[b]] || s[b],
|
|
966
|
-
L ? z(
|
|
965
|
+
const L = G.classNameAliases[s[b]] || s[b], K = c[b];
|
|
966
|
+
L ? z(K, L) : (O = K, X(), O = ""), b++;
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
969
|
function Ue(s, c) {
|
|
@@ -985,14 +985,14 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
985
985
|
if (s.endsWithParent)
|
|
986
986
|
return We(s.parent, c, b);
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function Ft(s) {
|
|
989
989
|
return p.matcher.regexIndex === 0 ? (O += s[0], 1) : (Me = !0, 0);
|
|
990
990
|
}
|
|
991
991
|
function Xt(s) {
|
|
992
992
|
const c = s[0], b = s.rule, w = new f(b), L = [b.__beforeBegin, b["on:begin"]];
|
|
993
|
-
for (const
|
|
994
|
-
if (
|
|
995
|
-
return
|
|
993
|
+
for (const K of L)
|
|
994
|
+
if (K && (K(s, w), w.isMatchIgnored))
|
|
995
|
+
return Ft(c);
|
|
996
996
|
return b.skip ? O += c : (b.excludeBegin && (O += c), H(), !b.returnBegin && !b.excludeBegin && (O = c)), Ue(b, s), b.returnBegin ? 0 : c.length;
|
|
997
997
|
}
|
|
998
998
|
function Yt(s) {
|
|
@@ -1041,7 +1041,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
1041
1041
|
throw new Error("potential infinite loop, way more iterations than matches");
|
|
1042
1042
|
return O += b, b.length;
|
|
1043
1043
|
}
|
|
1044
|
-
const G =
|
|
1044
|
+
const G = F(n);
|
|
1045
1045
|
if (!G)
|
|
1046
1046
|
throw Z(R.replace("{}", n)), new Error('Unknown language: "' + n + '"');
|
|
1047
1047
|
const Jt = kt(G);
|
|
@@ -1111,16 +1111,16 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
1111
1111
|
}
|
|
1112
1112
|
function Ee(n, l) {
|
|
1113
1113
|
l = l || o.languages || Object.keys(t);
|
|
1114
|
-
const _ = be(n), S = l.filter(
|
|
1114
|
+
const _ = be(n), S = l.filter(F).filter(je).map(
|
|
1115
1115
|
(H) => ne(H, n, !1)
|
|
1116
1116
|
);
|
|
1117
1117
|
S.unshift(_);
|
|
1118
1118
|
const k = S.sort((H, z) => {
|
|
1119
1119
|
if (H.relevance !== z.relevance) return z.relevance - H.relevance;
|
|
1120
1120
|
if (H.language && z.language) {
|
|
1121
|
-
if (
|
|
1121
|
+
if (F(H.language).supersetOf === z.language)
|
|
1122
1122
|
return 1;
|
|
1123
|
-
if (
|
|
1123
|
+
if (F(z.language).supersetOf === H.language)
|
|
1124
1124
|
return -1;
|
|
1125
1125
|
}
|
|
1126
1126
|
return 0;
|
|
@@ -1200,7 +1200,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
1200
1200
|
function Ut() {
|
|
1201
1201
|
return Object.keys(t);
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function F(n) {
|
|
1204
1204
|
return n = (n || "").toLowerCase(), t[n] || t[r[n]];
|
|
1205
1205
|
}
|
|
1206
1206
|
function He(n, { languageName: l }) {
|
|
@@ -1209,7 +1209,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
1209
1209
|
});
|
|
1210
1210
|
}
|
|
1211
1211
|
function je(n) {
|
|
1212
|
-
const l =
|
|
1212
|
+
const l = F(n);
|
|
1213
1213
|
return l && !l.disableAutodetect;
|
|
1214
1214
|
}
|
|
1215
1215
|
function Wt(n) {
|
|
@@ -1236,7 +1236,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
1236
1236
|
S[_] && S[_](l);
|
|
1237
1237
|
});
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function Kt(n) {
|
|
1240
1240
|
return V("10.7.0", "highlightBlock will be removed entirely in v12.0"), V("10.7.0", "Please use highlightElement now."), _e(n);
|
|
1241
1241
|
}
|
|
1242
1242
|
Object.assign(e, {
|
|
@@ -1245,14 +1245,14 @@ https://github.com/highlightjs/highlight.js/issues/2277`), k = n, S = l), _ ===
|
|
|
1245
1245
|
highlightAll: le,
|
|
1246
1246
|
highlightElement: _e,
|
|
1247
1247
|
// TODO: Remove with v12 API
|
|
1248
|
-
highlightBlock:
|
|
1248
|
+
highlightBlock: Kt,
|
|
1249
1249
|
configure: Dt,
|
|
1250
1250
|
initHighlighting: Pt,
|
|
1251
1251
|
initHighlightingOnLoad: Ht,
|
|
1252
1252
|
registerLanguage: jt,
|
|
1253
1253
|
unregisterLanguage: $t,
|
|
1254
1254
|
listLanguages: Ut,
|
|
1255
|
-
getLanguage:
|
|
1255
|
+
getLanguage: F,
|
|
1256
1256
|
registerAliases: He,
|
|
1257
1257
|
autoDetection: je,
|
|
1258
1258
|
inherit: Ie,
|
package/lib/CodeView.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-Bcj8cyOO.cjs"),n=require("react/jsx-runtime"),c=require("./index-deubsx3z.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
|
-
import { E as l } from "./index-
|
|
1
|
+
import { E as l } from "./index-BblvcbTH.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-BrsJsbds.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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-BAb_UADw.cjs"),t=require("react/jsx-runtime"),h=require("react"),l=require("./index-deubsx3z.cjs"),g=require("./separator-SRbPfmGa.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
|
-
import { C as d } from "./index-
|
|
1
|
+
import { C as d } from "./index-zw-Kd38i.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-BrsJsbds.js";
|
|
5
|
+
import { C as y } from "./separator-b-qOPJmp.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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-Bcj8cyOO.cjs"),x=require("@tiptap/pm/state"),A=require("@tiptap/pm/model"),f=require("react/jsx-runtime"),h=require("./index-deubsx3z.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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as p, E as v, N as b, m as y } from "./index-BblvcbTH.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-BrsJsbds.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "./theme.js";
|
|
8
8
|
function E(e, t, r = null) {
|
|
@@ -88,8 +88,8 @@ function x({
|
|
|
88
88
|
}
|
|
89
89
|
return !1;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const e = M(
|
|
91
|
+
function K() {
|
|
92
|
+
const e = M(k.name), {
|
|
93
93
|
icon: t = void 0,
|
|
94
94
|
tooltip: r = void 0,
|
|
95
95
|
shortcutKeys: n = void 0,
|
|
@@ -112,7 +112,7 @@ function F() {
|
|
|
112
112
|
}
|
|
113
113
|
) : /* @__PURE__ */ T(H, {});
|
|
114
114
|
}
|
|
115
|
-
const P = 200,
|
|
115
|
+
const P = 200, k = v.create({
|
|
116
116
|
name: "richtextColumnExtension",
|
|
117
117
|
addOptions() {
|
|
118
118
|
var e;
|
|
@@ -223,8 +223,8 @@ const P = 200, B = v.create({
|
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
export {
|
|
226
|
-
|
|
226
|
+
k as Column,
|
|
227
227
|
A as ColumnNode,
|
|
228
228
|
S as MultipleColumnNode,
|
|
229
|
-
|
|
229
|
+
K as RichTextColumn
|
|
230
230
|
};
|