reactjs-tiptap-editor 1.0.26 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{ActionMenuButton-B4KDkZ0z.js → ActionMenuButton-BhiGvRJ7.js} +1 -1
- package/lib/{ActionMenuButton-C3Cfeza9.cjs → ActionMenuButton-qUxkZlQg.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +27 -27
- package/lib/Blockquote.cjs +3 -3
- package/lib/Blockquote.js +251 -244
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout-B9uXfbP3.js +340 -0
- package/lib/Callout-C_TXsss3.cjs +1 -0
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +8 -222
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +2 -2
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +2 -2
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +2 -2
- package/lib/{Drawer-D7E9kTca.cjs → Drawer-D3B4lQJF.cjs} +1 -1
- package/lib/{Drawer-DA0FLHs9.js → Drawer-h401Yy6Y.js} +20 -20
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +168 -135
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +5 -5
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.js +2 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +10 -10
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +3 -3
- package/lib/History.cjs +2 -2
- package/lib/History.js +584 -531
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-DZ3r3QzK.js → Iframe-Dhn40BXx.js} +3 -3
- package/lib/{Iframe-OMVd0xa_.cjs → Iframe-bvGuzYwC.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +9 -6
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +19 -19
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +15 -15
- package/lib/{Indent-kI4G-clX.js → Indent-BK9DvCL7.js} +2 -2
- package/lib/{Indent-QgCoonRk.cjs → Indent-IOByomps.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-BPbXjcZQ.js → Katex-C_Ah9G9w.js} +7 -6
- package/lib/Katex-oLGrtLTf.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-Z7RRurvx.cjs → LinkEditBlock-BojxdGTm.cjs} +2 -2
- package/lib/{LinkEditBlock-BYWwH2_x.js → LinkEditBlock-DRdKXffy.js} +39 -35
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +4 -4
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +62 -61
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +8 -8
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-DPPmYEjC.cjs → SlashCommandNodeView-Dai-O3aD.cjs} +1 -1
- package/lib/{SlashCommandNodeView-C0l3Fb_3.js → SlashCommandNodeView-qwW9cuYt.js} +6 -6
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-DwseaFSD.js → Table-BKM8SvVj.js} +20 -20
- package/lib/{Table-D5G3rfwb.cjs → Table-CWI7tKme.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-q4ZGZL0i.cjs → Twitter-BfsPzA8_.cjs} +1 -1
- package/lib/{Twitter-DP26Lkn8.js → Twitter-CofLQ-zj.js} +9 -9
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -5
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +2258 -2552
- package/lib/{clsx-DRbkQ4T7.cjs → clsx-DJURdKPs.cjs} +2 -2
- package/lib/{clsx-_bq4MQQ7.js → clsx-b_2OwHLk.js} +19 -19
- package/lib/{dropdown-menu-CURWpB9o.cjs → dropdown-menu-CEMxzgnU.cjs} +1 -1
- package/lib/{dropdown-menu-BKSX4gvT.js → dropdown-menu-CKAKsyqu.js} +1 -1
- package/lib/extensions/Image/Image.d.ts +13 -1
- package/lib/index-BJQ1G8B1.js +311 -0
- package/lib/index-BO82_0q8.cjs +1 -0
- package/lib/{index-DQy9iBzV.js → index-Bn_WPziX.js} +1 -1
- package/lib/{index-BpLw6ebr.cjs → index-CwbGrQFa.cjs} +1 -1
- package/lib/{index-DtyAGMbq.js → index-DKruDABV.js} +1 -1
- package/lib/{index-SEMQrdk2.cjs → index-DN-IR-K0.cjs} +1 -1
- package/lib/{index-C52cuQ_Y.js → index-DRcwHivm.js} +1415 -1350
- package/lib/index-DUeBQoIA.cjs +1 -0
- package/lib/{index-Dbm_Mans.js → index-DeoYYWEA.js} +1 -1
- package/lib/{index-CHVV5iY-.cjs → index-Dgs2thVL.cjs} +1 -1
- package/lib/{index-BaR0Brts.js → index-DjB2kNdz.js} +171 -166
- package/lib/{index-CJMI7Fjf.js → index-DuWMq-Qs.js} +1 -1
- package/lib/{index-BGfIcDCQ.cjs → index-EoGU7W4e.cjs} +1 -1
- package/lib/{index-CDw4Eszh.cjs → index-MDz4NZcT.cjs} +9 -9
- package/lib/{index-Dx-Dh7KS.js → index-n4kM0Ll-.js} +110 -105
- package/lib/{index-BgNKVyMW.cjs → index-qZURFC5Q.cjs} +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/{popover-BB-ZDnqk.js → popover-Beieacfy.js} +1 -1
- package/lib/{popover-CrywEkBR.cjs → popover-Bl1kxRJX.cjs} +1 -1
- package/lib/{renderNodeView-5h3-p80E.cjs → renderNodeView-BIgT6Ghg.cjs} +1 -1
- package/lib/{renderNodeView-DoKZ4GYy.js → renderNodeView-Bi58v3DZ.js} +2 -2
- package/lib/{separator-BGO9AZp4.cjs → separator-DMLtkcoo.cjs} +1 -1
- package/lib/{separator-DuuOJRQd.js → separator-DfvK668q.js} +14 -14
- package/lib/style.css +1 -1
- package/lib/textarea-DV9Fw3y1.cjs +1 -0
- package/lib/textarea-GXaWJbm9.js +20 -0
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +1 -1
- package/lib/{updatePosition-CFTYKYNJ.js → updatePosition-DY1jI7qb.js} +2 -2
- package/lib/{updatePosition-B1oRJE1x.cjs → updatePosition-D_D-TbEu.cjs} +1 -1
- package/package.json +59 -59
- package/lib/Katex-CUofhjB5.cjs +0 -4
- package/lib/index-BG0kQamI.js +0 -285
- package/lib/index-NsYff_Ni.cjs +0 -1
- package/lib/index-aujjnfSJ.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const S=require("react"),re=require("react-dom"),A=require("react/jsx-runtime"),P=require("./index-
|
|
1
|
+
"use strict";const S=require("react"),re=require("react-dom"),A=require("react/jsx-runtime"),P=require("./index-EoGU7W4e.cjs");var j={exports:{}},M={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var Z;function Ze(){return Z||(Z=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,h){return c===h&&(c!==0||1/c===1/h)||c!==c&&h!==h}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,r=W(),n=typeof Object.is=="function"?Object.is:e,o=r.useSyncExternalStore,a=t.useRef,i=t.useEffect,s=t.useMemo,y=t.useDebugValue;G.useSyncExternalStoreWithSelector=function(c,h,p,v,l){var f=a(null);if(f.current===null){var m={hasValue:!1,value:null};f.current=m}else m=f.current;f=s(function(){function d(_){if(!E){if(E=!0,R=_,_=v(_),l!==void 0&&m.hasValue){var w=m.value;if(l(w,_))return O=w}return O=_}if(w=O,n(R,_))return w;var T=v(_);return l!==void 0&&l(w,T)?(R=_,w):(R=_,O=T)}var E=!1,R,O,g=p===void 0?null:p;return[function(){return d(h())},g===null?void 0:function(){return d(g())}]},[h,p,v,l]);var u=o(c,f[0],f[1]);return i(function(){m.hasValue=!0,m.value=u},[u]),y(u),u},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),G}var Q;function Qe(){return Q||(Q=1,process.env.NODE_ENV==="production"?D.exports=Xe():D.exports=Ze()),D.exports}var et=Qe(),tt=(...e)=>t=>{e.forEach(r=>{typeof r=="function"?r(t):r&&(r.current=t)})},rt=({contentComponent:e})=>{const t=ne.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return A.jsx(A.Fragment,{children:Object.values(t)})};function nt(){const e=new Set;let t={};return{subscribe(r){return e.add(r),()=>{e.delete(r)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(r,n){t={...t,[r]:re.createPortal(n.reactElement,n.element,r)},e.forEach(o=>o())},removeRenderer(r){const n={...t};delete n[r],t=n,e.forEach(o=>o())}}}var ot=class extends S.Component{constructor(e){super(e),this.editorContentRef=S.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const r=this.editorContentRef.current;r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r}),t.contentComponent=nt(),t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const r=document.createElement("div");r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r})}catch{}}}render(){const{editor:e,innerRef:t,...r}=this.props;return A.jsxs(A.Fragment,{children:[A.jsx("div",{ref:tt(t,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&A.jsx(rt,{contentComponent:e.contentComponent})]})}},it=S.forwardRef((e,t)=>{const r=S.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return S.createElement(ot,{key:r,innerRef:t,...e})}),st=S.memo(it),ut=typeof window<"u"?S.useLayoutEffect:S.useEffect,at=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}};function ct(e){var t;const[r]=S.useState(()=>new at(e.editor)),n=et.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:Je);return ut(()=>r.watch(e.editor),[e.editor,r]),S.useDebugValue(n),n}process.env.NODE_ENV;var V=S.createContext({editor:null});V.Consumer;var lt=()=>S.useContext(V),ie=S.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),dt=()=>S.useContext(ie),ft=S.forwardRef((e,t)=>{const{onDragStart:r}=dt(),n=e.as||"div";return A.jsx(n,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...e.style}})});function ee(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function te(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.forward_ref)"||e.$$typeof.description==="react.forward_ref"))}function ht(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.memo)"||e.$$typeof.description==="react.memo"))}function pt(e){if(ee(e)||te(e))return!0;if(ht(e)){const t=e.type;if(t)return ee(t)||te(t)}return!1}function mt(){try{if(S.version)return parseInt(S.version.split(".")[0],10)>=19}catch{}return!1}var se=class{constructor(e,{editor:t,props:r={},as:n="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(n),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isEditorContentInitialized?re.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;const t=this.component,r=this.props,n=this.editor,o=mt(),a=pt(t),i={...r};i.ref&&!(o||a)&&delete i.ref,!i.ref&&(o||a)&&(i.ref=s=>{this.ref=s}),this.reactElement=A.jsx(t,{...i}),(e=n==null?void 0:n.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1;const r=Object.keys(e);for(let n=0;n<r.length;n+=1){const o=r[n];if(e[o]!==this.props[o]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;const t=this.editor;(e=t==null?void 0:t.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};S.createContext({markViewContentRef:()=>{}});var Et=class extends P.NodeView{constructor(e,t,r){if(super(e,t,r),this.selectionRafId=null,this.handlePositionUpdate=()=>{const n=this.getPos();typeof n!="number"||n===this.currentPos||(this.currentPos=n,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const n=this.dom.querySelector("[data-node-view-content]");if(!n)return;n.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(r,n,o){var a;return n==="storage"?(a=e.storage[t.name])!=null?a:{}:Reflect.get(r,n,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode(),ref:S.createRef()};if(!this.component.displayName){const c=h=>h.charAt(0).toUpperCase()+h.substring(1);this.component.displayName=c(this.extension.name)}const o={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&(c.hasAttribute("data-node-view-wrapper")&&c.removeAttribute("data-node-view-wrapper"),c.appendChild(this.contentDOMElement))}},a=this.component,i=S.memo(c=>A.jsx(ie.Provider,{value:o,children:S.createElement(a,c)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:y=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new se(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${y}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var e;if(this.renderer.element.firstElementChild&&!((e=this.renderer.element.firstElementChild)!=null&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const e=this.currentPos;if(typeof e!="number")return;if(P.isNodeViewSelected({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,r){const n=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,y=this.decorations,c=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.currentPos=this.getPos(),this.options.update({oldNode:s,oldDecorations:y,newNode:e,newDecorations:t,oldInnerDecorations:c,innerDecorations:r,updateProps:()=>n({node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage})})}if(!(e!==this.node))return this.node=e,this.decorations=t,this.innerDecorations=r,!0;const a=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=r,this.currentPos=a;const i={node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(i.getPos=()=>this.getPos()),n(i),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=P.getRenderedAttributes(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function yt(e,t){return r=>r.editor.contentComponent?new Et(e,r,t):{}}var $=S.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});$.displayName="TiptapContext";var vt=()=>S.useContext($);function ue({editor:e,instance:t,children:r}){const n=e??t;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=S.useMemo(()=>({editor:n}),[n]),a=S.useMemo(()=>({editor:n}),[n]);return A.jsx(V.Provider,{value:a,children:A.jsx($.Provider,{value:o,children:r})})}ue.displayName="Tiptap";function ae({...e}){const{editor:t}=vt();return A.jsx(st,{editor:t,...e})}ae.displayName="Tiptap.Content";Object.assign(ue,{Content:ae});function ce(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=ce(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function St(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=ce(e))&&(n&&(n+=" "),n+=t);return n}exports.EditorContext=V;exports.NodeViewWrapper=ft;exports.ReactNodeViewRenderer=yt;exports.ReactRenderer=se;exports.clsx=St;exports.shimExports=ne;exports.useCurrentEditor=lt;exports.useEditorState=ct;
|
|
33
|
+
*/var Z;function Ze(){return Z||(Z=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,h){return c===h&&(c!==0||1/c===1/h)||c!==c&&h!==h}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,r=W(),n=typeof Object.is=="function"?Object.is:e,o=r.useSyncExternalStore,a=t.useRef,i=t.useEffect,s=t.useMemo,y=t.useDebugValue;G.useSyncExternalStoreWithSelector=function(c,h,p,v,l){var f=a(null);if(f.current===null){var m={hasValue:!1,value:null};f.current=m}else m=f.current;f=s(function(){function d(_){if(!E){if(E=!0,R=_,_=v(_),l!==void 0&&m.hasValue){var w=m.value;if(l(w,_))return O=w}return O=_}if(w=O,n(R,_))return w;var T=v(_);return l!==void 0&&l(w,T)?(R=_,w):(R=_,O=T)}var E=!1,R,O,g=p===void 0?null:p;return[function(){return d(h())},g===null?void 0:function(){return d(g())}]},[h,p,v,l]);var u=o(c,f[0],f[1]);return i(function(){m.hasValue=!0,m.value=u},[u]),y(u),u},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),G}var Q;function Qe(){return Q||(Q=1,process.env.NODE_ENV==="production"?D.exports=Xe():D.exports=Ze()),D.exports}var et=Qe(),tt=(...e)=>t=>{e.forEach(r=>{typeof r=="function"?r(t):r&&(r.current=t)})},rt=({contentComponent:e})=>{const t=ne.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return A.jsx(A.Fragment,{children:Object.values(t)})};function nt(){const e=new Set;let t={};return{subscribe(r){return e.add(r),()=>{e.delete(r)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(r,n){t={...t,[r]:re.createPortal(n.reactElement,n.element,r)},e.forEach(o=>o())},removeRenderer(r){const n={...t};delete n[r],t=n,e.forEach(o=>o())}}}var ot=class extends S.Component{constructor(e){super(e),this.editorContentRef=S.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;const r=this.editorContentRef.current;r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r}),t.contentComponent=nt(),t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;const r=document.createElement("div");r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r})}catch{}}}render(){const{editor:e,innerRef:t,...r}=this.props;return A.jsxs(A.Fragment,{children:[A.jsx("div",{ref:tt(t,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&A.jsx(rt,{contentComponent:e.contentComponent})]})}},it=S.forwardRef((e,t)=>{const r=S.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return S.createElement(ot,{key:r,innerRef:t,...e})}),st=S.memo(it),ut=typeof window<"u"?S.useLayoutEffect:S.useEffect,at=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}};function ct(e){var t;const[r]=S.useState(()=>new at(e.editor)),n=et.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:Je);return ut(()=>r.watch(e.editor),[e.editor,r]),S.useDebugValue(n),n}process.env.NODE_ENV;var V=S.createContext({editor:null});V.Consumer;var lt=()=>S.useContext(V),ie=S.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),dt=()=>S.useContext(ie),ft=S.forwardRef((e,t)=>{const{onDragStart:r}=dt(),n=e.as||"div";return A.jsx(n,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...e.style}})});function ee(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function te(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.forward_ref)"||e.$$typeof.description==="react.forward_ref"))}function ht(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.memo)"||e.$$typeof.description==="react.memo"))}function pt(e){if(ee(e)||te(e))return!0;if(ht(e)){const t=e.type;if(t)return ee(t)||te(t)}return!1}function mt(){try{if(S.version)return parseInt(S.version.split(".")[0],10)>=19}catch{}return!1}var se=class{constructor(e,{editor:t,props:r={},as:n="div",className:o=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(n),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isEditorContentInitialized?re.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;const t=this.component,r=this.props,n=this.editor,o=mt(),a=pt(t),i={...r};i.ref&&!(o||a)&&delete i.ref,!i.ref&&(o||a)&&(i.ref=s=>{this.ref=s}),this.reactElement=A.jsx(t,{...i}),(e=n==null?void 0:n.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1;const r=Object.keys(e);for(let n=0;n<r.length;n+=1){const o=r[n];if(e[o]!==this.props[o]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;const t=this.editor;(e=t==null?void 0:t.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};S.createContext({markViewContentRef:()=>{}});var Et=class extends P.NodeView{constructor(e,t,r){if(super(e,t,r),this.selectionRafId=null,this.handlePositionUpdate=()=>{const n=this.getPos();typeof n!="number"||n===this.currentPos||(this.currentPos=n,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const n=this.dom.querySelector("[data-node-view-content]");if(!n)return;n.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(r,n,o){var a;return n==="storage"?(a=e.storage[t.name])!=null?a:{}:Reflect.get(r,n,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode(),ref:S.createRef()};if(!this.component.displayName){const c=h=>h.charAt(0).toUpperCase()+h.substring(1);this.component.displayName=c(this.extension.name)}const o={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&(c.hasAttribute("data-node-view-wrapper")&&c.removeAttribute("data-node-view-wrapper"),c.appendChild(this.contentDOMElement))}},a=this.component,i=S.memo(c=>A.jsx(ie.Provider,{value:o,children:S.createElement(a,c)}));i.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:y=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new se(i,{editor:this.editor,props:t,as:s,className:`node-${this.node.type.name} ${y}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var e;if(this.renderer.element.firstElementChild&&!((e=this.renderer.element.firstElementChild)!=null&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const e=this.currentPos;if(typeof e!="number")return;if(P.isNodeViewSelected({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,r){const n=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,y=this.decorations,c=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.currentPos=this.getPos(),this.options.update({oldNode:s,oldDecorations:y,newNode:e,newDecorations:t,oldInnerDecorations:c,innerDecorations:r,updateProps:()=>n({node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage})})}if(!(e!==this.node))return this.node=e,this.decorations=t,this.innerDecorations=r,!0;const a=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=r,this.currentPos=a;const i={node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(i.getPos=()=>this.getPos()),n(i),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=P.getRenderedAttributes(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function yt(e,t){return r=>r.editor.contentComponent?new Et(e,r,t):{}}var $=S.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});$.displayName="TiptapContext";var vt=()=>S.useContext($);function ue({children:e,...t}){const r="editor"in t?t.editor:t.instance;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const n=S.useMemo(()=>({editor:r}),[r]),o=S.useMemo(()=>({editor:r}),[r]);return A.jsx(V.Provider,{value:o,children:A.jsx($.Provider,{value:n,children:e})})}ue.displayName="Tiptap";function ae({...e}){const{editor:t}=vt();return A.jsx(st,{editor:t,...e})}ae.displayName="Tiptap.Content";Object.assign(ue,{Content:ae});function ce(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=ce(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function St(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=ce(e))&&(n&&(n+=" "),n+=t);return n}exports.EditorContext=V;exports.NodeViewWrapper=ft;exports.ReactNodeViewRenderer=yt;exports.ReactRenderer=se;exports.clsx=St;exports.shimExports=ne;exports.useCurrentEditor=lt;exports.useEditorState=ct;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import A, { createContext as U, useContext as G, createRef as de, memo as fe, createElement as he, version as
|
|
1
|
+
import A, { createContext as U, useContext as G, createRef as de, memo as fe, createElement as he, version as $, useState as pe, useDebugValue as me, useLayoutEffect as Ee, useEffect as ye, forwardRef as ve, useMemo as z } from "react";
|
|
2
2
|
import Se, { flushSync as _e } from "react-dom";
|
|
3
3
|
import { jsx as b, jsxs as ge, Fragment as ie } from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { a0 as Oe, a1 as we, a as Ae } from "./index-n4kM0Ll-.js";
|
|
5
5
|
var D = { exports: {} }, P = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
@@ -207,7 +207,7 @@ function Z(e, t, r) {
|
|
|
207
207
|
return !0;
|
|
208
208
|
}
|
|
209
209
|
const Be = T;
|
|
210
|
-
function
|
|
210
|
+
function ke(e, t, r) {
|
|
211
211
|
const n = X(e);
|
|
212
212
|
let o = n.length;
|
|
213
213
|
if (X(t).length !== o)
|
|
@@ -228,7 +228,7 @@ function N(e, t, r) {
|
|
|
228
228
|
return !1;
|
|
229
229
|
return !0;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function $e(e, t) {
|
|
232
232
|
return T(e.valueOf(), t.valueOf());
|
|
233
233
|
}
|
|
234
234
|
function ze(e, t) {
|
|
@@ -359,8 +359,8 @@ function ct({ circular: e, createCustomConfig: t, strict: r }) {
|
|
|
359
359
|
areFunctionsEqual: We,
|
|
360
360
|
areMapsEqual: r ? M(Z, N) : Z,
|
|
361
361
|
areNumbersEqual: Be,
|
|
362
|
-
areObjectsEqual: r ? N :
|
|
363
|
-
arePrimitiveWrappersEqual:
|
|
362
|
+
areObjectsEqual: r ? N : ke,
|
|
363
|
+
arePrimitiveWrappersEqual: $e,
|
|
364
364
|
areRegExpsEqual: ze,
|
|
365
365
|
areSetsEqual: r ? M(Q, N) : Q,
|
|
366
366
|
areTypedArraysEqual: r ? M(x, N) : x,
|
|
@@ -771,8 +771,8 @@ function Tt(e) {
|
|
|
771
771
|
}
|
|
772
772
|
function Ct() {
|
|
773
773
|
try {
|
|
774
|
-
if (
|
|
775
|
-
return parseInt(
|
|
774
|
+
if ($)
|
|
775
|
+
return parseInt($.split(".")[0], 10) >= 19;
|
|
776
776
|
} catch {
|
|
777
777
|
}
|
|
778
778
|
return !1;
|
|
@@ -1043,22 +1043,22 @@ var Dt = class extends Oe {
|
|
|
1043
1043
|
function Ut(e, t) {
|
|
1044
1044
|
return (r) => r.editor.contentComponent ? new Dt(e, r, t) : {};
|
|
1045
1045
|
}
|
|
1046
|
-
var
|
|
1046
|
+
var k = U({
|
|
1047
1047
|
get editor() {
|
|
1048
1048
|
throw new Error("useTiptap must be used within a <Tiptap> provider");
|
|
1049
1049
|
}
|
|
1050
1050
|
});
|
|
1051
|
-
|
|
1052
|
-
var jt = () => G(
|
|
1053
|
-
function ue({
|
|
1054
|
-
const
|
|
1055
|
-
if (!
|
|
1051
|
+
k.displayName = "TiptapContext";
|
|
1052
|
+
var jt = () => G(k);
|
|
1053
|
+
function ue({ children: e, ...t }) {
|
|
1054
|
+
const r = "editor" in t ? t.editor : t.instance;
|
|
1055
|
+
if (!r)
|
|
1056
1056
|
throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
|
|
1057
|
-
const
|
|
1058
|
-
() => ({ editor:
|
|
1059
|
-
[
|
|
1060
|
-
),
|
|
1061
|
-
return /* @__PURE__ */ b(B.Provider, { value:
|
|
1057
|
+
const n = z(
|
|
1058
|
+
() => ({ editor: r }),
|
|
1059
|
+
[r]
|
|
1060
|
+
), o = z(() => ({ editor: r }), [r]);
|
|
1061
|
+
return /* @__PURE__ */ b(B.Provider, { value: o, children: /* @__PURE__ */ b(k.Provider, { value: n, children: e }) });
|
|
1062
1062
|
}
|
|
1063
1063
|
ue.displayName = "Tiptap";
|
|
1064
1064
|
function ce({ ...e }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),w=require("@radix-ui/react-dropdown-menu"),d=require("lucide-react"),g=require("react"),a=require("./index-
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),w=require("@radix-ui/react-dropdown-menu"),d=require("lucide-react"),g=require("react"),a=require("./index-BO82_0q8.cjs");function x(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:()=>t[i]})}}return r.default=t,Object.freeze(r)}const e=x(w),n=x(g),y=e.Root,N=e.Trigger,D=e.Portal,M=e.Sub,h=n.forwardRef(({className:t,inset:r,children:i,...o},s)=>c.jsxs(e.SubTrigger,{ref:s,className:a.cn("richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none focus:richtext-bg-accent data-[state=open]:richtext-bg-accent",r&&"richtext-pl-8",t),...o,children:[i,c.jsx(d.ChevronRight,{className:"richtext-ml-auto richtext-size-4"})]}));h.displayName=e.SubTrigger.displayName;const l=n.forwardRef(({className:t,...r},i)=>c.jsx(e.SubContent,{"data-richtext-portal":!0,ref:i,className:a.cn("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-lg 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",t),...r}));l.displayName=e.SubContent.displayName;const u=n.forwardRef(({className:t,sideOffset:r=4,...i},o)=>c.jsx(e.Portal,{"data-richtext-portal":!0,children:c.jsx(e.Content,{"data-richtext-portal":!0,ref:o,sideOffset:r,className:a.cn("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-1 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",t),...i})}));u.displayName=e.Content.displayName;const p=n.forwardRef(({className:t,inset:r,...i},o)=>c.jsx(e.Item,{ref:o,className:a.cn("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",r&&"richtext-pl-8",t),...i}));p.displayName=e.Item.displayName;const m=n.forwardRef(({className:t,children:r,checked:i,...o},s)=>c.jsxs(e.CheckboxItem,{checked:i,ref:s,className:a.cn("richtext-relative richtext-flex 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 richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",t),...o,children:[c.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center",children:c.jsx(e.ItemIndicator,{children:c.jsx(d.Check,{className:"richtext-size-4"})})}),r]}));m.displayName=e.CheckboxItem.displayName;const j=n.forwardRef(({className:t,children:r,...i},o)=>c.jsxs(e.RadioItem,{ref:o,className:a.cn("richtext-relative richtext-flex 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 richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",t),...i,children:[c.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center",children:c.jsx(e.ItemIndicator,{children:c.jsx(d.Circle,{className:"richtext-size-2 richtext-fill-current"})})}),r]}));j.displayName=e.RadioItem.displayName;const S=n.forwardRef(({className:t,inset:r,...i},o)=>c.jsx(e.Label,{ref:o,className:a.cn("richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-font-semibold",r&&"richtext-pl-8",t),...i}));S.displayName=e.Label.displayName;const f=n.forwardRef(({className:t,...r},i)=>c.jsx(e.Separator,{className:a.cn("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",t),ref:i,...r}));f.displayName=e.Separator.displayName;function b({className:t,...r}){return c.jsx("span",{className:a.cn("richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",t),...r})}b.displayName="DropdownMenuShortcut";exports.DropdownMenu=y;exports.DropdownMenuCheckboxItem=m;exports.DropdownMenuContent=u;exports.DropdownMenuItem=p;exports.DropdownMenuPortal=D;exports.DropdownMenuSeparator=f;exports.DropdownMenuShortcut=b;exports.DropdownMenuSub=M;exports.DropdownMenuSubContent=l;exports.DropdownMenuSubTrigger=h;exports.DropdownMenuTrigger=N;
|
|
@@ -2,7 +2,7 @@ import { jsx as c, jsxs as x } from "react/jsx-runtime";
|
|
|
2
2
|
import * as t from "@radix-ui/react-dropdown-menu";
|
|
3
3
|
import { ChevronRight as d, Check as h, Circle as l } from "lucide-react";
|
|
4
4
|
import * as s from "react";
|
|
5
|
-
import { c as o } from "./index-
|
|
5
|
+
import { c as o } from "./index-DRcwHivm.js";
|
|
6
6
|
const R = t.Root, I = t.Trigger, S = t.Portal, C = t.Sub, m = s.forwardRef(({ className: e, inset: r, children: i, ...a }, n) => /* @__PURE__ */ x(
|
|
7
7
|
t.SubTrigger,
|
|
8
8
|
{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { GeneralOptions } from '../../types';
|
|
1
|
+
import { GeneralOptions, JSONContent } from '../../types';
|
|
2
2
|
export * from './components/RichTextImage';
|
|
3
|
+
export declare const IMAGE_BLOCK_NAME = "imageBlock";
|
|
3
4
|
export interface SetImageAttrsOptions {
|
|
4
5
|
src?: string;
|
|
5
6
|
/** The alternative text for the image. */
|
|
@@ -18,6 +19,12 @@ export interface SetImageAttrsOptions {
|
|
|
18
19
|
flipY?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare const DEFAULT_OPTIONS: any;
|
|
22
|
+
/**
|
|
23
|
+
* Converts old JSON documents that stored block images as paragraph-wrapped `image`
|
|
24
|
+
* inline nodes into the new `imageBlock` node. The original `image` node remains
|
|
25
|
+
* supported, so using this helper is optional and can be done during persistence migration.
|
|
26
|
+
*/
|
|
27
|
+
export declare function migrateImageJSONToImageBlock(content: JSONContent): JSONContent;
|
|
21
28
|
declare module '@tiptap/core' {
|
|
22
29
|
interface Commands<ReturnType> {
|
|
23
30
|
imageUpload: {
|
|
@@ -25,6 +32,10 @@ declare module '@tiptap/core' {
|
|
|
25
32
|
* Add an image
|
|
26
33
|
*/
|
|
27
34
|
setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
35
|
+
/**
|
|
36
|
+
* Add a block image
|
|
37
|
+
*/
|
|
38
|
+
setImageBlock: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
28
39
|
/**
|
|
29
40
|
* Update an image
|
|
30
41
|
*/
|
|
@@ -54,4 +65,5 @@ export interface IImageOptions extends GeneralOptions<IImageOptions> {
|
|
|
54
65
|
file?: File;
|
|
55
66
|
}) => void;
|
|
56
67
|
}
|
|
68
|
+
export declare const ImageBlock: import('@tiptap/core').Node<IImageOptions, any>;
|
|
57
69
|
export declare const Image: import('@tiptap/core').Node<IImageOptions, any>;
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { useSyncExternalStore as I, useCallback as m } from "react";
|
|
2
|
+
function z({ update: e, notify: n, unwatched: i }) {
|
|
3
|
+
return {
|
|
4
|
+
link: r,
|
|
5
|
+
unlink: c,
|
|
6
|
+
propagate: x,
|
|
7
|
+
checkDirty: H,
|
|
8
|
+
shallowPropagate: y
|
|
9
|
+
};
|
|
10
|
+
function r(t, l, s) {
|
|
11
|
+
const d = l.depsTail;
|
|
12
|
+
if (d !== void 0 && d.dep === t)
|
|
13
|
+
return;
|
|
14
|
+
const f = d !== void 0 ? d.nextDep : l.deps;
|
|
15
|
+
if (f !== void 0 && f.dep === t) {
|
|
16
|
+
f.version = s, l.depsTail = f;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const u = t.subsTail;
|
|
20
|
+
if (u !== void 0 && u.version === s && u.sub === l)
|
|
21
|
+
return;
|
|
22
|
+
const a = l.depsTail = t.subsTail = {
|
|
23
|
+
version: s,
|
|
24
|
+
dep: t,
|
|
25
|
+
sub: l,
|
|
26
|
+
prevDep: d,
|
|
27
|
+
nextDep: f,
|
|
28
|
+
prevSub: u,
|
|
29
|
+
nextSub: void 0
|
|
30
|
+
};
|
|
31
|
+
f !== void 0 && (f.prevDep = a), d !== void 0 ? d.nextDep = a : l.deps = a, u !== void 0 ? u.nextSub = a : t.subs = a;
|
|
32
|
+
}
|
|
33
|
+
function c(t, l = t.sub) {
|
|
34
|
+
const { dep: s, prevDep: d, nextDep: f, nextSub: u, prevSub: a } = t;
|
|
35
|
+
return f !== void 0 ? f.prevDep = d : l.depsTail = d, d !== void 0 ? d.nextDep = f : l.deps = f, u !== void 0 ? u.prevSub = a : s.subsTail = a, a !== void 0 ? a.nextSub = u : (s.subs = u) === void 0 && i(s), f;
|
|
36
|
+
}
|
|
37
|
+
function x(t, l) {
|
|
38
|
+
let s = t.nextSub, d;
|
|
39
|
+
e: do {
|
|
40
|
+
const f = t.sub;
|
|
41
|
+
let u = f.flags;
|
|
42
|
+
if (u & 60 ? u & 12 ? u & 4 ? !(u & 48) && j(t, f) ? (f.flags = u | 40, u &= 1) : u = 0 : f.flags = u & -9 | 32 : u = 0 : (f.flags = u | 32, l && (f.flags |= 8)), u & 2 && n(f), u & 1) {
|
|
43
|
+
const a = f.subs;
|
|
44
|
+
if (a !== void 0) {
|
|
45
|
+
const p = (t = a).nextSub;
|
|
46
|
+
p !== void 0 && (d = { value: s, prev: d }, s = p);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if ((t = s) !== void 0) {
|
|
51
|
+
s = t.nextSub;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
for (; d !== void 0; )
|
|
55
|
+
if (t = d.value, d = d.prev, t !== void 0) {
|
|
56
|
+
s = t.nextSub;
|
|
57
|
+
continue e;
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
} while (!0);
|
|
61
|
+
}
|
|
62
|
+
function H(t, l) {
|
|
63
|
+
let s, d = 0, f = !1;
|
|
64
|
+
e: do {
|
|
65
|
+
const u = t.dep, a = u.flags;
|
|
66
|
+
if (l.flags & 16)
|
|
67
|
+
f = !0;
|
|
68
|
+
else if ((a & 17) === 17) {
|
|
69
|
+
const p = u.subs;
|
|
70
|
+
e(u) && (p.nextSub !== void 0 && y(p), f = !0);
|
|
71
|
+
} else if ((a & 33) === 33) {
|
|
72
|
+
s = { value: t, prev: s }, t = u.deps, l = u, ++d;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (!f) {
|
|
76
|
+
const p = t.nextDep;
|
|
77
|
+
if (p !== void 0) {
|
|
78
|
+
t = p;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
for (; d--; ) {
|
|
83
|
+
if (t = s.value, s = s.prev, f) {
|
|
84
|
+
const V = l.subs;
|
|
85
|
+
if (e(l)) {
|
|
86
|
+
V.nextSub !== void 0 && y(V), l = t.sub;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
f = !1;
|
|
90
|
+
} else
|
|
91
|
+
l.flags &= -33;
|
|
92
|
+
l = t.sub;
|
|
93
|
+
const p = t.nextDep;
|
|
94
|
+
if (p !== void 0) {
|
|
95
|
+
t = p;
|
|
96
|
+
continue e;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return f && !!l.flags;
|
|
100
|
+
} while (!0);
|
|
101
|
+
}
|
|
102
|
+
function y(t) {
|
|
103
|
+
do {
|
|
104
|
+
const l = t.sub, s = l.flags;
|
|
105
|
+
(s & 48) === 32 && (l.flags = s | 16, (s & 6) === 2 && n(l));
|
|
106
|
+
} while ((t = t.nextSub) !== void 0);
|
|
107
|
+
}
|
|
108
|
+
function j(t, l) {
|
|
109
|
+
let s = l.depsTail;
|
|
110
|
+
for (; s !== void 0; ) {
|
|
111
|
+
if (s === t)
|
|
112
|
+
return !0;
|
|
113
|
+
s = s.prevDep;
|
|
114
|
+
}
|
|
115
|
+
return !1;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const D = 64;
|
|
119
|
+
let T = 0, v = 0, b = 0, h = 0, g;
|
|
120
|
+
const o = [], { link: C, unlink: S, propagate: B, checkDirty: F, shallowPropagate: G } = z({
|
|
121
|
+
update(e) {
|
|
122
|
+
return "getter" in e ? K(e) : "currentValue" in e ? O(e) : (e.flags = 1, !0);
|
|
123
|
+
},
|
|
124
|
+
notify(e) {
|
|
125
|
+
var r;
|
|
126
|
+
let n = h, i = n;
|
|
127
|
+
do
|
|
128
|
+
if (o[n++] = e, e.flags &= -3, e = (r = e.subs) == null ? void 0 : r.sub, e === void 0 || !(e.flags & 2))
|
|
129
|
+
break;
|
|
130
|
+
while (!0);
|
|
131
|
+
for (h = n; i < --n; ) {
|
|
132
|
+
const c = o[i];
|
|
133
|
+
o[i++] = o[n], o[n] = c;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
unwatched(e) {
|
|
137
|
+
"getter" in e ? e.depsTail !== void 0 && (e.flags = 17, P(e)) : "currentValue" in e || ("fn" in e ? A.call(e) : E.call(e));
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
function w(e) {
|
|
141
|
+
const n = g;
|
|
142
|
+
return g = e, n;
|
|
143
|
+
}
|
|
144
|
+
function J(e) {
|
|
145
|
+
return Q.bind({
|
|
146
|
+
currentValue: e,
|
|
147
|
+
pendingValue: e,
|
|
148
|
+
subs: void 0,
|
|
149
|
+
subsTail: void 0,
|
|
150
|
+
flags: 1
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function L(e) {
|
|
154
|
+
const n = {
|
|
155
|
+
fn: e,
|
|
156
|
+
cleanup: void 0,
|
|
157
|
+
subs: void 0,
|
|
158
|
+
subsTail: void 0,
|
|
159
|
+
deps: void 0,
|
|
160
|
+
depsTail: void 0,
|
|
161
|
+
flags: 6
|
|
162
|
+
}, i = w(n);
|
|
163
|
+
i !== void 0 && (C(n, i, 0), i.flags |= D);
|
|
164
|
+
try {
|
|
165
|
+
++v, n.cleanup = n.fn();
|
|
166
|
+
} finally {
|
|
167
|
+
--v, g = i, n.flags &= -5;
|
|
168
|
+
}
|
|
169
|
+
return A.bind(n);
|
|
170
|
+
}
|
|
171
|
+
function K(e) {
|
|
172
|
+
if (e.flags & D) {
|
|
173
|
+
let i = e.depsTail;
|
|
174
|
+
for (; i !== void 0; ) {
|
|
175
|
+
const r = i.prevDep, c = i.dep;
|
|
176
|
+
!("getter" in c) && !("currentValue" in c) && S(i, e), i = r;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
e.depsTail = void 0, e.flags = 5;
|
|
180
|
+
const n = w(e);
|
|
181
|
+
try {
|
|
182
|
+
++T;
|
|
183
|
+
const i = e.value;
|
|
184
|
+
return i !== (e.value = e.getter(i));
|
|
185
|
+
} finally {
|
|
186
|
+
g = n, e.flags &= -5, R(e);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function O(e) {
|
|
190
|
+
return e.flags = 1, e.currentValue !== (e.currentValue = e.pendingValue);
|
|
191
|
+
}
|
|
192
|
+
function M(e) {
|
|
193
|
+
const n = e.flags;
|
|
194
|
+
if (n & 16 || n & 32 && F(e.deps, e)) {
|
|
195
|
+
if (n & D) {
|
|
196
|
+
let r = e.depsTail;
|
|
197
|
+
for (; r !== void 0; ) {
|
|
198
|
+
const c = r.prevDep, x = r.dep;
|
|
199
|
+
!("getter" in x) && !("currentValue" in x) && S(r, e), r = c;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (e.cleanup && (q(e), !e.flags))
|
|
203
|
+
return;
|
|
204
|
+
e.depsTail = void 0, e.flags = 6;
|
|
205
|
+
const i = w(e);
|
|
206
|
+
try {
|
|
207
|
+
++T, ++v, e.cleanup = e.fn();
|
|
208
|
+
} finally {
|
|
209
|
+
--v, g = i, e.flags &= -5, R(e);
|
|
210
|
+
}
|
|
211
|
+
} else e.deps !== void 0 && (e.flags = 2 | n & D);
|
|
212
|
+
}
|
|
213
|
+
function N() {
|
|
214
|
+
try {
|
|
215
|
+
for (; b < h; ) {
|
|
216
|
+
const e = o[b];
|
|
217
|
+
o[b++] = void 0, M(e);
|
|
218
|
+
}
|
|
219
|
+
} finally {
|
|
220
|
+
for (; b < h; ) {
|
|
221
|
+
const e = o[b];
|
|
222
|
+
o[b++] = void 0, e.flags |= 10;
|
|
223
|
+
}
|
|
224
|
+
b = 0, h = 0;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function Q(...e) {
|
|
228
|
+
if (e.length) {
|
|
229
|
+
if (this.pendingValue !== (this.pendingValue = e[0])) {
|
|
230
|
+
this.flags = 17;
|
|
231
|
+
const n = this.subs;
|
|
232
|
+
n !== void 0 && (B(n, !!v), N());
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
if (this.flags & 16 && O(this)) {
|
|
236
|
+
const i = this.subs;
|
|
237
|
+
i !== void 0 && G(i);
|
|
238
|
+
}
|
|
239
|
+
const n = g;
|
|
240
|
+
return n !== void 0 && C(this, n, T), this.currentValue;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function q(e) {
|
|
244
|
+
const n = e.cleanup;
|
|
245
|
+
e.cleanup = void 0;
|
|
246
|
+
const i = g;
|
|
247
|
+
g = void 0;
|
|
248
|
+
try {
|
|
249
|
+
n();
|
|
250
|
+
} finally {
|
|
251
|
+
g = i;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function A() {
|
|
255
|
+
E.call(this), this.cleanup && q(this);
|
|
256
|
+
}
|
|
257
|
+
function E() {
|
|
258
|
+
this.flags = 0, P(this);
|
|
259
|
+
const e = this.subs;
|
|
260
|
+
e !== void 0 && S(e);
|
|
261
|
+
}
|
|
262
|
+
function P(e) {
|
|
263
|
+
let n = e.depsTail;
|
|
264
|
+
for (; n !== void 0; ) {
|
|
265
|
+
const i = n.prevDep;
|
|
266
|
+
S(n, e), n = i;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function R(e) {
|
|
270
|
+
const n = e.depsTail;
|
|
271
|
+
let i = n !== void 0 ? n.nextDep : e.deps;
|
|
272
|
+
for (; i !== void 0; )
|
|
273
|
+
i = S(i, e);
|
|
274
|
+
}
|
|
275
|
+
var W = J;
|
|
276
|
+
function X(e) {
|
|
277
|
+
let n = I((r) => {
|
|
278
|
+
let c = L(() => {
|
|
279
|
+
e(), r();
|
|
280
|
+
});
|
|
281
|
+
return () => c();
|
|
282
|
+
}, () => e(), () => e()), i = m((r) => {
|
|
283
|
+
e(typeof r == "function" ? r(e()) : r);
|
|
284
|
+
}, []);
|
|
285
|
+
return [n, i];
|
|
286
|
+
}
|
|
287
|
+
function Y(e) {
|
|
288
|
+
return I((n) => {
|
|
289
|
+
let i = L(() => {
|
|
290
|
+
e(), n();
|
|
291
|
+
});
|
|
292
|
+
return () => i();
|
|
293
|
+
}, () => e(), () => e());
|
|
294
|
+
}
|
|
295
|
+
function Z(e) {
|
|
296
|
+
return m((n) => {
|
|
297
|
+
e(typeof n == "function" ? n(e()) : n);
|
|
298
|
+
}, []);
|
|
299
|
+
}
|
|
300
|
+
function _(e) {
|
|
301
|
+
return { value: () => e(), setValue: (n) => {
|
|
302
|
+
e(typeof n == "function" ? n(e()) : n);
|
|
303
|
+
} };
|
|
304
|
+
}
|
|
305
|
+
export {
|
|
306
|
+
Z as S,
|
|
307
|
+
X as V,
|
|
308
|
+
Y as b,
|
|
309
|
+
_ as v,
|
|
310
|
+
W as y
|
|
311
|
+
};
|