reactjs-tiptap-editor 1.0.25 → 1.0.26
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-8cTG45Ft.js → ActionMenuButton-B4KDkZ0z.js} +1 -1
- package/lib/{ActionMenuButton-CXeFhner.cjs → ActionMenuButton-C3Cfeza9.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +25 -25
- package/lib/Blockquote.cjs +5 -5
- package/lib/Blockquote.js +1490 -53
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +3 -3
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +222 -8
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +56 -39
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +8 -4
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +2 -2
- package/lib/{Drawer-TJY4NuHx.cjs → Drawer-D7E9kTca.cjs} +1 -1
- package/lib/{Drawer-C-EO1uoK.js → Drawer-DA0FLHs9.js} +20 -20
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +1644 -148
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +10 -10
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/FormatPainter.cjs +1 -0
- package/lib/FormatPainter.js +133 -0
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +10 -6
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +3 -3
- package/lib/History.cjs +7 -1
- package/lib/History.js +519 -478
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-CGb6-2LD.js → Iframe-DZ3r3QzK.js} +7 -7
- package/lib/{Iframe-5zx43DL4.cjs → Iframe-OMVd0xa_.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +6 -6
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +35 -35
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +15 -15
- package/lib/{Indent-DuwV8s1t.cjs → Indent-QgCoonRk.cjs} +1 -1
- package/lib/{Indent-CdMYsDNS.js → Indent-kI4G-clX.js} +2 -2
- 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-CCP_ZQz2.js → Katex-BPbXjcZQ.js} +6 -7
- package/lib/Katex-CUofhjB5.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-B1m-TVMu.js → LinkEditBlock-BYWwH2_x.js} +59 -32
- package/lib/{LinkEditBlock-DQ8-iufJ.cjs → LinkEditBlock-Z7RRurvx.cjs} +2 -2
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +9 -5
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +61 -62
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +14 -14
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-Dt6n1SP9.js → SlashCommandNodeView-C0l3Fb_3.js} +10 -10
- package/lib/{SlashCommandNodeView-DNixmQGa.cjs → SlashCommandNodeView-DPPmYEjC.cjs} +1 -1
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-C5JxBXef.cjs → Table-D5G3rfwb.cjs} +5 -5
- package/lib/{Table-DdEgaUwa.js → Table-DwseaFSD.js} +115 -97
- 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 +11 -11
- 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-Dnz9qyW0.js → Twitter-DP26Lkn8.js} +195 -195
- package/lib/Twitter-q4ZGZL0i.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -5
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +2783 -2137
- package/lib/{clsx-D6gYQn3o.cjs → clsx-DRbkQ4T7.cjs} +1 -1
- package/lib/{clsx-0OU6n9va.js → clsx-_bq4MQQ7.js} +14 -4
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleCodeBlock.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleKatex.d.ts +2 -1
- package/lib/components/Bubble/RichTextBubbleLink.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleMedia.d.ts +3 -3
- package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -1
- package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleTable.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleText.d.ts +1 -1
- package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -1
- package/lib/components/ColorPicker.d.ts +1 -1
- package/lib/components/ReactBus.d.ts +1 -1
- package/lib/components/RichTextProvider.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -1
- package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +2 -1
- package/lib/components/icons/Activity.d.ts +2 -1
- package/lib/components/icons/Animas.d.ts +2 -1
- package/lib/components/icons/AspectRatio.d.ts +1 -1
- package/lib/components/icons/Blockquote.d.ts +1 -1
- package/lib/components/icons/CodeView.d.ts +1 -1
- package/lib/components/icons/ColumnAddLeft.d.ts +1 -1
- package/lib/components/icons/ColumnAddRight.d.ts +1 -1
- package/lib/components/icons/DeleteColumn.d.ts +1 -1
- package/lib/components/icons/DeleteRow.d.ts +1 -1
- package/lib/components/icons/Direction.d.ts +1 -1
- package/lib/components/icons/Excalidraw.d.ts +1 -1
- package/lib/components/icons/ExportPdf.d.ts +1 -1
- package/lib/components/icons/ExportWord.d.ts +2 -1
- package/lib/components/icons/FileWordOutline.d.ts +1 -1
- package/lib/components/icons/Flag.d.ts +2 -1
- package/lib/components/icons/Food.d.ts +2 -1
- package/lib/components/icons/GIfIcon.d.ts +1 -1
- package/lib/components/icons/Html.d.ts +1 -1
- package/lib/components/icons/Icon.d.ts +1 -1
- package/lib/components/icons/IconColorFill.d.ts +1 -1
- package/lib/components/icons/IconHighlightFill.d.ts +1 -1
- package/lib/components/icons/ImportWord.d.ts +2 -1
- package/lib/components/icons/LeftToRight.d.ts +1 -1
- package/lib/components/icons/LineHeight.d.ts +1 -1
- package/lib/components/icons/MenuDown.d.ts +1 -1
- package/lib/components/icons/Mermaid.d.ts +1 -1
- package/lib/components/icons/NoFill.d.ts +1 -1
- package/lib/components/icons/Object.d.ts +2 -1
- package/lib/components/icons/RightToLeft.d.ts +1 -1
- package/lib/components/icons/SizeL.d.ts +1 -1
- package/lib/components/icons/SizeM.d.ts +1 -1
- package/lib/components/icons/SizeS.d.ts +1 -1
- package/lib/components/icons/Symbol.d.ts +2 -1
- package/lib/components/icons/Travel.d.ts +2 -1
- package/lib/components/icons/Twitter.d.ts +1 -1
- package/lib/components/ui/dialog.d.ts +2 -2
- package/lib/components/ui/dropdown-menu.d.ts +1 -1
- package/lib/components/ui/emoji-picker.d.ts +4 -4
- package/lib/components/ui/toaster.d.ts +1 -1
- package/lib/{dropdown-menu-ROihzXsP.js → dropdown-menu-BKSX4gvT.js} +1 -1
- package/lib/{dropdown-menu-yQ-sQ1k4.cjs → dropdown-menu-CURWpB9o.cjs} +1 -1
- package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -1
- package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -1
- package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -1
- package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -1
- package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -1
- package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -1
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -1
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -1
- package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -1
- package/lib/extensions/Code/components/RichTextCode.d.ts +1 -1
- package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -1
- package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -1
- package/lib/extensions/Color/components/RichTextColor.d.ts +1 -1
- package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -1
- package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -1
- package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +27 -27
- package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -1
- package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -1
- package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -1
- package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +2 -1
- package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -1
- package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -1
- package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -1
- package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -1
- package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +1 -1
- package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +1 -1
- package/lib/extensions/FormatPainter/FormatPainter.d.ts +17 -0
- package/lib/extensions/FormatPainter/components/RichTextFormatPainter.d.ts +1 -0
- package/lib/extensions/FormatPainter/index.d.ts +1 -0
- package/lib/extensions/Heading/components/RichTextHeading.d.ts +1 -1
- package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +2 -1
- package/lib/extensions/History/components/RichTextHistory.d.ts +3 -2
- package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -1
- package/lib/extensions/Iframe/components/IframeNodeView.d.ts +1 -1
- package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -1
- package/lib/extensions/Image/components/ImageCropper.d.ts +2 -1
- package/lib/extensions/Image/components/ImageView.d.ts +2 -1
- package/lib/extensions/Image/components/RichTextImage.d.ts +1 -1
- package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -1
- package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -1
- package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -1
- package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -1
- package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -1
- package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -1
- package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -1
- package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -1
- package/lib/extensions/Link/components/LinkEditBlock.d.ts +1 -1
- package/lib/extensions/Link/components/LinkViewBlock.d.ts +2 -1
- package/lib/extensions/Link/components/RichTextLink.d.ts +1 -1
- package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -1
- package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -1
- package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +1 -1
- package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -1
- package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -1
- package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +1 -1
- package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -1
- package/lib/extensions/Table/components/CreateTablePopover.d.ts +2 -1
- package/lib/extensions/Table/components/RichTextTable.d.ts +2 -1
- package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -1
- package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +1 -1
- package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +1 -1
- package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -1
- package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +1 -1
- package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +1 -1
- package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -1
- package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -1
- package/lib/index-BGfIcDCQ.cjs +26 -0
- package/lib/index-BaR0Brts.js +1115 -0
- package/lib/index-BgNKVyMW.cjs +2 -0
- package/lib/index-BpLw6ebr.cjs +1 -0
- package/lib/{index-X6WZUM9O.js → index-C52cuQ_Y.js} +1503 -1352
- package/lib/index-CDw4Eszh.cjs +12 -0
- package/lib/{index-CUvjYuRp.cjs → index-CHVV5iY-.cjs} +1 -1
- package/lib/{index-zw-Kd38i.js → index-CJMI7Fjf.js} +1 -1
- package/lib/{index-D-Ouz0vF.js → index-DQy9iBzV.js} +1 -1
- package/lib/index-Dbm_Mans.js +1756 -0
- package/lib/{index-oj858lQO.js → index-DtyAGMbq.js} +208 -208
- package/lib/{index-BblvcbTH.js → index-Dx-Dh7KS.js} +1464 -1348
- package/lib/{index-BAb_UADw.cjs → index-SEMQrdk2.cjs} +1 -1
- package/lib/index-aujjnfSJ.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/{jsx-runtime-CT7Pcg-t.js → jsx-runtime-DE8oVoME.js} +3 -1
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/index.d.ts +1 -1
- package/lib/{popover-BfWFqCIs.js → popover-BB-ZDnqk.js} +1 -1
- package/lib/{popover-BPzkMuyi.cjs → popover-CrywEkBR.cjs} +1 -1
- package/lib/{renderNodeView-D--fDFov.cjs → renderNodeView-5h3-p80E.cjs} +1 -1
- package/lib/{renderNodeView-CfWJK4rG.js → renderNodeView-DoKZ4GYy.js} +2 -2
- package/lib/{separator-DpaS43Gt.cjs → separator-BGO9AZp4.cjs} +1 -1
- package/lib/{separator-CBPrZizK.js → separator-DuuOJRQd.js} +21 -21
- package/lib/store/EditorEditableReactive.d.ts +1 -1
- package/lib/store/ThemeColorReactive.d.ts +1 -1
- package/lib/style.css +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/{updatePosition-DGPtRfWN.cjs → updatePosition-B1oRJE1x.cjs} +1 -1
- package/lib/{updatePosition-BwzAsiY0.js → updatePosition-CFTYKYNJ.js} +2 -2
- package/package.json +79 -66
- package/lib/Callout-DWOMZPiP.cjs +0 -1
- package/lib/Callout-ZlPQrMEt.js +0 -340
- package/lib/Katex-D9FP7EUE.cjs +0 -4
- package/lib/Twitter--tfifMt1.cjs +0 -1
- package/lib/index-BF3EVCB1.cjs +0 -2
- package/lib/index-Bcj8cyOO.cjs +0 -24
- package/lib/index-CGjT-a9h.js +0 -1377
- package/lib/index-CPTpXLfX.cjs +0 -11
- package/lib/index-CWw4s87s.cjs +0 -1
- package/lib/index-Cal5SPfB.js +0 -779
- package/lib/index-Gi752TMk.cjs +0 -1
- package/lib/textarea-Bl64keav.js +0 -20
- package/lib/textarea-wvARZKyA.cjs +0 -1
package/lib/Bold.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-BGfIcDCQ.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),n=require("./index-aujjnfSJ.cjs"),i=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,v=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return u.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:u.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:y,type:this.type}),o.markInputRule({find:B,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:k,type:this.type})]}});function M(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:d=void 0,isActive:p=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:g,disabled:a,update:m}=n.useToggleActive(p),h=()=>{a||d&&(d(),m())};return t?i.jsx(n.ActionButton,{action:h,dataState:g,disabled:a,icon:e,shortcutKeys:s,tooltip:r,tooltipOptions:c}):i.jsx(i.Fragment,{})}const l=v.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:r,extension:s})=>({component:n.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:s.options.shortcutKeys??["mod","B"],tooltip:r("editor.bold.tooltip")}})}}});exports.Bold=l;exports.RichTextBold=M;
|
package/lib/Bold.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as _, h as a, j as i, m as y } from "./index-
|
|
2
|
-
import { h as d } from "./jsx-runtime-
|
|
3
|
-
import { u as f, d as M, A as u } from "./index-
|
|
1
|
+
import { M as _, h as a, j as i, m as y } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { h as d } from "./jsx-runtime-DE8oVoME.js";
|
|
3
|
+
import { u as f, d as M, A as u } from "./index-C52cuQ_Y.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-CDw4Eszh.cjs"),s=require("react/jsx-runtime"),n=require("./index-aujjnfSJ.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-BaR0Brts.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-C52cuQ_Y.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
function y() {
|
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"});const m=require("./index-BGfIcDCQ.cjs"),h=require("./clsx-DRbkQ4T7.cjs"),e=require("./index-aujjnfSJ.cjs"),t=require("react/jsx-runtime"),d=require("react");require("./theme.cjs");const n=require("lucide-react"),k=require("./index-BpLw6ebr.cjs"),j=[{value:"note",label:"Note",icon:n.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:n.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:n.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:n.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:n.OctagonAlert,color:"#f85149",background:"#f851491f"}];function q({node:l}){const{type:o="note",title:i="",body:c=""}=l.attrs,s=(j.find(u=>u.value===o)||j[0]).icon;return t.jsx(h.NodeViewWrapper,{children:t.jsxs("div",{className:h.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-border-[#1f6feb] richtext-bg-[#1f6feb1f]":o==="note","richtext-border-[#238636] richtext-bg-[#2386361f]":o==="tip","richtext-border-[#ab7df8] richtext-bg-[#ab7df81f]":o==="important","richtext-border-[#d29922] richtext-bg-[#d299221f]":o==="warning","richtext-border-[#f85149] richtext-bg-[#f851491f]":o==="caution"}),children:[t.jsxs("div",{className:h.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":o==="note","richtext-text-[#238636]":o==="tip","richtext-text-[#ab7df8]":o==="important","richtext-text-[#d29922]":o==="warning","richtext-text-[#f85149]":o==="caution"}),children:[t.jsx(s,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:i})]}),c&&t.jsx("p",{className:"richtext-pl-[28px]",children:c})]})})}const w=[{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 M(){const{t:l}=k.useLocale(),o=e.useEditorInstance(),i=e.useButtonProps(C.name),[c,a]=d.useState(!1),[s,u]=d.useState("note"),[p,b]=d.useState(""),[g,f]=d.useState(""),{icon:y=void 0,tooltip:T=void 0,shortcutKeys:A=void 0,tooltipOptions:L={},isActive:N=void 0}=(i==null?void 0:i.componentProps)??{},{dataState:S,disabled:v}=e.useToggleActive(N),I=()=>{o&&(o.chain().focus().setCallout({type:s,title:p,body:g}).run(),a(!1),u("note"),b(""),f(""))},O=()=>{v||a(!0)};return i?t.jsxs(e.Dialog,{onOpenChange:a,open:c,children:[t.jsx(e.DialogTrigger,{asChild:!0,children:t.jsx(e.ActionButton,{action:O,dataState:S,disabled:v,icon:y,shortcutKeys:A,tooltip:T,tooltipOptions:L})}),t.jsxs(e.DialogContent,{children:[t.jsx(e.DialogTitle,{children:l("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(e.Label,{children:l("editor.callout.dialog.type")}),t.jsxs(e.Select,{onValueChange:u,value:s,children:[t.jsx(e.SelectTrigger,{children:t.jsx(e.SelectValue,{placeholder:l("editor.callout.dialog.type.placeholder")})}),t.jsx(e.SelectContent,{children:w.map(r=>t.jsx(e.SelectItem,{value:r.value,children:l(`editor.callout.type.${r.value}`)},r.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(e.Label,{children:l("editor.callout.dialog.title.label")}),t.jsx(e.Input,{onChange:r=>b(r.target.value),placeholder:l("editor.callout.dialog.title.placeholder"),value:p})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(e.Label,{children:l("editor.callout.dialog.body.label")}),t.jsx(e.Input,{onChange:r=>f(r.target.value),placeholder:l("editor.callout.dialog.body.placeholder"),value:g})]})]}),t.jsxs(e.DialogFooter,{children:[t.jsx(e.Button,{onClick:()=>a(!1),variant:"outline",children:l("editor.callout.dialog.button.cancel")}),t.jsx(e.Button,{onClick:I,children:l("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function x(l){return o=>o.getAttribute(l)}const C=m.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var l;return{...(l=this.parent)==null?void 0:l.call(this),HTMLAttributes:{class:"callout"},button:({editor:o,t:i})=>({component:e.ActionButton,componentProps:{action:()=>!0,isActive:()=>o.isActive("callout"),disabled:!1,icon:"Callout",tooltip:i("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:l}){return["div",m.mergeAttributes(this.options&&this.options.HTMLAttributes||{},l)]},addAttributes(){return{type:{default:"",parseHTML:x("type")},title:{default:"",parseHTML:x("title")},body:{default:"",parseHTML:x("body")}}},addCommands(){return{setCallout:l=>({chain:o})=>o().insertContent({type:this.name,attrs:l}).run()}},addNodeView(){return h.ReactNodeViewRenderer(q)}});exports.Callout=C;exports.RichTextCallout=M;
|
package/lib/Callout.js
CHANGED
|
@@ -1,11 +1,225 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import "./clsx-
|
|
3
|
-
import "./index-
|
|
4
|
-
import "react/jsx-runtime";
|
|
5
|
-
import "react";
|
|
1
|
+
import { N as D, m as H } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { N as M, c as x, a as B } from "./clsx-_bq4MQQ7.js";
|
|
3
|
+
import { h as V, u as P, d as E, D as R, n as W, A as T, o as j, p as F, L as u, S as U, q as Y, r as _, s as $, t as q, k as v, v as z, B as C } from "./index-C52cuQ_Y.js";
|
|
4
|
+
import { jsx as o, jsxs as l, Fragment as K } from "react/jsx-runtime";
|
|
5
|
+
import { useState as s } from "react";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import {
|
|
7
|
+
import { Info as G, Lightbulb as J, AlertCircle as Q, TriangleAlert as X, OctagonAlert as Z } from "lucide-react";
|
|
8
|
+
import { u as tt } from "./index-DtyAGMbq.js";
|
|
9
|
+
const y = [
|
|
10
|
+
{
|
|
11
|
+
value: "note",
|
|
12
|
+
label: "Note",
|
|
13
|
+
icon: G,
|
|
14
|
+
color: "#1f6feb",
|
|
15
|
+
background: "#1f6feb1f"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "tip",
|
|
19
|
+
label: "Tip",
|
|
20
|
+
icon: J,
|
|
21
|
+
color: "#238636",
|
|
22
|
+
background: "#2386361f"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "important",
|
|
26
|
+
label: "Important",
|
|
27
|
+
icon: Q,
|
|
28
|
+
color: "#ab7df8",
|
|
29
|
+
background: "#ab7df81f"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: "warning",
|
|
33
|
+
label: "Warning",
|
|
34
|
+
icon: X,
|
|
35
|
+
color: "#d29922",
|
|
36
|
+
background: "#d299221f"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "caution",
|
|
40
|
+
label: "Caution",
|
|
41
|
+
icon: Z,
|
|
42
|
+
color: "#f85149",
|
|
43
|
+
background: "#f851491f"
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
function et({ node: t }) {
|
|
47
|
+
const { type: e = "note", title: a = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
|
|
48
|
+
return /* @__PURE__ */ o(M, { children: /* @__PURE__ */ l(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: x(
|
|
52
|
+
"richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",
|
|
53
|
+
{
|
|
54
|
+
"richtext-border-[#1f6feb] richtext-bg-[#1f6feb1f]": e === "note",
|
|
55
|
+
"richtext-border-[#238636] richtext-bg-[#2386361f]": e === "tip",
|
|
56
|
+
"richtext-border-[#ab7df8] richtext-bg-[#ab7df81f]": e === "important",
|
|
57
|
+
"richtext-border-[#d29922] richtext-bg-[#d299221f]": e === "warning",
|
|
58
|
+
"richtext-border-[#f85149] richtext-bg-[#f851491f]": e === "caution"
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ l(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: x("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2", {
|
|
66
|
+
"richtext-text-[#1f6feb]": e === "note",
|
|
67
|
+
"richtext-text-[#238636]": e === "tip",
|
|
68
|
+
"richtext-text-[#ab7df8]": e === "important",
|
|
69
|
+
"richtext-text-[#d29922]": e === "warning",
|
|
70
|
+
"richtext-text-[#f85149]": e === "caution"
|
|
71
|
+
}),
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ o(c, { className: "richtext-size-5" }),
|
|
74
|
+
/* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: a })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
n && /* @__PURE__ */ o("p", { className: "richtext-pl-[28px]", children: n })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
) });
|
|
82
|
+
}
|
|
83
|
+
const ot = [
|
|
84
|
+
{ value: "note", label: "Note", icon: "Info" },
|
|
85
|
+
{ value: "tip", label: "Tip", icon: "Lightbulb" },
|
|
86
|
+
{ value: "important", label: "Important", icon: "AlertCircle" },
|
|
87
|
+
{ value: "warning", label: "Warning", icon: "TriangleAlert" },
|
|
88
|
+
{ value: "caution", label: "Caution", icon: "OctagonAlert" }
|
|
89
|
+
];
|
|
90
|
+
function pt() {
|
|
91
|
+
const { t } = tt(), e = V(), a = P(lt.name), [n, i] = s(!1), [c, d] = s("note"), [h, b] = s(""), [g, f] = s(""), {
|
|
92
|
+
icon: A = void 0,
|
|
93
|
+
tooltip: N = void 0,
|
|
94
|
+
shortcutKeys: L = void 0,
|
|
95
|
+
tooltipOptions: S = {},
|
|
96
|
+
isActive: k = void 0
|
|
97
|
+
} = (a == null ? void 0 : a.componentProps) ?? {}, { dataState: I, disabled: m } = E(k), w = () => {
|
|
98
|
+
e && (e.chain().focus().setCallout({ type: c, title: h, body: g }).run(), i(!1), d("note"), b(""), f(""));
|
|
99
|
+
}, O = () => {
|
|
100
|
+
m || i(!0);
|
|
101
|
+
};
|
|
102
|
+
return a ? /* @__PURE__ */ l(R, { onOpenChange: i, open: n, children: [
|
|
103
|
+
/* @__PURE__ */ o(W, { asChild: !0, children: /* @__PURE__ */ o(
|
|
104
|
+
T,
|
|
105
|
+
{
|
|
106
|
+
action: O,
|
|
107
|
+
dataState: I,
|
|
108
|
+
disabled: m,
|
|
109
|
+
icon: A,
|
|
110
|
+
shortcutKeys: L,
|
|
111
|
+
tooltip: N,
|
|
112
|
+
tooltipOptions: S
|
|
113
|
+
}
|
|
114
|
+
) }),
|
|
115
|
+
/* @__PURE__ */ l(j, { children: [
|
|
116
|
+
/* @__PURE__ */ o(F, { children: t("editor.callout.dialog.title") }),
|
|
117
|
+
/* @__PURE__ */ l("div", { className: "richtext-space-y-4 richtext-py-4", children: [
|
|
118
|
+
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
119
|
+
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.type") }),
|
|
120
|
+
/* @__PURE__ */ l(U, { onValueChange: d, value: c, children: [
|
|
121
|
+
/* @__PURE__ */ o(Y, { children: /* @__PURE__ */ o(_, { placeholder: t("editor.callout.dialog.type.placeholder") }) }),
|
|
122
|
+
/* @__PURE__ */ o($, { children: ot.map((r) => /* @__PURE__ */ o(q, { value: r.value, children: t(`editor.callout.type.${r.value}`) }, r.value)) })
|
|
123
|
+
] })
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
126
|
+
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.title.label") }),
|
|
127
|
+
/* @__PURE__ */ o(
|
|
128
|
+
v,
|
|
129
|
+
{
|
|
130
|
+
onChange: (r) => b(r.target.value),
|
|
131
|
+
placeholder: t("editor.callout.dialog.title.placeholder"),
|
|
132
|
+
value: h
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
] }),
|
|
136
|
+
/* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
|
|
137
|
+
/* @__PURE__ */ o(u, { children: t("editor.callout.dialog.body.label") }),
|
|
138
|
+
/* @__PURE__ */ o(
|
|
139
|
+
v,
|
|
140
|
+
{
|
|
141
|
+
onChange: (r) => f(r.target.value),
|
|
142
|
+
placeholder: t("editor.callout.dialog.body.placeholder"),
|
|
143
|
+
value: g
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
] })
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ l(z, { children: [
|
|
149
|
+
/* @__PURE__ */ o(C, { onClick: () => i(!1), variant: "outline", children: t("editor.callout.dialog.button.cancel") }),
|
|
150
|
+
/* @__PURE__ */ o(C, { onClick: w, children: t("editor.callout.dialog.button.apply") })
|
|
151
|
+
] })
|
|
152
|
+
] })
|
|
153
|
+
] }) : /* @__PURE__ */ o(K, {});
|
|
154
|
+
}
|
|
155
|
+
function p(t) {
|
|
156
|
+
return (e) => e.getAttribute(t);
|
|
157
|
+
}
|
|
158
|
+
const lt = /* @__PURE__ */ D.create({
|
|
159
|
+
name: "callout",
|
|
160
|
+
group: "block",
|
|
161
|
+
selectable: !0,
|
|
162
|
+
atom: !0,
|
|
163
|
+
draggable: !0,
|
|
164
|
+
inline: !1,
|
|
165
|
+
//@ts-expect-error
|
|
166
|
+
addOptions() {
|
|
167
|
+
var t;
|
|
168
|
+
return {
|
|
169
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
170
|
+
HTMLAttributes: {
|
|
171
|
+
class: "callout"
|
|
172
|
+
},
|
|
173
|
+
button: ({ editor: e, t: a }) => ({
|
|
174
|
+
component: T,
|
|
175
|
+
componentProps: {
|
|
176
|
+
action: () => !0,
|
|
177
|
+
isActive: () => e.isActive("callout"),
|
|
178
|
+
disabled: !1,
|
|
179
|
+
icon: "Callout",
|
|
180
|
+
tooltip: a("editor.callout.tooltip")
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
parseHTML() {
|
|
186
|
+
return [{ tag: "div.callout" }];
|
|
187
|
+
},
|
|
188
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
189
|
+
return [
|
|
190
|
+
"div",
|
|
191
|
+
H(this.options && this.options.HTMLAttributes || {}, t)
|
|
192
|
+
];
|
|
193
|
+
},
|
|
194
|
+
addAttributes() {
|
|
195
|
+
return {
|
|
196
|
+
type: {
|
|
197
|
+
default: "",
|
|
198
|
+
parseHTML: p("type")
|
|
199
|
+
},
|
|
200
|
+
title: {
|
|
201
|
+
default: "",
|
|
202
|
+
parseHTML: p("title")
|
|
203
|
+
},
|
|
204
|
+
body: {
|
|
205
|
+
default: "",
|
|
206
|
+
parseHTML: p("body")
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
},
|
|
210
|
+
addCommands() {
|
|
211
|
+
return {
|
|
212
|
+
setCallout: (t) => ({ chain: e }) => e().insertContent({
|
|
213
|
+
type: this.name,
|
|
214
|
+
attrs: t
|
|
215
|
+
}).run()
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
addNodeView() {
|
|
219
|
+
return B(et);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
8
222
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
223
|
+
lt as Callout,
|
|
224
|
+
pt as RichTextCallout
|
|
11
225
|
};
|
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-BGfIcDCQ.cjs"),n=require("react/jsx-runtime"),i=require("./index-aujjnfSJ.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-Dx-Dh7KS.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-C52cuQ_Y.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-BGfIcDCQ.cjs"),i=require("react/jsx-runtime"),d=require("./index-aujjnfSJ.cjs");require("react");require("./theme.cjs");var h=e=>{const t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},g=e=>{const t=/`([^`]+)`(?!`)/g,r=[];let n;for(;(n=t.exec(e))!==null;)n.index>0&&e[n.index-1]==="`"||r.push({index:n.index,text:n[0],replaceWith:n[1]});return r},M=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:g,type:this.type})]}});function C(){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:l=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:p,disabled:a,update:m}=d.useToggleActive(l),x=()=>{a||s&&(s(),m())};return e?i.jsx(d.ActionButton,{action:x,dataState:p,disabled:a,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:c}):i.jsx(i.Fragment,{})}const u=M.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=C;
|
package/lib/Code.js
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import { M as m, h as l, j as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { u as
|
|
1
|
+
import { M as m, h as l, j as h, m as x } from "./index-Dx-Dh7KS.js";
|
|
2
|
+
import { jsx as d, Fragment as g } from "react/jsx-runtime";
|
|
3
|
+
import { u as M, d as f, A as v } from "./index-C52cuQ_Y.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
|
-
var
|
|
6
|
+
var C = (e) => {
|
|
7
|
+
const t = /`([^`]+)`(?!`)$/.exec(e);
|
|
8
|
+
return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
|
|
9
|
+
index: t.index,
|
|
10
|
+
text: t[0],
|
|
11
|
+
replaceWith: t[1]
|
|
12
|
+
};
|
|
13
|
+
}, k = (e) => {
|
|
14
|
+
const t = /`([^`]+)`(?!`)/g, o = [];
|
|
15
|
+
let n;
|
|
16
|
+
for (; (n = t.exec(e)) !== null; )
|
|
17
|
+
n.index > 0 && e[n.index - 1] === "`" || o.push({
|
|
18
|
+
index: n.index,
|
|
19
|
+
text: n[0],
|
|
20
|
+
replaceWith: n[1]
|
|
21
|
+
});
|
|
22
|
+
return o;
|
|
23
|
+
}, y = m.create({
|
|
7
24
|
name: "code",
|
|
8
25
|
addOptions() {
|
|
9
26
|
return {
|
|
@@ -16,17 +33,17 @@ var x = /(^|[^`])`([^`]+)`(?!`)$/, f = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
|
16
33
|
parseHTML() {
|
|
17
34
|
return [{ tag: "code" }];
|
|
18
35
|
},
|
|
19
|
-
renderHTML({ HTMLAttributes:
|
|
20
|
-
return ["code",
|
|
36
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
37
|
+
return ["code", x(this.options.HTMLAttributes, e), 0];
|
|
21
38
|
},
|
|
22
39
|
markdownTokenName: "codespan",
|
|
23
|
-
parseMarkdown: (
|
|
24
|
-
renderMarkdown: (
|
|
40
|
+
parseMarkdown: (e, t) => t.applyMark("code", [{ type: "text", text: e.text || "" }]),
|
|
41
|
+
renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
|
|
25
42
|
addCommands() {
|
|
26
43
|
return {
|
|
27
|
-
setCode: () => ({ commands:
|
|
28
|
-
toggleCode: () => ({ commands:
|
|
29
|
-
unsetCode: () => ({ commands:
|
|
44
|
+
setCode: () => ({ commands: e }) => e.setMark(this.name),
|
|
45
|
+
toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
46
|
+
unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
30
47
|
};
|
|
31
48
|
},
|
|
32
49
|
addKeyboardShortcuts() {
|
|
@@ -36,8 +53,8 @@ var x = /(^|[^`])`([^`]+)`(?!`)$/, f = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
|
36
53
|
},
|
|
37
54
|
addInputRules() {
|
|
38
55
|
return [
|
|
39
|
-
|
|
40
|
-
find:
|
|
56
|
+
h({
|
|
57
|
+
find: C,
|
|
41
58
|
type: this.type
|
|
42
59
|
})
|
|
43
60
|
];
|
|
@@ -45,49 +62,49 @@ var x = /(^|[^`])`([^`]+)`(?!`)$/, f = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
|
|
|
45
62
|
addPasteRules() {
|
|
46
63
|
return [
|
|
47
64
|
l({
|
|
48
|
-
find:
|
|
65
|
+
find: k,
|
|
49
66
|
type: this.type
|
|
50
67
|
})
|
|
51
68
|
];
|
|
52
69
|
}
|
|
53
70
|
});
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
icon:
|
|
71
|
+
function K() {
|
|
72
|
+
const e = M(A.name), {
|
|
73
|
+
icon: t = void 0,
|
|
57
74
|
tooltip: o = void 0,
|
|
58
|
-
shortcutKeys:
|
|
59
|
-
tooltipOptions:
|
|
60
|
-
action:
|
|
61
|
-
isActive:
|
|
62
|
-
} = (
|
|
63
|
-
|
|
75
|
+
shortcutKeys: n = void 0,
|
|
76
|
+
tooltipOptions: s = {},
|
|
77
|
+
action: r = void 0,
|
|
78
|
+
isActive: a = void 0
|
|
79
|
+
} = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: i, update: u } = f(a), p = () => {
|
|
80
|
+
i || r && (r(), u());
|
|
64
81
|
};
|
|
65
|
-
return
|
|
66
|
-
|
|
82
|
+
return e ? /* @__PURE__ */ d(
|
|
83
|
+
v,
|
|
67
84
|
{
|
|
68
85
|
action: p,
|
|
69
|
-
dataState:
|
|
70
|
-
disabled:
|
|
71
|
-
icon:
|
|
72
|
-
shortcutKeys:
|
|
86
|
+
dataState: c,
|
|
87
|
+
disabled: i,
|
|
88
|
+
icon: t,
|
|
89
|
+
shortcutKeys: n,
|
|
73
90
|
tooltip: o,
|
|
74
|
-
tooltipOptions:
|
|
91
|
+
tooltipOptions: s
|
|
75
92
|
}
|
|
76
|
-
) : /* @__PURE__ */
|
|
93
|
+
) : /* @__PURE__ */ d(g, {});
|
|
77
94
|
}
|
|
78
95
|
const A = /* @__PURE__ */ y.extend({
|
|
79
96
|
//@ts-expect-error
|
|
80
97
|
addOptions() {
|
|
81
|
-
var
|
|
98
|
+
var e;
|
|
82
99
|
return {
|
|
83
|
-
...(
|
|
84
|
-
button: ({ editor:
|
|
100
|
+
...(e = this.parent) == null ? void 0 : e.call(this),
|
|
101
|
+
button: ({ editor: t, t: o, extension: n }) => ({
|
|
85
102
|
componentProps: {
|
|
86
|
-
action: () =>
|
|
87
|
-
isActive: () =>
|
|
88
|
-
disabled: !
|
|
103
|
+
action: () => t.commands.toggleCode(),
|
|
104
|
+
isActive: () => t.isActive("code"),
|
|
105
|
+
disabled: !t.can().toggleCode(),
|
|
89
106
|
icon: "Code",
|
|
90
|
-
shortcutKeys:
|
|
107
|
+
shortcutKeys: n.options.shortcutKeys ?? ["mod", "E"],
|
|
91
108
|
tooltip: o("editor.code.tooltip")
|
|
92
109
|
}
|
|
93
110
|
})
|
|
@@ -96,5 +113,5 @@ const A = /* @__PURE__ */ y.extend({
|
|
|
96
113
|
});
|
|
97
114
|
export {
|
|
98
115
|
A as Code,
|
|
99
|
-
|
|
116
|
+
K as RichTextCode
|
|
100
117
|
};
|
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-BGfIcDCQ.cjs"),J=require("@tiptap/pm/state"),qe=require("@tiptap/pm/view"),Qt=require("./_commonjsHelpers-BTDuMlIz.cjs"),Oe=require("react/jsx-runtime"),Ae=require("./index-aujjnfSJ.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 Ke, m as en, K as Oe } from "./index-
|
|
1
|
+
import { N as Qt, t as Ke, m as en, K as Oe } from "./index-Dx-Dh7KS.js";
|
|
2
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-C52cuQ_Y.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({
|
|
@@ -209,7 +209,9 @@ 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(
|
|
213
|
+
Fe.near(M.doc.resolve(Math.max(0, M.selection.from - 2)))
|
|
214
|
+
), M.setMeta("paste", !0), i.dispatch(M), !0;
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
217
|
})
|
|
@@ -1324,7 +1326,9 @@ function _n({
|
|
|
1324
1326
|
defaultLanguage: h
|
|
1325
1327
|
}) {
|
|
1326
1328
|
if (!["highlight", "highlightAuto", "listLanguages"].every((E) => En(f[E])))
|
|
1327
|
-
throw Error(
|
|
1329
|
+
throw Error(
|
|
1330
|
+
"You should provide an instance of lowlight to use the code-block-lowlight extension"
|
|
1331
|
+
);
|
|
1328
1332
|
const u = new Ve({
|
|
1329
1333
|
key: new qe("lowlight"),
|
|
1330
1334
|
state: {
|
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-BGfIcDCQ.cjs"),n=require("react/jsx-runtime"),c=require("./index-aujjnfSJ.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-Dx-Dh7KS.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-C52cuQ_Y.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-SEMQrdk2.cjs"),t=require("react/jsx-runtime"),h=require("react"),l=require("./index-aujjnfSJ.cjs"),g=require("./separator-BGO9AZp4.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-CJMI7Fjf.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-C52cuQ_Y.js";
|
|
5
|
+
import { C as y } from "./separator-DuuOJRQd.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-BGfIcDCQ.cjs"),x=require("@tiptap/pm/state"),A=require("@tiptap/pm/model"),f=require("react/jsx-runtime"),h=require("./index-aujjnfSJ.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 { k as p, E as v, N as b, m as y } from "./index-
|
|
1
|
+
import { k as p, E as v, N as b, m as y } from "./index-Dx-Dh7KS.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-C52cuQ_Y.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "./theme.js";
|
|
8
8
|
function E(e, t, r = null) {
|