@remarkablejames/editor 0.0.5 → 0.0.6
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-DBZjUu-F.js → ActionMenuButton-CpmEfz31.js} +1 -1
- package/lib/{ActionMenuButton-C6jGtl3k.cjs → ActionMenuButton-NfiUDE60.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +2 -2
- package/lib/Blockquote.cjs +1 -1
- package/lib/Blockquote.js +1 -1
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +1 -1
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +1 -1
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +15 -16
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +1 -1
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +1 -1
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +31 -32
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +1 -1
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +2 -2
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +1 -1
- package/lib/{Drawer-DTCwtJEs.js → Drawer-CayP4Ww4.js} +13 -13
- package/lib/{Drawer-B031ezmA.cjs → Drawer-DlgdaO_B.cjs} +1 -1
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +2 -2
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +8 -8
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +36 -36
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +1 -1
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +1 -1
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +3 -3
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +3 -3
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +8 -8
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +2 -2
- package/lib/History.cjs +1 -1
- package/lib/History.js +1 -1
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +1 -1
- package/lib/{Iframe-D-UYBxiv.js → Iframe-C6Sb97KS.js} +5 -5
- package/lib/{Iframe-BUK2pkOL.cjs → Iframe-CANdxSpV.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +3 -3
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +19 -19
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +12 -12
- package/lib/{Indent-Bvt-Qwar.js → Indent-CcFe8py3.js} +1 -1
- package/lib/{Indent-_y6N8MIQ.cjs → Indent-DuB2U6Cs.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +1 -1
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +1 -1
- package/lib/{Katex-CJDtvu-v.js → Katex-Bp6AnIUF.js} +3 -4
- package/lib/Katex-DFU1unCm.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +1 -1
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +2 -2
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +1 -1
- package/lib/{LinkEditBlock-Cdqwj_NU.js → LinkEditBlock-BiHumIJR.js} +7 -7
- package/lib/{LinkEditBlock-ewTApx0K.cjs → LinkEditBlock-C2zX0WVK.cjs} +1 -1
- package/lib/Mermaid-B8lQSOGn.cjs +2 -0
- package/lib/{Mermaid-CnMYVX1P.js → Mermaid-Dlx0XTJj.js} +23 -24
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +1 -1
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +2 -2
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +1 -1
- package/lib/PaywallSeparator.cjs +1 -0
- package/lib/PaywallSeparator.js +140 -0
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +7 -7
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +2 -2
- package/lib/SlashCommandNodeView-BfWNWGRr.cjs +1 -0
- package/lib/{SlashCommandNodeView-DcoLvt_6.js → SlashCommandNodeView-DzmsYaNc.js} +73 -57
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +1 -1
- package/lib/{Table-B8CHl8jK.cjs → Table-BfM6ywrZ.cjs} +1 -1
- package/lib/{Table-Cu12PvQ_.js → Table-IH34r4jd.js} +2 -2
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +1 -1
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +2 -2
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +2 -2
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +1 -1
- package/lib/{Twitter-CrX4XY1j.js → Twitter-FVQKPaq6.js} +7 -7
- package/lib/{Twitter-6HYP_upt.cjs → Twitter-axcoCgD7.cjs} +1 -1
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +1 -1
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +3 -3
- package/lib/bubble.cjs +3 -3
- package/lib/bubble.js +81 -83
- package/lib/{dropdown-menu-CVwXaR3Z.js → dropdown-menu-Ce2TorkG.js} +1 -1
- package/lib/{dropdown-menu-XIrQk3jr.cjs → dropdown-menu-DirUyRAI.cjs} +1 -1
- package/lib/extensions/PaywallSeparator/PaywallSeparator.d.ts +35 -0
- package/lib/extensions/PaywallSeparator/components/PaywallIcon.d.ts +2 -0
- package/lib/extensions/PaywallSeparator/components/PaywallSeparatorView.d.ts +17 -0
- package/lib/extensions/PaywallSeparator/components/RichTextPaywallSeparator.d.ts +1 -0
- package/lib/extensions/PaywallSeparator/components/index.d.ts +2 -0
- package/lib/extensions/PaywallSeparator/index.d.ts +1 -0
- package/lib/index-BynXHtjJ.cjs +28 -0
- package/lib/{index-B0d-u29p.js → index-CnKgiZFQ.js} +1201 -1050
- package/lib/index.cjs +1 -1
- package/lib/index.js +27 -27
- package/lib/{popover-0syCfWYi.cjs → popover-BdLwAlrM.cjs} +1 -1
- package/lib/{popover-DDT8YRht.js → popover-BzJyaFvy.js} +1 -1
- package/lib/{separator-D8lOAf8f.cjs → separator-CoQaQmFK.cjs} +1 -1
- package/lib/{separator-DRGTEiX4.js → separator-D-fyzbfx.js} +14 -14
- package/lib/style.css +1 -1
- package/lib/types.d.ts +5 -5
- package/package.json +14 -1
- package/lib/Katex-bJXkt-VP.cjs +0 -4
- package/lib/Mermaid-Dwz9o-yM.cjs +0 -2
- package/lib/SlashCommandNodeView-BMgQJ4xT.cjs +0 -1
- package/lib/index-De9MZVWQ.cjs +0 -28
- package/lib/select-D9wQw2qB.js +0 -120
- package/lib/select-DTNz0ZeE.cjs +0 -1
- package/lib/textarea-DfVzbMr5.js +0 -20
- package/lib/textarea-DpkwluT0.cjs +0 -1
package/lib/History.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./clsx-CXbNJWDD.cjs"),C=require("@tiptap/pm/state"),E=require("@tiptap/pm/view"),R=require("./index-neeeY2o7.cjs"),b=require("react/jsx-runtime"),x=require("./index-De9MZVWQ.cjs");require("react");require("./theme.cjs");function _(r={}){return new p.Plugin({view(e){return new W(e,r)}})}class W{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let c=e.nodeBefore,h=e.nodeAfter;if(c||h){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),S=c?v.bottom:v.top;c&&h&&(S=(S+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let I=this.width/2*l;n={left:v.left,right:v.right,top:S-I,bottom:S+I}}}}if(!n){let c=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;n={left:c.left-h,right:c.left+h,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),h=c.width/a.offsetWidth,m=c.height/a.offsetHeight;d=c.left-a.scrollLeft*h,u=c.top-a.scrollTop*m}this.element.style.left=(n.left-d)/s+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=p.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends p.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return f.valid(n)?new f(n):p.Selection.near(n)}content(){return p.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new z(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!U(e)||!q(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&f.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(f.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!p.NodeSelection.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),n=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;p.Selection.jsonID("gapcursor",f);class z{constructor(e){this.pos=e}map(e){return new z(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):p.Selection.near(t)}}function L(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function U(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||L(i.type))return!0;if(i.inlineContent)return!1}}return!0}function q(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||L(i.type))return!0;if(i.inlineContent)return!1}}return!0}function X(){return new p.Plugin({props:{decorations:Q,createSelectionBetween(r,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:J,handleKeyDown:Y,handleDOMEvents:{beforeinput:Z}}})}const Y=R.keydownHandler({ArrowLeft:A("horiz",-1),ArrowRight:A("horiz",1),ArrowUp:A("vert",-1),ArrowDown:A("vert",1)});function A(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,o){let s=n.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof p.TextSelection){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let d=f.findGapCursorFrom(l,e,a);return d?(i&&i(n.tr.setSelection(new f(d))),!0):!1}}function J(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!f.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&p.NodeSelection.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new f(n))),!0)}function Z(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof f))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=p.Fragment.empty;for(let s=n.length-1;s>=0;s--)i=p.Fragment.from(n[s].createAndFill(null,i));let o=r.state.tr.replace(t.pos,t.pos,new p.Slice(i,0,0));return o.setSelection(p.TextSelection.near(o.doc.resolve(t.pos+1))),r.dispatch(o),!1}function Q(r){if(!(r.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",R.DecorationSet.create(r.doc,[R.Decoration.widget(r.selection.head,e,{key:"gapcursor"})])}var O=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<O&&this.leafAppend(e)||this.length<O&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new $(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};g.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,n),i};g.from=function(e){return e instanceof g?e:e&&e.length?new B(e):g.empty};var B=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=O)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=O)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new B([]);var $=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(n,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(n,i):n>=o?this.right.slice(n-o,i-o):this.left.slice(n,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(g);const ee=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,o;t&&(i=this.remapping(n,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,h)=>{if(!c.step){i||(i=this.remapping(n,h+1),o=i.maps.length),o--,u.push(c);return}if(i){u.push(new y(c.map));let m=c.step.map(i.slice(o)),v;m&&s.maybeStep(m).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new y(v,void 0,void 0,d.length+u.length))),o--,v&&i.appendMap(v,o)}else s.maybeStep(c.step);if(c.selection)return l=i?c.selection.map(i.slice(o)):c.selection,a=new w(this.items.slice(0,n).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,n,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),h=new y(e.mapping.maps[u],c,t),m;(m=a&&a.merge(h))&&(h=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let d=s-n.depth;return d>ne&&(l=te(l,d),s-=d),new w(l.append(o),s)}remapping(e,t){let n=new p.Mapping;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,t),n}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let v=o.maps[m];if(h.step){let S=e.steps[m].invert(e.docs[m]),I=h.selection&&h.selection.map(o.slice(a+1,m));I&&l++,n.push(new y(v,S,I))}else n.push(new y(v))},i);let d=[];for(let h=t;h<s;h++)d.push(new y(o.maps[h]));let u=this.items.slice(0,i).append(d).append(n),c=new w(u,l);return c.emptyItemCount()>ee&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(n)),d=a&&a.getMap();if(n--,d&&t.appendMap(d,n),a){let u=s.selection&&s.selection.map(t.slice(n));u&&o++;let c=new y(d.invert(),a,u),h,m=i.length-1;(h=i.length&&i[m].merge(c))?i[m]=h:i.push(c)}}else s.map&&n--},this.items.length,0),new w(g.from(i.reverse()),o)}}w.empty=new w(g.empty,0);function te(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class y{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class P{constructor(e,t,n,i,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=o}}const ne=20;function ie(r,e,t,n){let i=t.getMeta(M),o;if(i)return i.historyState;t.getMeta(se)&&(r=new P(r.done,r.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(s&&s.getMeta(M))return s.getMeta(M).redo?new P(r.done.addTransform(t,void 0,n,T(e)),r.undone,F(t.mapping.maps),r.prevTime,r.prevComposition):new P(r.done,r.undone.addTransform(t,void 0,n,T(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!s&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!re(t,r.prevRanges)),d=s?D(r.prevRanges,t.mapping):F(t.mapping.maps);return new P(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,T(e)),w.empty,d,t.time,l??r.prevComposition)}else return(o=t.getMeta("rebased"))?new P(r.done.rebased(t,o),r.undone.rebased(t,o),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new P(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function re(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let o=0;o<e.length;o+=2)n<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function F(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,o,s)=>e.push(o,s));return e}function D(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),o=e.map(r[n+1],-1);i<=o&&t.push(i,o)}return t}function oe(r,e,t){let n=T(e),i=M.get(e).spec.config,o=(t?r.undone:r.done).popEvent(e,n);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?r.done:r.undone).addTransform(o.transform,e.selection.getBookmark(),i,n),a=new P(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(M,{redo:t,historyState:a})}let k=!1,V=null;function T(r){let e=r.plugins;if(V!=e){k=!1,V=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const M=new p.PluginKey("history"),se=new p.PluginKey("closeHistory");function le(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new p.Plugin({key:M,state:{init(){return new P(w.empty,w.empty,null,0,-1)},apply(e,t,n){return ie(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?H:n=="historyRedo"?G:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function j(r,e){return(t,n)=>{let i=M.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let o=oe(i,t,r);o&&n(e?o.scrollIntoView():o)}return!0}}const H=j(!1,!0),G=j(!0,!0);p.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc;if(((r==null?void 0:r.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const o=this.storage.characters({node:n.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=n.tr.deleteRange(l,a);return r=!0,d}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n||i>n&&o>n&&o<=i)return!0;if(i>n&&o>n&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-n,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>n)}})]}});p.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[_(this.options)]}});p.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,o=[];if(!t||!n)return E.DecorationSet.create(r,[]);let s=0;this.options.mode==="deepest"&&r.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return r.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(E.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),E.DecorationSet.create(r,o)}}})]}});p.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[X()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=p.callOrReturn(p.getExtensionField(r,"allowGapCursor",t)))!=null?e:null}}});p.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return r.descendants((s,l)=>{const a=n>=l&&n<=l+s.nodeSize,d=!s.isLeaf&&p.isNodeEmpty(s);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const c=E.Decoration.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});i.push(c)}return this.options.includeChildren}),E.DecorationSet.create(r,i)}}})]}});p.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||p.isNodeSelection(t.selection)||r.view.dragging?null:E.DecorationSet.create(t.doc,[E.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function K({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||(e==null?void 0:e.type)===r}p.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new C.PluginKey(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new C.Plugin({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,h=d.nodes[t];if(u)return a.insert(c,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!K({node:s,types:n})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!K({node:s,types:n})}}})]}});var ae=p.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>H(r,e),redo:()=>({state:r,dispatch:e})=>G(r,e)}},addProseMirrorPlugins(){return[le(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function de(){var u;const r=x.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((u=r==null?void 0:r.componentProps)==null?void 0:u.undo)??{},{disabled:l}=x.useActive(s),a=x.icons[e],d=()=>{l||o&&o()};return!r||!a?b.jsx(b.Fragment,{}):b.jsx(x.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i})}function ce(){var d;const r=x.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((d=r==null?void 0:r.componentProps)==null?void 0:d.redo)??{},{disabled:l}=x.useActive(s),a=()=>{l||o&&o()};return r?b.jsx(x.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i}):b.jsx(b.Fragment,{})}const N=ae.extend({addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:n})=>{var i,o;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=n.options.shortcutKeys)==null?void 0:i[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((o=n.options.shortcutKeys)==null?void 0:o[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=N;exports.RichTextRedo=ce;exports.RichTextUndo=de;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./clsx-CXbNJWDD.cjs"),C=require("@tiptap/pm/state"),E=require("@tiptap/pm/view"),R=require("./index-neeeY2o7.cjs"),b=require("react/jsx-runtime"),x=require("./index-BynXHtjJ.cjs");require("react");require("./theme.cjs");function _(r={}){return new p.Plugin({view(e){return new W(e,r)}})}class W{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(t){let c=e.nodeBefore,h=e.nodeAfter;if(c||h){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),S=c?v.bottom:v.top;c&&h&&(S=(S+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let I=this.width/2*l;n={left:v.left,right:v.right,top:S-I,bottom:S+I}}}}if(!n){let c=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;n={left:c.left-h,right:c.left+h,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let c=a.getBoundingClientRect(),h=c.width/a.offsetWidth,m=c.height/a.offsetHeight;d=c.left-a.scrollLeft*h,u=c.top-a.scrollTop*m}this.element.style.left=(n.left-d)/s+"px",this.element.style.top=(n.top-u)/l+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=p.dropPoint(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends p.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return f.valid(n)?new f(n):p.Selection.near(n)}content(){return p.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new z(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!U(e)||!q(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&f.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(f.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!p.NodeSelection.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),n=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;p.Selection.jsonID("gapcursor",f);class z{constructor(e){this.pos=e}map(e){return new z(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):p.Selection.near(t)}}function L(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function U(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||L(i.type))return!0;if(i.inlineContent)return!1}}return!0}function q(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||L(i.type))return!0;if(i.inlineContent)return!1}}return!0}function X(){return new p.Plugin({props:{decorations:Q,createSelectionBetween(r,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:J,handleKeyDown:Y,handleDOMEvents:{beforeinput:Z}}})}const Y=R.keydownHandler({ArrowLeft:A("horiz",-1),ArrowRight:A("horiz",1),ArrowUp:A("vert",-1),ArrowDown:A("vert",1)});function A(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,o){let s=n.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof p.TextSelection){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let d=f.findGapCursorFrom(l,e,a);return d?(i&&i(n.tr.setSelection(new f(d))),!0):!1}}function J(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!f.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&p.NodeSelection.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new f(n))),!0)}function Z(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof f))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=p.Fragment.empty;for(let s=n.length-1;s>=0;s--)i=p.Fragment.from(n[s].createAndFill(null,i));let o=r.state.tr.replace(t.pos,t.pos,new p.Slice(i,0,0));return o.setSelection(p.TextSelection.near(o.doc.resolve(t.pos+1))),r.dispatch(o),!1}function Q(r){if(!(r.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",R.DecorationSet.create(r.doc,[R.Decoration.widget(r.selection.head,e,{key:"gapcursor"})])}var O=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<O&&this.leafAppend(e)||this.length<O&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new $(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};g.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,n),i};g.from=function(e){return e instanceof g?e:e&&e.length?new B(e):g.empty};var B=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=O)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=O)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new B([]);var $=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(n,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(n,i):n>=o?this.right.slice(n-o,i-o):this.left.slice(n,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(g);const ee=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,o;t&&(i=this.remapping(n,this.items.length),o=i.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((c,h)=>{if(!c.step){i||(i=this.remapping(n,h+1),o=i.maps.length),o--,u.push(c);return}if(i){u.push(new y(c.map));let m=c.step.map(i.slice(o)),v;m&&s.maybeStep(m).doc&&(v=s.mapping.maps[s.mapping.maps.length-1],d.push(new y(v,void 0,void 0,d.length+u.length))),o--,v&&i.appendMap(v,o)}else s.maybeStep(c.step);if(c.selection)return l=i?c.selection.map(i.slice(o)):c.selection,a=new w(this.items.slice(0,n).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,n,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let c=e.steps[u].invert(e.docs[u]),h=new y(e.mapping.maps[u],c,t),m;(m=a&&a.merge(h))&&(h=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),t&&(s++,t=void 0),i||(a=h)}let d=s-n.depth;return d>ne&&(l=te(l,d),s-=d),new w(l.append(o),s)}remapping(e,t){let n=new p.Mapping;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,t),n}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let v=o.maps[m];if(h.step){let S=e.steps[m].invert(e.docs[m]),I=h.selection&&h.selection.map(o.slice(a+1,m));I&&l++,n.push(new y(v,S,I))}else n.push(new y(v))},i);let d=[];for(let h=t;h<s;h++)d.push(new y(o.maps[h]));let u=this.items.slice(0,i).append(d).append(n),c=new w(u,l);return c.emptyItemCount()>ee&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(n)),d=a&&a.getMap();if(n--,d&&t.appendMap(d,n),a){let u=s.selection&&s.selection.map(t.slice(n));u&&o++;let c=new y(d.invert(),a,u),h,m=i.length-1;(h=i.length&&i[m].merge(c))?i[m]=h:i.push(c)}}else s.map&&n--},this.items.length,0),new w(g.from(i.reverse()),o)}}w.empty=new w(g.empty,0);function te(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class y{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class P{constructor(e,t,n,i,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=o}}const ne=20;function ie(r,e,t,n){let i=t.getMeta(M),o;if(i)return i.historyState;t.getMeta(se)&&(r=new P(r.done,r.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(s&&s.getMeta(M))return s.getMeta(M).redo?new P(r.done.addTransform(t,void 0,n,T(e)),r.undone,F(t.mapping.maps),r.prevTime,r.prevComposition):new P(r.done,r.undone.addTransform(t,void 0,n,T(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!s&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!re(t,r.prevRanges)),d=s?D(r.prevRanges,t.mapping):F(t.mapping.maps);return new P(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,T(e)),w.empty,d,t.time,l??r.prevComposition)}else return(o=t.getMeta("rebased"))?new P(r.done.rebased(t,o),r.undone.rebased(t,o),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new P(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),D(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function re(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let o=0;o<e.length;o+=2)n<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function F(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,o,s)=>e.push(o,s));return e}function D(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),o=e.map(r[n+1],-1);i<=o&&t.push(i,o)}return t}function oe(r,e,t){let n=T(e),i=M.get(e).spec.config,o=(t?r.undone:r.done).popEvent(e,n);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?r.done:r.undone).addTransform(o.transform,e.selection.getBookmark(),i,n),a=new P(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(M,{redo:t,historyState:a})}let k=!1,V=null;function T(r){let e=r.plugins;if(V!=e){k=!1,V=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){k=!0;break}}return k}const M=new p.PluginKey("history"),se=new p.PluginKey("closeHistory");function le(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new p.Plugin({key:M,state:{init(){return new P(w.empty,w.empty,null,0,-1)},apply(e,t,n){return ie(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?H:n=="historyRedo"?G:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function j(r,e){return(t,n)=>{let i=M.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let o=oe(i,t,r);o&&n(e?o.scrollIntoView():o)}return!0}}const H=j(!1,!0),G=j(!0,!0);p.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc;if(((r==null?void 0:r.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=(r==null?void 0:r.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new C.Plugin({key:new C.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const o=this.storage.characters({node:n.doc});if(o>i){const s=o-i,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const d=n.tr.deleteRange(l,a);return r=!0,d}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n||i>n&&o>n&&o<=i)return!0;if(i>n&&o>n&&o>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=o-n,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>n)}})]}});p.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[_(this.options)]}});p.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,o=[];if(!t||!n)return E.DecorationSet.create(r,[]);let s=0;this.options.mode==="deepest"&&r.descendants((a,d)=>{if(a.isText)return;if(!(i>=d&&i<=d+a.nodeSize-1))return!1;s+=1});let l=0;return r.descendants((a,d)=>{if(a.isText||!(i>=d&&i<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(E.Decoration.node(d,d+a.nodeSize,{class:this.options.className}))}),E.DecorationSet.create(r,o)}}})]}});p.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[X()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=p.callOrReturn(p.getExtensionField(r,"allowGapCursor",t)))!=null?e:null}}});p.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new C.Plugin({key:new C.PluginKey("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const o=this.editor.isEmpty;return r.descendants((s,l)=>{const a=n>=l&&n<=l+s.nodeSize,d=!s.isLeaf&&p.isNodeEmpty(s);if((a||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const c=E.Decoration.node(l,l+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});i.push(c)}return this.options.includeChildren}),E.DecorationSet.create(r,i)}}})]}});p.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new C.Plugin({key:new C.PluginKey("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||p.isNodeSelection(t.selection)||r.view.dragging?null:E.DecorationSet.create(t.doc,[E.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function K({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||(e==null?void 0:e.type)===r}p.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new C.PluginKey(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new C.Plugin({key:e,appendTransaction:(i,o,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),c=l.content.size,h=d.nodes[t];if(u)return a.insert(c,h.create())},state:{init:(i,o)=>{const s=o.tr.doc.lastChild;return!K({node:s,types:n})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const s=i.doc.lastChild;return!K({node:s,types:n})}}})]}});var ae=p.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>H(r,e),redo:()=>({state:r,dispatch:e})=>G(r,e)}},addProseMirrorPlugins(){return[le(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});function de(){var u;const r=x.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((u=r==null?void 0:r.componentProps)==null?void 0:u.undo)??{},{disabled:l}=x.useActive(s),a=x.icons[e],d=()=>{l||o&&o()};return!r||!a?b.jsx(b.Fragment,{}):b.jsx(x.ActionButton,{action:d,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i})}function ce(){var d;const r=x.useButtonProps(N.name),{icon:e=void 0,tooltip:t=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:o=void 0,isActive:s=void 0}=((d=r==null?void 0:r.componentProps)==null?void 0:d.redo)??{},{disabled:l}=x.useActive(s),a=()=>{l||o&&o()};return r?b.jsx(x.ActionButton,{action:a,disabled:l,icon:e,shortcutKeys:n,tooltip:t,tooltipOptions:i}):b.jsx(b.Fragment,{})}const N=ae.extend({addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),depth:100,newGroupDelay:500,button:({editor:e,t,extension:n})=>{var i,o;return{componentProps:{undo:{action:()=>{e.chain().focus().undo().run()},shortcutKeys:((i=n.options.shortcutKeys)==null?void 0:i[0])??["mod","Z"],isActive:()=>e.can().undo(),icon:"Undo2",tooltip:t("editor.undo.tooltip")},redo:{action:()=>{e.chain().focus().redo().run()},shortcutKeys:((o=n.options.shortcutKeys)==null?void 0:o[1])??["shift","mod","Z"],isActive:()=>e.can().redo(),icon:"Redo2",tooltip:t("editor.redo.tooltip")}}}}}}});exports.History=N;exports.RichTextRedo=ce;exports.RichTextUndo=de;
|
package/lib/History.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Plugin as I, PluginKey as b } from "@tiptap/pm/state";
|
|
|
3
3
|
import { DecorationSet as O, Decoration as R } from "@tiptap/pm/view";
|
|
4
4
|
import { k as le, D as ae, a as de } from "./index-RkKGy5oa.js";
|
|
5
5
|
import { jsx as T, Fragment as j } from "react/jsx-runtime";
|
|
6
|
-
import { u as U, e as X, A as Y, i as ce } from "./index-
|
|
6
|
+
import { u as U, e as X, A as Y, i as ce } from "./index-CnKgiZFQ.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "./theme.js";
|
|
9
9
|
function ue(i = {}) {
|
package/lib/HorizontalRule.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),l=require("@tiptap/pm/state"),p=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),l=require("@tiptap/pm/state"),p=require("./index-BynXHtjJ.cjs"),m=require("react/jsx-runtime");require("react");require("./theme.cjs");var A=i.Node3.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",i.mergeAttributes(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,n)=>n.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:n})=>{if(!i.canInsertNode(n,n.schema.nodes[this.name]))return!1;const{selection:r}=n,{$to:s}=r,c=t();return i.isNodeSelection(r)?c.insertContentAt(s.pos,{type:this.name}):c.insertContent({type:this.name}),c.command(({state:a,tr:e,dispatch:h})=>{if(h){const{$to:o}=e.selection,u=o.end();if(o.nodeAfter)o.nodeAfter.isTextblock?e.setSelection(l.TextSelection.create(e.doc,o.pos+1)):o.nodeAfter.isBlock?e.setSelection(l.NodeSelection.create(e.doc,o.pos)):e.setSelection(l.TextSelection.create(e.doc,o.pos));else{const d=a.schema.nodes[this.options.nextNodeType]||o.parent.type.contentMatch.defaultType,T=d==null?void 0:d.create();T&&(e.insert(u,T),e.setSelection(l.TextSelection.create(e.doc,u+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[i.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});function y(){const t=p.useButtonProps(f.name),{icon:n=void 0,tooltip:r=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:e=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:h,disabled:o,update:u}=p.useToggleActive(e),d=()=>{o||a&&(a(),u())};return t?m.jsx(p.ActionButton,{action:d,dataState:h,disabled:o,icon:n,shortcutKeys:s,tooltip:r,tooltipOptions:c}):m.jsx(m.Fragment,{})}const f=A.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:n,t:r,extension:s})=>({component:p.ActionButton,componentProps:{action:()=>n.commands.setHorizontalRule(),disabled:!n.can().setHorizontalRule(),icon:"Minus",shortcutKeys:s.options.shortcutKeys??["mod","alt","S"],tooltip:r("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}},renderHTML(){return["div",i.mergeAttributes(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}});exports.HorizontalRule=f;exports.RichTextHorizontalRule=y;
|
package/lib/HorizontalRule.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { N as T, n as A, o as y, q as H, m as h } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { TextSelection as u, NodeSelection as R } from "@tiptap/pm/state";
|
|
3
|
-
import { u as M, d as v, A as f } from "./index-
|
|
3
|
+
import { u as M, d as v, A as f } from "./index-CnKgiZFQ.js";
|
|
4
4
|
import { jsx as m, Fragment as z } from "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
|
@@ -2,7 +2,7 @@ import { h as v, j as x, N as k, k as y, n as S, m as I } from "./clsx-BUPZHhq3.
|
|
|
2
2
|
import { jsxs as f, jsx as d, Fragment as P } from "react/jsx-runtime";
|
|
3
3
|
import { Resizable as M } from "re-resizable";
|
|
4
4
|
import { useState as R, useCallback as N } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { G as j, j as U, B as q, u as A, d as L, A as D, M as l } from "./index-CnKgiZFQ.js";
|
|
6
6
|
import "./theme.js";
|
|
7
7
|
const m = {
|
|
8
8
|
youtube: {
|
|
@@ -167,10 +167,10 @@ function X(e) {
|
|
|
167
167
|
function J(e, t) {
|
|
168
168
|
return t.src = `${t.matchedUrl}?background=white&banner=show&embedded=true`, t.validId = !0, t.originalLink = e, t;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function W(e, t) {
|
|
171
171
|
return t.src = `${t.matchedUrl}`, t.validId = !0, t.originalLink = e, t;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function F(e, t, i) {
|
|
174
174
|
if (e === "googlemaps")
|
|
175
175
|
return i.validLink = !0, i.matchedUrl = t, i;
|
|
176
176
|
const n = m[e].linkRule;
|
|
@@ -195,7 +195,7 @@ function Z(e) {
|
|
|
195
195
|
src: ""
|
|
196
196
|
};
|
|
197
197
|
const i = G(e);
|
|
198
|
-
if (t =
|
|
198
|
+
if (t = F(i, e, t), !t.validLink)
|
|
199
199
|
return t;
|
|
200
200
|
switch (i) {
|
|
201
201
|
case "youtube":
|
|
@@ -227,7 +227,7 @@ function Z(e) {
|
|
|
227
227
|
case "jinshuju":
|
|
228
228
|
return J(e, t);
|
|
229
229
|
case "iframe":
|
|
230
|
-
return
|
|
230
|
+
return W(e, t);
|
|
231
231
|
default:
|
|
232
232
|
return e;
|
|
233
233
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const m=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),k=require("re-resizable"),b=require("react"),u=require("./index-
|
|
1
|
+
"use strict";const m=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),k=require("re-resizable"),b=require("react"),u=require("./index-BynXHtjJ.cjs");require("./theme.cjs");const p={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function y(e){const t=p.youtube,i=e.matchedUrl;e.validLink=!0;const r=i.split("="),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}/${c}`,e.validId=!0}return e}function S(e){const t=p.youku,i=e.matchedUrl,r=t.idRule,n=new RegExp(r),c=i.match(n);if(c&&c.length>0){const o=c[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${o}`}else e.validId=!1;return e}function I(e){const t=p.bilibili,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function R(e){const t=p.qqvideo,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function P(e,t){return t.src=e,t.validId=!0,t}function j(e,t){return t.src=e,t.validId=!0,t}function M(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function N(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function q(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function U(e){const t=p.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function A(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function D(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function L(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function _(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function $(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function T(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=p[e].linkRule;for(const c of n){const o=new RegExp(c),a=t.match(o);if(a&&a.length>0)return i.validLink=!0,i.matchedUrl=e==="youtube"?a[1]:a[0],i}return i}function z(e){var i,r;let t="iframe";return((i=e.includes)!=null&&i.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function v(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const i=z(e);if(t=T(i,e,t),!t.validLink)return t;switch(i){case"youtube":return y(t);case"youku":return S(t);case"bilibili":return I(t);case"qqvideo":return R(t);case"amap":return P(e,t);case"baidu_map":return j(e,t);case"googlemaps":return M(e,t);case"modao":return N(t);case"lanhu":return q(t);case"figma":return U(t);case"canva":return A(e,t);case"processon":return D(e,t);case"codepen":return L(t);case"jinshuju":return _(e,t);case"iframe":return $(e,t);default:return e}}const Y="_wrap_5y04w_1",C="_innerWrap_5y04w_15",g={wrap:Y,innerWrap:C};function E({editor:e,node:t,updateAttributes:i}){const r=u.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,l]=b.useState("");function h(){if(!a)return;const d=v(a);e.chain().updateAttributes(f.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const x=b.useCallback(d=>{i({width:d.width,height:d.height})},[i]);return s.jsxs(m.NodeViewWrapper,{children:[!n&&s.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-border richtext-p-[10px]",children:[s.jsx(u.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>l(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(u.Button,{className:"richtext-w-[60px]",onClick:h,children:"OK"})]}),n&&s.jsx(k.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,B,V,w)=>{x({width:Number.parseInt(c)+w.width,height:Number.parseInt(o)+w.height})},children:s.jsx("div",{className:m.clsx(g.wrap,"render-wrapper"),children:s.jsx("div",{className:g.innerWrap,style:{pointerEvents:r?"none":"auto"},children:s.jsx("iframe",{className:"richtext-my-[12px]",src:n})})})})]})}function H(){const e=u.useButtonProps(f.name),{icon:t=void 0,tooltip:i=void 0,shortcutKeys:r=void 0,tooltipOptions:n={},action:c=void 0,isActive:o=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:l}=u.useToggleActive(o),h=()=>{a||c&&(c(),l())};return e?s.jsx(u.ActionButton,{action:h,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const f=m.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({componentProps:{action:n=>t.commands.setIframe(n),upload:i.options.upload,icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:u.getDatasetAttribute("width")},height:{default:300,parseHTML:u.getDatasetAttribute("height")},src:{default:null,parseHTML:u.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",m.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var c,o,a;if(((a=(o=(c=t.selection)==null?void 0:c.node)==null?void 0:o.type)==null?void 0:a.name)==this.name)return i.updateAttributes(this.name,e);const n=e||{url:""};return r().insertContent({type:this.name,attrs:n}).run()}}},addInputRules(){return[m.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return m.ReactNodeViewRenderer(E)}});exports.Iframe=f;exports.RichTextIframe=H;exports.getServiceSrc=v;
|
package/lib/Iframe.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Iframe-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Iframe-CANdxSpV.cjs");require("./index-BynXHtjJ.cjs");exports.Iframe=e.Iframe;exports.RichTextIframe=e.RichTextIframe;
|
package/lib/Iframe.js
CHANGED
package/lib/Image.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./index-BynXHtjJ.cjs");exports.Image=e.Image;exports.RichTextImage=e.RichTextImage;
|
package/lib/Image.js
CHANGED
package/lib/ImageGif.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./clsx-CXbNJWDD.cjs"),f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./clsx-CXbNJWDD.cjs"),f=require("./index-BynXHtjJ.cjs"),l=require("react/jsx-runtime"),u=require("react"),j=require("./index-DgOXAdKt.cjs");require("./theme.cjs");const L=require("./popover-BdLwAlrM.cjs"),N={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function q(e){var k,z;const[t,r]=u.useState({width:j.IMAGE_MAX_SIZE,height:j.IMAGE_MAX_SIZE}),[o,i]=u.useState({width:0,height:0}),[n]=u.useState([N.TOP_LEFT,N.TOP_RIGHT,N.BOTTOM_LEFT,N.BOTTOM_RIGHT]),[s,a]=u.useState(!1),[h,x]=u.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=(k=e==null?void 0:e.node)==null?void 0:k.attrs,m=u.useMemo(()=>{var b;const{src:c,alt:w,width:v,height:A}=(b=e==null?void 0:e.node)==null?void 0:b.attrs,G=f.isNumber(v)?`${v}px`:v,d=f.isNumber(A)?`${A}px`:A;return{src:c||void 0,alt:w||void 0,style:{width:G||void 0,height:d||void 0}}},[(z=e==null?void 0:e.node)==null?void 0:z.attrs]),_=u.useMemo(()=>{const{style:{width:c}}=m;return{width:c==="100%"?c:void 0}},[m]);function g(c){i({width:c.target.width,height:c.target.height})}function I(){const{editor:c,getPos:w}=e;c.commands.setNodeSelection(w())}const M=u.useCallback(f.throttle(()=>{const{editor:c}=e,{width:w}=getComputedStyle(c.view.dom);r(v=>({...v,width:Number.parseInt(w,10)}))},j.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function H(c,w){c.preventDefault(),c.stopPropagation();const v=o.width,A=o.height,G=v/A;let d=Number(e.node.attrs.width),b=Number(e.node.attrs.height);const y=t.width;d&&!b?(d=d>y?y:d,b=Math.round(d/G)):b&&!d?(d=Math.round(b*G),d=d>y?y:d):!d&&!b?(d=v>y?y:v,b=Math.round(d/G)):d=d>y?y:d,a(!0),x({x:c.clientX,y:c.clientY,w:d,h:b,dir:w})}const E=u.useCallback(f.throttle(c=>{if(c.preventDefault(),c.stopPropagation(),!s)return;const{x:w,w:v,dir:A}=h,G=(c.clientX-w)*(/l/.test(A)?-1:1),d=f.clamp$1(v+G,j.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:d,height:null})},j.IMAGE_THROTTLE_WAIT_TIME),[s,h,t,e.updateAttributes]),S=u.useCallback(c=>{c.preventDefault(),c.stopPropagation(),s&&(x({x:0,y:0,w:0,h:0,dir:""}),a(!1),I())},[s,I]),$=u.useCallback(()=>{document==null||document.addEventListener("mousemove",E,!0),document==null||document.addEventListener("mouseup",S,!0)},[E,S]),O=u.useCallback(()=>{document==null||document.removeEventListener("mousemove",E,!0),document==null||document.removeEventListener("mouseup",S,!0)},[E,S]);u.useEffect(()=>(s?$():O(),()=>{O()}),[s,$,O]);const R=u.useMemo(()=>new ResizeObserver(()=>M()),[M]);return u.useEffect(()=>(R.observe(e.editor.view.dom),()=>{R.disconnect()}),[e.editor.view.dom,R]),l.jsx(P.NodeViewWrapper,{className:"image-view",style:{..._,width:"100%",textAlign:T},children:l.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:_,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[l.jsx("img",{alt:m.alt,className:"image-view__body__image block",height:"auto",onClick:I,onLoad:g,src:m.src,style:m.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||s)&&l.jsx("div",{className:"image-resizer",children:n==null?void 0:n.map(c=>l.jsx("span",{className:`image-resizer__handler image-resizer__handler--${c}`,onMouseDown:w=>H(w,c)},`image-dir-${c}`))})]})})}async function W(e){var o;const r=await(await fetch(`https://api.giphy.com/v1/gifs/trending?q=&limit=15&api_key=${e}`)).json();return(o=r==null?void 0:r.data)==null?void 0:o.map(i=>{var n,s,a;return{id:i==null?void 0:i.id,src:(n=i==null?void 0:i.images.original)==null?void 0:n.url,width:+((s=i==null?void 0:i.images.original)==null?void 0:s.width),height:+((a=i==null?void 0:i.images.original)==null?void 0:a.width)}})}async function p(e,t){var i;const o=await(await fetch(`https://api.giphy.com/v1/gifs/search?q=${e}&limit=15&api_key=${t}`)).json();return(i=o==null?void 0:o.data)==null?void 0:i.map(n=>{var s,a,h;return{id:n==null?void 0:n.id,src:(s=n==null?void 0:n.images.original)==null?void 0:s.url,width:+((a=n==null?void 0:n.images.original)==null?void 0:a.width),height:+((h=n==null?void 0:n.images.original)==null?void 0:h.width)}})}async function D(e){var n,s;const t=await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`),r=await(t==null?void 0:t.json()),i=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(n=r==null?void 0:r.results)==null?void 0:n[0]}&limit=15`)).json();return(s=i==null?void 0:i.results)==null?void 0:s.map(a=>{var h,x,T,m,_,g,I,M;return{id:a==null?void 0:a.id,src:(x=(h=a==null?void 0:a.media_formats)==null?void 0:h.gif)==null?void 0:x.url,width:(_=(m=(T=a==null?void 0:a.media_formats)==null?void 0:T.gif)==null?void 0:m.dims)==null?void 0:_[0],height:(M=(I=(g=a==null?void 0:a.media_formats)==null?void 0:g.gif)==null?void 0:I.dims)==null?void 0:M[1]}})}async function F(e,t){var i;const o=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();return(i=o==null?void 0:o.results)==null?void 0:i.map(n=>{var s,a,h,x,T,m,_,g;return{id:n==null?void 0:n.id,src:(a=(s=n==null?void 0:n.media_formats)==null?void 0:s.gif)==null?void 0:a.url,width:(T=(x=(h=n==null?void 0:n.media_formats)==null?void 0:h.gif)==null?void 0:x.dims)==null?void 0:T[0],height:(g=(_=(m=n==null?void 0:n.media_formats)==null?void 0:m.gif)==null?void 0:_.dims)==null?void 0:g[1]}})}function B(e,t){return{searchTrending:async()=>t?e==="giphy"?W(t):e==="tenor"?D(t):[]:[],searchWord:async i=>t?e==="giphy"?p(i,t):e==="tenor"?F(i,t):[]:[]}}function V({selectImage:e,apiKey:t,provider:r,children:o}){const[i,n]=u.useState(!1),[s,a]=u.useState([]),{editorDisabled:h}=f.useToggleActive(),x=u.useRef(null),{searchTrending:T,searchWord:m}=B(r,t);u.useEffect(()=>{(async()=>{const g=await T();a(g)})()},[]);const _=u.useCallback(f.debounce(async g=>{if(!g.target.value){const M=await T();a(M);return}const I=await m(g.target.value);a(I)},350),[]);return l.jsxs(L.Popover,{modal:!0,onOpenChange:n,open:i,children:[l.jsx(L.PopoverTrigger,{asChild:!0,disabled:h,children:o}),l.jsx(L.PopoverContent,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:t?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"richtext-mb-[10px] richtext-w-full",children:l.jsx(f.Input,{onChange:_,placeholder:"Search GIF",ref:x,type:"text"})}),l.jsx("div",{className:"richtext-max-h-[280px] !richtext-max-w-[400px] richtext-overflow-y-auto",children:l.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1",children:s!=null&&s.length?s==null?void 0:s.map(g=>l.jsx("img",{alt:"",className:"richtext-cursor-pointer richtext-object-contain richtext-text-center",src:g.src,onClick:()=>{e(g.src),n(!1)}},g.id)):l.jsx("p",{children:"No GIFs found"})})})]}):l.jsx("div",{children:l.jsx("p",{children:"Missing Giphy API Key"})})})]})}function X(){const e=f.useButtonProps(C.name),{action:t,icon:r,tooltip:o,apiKey:i,provider:n}=(e==null?void 0:e.componentProps)??{},{editorDisabled:s}=f.useToggleActive(),a=h=>{s||t&&t(h)};return l.jsx(V,{apiKey:i,provider:n,selectImage:a,children:l.jsx(f.ActionButton,{disabled:s,icon:r,tooltip:o})})}const C=f.index_default.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",API_KEY:"",provider:"giphy",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:r,t:o})=>{var s,a;const i=((s=r==null?void 0:r.options)==null?void 0:s.provider)||"",n=((a=r==null?void 0:r.options)==null?void 0:a.API_KEY)||"";return{componentProps:{action:h=>{t.chain().focus().setImageGif({src:h}).run()},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:o("editor.imageGif.tooltip"),apiKey:n,provider:i}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||"10";return r===void 0?null:Number.parseInt(`${r}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return P.ReactNodeViewRenderer(q)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:r})=>r.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:r})=>r.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",P.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});exports.ImageGif=C;exports.RichTextImageGif=X;
|
package/lib/ImageGif.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { h as B, m as q, k as V } from "./clsx-BUPZHhq3.js";
|
|
2
|
-
import {
|
|
2
|
+
import { N as H, O as C, P as X, u as Y, d as D, A as Z, Q, j as U, R as J } from "./index-CnKgiZFQ.js";
|
|
3
3
|
import { jsx as u, jsxs as z, Fragment as K } from "react/jsx-runtime";
|
|
4
|
-
import { useState as G, useMemo as
|
|
4
|
+
import { useState as G, useMemo as L, useCallback as M, useEffect as R, useRef as ee } from "react";
|
|
5
5
|
import { I as j, i as W, j as te } from "./index-BGd2HiwP.js";
|
|
6
6
|
import "./theme.js";
|
|
7
|
-
import { P as ne, a as re, b as ie } from "./popover-
|
|
7
|
+
import { P as ne, a as re, b as ie } from "./popover-BzJyaFvy.js";
|
|
8
8
|
const O = {
|
|
9
9
|
TOP_LEFT: "tl",
|
|
10
10
|
TOP_RIGHT: "tr",
|
|
@@ -12,7 +12,7 @@ const O = {
|
|
|
12
12
|
BOTTOM_RIGHT: "br"
|
|
13
13
|
};
|
|
14
14
|
function ae(e) {
|
|
15
|
-
var p,
|
|
15
|
+
var p, k;
|
|
16
16
|
const [t, r] = G({
|
|
17
17
|
width: j,
|
|
18
18
|
height: j
|
|
@@ -30,9 +30,9 @@ function ae(e) {
|
|
|
30
30
|
w: 0,
|
|
31
31
|
h: 0,
|
|
32
32
|
dir: ""
|
|
33
|
-
}), { align: b } = (p = e == null ? void 0 : e.node) == null ? void 0 : p.attrs, g =
|
|
33
|
+
}), { align: b } = (p = e == null ? void 0 : e.node) == null ? void 0 : p.attrs, g = L(() => {
|
|
34
34
|
var w;
|
|
35
|
-
const { src: o, alt: m, width: f, height: x } = (w = e == null ? void 0 : e.node) == null ? void 0 : w.attrs, A =
|
|
35
|
+
const { src: o, alt: m, width: f, height: x } = (w = e == null ? void 0 : e.node) == null ? void 0 : w.attrs, A = H(f) ? `${f}px` : f, d = H(x) ? `${x}px` : x;
|
|
36
36
|
return {
|
|
37
37
|
src: o || void 0,
|
|
38
38
|
alt: m || void 0,
|
|
@@ -41,7 +41,7 @@ function ae(e) {
|
|
|
41
41
|
height: d || void 0
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
}, [(
|
|
44
|
+
}, [(k = e == null ? void 0 : e.node) == null ? void 0 : k.attrs]), _ = L(() => {
|
|
45
45
|
const {
|
|
46
46
|
style: { width: o }
|
|
47
47
|
} = g;
|
|
@@ -102,18 +102,18 @@ function ae(e) {
|
|
|
102
102
|
}), s(!1), y());
|
|
103
103
|
},
|
|
104
104
|
[a, y]
|
|
105
|
-
),
|
|
105
|
+
), $ = M(() => {
|
|
106
106
|
document == null || document.addEventListener("mousemove", N, !0), document == null || document.addEventListener("mouseup", E, !0);
|
|
107
|
-
}, [N, E]),
|
|
107
|
+
}, [N, E]), P = M(() => {
|
|
108
108
|
document == null || document.removeEventListener("mousemove", N, !0), document == null || document.removeEventListener("mouseup", E, !0);
|
|
109
109
|
}, [N, E]);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}), [a,
|
|
113
|
-
const
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
}), [e.editor.view.dom,
|
|
110
|
+
R(() => (a ? $() : P(), () => {
|
|
111
|
+
P();
|
|
112
|
+
}), [a, $, P]);
|
|
113
|
+
const S = L(() => new ResizeObserver(() => I()), [I]);
|
|
114
|
+
return R(() => (S.observe(e.editor.view.dom), () => {
|
|
115
|
+
S.disconnect();
|
|
116
|
+
}), [e.editor.view.dom, S]), /* @__PURE__ */ u(
|
|
117
117
|
B,
|
|
118
118
|
{
|
|
119
119
|
className: "image-view",
|
|
@@ -220,14 +220,14 @@ function le(e, t) {
|
|
|
220
220
|
}
|
|
221
221
|
function he({ selectImage: e, apiKey: t, provider: r, children: c }) {
|
|
222
222
|
const [i, n] = G(!1), [a, s] = G([]), { editorDisabled: l } = D(), v = ee(null), { searchTrending: b, searchWord: g } = le(r, t);
|
|
223
|
-
|
|
223
|
+
R(() => {
|
|
224
224
|
(async () => {
|
|
225
225
|
const h = await b();
|
|
226
226
|
s(h);
|
|
227
227
|
})();
|
|
228
228
|
}, []);
|
|
229
229
|
const _ = M(
|
|
230
|
-
|
|
230
|
+
Q(async (h) => {
|
|
231
231
|
if (!h.target.value) {
|
|
232
232
|
const I = await b();
|
|
233
233
|
s(I);
|
|
@@ -281,7 +281,7 @@ function ye() {
|
|
|
281
281
|
a || t && t(l);
|
|
282
282
|
}, children: /* @__PURE__ */ u(Z, { disabled: a, icon: r, tooltip: c }) });
|
|
283
283
|
}
|
|
284
|
-
const ue = /* @__PURE__ */
|
|
284
|
+
const ue = /* @__PURE__ */ J.extend({
|
|
285
285
|
name: "imageGif",
|
|
286
286
|
//@ts-expect-error
|
|
287
287
|
addOptions() {
|
package/lib/ImportWord.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./clsx-CXbNJWDD.cjs"),u=require("react/jsx-runtime"),H=require("mammoth"),T=require("react"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./clsx-CXbNJWDD.cjs"),u=require("react/jsx-runtime"),H=require("mammoth"),T=require("react"),s=require("./index-BynXHtjJ.cjs");require("./theme.cjs");const P=require("./index-DgOXAdKt.cjs");function N(o,t){const a=atob(o.split(",")[1]),l=Array.from({length:a.length});for(let i=0;i<a.length;i++)l[i]=a.charCodeAt(i);const m=new Uint8Array(l);return new Blob([m],{type:t})}function k(o,t){return new File([o],t,{type:o.type})}function z(){const o=s.useEditorInstance(),t=s.useButtonProps(y.name),{icon:a=void 0,tooltip:l=void 0,tooltipOptions:m={},isActive:i=void 0,mammothOptions:w,limit:j,convert:b}=(t==null?void 0:t.componentProps)??{},{editorDisabled:W}=s.useToggleActive(i),p=s.useExtension(y.name),{toast:q}=s.useToast(),{t:S}=P.useLocale(),[C,v]=T.useState(!1),x=T.useRef(null);function O(){var e;(e=x.current)==null||e.click()}function R(e){const n=e.target.files[0];if(n){if(n.size>j){q({variant:"destructive",title:S("editor.importWord.limitSize")});return}E(n)}}async function B(e){const c=new DOMParser().parseFromString(e,"text/html"),f=c.querySelectorAll("img");if(f.length===0)return c.body.innerHTML;if(s.hasExtension(o,s.Image.name)){const g=p==null?void 0:p.options;if(g&&typeof g.upload=="function"){const A=[];for(const h of f){const d=h.getAttribute("src"),r=N(d,"image/jpeg"),L=k(r,"image.jpeg");A.push(L)}const F=await g.upload(A);for(const[h,d]of f.entries()){d.setAttribute("src",F[h].src);const r=d.parentElement;(r==null?void 0:r.tagName)==="P"&&(r.insertAdjacentElement("beforebegin",d),!r.hasChildNodes()&&r.textContent===""&&r.remove())}return c.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),c.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),c.body.innerHTML}async function E(e){v(!0);try{if(b){const n=await b(e);I(n)}else{const n=await e.arrayBuffer(),{value:c}=await H.convertToHtml({arrayBuffer:n},w);I(c)}}finally{v(!1)}}async function I(e){const n=await B(e);o.chain().setContent(n,!0).run()}return t?u.jsxs(u.Fragment,{children:[u.jsx(s.ActionButton,{action:O,disabled:W,icon:a,loading:C,tooltip:l,tooltipOptions:m}),u.jsx("input",{accept:".docx",onChange:R,ref:x,type:"file",style:{display:"none"}})]}):u.jsx(u.Fragment,{})}const y=M.Extension.create({name:"importWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),upload:void 0,convert:void 0,limit:1024*1024*10,button:({extension:t,t:a})=>{const{convert:l,limit:m,mammothOptions:i}=t.options;return{componentProps:{convert:l,limit:m,mammothOptions:i,icon:"Word",shortcutKeys:t.options.shortcutKeys??["alt","mod","S"],tooltip:a("editor.importWord.tooltip")}}}}}});exports.ImportWord=y;exports.RichTextImportWord=z;
|
package/lib/ImportWord.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { E as M } from "./clsx-BUPZHhq3.js";
|
|
2
|
-
import { jsx as g, Fragment as
|
|
2
|
+
import { jsx as g, Fragment as w, jsxs as P } from "react/jsx-runtime";
|
|
3
3
|
import R from "mammoth";
|
|
4
4
|
import { useState as N, useRef as k } from "react";
|
|
5
|
-
import { h as
|
|
5
|
+
import { h as z, u as D, d as K, v as U, w as q, A as G, x as J, y as Q } from "./index-CnKgiZFQ.js";
|
|
6
6
|
import "./theme.js";
|
|
7
7
|
import { u as V } from "./index-BGd2HiwP.js";
|
|
8
8
|
function X(e, t) {
|
|
@@ -16,15 +16,15 @@ function Y(e, t) {
|
|
|
16
16
|
return new File([e], t, { type: e.type });
|
|
17
17
|
}
|
|
18
18
|
function it() {
|
|
19
|
-
const e =
|
|
19
|
+
const e = z(), t = D(I.name), {
|
|
20
20
|
icon: s = void 0,
|
|
21
21
|
tooltip: c = void 0,
|
|
22
22
|
tooltipOptions: l = {},
|
|
23
23
|
isActive: i = void 0,
|
|
24
|
-
mammothOptions:
|
|
25
|
-
limit:
|
|
24
|
+
mammothOptions: x,
|
|
25
|
+
limit: T,
|
|
26
26
|
convert: h
|
|
27
|
-
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: C } =
|
|
27
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: C } = K(i), u = U(I.name), { toast: E } = q(), { t: W } = V(), [B, y] = N(!1), b = k(null);
|
|
28
28
|
function L() {
|
|
29
29
|
var o;
|
|
30
30
|
(o = b.current) == null || o.click();
|
|
@@ -32,7 +32,7 @@ function it() {
|
|
|
32
32
|
function O(o) {
|
|
33
33
|
const n = o.target.files[0];
|
|
34
34
|
if (n) {
|
|
35
|
-
if (n.size >
|
|
35
|
+
if (n.size > T) {
|
|
36
36
|
E({
|
|
37
37
|
variant: "destructive",
|
|
38
38
|
title: W("editor.importWord.limitSize")
|
|
@@ -73,7 +73,7 @@ function it() {
|
|
|
73
73
|
const n = await h(o);
|
|
74
74
|
v(n);
|
|
75
75
|
} else {
|
|
76
|
-
const n = await o.arrayBuffer(), { value: a } = await R.convertToHtml({ arrayBuffer: n },
|
|
76
|
+
const n = await o.arrayBuffer(), { value: a } = await R.convertToHtml({ arrayBuffer: n }, x);
|
|
77
77
|
v(a);
|
|
78
78
|
}
|
|
79
79
|
} finally {
|
|
@@ -84,7 +84,7 @@ function it() {
|
|
|
84
84
|
const n = await S(o);
|
|
85
85
|
e.chain().setContent(n, !0).run();
|
|
86
86
|
}
|
|
87
|
-
return t ? /* @__PURE__ */ P(
|
|
87
|
+
return t ? /* @__PURE__ */ P(w, { children: [
|
|
88
88
|
/* @__PURE__ */ g(
|
|
89
89
|
G,
|
|
90
90
|
{
|
|
@@ -108,9 +108,9 @@ function it() {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
)
|
|
111
|
-
] }) : /* @__PURE__ */ g(
|
|
111
|
+
] }) : /* @__PURE__ */ g(w, {});
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const I = /* @__PURE__ */ M.create({
|
|
114
114
|
name: "importWord",
|
|
115
115
|
//@ts-expect-error
|
|
116
116
|
addOptions() {
|
|
@@ -140,6 +140,6 @@ const w = /* @__PURE__ */ M.create({
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
export {
|
|
143
|
-
|
|
143
|
+
I as ImportWord,
|
|
144
144
|
it as RichTextImportWord
|
|
145
145
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as y, E as x } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { TextSelection as b, AllSelection as I } from "@tiptap/pm/state";
|
|
3
3
|
import { jsx as d, Fragment as m, jsxs as A } from "react/jsx-runtime";
|
|
4
|
-
import { u as T, d as K, A as p } from "./index-
|
|
4
|
+
import { u as T, d as K, A as p } from "./index-CnKgiZFQ.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
|
7
7
|
var a = /* @__PURE__ */ ((t) => (t[t.max = 7] = "max", t[t.min = 0] = "min", t[t.more = 1] = "more", t[t.less = -1] = "less", t))(a || {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const p=require("./clsx-CXbNJWDD.cjs"),l=require("@tiptap/pm/state"),c=require("react/jsx-runtime"),u=require("./index-
|
|
1
|
+
"use strict";const p=require("./clsx-CXbNJWDD.cjs"),l=require("@tiptap/pm/state"),c=require("react/jsx-runtime"),u=require("./index-BynXHtjJ.cjs");require("react");require("./theme.cjs");var a=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(a||{});function b(t,e,n){return t<e?e:t>n?n:t}function A(t,e,n,o){const{doc:s,selection:r}=t;if(!s||!r||!(r instanceof l.TextSelection||r instanceof l.AllSelection))return t;const{from:i,to:d}=r;return s.nodesBetween(i,d,(m,x)=>{const I=m.type;return n.includes(I.name)?(t=h(t,x,e),!1):!p.isList(m.type.name,o.extensionManager.extensions)}),t}function h(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o)return t;const i=b((o.attrs.indent||0)+n,0,7);if(i===o.attrs.indent)return t;const d={...o.attrs,indent:i};return t.setNodeMarkup(e,o.type,d,o.marks)}function f({delta:t,types:e}){return({state:n,dispatch:o,editor:s})=>{const{selection:r}=n;let{tr:i}=n;return i=i.setSelection(r),i=A(i,t,e,s),i.docChanged?(o&&o(i),!0):!1}}function T(){const t=u.useButtonProps(y.name),{indent:e,outdent:n}=(t==null?void 0:t.componentProps)??{},{editorDisabled:o}=u.useToggleActive(),s=()=>{o||e!=null&&e.action&&(e==null||e.action())},r=()=>{o||n!=null&&n.action&&(n==null||n.action())};return t?c.jsxs(c.Fragment,{children:[c.jsx(u.ActionButton,{action:s,disabled:o,icon:e==null?void 0:e.icon,shortcutKeys:e==null?void 0:e.shortcutKeys,tooltip:e==null?void 0:e.tooltip}),c.jsx(u.ActionButton,{action:r,disabled:o,icon:n==null?void 0:n.icon,shortcutKeys:n==null?void 0:n.shortcutKeys,tooltip:n==null?void 0:n.tooltip})]}):c.jsx(c.Fragment,{})}const y=p.Extension.create({name:"richtextIndentOutdent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:a.min,maxIndent:a.max,button({editor:e,t:n,extension:o}){var s,r;return{componentProps:{indent:{action:()=>{e.commands.indent()},shortcutKeys:((s=o.options.shortcutKeys)==null?void 0:s[0])??["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")},outdent:{action:()=>{e.commands.outdent()},shortcutKeys:((r=o.options.shortcutKeys)==null?void 0:r[1])??["Shift","Tab"],icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.dataset.indent;return(e?Number.parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>f({delta:a.more,types:this.options.types}),outdent:()=>f({delta:a.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});exports.Indent=y;exports.IndentProps=a;exports.RichTextIndent=T;exports.setNodeIndentMarkup=h;
|
package/lib/Indent.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Indent-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./Indent-DuB2U6Cs.cjs");exports.Indent=e.Indent;exports.RichTextIndent=e.RichTextIndent;
|
package/lib/Indent.js
CHANGED
package/lib/Italic.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),a=require("./index-BynXHtjJ.cjs");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,I=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,h=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,v=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,f=r.Mark.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",r.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[r.markInputRule({find:y,type:this.type}),r.markInputRule({find:h,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:I,type:this.type}),r.markPasteRule({find:v,type:this.type})]}}),k=f;function M(){const t=a.useButtonProps(u.name),{icon:e=void 0,tooltip:n=void 0,shortcutKeys:i=void 0,tooltipOptions:l={},action:o=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:m,disabled:c,update:p}=a.useToggleActive(d),g=()=>{c||o&&(o(),p())};return t?s.jsx(a.ActionButton,{action:g,dataState:m,disabled:c,icon:e,shortcutKeys:i,tooltip:n,tooltipOptions:l}):s.jsx(s.Fragment,{})}const u=k.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,t:n,extension:i}){return{componentProps:{action:()=>e.commands.toggleItalic(),isActive:()=>e.isActive("italic")||!1,disabled:!1,shortcutKeys:i.options.shortcutKeys??["mod","I"],icon:"Italic",tooltip:n("editor.italic.tooltip")}}}}}});exports.Italic=u;exports.RichTextItalic=M;
|
package/lib/Italic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as g, e as i, f as o, m as y } from "./clsx-BUPZHhq3.js";
|
|
2
2
|
import { jsx as d, Fragment as f } from "react/jsx-runtime";
|
|
3
|
-
import { u as h, d as I, A as v } from "./index-
|
|
3
|
+
import { u as h, d as I, A as v } from "./index-CnKgiZFQ.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "./theme.js";
|
|
6
6
|
var M = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, k = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, A = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, _ = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, x = g.create({
|