@sovann72-dev/lynqify-ui 1.0.0 → 1.0.2
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/dist/components/NoteEditor/BatchImageGalleryNodeView.d.ts +19 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/constants/index.d.ts +22 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/controllers/image-node-view.d.ts +38 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/controllers/position-controller.d.ts +12 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/controllers/resize-controller.d.ts +13 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/image-resize.d.ts +22 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/index.d.ts +4 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/types/index.d.ts +20 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/attribute-parser.d.ts +4 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/clamp-width.d.ts +6 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/index.d.ts +7 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/resize-handler.d.ts +12 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/style-manager.d.ts +6 -0
- package/dist/components/RichTextEditor/Extension/Indent/backspace.indent.handlers.d.ts +18 -0
- package/dist/components/RichTextEditor/Extension/Indent/indent.extension.d.ts +26 -0
- package/dist/components/RichTextEditor/Extension/Indent/indent.handlers.d.ts +16 -0
- package/{src/components/RichTextEditor/Extension/Indent/indent.types.ts → dist/components/RichTextEditor/Extension/Indent/indent.types.d.ts} +10 -35
- package/dist/components/RichTextEditor/Extension/Indent/indent.utils.d.ts +8 -0
- package/dist/components/RichTextEditor/Extension/Indent/outdent.handlers.d.ts +6 -0
- package/dist/components/RichTextEditor/Extension/Indent/shifttab.indent.handlers.d.ts +18 -0
- package/dist/components/RichTextEditor/Extension/Indent/tab.indent.handlers.d.ts +21 -0
- package/dist/components/RichTextEditor/Extension/List/custom-list-item.extension.d.ts +17 -0
- package/dist/components/RichTextEditor/Extension/List/dynamic-bullet-styling.extension.d.ts +2 -0
- package/dist/components/RichTextEditor/Extension/batch-segment-images.extension.d.ts +19 -0
- package/dist/components/RichTextEditor/Extension/batch-segment-images.types.d.ts +33 -0
- package/dist/components/RichTextEditor/Extension/custom-image.extension.d.ts +4 -0
- package/dist/components/RichTextEditor/Extension/custom-link.extension.d.ts +3 -0
- package/dist/components/RichTextEditor/Extension/custom-mention.extension.d.ts +3 -0
- package/dist/components/RichTextEditor/Extension/custom-paragraph.extension.d.ts +6 -0
- package/dist/components/RichTextEditor/Extension/extensions.d.ts +4 -0
- package/dist/components/RichTextEditor/Extension/file-filtering.extension.d.ts +1 -0
- package/dist/components/RichTextEditor/Extension/list-indent-integration.extension.d.ts +2 -0
- package/dist/components/RichTextEditor/Extension/mentionstorage.extension.d.ts +9 -0
- package/dist/components/RichTextEditor/Extension/tiptap-extension-fontsize.d.ts +21 -0
- package/dist/components/RichTextEditor/Extension/tiptap-extension-lineheight.d.ts +21 -0
- package/{src/index.ts → dist/index.d.ts} +9 -17
- package/dist/lynqify-ui.js +3806 -0
- package/dist/lynqify-ui.umd.cjs +53 -0
- package/package.json +60 -31
- package/src/components/RichTextEditor/Extension/Indent/backspace.indent.handlers.ts +0 -77
- package/src/components/RichTextEditor/Extension/Indent/indent.extension.ts +0 -285
- package/src/components/RichTextEditor/Extension/Indent/indent.handlers.ts +0 -121
- package/src/components/RichTextEditor/Extension/Indent/indent.utils.ts +0 -8
- package/src/components/RichTextEditor/Extension/Indent/outdent.handlers.ts +0 -71
- package/src/components/RichTextEditor/Extension/Indent/shifttab.indent.handlers.ts +0 -133
- package/src/components/RichTextEditor/Extension/Indent/tab.indent.handlers.ts +0 -103
- package/src/components/RichTextEditor/Extension/List/custom-list-item.extension.ts +0 -107
- package/src/components/RichTextEditor/Extension/List/dynamic-bullet-styling.extension.ts +0 -40
- package/src/components/RichTextEditor/Extension/batch-segment-images.extension.ts +0 -486
- package/src/components/RichTextEditor/Extension/batch-segment-images.types.ts +0 -35
- package/src/components/RichTextEditor/Extension/custom-image.extension.ts +0 -18
- package/src/components/RichTextEditor/Extension/custom-link.extension.ts +0 -58
- package/src/components/RichTextEditor/Extension/custom-mention.extension.ts +0 -29
- package/src/components/RichTextEditor/Extension/custom-paragraph.extension.ts +0 -46
- package/src/components/RichTextEditor/Extension/extensions.ts +0 -118
- package/src/components/RichTextEditor/Extension/file-filtering.extension.ts +0 -0
- package/src/components/RichTextEditor/Extension/list-indent-integration.extension.ts +0 -125
- package/src/components/RichTextEditor/Extension/mentionstorage.extension.ts +0 -10
- package/src/components/RichTextEditor/Extension/tiptap-extension-fontsize.ts +0 -73
- package/src/components/RichTextEditor/Extension/tiptap-extension-lineheight.ts +0 -73
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
(function(h,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("@tiptap/extension-bold"),require("@tiptap/extension-color"),require("@tiptap/extension-document"),require("@tiptap/extension-file-handler"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-heading"),require("@tiptap/extension-highlight"),require("@tiptap/extension-image"),require("@tiptap/extension-italic"),require("@tiptap/extension-link"),require("@tiptap/extension-list"),require("@tiptap/extension-mention"),require("@tiptap/extension-paragraph"),require("@tiptap/extension-table"),require("@tiptap/extension-text"),require("@tiptap/extension-text-align"),require("@tiptap/extension-text-style"),require("@tiptap/extension-underline"),require("@tiptap/extensions"),require("@tiptap/core"),require("@tiptap/react"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","@tiptap/extension-bold","@tiptap/extension-color","@tiptap/extension-document","@tiptap/extension-file-handler","@tiptap/extension-hard-break","@tiptap/extension-heading","@tiptap/extension-highlight","@tiptap/extension-image","@tiptap/extension-italic","@tiptap/extension-link","@tiptap/extension-list","@tiptap/extension-mention","@tiptap/extension-paragraph","@tiptap/extension-table","@tiptap/extension-text","@tiptap/extension-text-align","@tiptap/extension-text-style","@tiptap/extension-underline","@tiptap/extensions","@tiptap/core","@tiptap/react","react","react-dom"],$):(h=typeof globalThis<"u"?globalThis:h||self,$(h.LynqifyUI={},h.Bold,h.Color,h.Document,h.FileHandler,h.HardBreak,h.Heading,h.Highlight,h.Image,h.Italic,h.Link,h.extensionList,h.Mention,h.Paragraph,h.extensionTable,h.Text,h.TextAlign,h.extensionTextStyle,h.Underline,h.extensions,h.TipTapCore,h.TipTapReact,h.React,h.ReactDOM))})(this,(function(h,$,X,Pe,gt,De,yt,vt,wt,_e,St,D,It,Be,Y,$e,Fe,Je,We,Z,se,Ee,He,xn){"use strict";var Kr=Object.defineProperty;var Xr=(h,$,X)=>$ in h?Kr(h,$,{enumerable:!0,configurable:!0,writable:!0,value:X}):h[$]=X;var R=(h,$,X)=>Xr(h,typeof $!="symbol"?$+"":$,X);function Tn(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const je=Tn(He);function bt(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let l=0;i.text[l]==s.text[l];l++)t++;return t}if(i.content.size||s.content.size){let l=bt(i.content,s.content,t+1);if(l!=null)return l}t+=i.nodeSize}}function Et(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let l=r.child(--i),a=e.child(--s),c=l.nodeSize;if(l==a){t-=c,n-=c;continue}if(!l.sameMarkup(a))return{a:t,b:n};if(l.isText&&l.text!=a.text){let f=0,u=Math.min(l.text.length,a.text.length);for(;f<u&&l.text[l.text.length-f-1]==a.text[a.text.length-f-1];)f++,t--,n--;return{a:t,b:n}}if(l.content.size||a.content.size){let f=Et(l.content,a.content,t-1,n-1);if(f)return f}t-=c,n-=c}}class O{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let l=0,a=0;a<t;l++){let c=this.content[l],f=a+c.nodeSize;if(f>e&&n(c,i+a,s||null,l)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),n,i+u)}a=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",l=!0;return this.nodesBetween(e,t,(a,c)=>{let f=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&f||a.isTextblock)&&n&&(l?l=!1:s+=n),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new O(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;c>e&&((l<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-l),Math.min(a.text.length,t-l)):a=a.cut(Math.max(0,e-l-1),Math.min(a.content.size,t-l-1))),n.push(a),i+=a.nodeSize),l=c}return new O(n,i)}cutByIndex(e,t){return e==t?O.empty:e==0&&t==this.content.length?this:new O(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new O(i,s)}addToStart(e){return new O([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new O(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return bt(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Et(this,e,t,n)}findIndex(e){if(e==0)return xe(0,e);if(e==this.size)return xe(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?xe(t+1,s):xe(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return O.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new O(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return O.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new O(t||e,n)}static from(e){if(!e)return O.empty;if(e instanceof O)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new O([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}O.empty=new O([],0);const qe={index:0,offset:0};function xe(r,e){return qe.index=r,qe.offset=e,qe}class Rn extends Error{}class T{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Tt(this.content,e+this.openStart,t);return n&&new T(n,this.openStart,this.openEnd)}removeBetween(e,t){return new T(xt(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return T.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new T(O.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new T(e,n,i)}}T.empty=new T(O.empty,0,0);function xt(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:l,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(l).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=l)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(xt(s.content,e-i-1,t-i-1)))}function Tt(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),l=r.maybeChild(i);if(s==e||l.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let a=Tt(l.content,e-s-1,t,l);return a&&r.replaceChild(i,l.copy(a))}class Rt{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Ot=65535,Ct=Math.pow(2,16);function On(r,e){return r+e*Ct}function kt(r){return r&Ot}function Cn(r){return(r-(r&Ot))/Ct}const Nt=1,Lt=2,Te=4,At=8;class zt{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&At)>0}get deletedBefore(){return(this.delInfo&(Nt|Te))>0}get deletedAfter(){return(this.delInfo&(Lt|Te))>0}get deletedAcross(){return(this.delInfo&Te)>0}}class j{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&j.empty)return j.empty}recover(e){let t=0,n=kt(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Cn(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?i:0);if(c>e)break;let f=this.ranges[a+s],u=this.ranges[a+l],p=c+f;if(e<=p){let y=f?e==c?-1:e==p?1:t:t,w=c+i+(y<0?0:u);if(n)return w;let g=e==(t<0?c:p)?null:On(a/3,e-c),b=e==c?Lt:e==p?Nt:Te;return(t<0?e!=c:e!=p)&&(b|=At),new zt(w,b,g)}i+=u-f}return n?e+i:new zt(e+i,0,null)}touches(e,t){let n=0,i=kt(t),s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?n:0);if(c>e)break;let f=this.ranges[a+s],u=c+f;if(e<=u&&a==i*3)return!0;n+=this.ranges[a+l]-f}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],a=l-(this.inverted?s:0),c=l+(this.inverted?0:s),f=this.ranges[i+t],u=this.ranges[i+n];e(a,a+f,c,c+u),s+=u-f}}invert(){return new j(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?j.empty:new j(e<0?[0,-e,0]:[0,0,e])}}j.empty=new j([]);const Ve=Object.create(null);class _{getMap(){return j.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Ve[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ve)throw new RangeError("Duplicate use of step JSON ID "+e);return Ve[e]=t,t.prototype.jsonID=e,t}}class N{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new N(e,null)}static fail(e){return new N(null,e)}static fromReplace(e,t,n,i){try{return N.ok(e.replace(t,n,i))}catch(s){if(s instanceof Rn)return N.fail(s.message);throw s}}}function Ue(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(Ue(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return O.fromArray(n)}class Q extends _{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new T(Ue(t.content,(l,a)=>!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),t.openStart,t.openEnd);return N.fromReplace(e,this.from,this.to,s)}invert(){return new ee(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Q(t.pos,n.pos,this.mark)}merge(e){return e instanceof Q&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Q(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Q(t.from,t.to,e.markFromJSON(t.mark))}}_.jsonID("addMark",Q);class ee extends _{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new T(Ue(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return N.fromReplace(e,this.from,this.to,n)}invert(){return new Q(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ee(t.pos,n.pos,this.mark)}merge(e){return e instanceof ee&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ee(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ee(t.from,t.to,e.markFromJSON(t.mark))}}_.jsonID("removeMark",ee);class te extends _{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new te(this.pos,t.marks[i]);return new te(this.pos,this.mark)}}return new he(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new te(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new te(t.pos,e.markFromJSON(t.mark))}}_.jsonID("addNodeMark",te);class he extends _{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new te(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new he(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new he(t.pos,e.markFromJSON(t.mark))}}_.jsonID("removeNodeMark",he);class V extends _{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&Ke(e,this.from,this.to)?N.fail("Structure replace would overwrite content"):N.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new j([this.from,this.to-this.from,this.slice.size])}invert(e){return new V(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&V.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new V(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof V)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new V(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new V(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new V(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}}V.MAP_BIAS=1,_.jsonID("replace",V);class oe extends _{constructor(e,t,n,i,s,l,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=l,this.structure=a}apply(e){if(this.structure&&(Ke(e,this.from,this.gapFrom)||Ke(e,this.gapTo,this.to)))return N.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return N.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?N.fromReplace(e,this.from,this.to,n):N.fail("Content does not fit in gap")}getMap(){return new j([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new oe(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new oe(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new oe(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}_.jsonID("replaceAround",oe);function Ke(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let l=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function kn(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Mt(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let l=r.$from.node(n),a=r.$from.index(n)+i,c=r.$to.indexAfter(n)-s;if(n<r.depth&&l.canReplace(a,c,t))return n;if(n==0||l.type.spec.isolating||!kn(l,a,c))break;a&&(i=1),c<l.childCount&&(s=1)}return null}class pe extends _{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return N.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return N.fromReplace(e,this.pos,this.pos+1,new T(O.from(i),0,t.isLeaf?0:1))}getMap(){return j.empty}invert(e){return new pe(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pe(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new pe(t.pos,t.attr,t.value)}}_.jsonID("attr",pe);class Re extends _{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return N.ok(n)}getMap(){return j.empty}invert(e){return new Re(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Re(t.attr,t.value)}}_.jsonID("docAttr",Re);let me=class extends Error{};me=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},me.prototype=Object.create(Error.prototype),me.prototype.constructor=me,me.prototype.name="TransformError";const Xe=Object.create(null);class z{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Nn(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=T.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,l=this.ranges;for(let a=0;a<l.length;a++){let{$from:c,$to:f}=l[a],u=e.mapping.slice(s);e.replaceRange(u.map(c.pos),u.map(f.pos),a?T.empty:t),a==0&&_t(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:a}=i[s],c=e.mapping.slice(n),f=c.map(l.pos),u=c.map(a.pos);s?e.deleteRange(f,u):(e.replaceRangeWith(f,u,t),_t(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new F(e):ae(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let l=t<0?ae(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):ae(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new K(e.node(0))}static atStart(e){return ae(e,e,0,0,1)||new K(e)}static atEnd(e){return ae(e,e,e.content.size,e.childCount,-1)||new K(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Xe[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Xe)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xe[e]=t,t.prototype.jsonID=e,t}getBookmark(){return F.between(this.$anchor,this.$head).getBookmark()}}z.prototype.visible=!0;class Nn{constructor(e,t){this.$from=e,this.$to=t}}let Pt=!1;function Dt(r){!Pt&&!r.parent.inlineContent&&(Pt=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class F extends z{constructor(e,t=e){Dt(e),Dt(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return z.near(n);let i=e.resolve(t.map(this.anchor));return new F(i.parent.inlineContent?i:n,n)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof F&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Oe(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new F(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=z.findFrom(t,n,!0)||z.findFrom(t,-n,!0);if(s)t=s.$head;else return z.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(z.findFrom(e,-n,!0)||z.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new F(e,t)}}z.jsonID("text",F);class Oe{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Oe(e.map(this.anchor),e.map(this.head))}resolve(e){return F.between(e.resolve(this.anchor),e.resolve(this.head))}}class B extends z{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?z.near(s):new B(s)}content(){return new T(O.from(this.node),0,0)}eq(e){return e instanceof B&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ye(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new B(e.resolve(t.anchor))}static create(e,t){return new B(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}B.prototype.visible=!1,z.jsonID("node",B);class Ye{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Oe(n,n):new Ye(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&B.isSelectable(n)?new B(t):z.near(t)}}class K extends z{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let n=z.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new K(e)}map(e){return new K(e)}eq(e){return e instanceof K}getBookmark(){return Ln}}z.jsonID("all",K);const Ln={map(){return this},resolve(r){return new K(r)}};function ae(r,e,t,n,i,s=!1){if(e.inlineContent)return F.create(r,t);for(let l=n-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let a=e.child(l);if(a.isAtom){if(!s&&B.isSelectable(a))return B.create(r,t-(i<0?a.nodeSize:0))}else{let c=ae(r,a,t+i,i<0?a.childCount:0,i,s);if(c)return c}t+=a.nodeSize*i}return null}function _t(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof V||i instanceof oe))return;let s=r.mapping.maps[n],l;s.forEach((a,c,f,u)=>{l==null&&(l=u)}),r.setSelection(z.near(r.doc.resolve(l),t))}function Bt(r,e){return!e||!r?r:r.bind(e)}class Ce{constructor(e,t,n){this.name=e,this.init=Bt(t.init,n),this.apply=Bt(t.apply,n)}}new Ce("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Ce("selection",{init(r,e){return r.selection||z.atStart(e.doc)},apply(r){return r.selection}}),new Ce("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new Ce("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}});function $t(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=$t(i,e,{})),t[n]=i}return t}class le{constructor(e){this.spec=e,this.props={},e.props&&$t(e.props,this,this.props),this.key=e.key?e.key.key:Ft("plugin")}getState(e){return e[this.key]}}const Ge=Object.create(null);function Ft(r){return r in Ge?r+"$"+ ++Ge[r]:(Ge[r]=0,r+"$")}class An{constructor(e="key"){this.key=Ft(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ze=St.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),"data-note-file-id":{default:null,parseHTML:e=>e.getAttribute("data-note-file-id"),renderHTML:e=>e["data-note-file-id"]?{"data-note-file-id":e["data-note-file-id"]}:{}}}},addProseMirrorPlugins(){return[new le({appendTransaction(r,e,t){if(!r.some(p=>p.docChanged))return null;const{selection:n}=t;if(!n.empty)return null;const{$from:i}=n;if(i.parent.type.name!=="paragraph"||i.parent.content.size!==0)return null;const s=i.before(i.depth),l=e.selection.$from;if(l.depth<1)return null;const a=l.before(l.depth);if(s!==a)return null;const c=e.doc.nodeAt(s);if(!c||c.type.name!=="paragraph")return null;let f=!1;if(c.forEach(p=>{p.marks.some(y=>y.type.name==="link")&&(f=!0)}),!f)return null;const u=t.tr;try{u.join(s)}catch{}return u.setStoredMarks([])}})]}}),Jt=Be.extend({addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("p");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}},addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0"),renderHTML:e=>e.indent?{"data-indent":e.indent,style:`--indent-level: ${e.indent};`}:{}}}}}),P={MOBILE_BREAKPOINT:768,ICON_SIZE:"24px",CONTROLLER_HEIGHT:"25px",DOT_SIZE:{MOBILE:16,DESKTOP:9},DOT_POSITION:{MOBILE:"-8px",DESKTOP:"-4px"},COLORS:{BORDER:"#6C6C6C",BACKGROUND:"rgba(255, 255, 255, 1)"},ICONS:{LEFT:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_left/default/20px.svg",CENTER:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_center/default/20px.svg",RIGHT:"https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_right/default/20px.svg"}},ne={isMobile(){return document.documentElement.clientWidth<P.MOBILE_BREAKPOINT},getDotPosition(){return ne.isMobile()?P.DOT_POSITION.MOBILE:P.DOT_POSITION.DESKTOP},getDotSize(){return ne.isMobile()?P.DOT_SIZE.MOBILE:P.DOT_SIZE.DESKTOP},clearContainerBorder(r){const e=r.getAttribute("style"),t=e==null?void 0:e.replace("border: 1px dashed #6C6C6C;","").replace("border: 1px dashed rgb(108, 108, 108)","");r.setAttribute("style",t)},removeResizeElements(r){if(r.childElementCount>3)for(let e=0;e<5;e++)r.removeChild(r.lastChild)}};class Qe{static parseImageAttributes(e,t){Object.entries(e).forEach(([n,i])=>{if(!(i==null||n==="wrapperStyle")){if(n==="containerStyle"){const s=i.match(/width:\s*([0-9.]+)px/);s&&t.setAttribute("width",s[1]);return}t.setAttribute(n,i)}})}static extractWidthFromStyle(e){const t=e.match(/width:\s*([0-9.]+)px/);return t?(t==null?void 0:t.at(1))??null:null}}function et(r,e){const{minWidth:t,maxWidth:n}=e,i=t!==void 0?Math.max(0,t):0;let s=Math.max(i,r);return n!==void 0&&s>n&&(s=n),s}class ce{static getContainerStyle(e,t){return`${`width: ${t&&t!=="0px"&&t!=="0"?t:"100%"}; height: auto; cursor: pointer;`} ${e?"display: inline-block;":""}`}static getWrapperStyle(e){return e?"display: inline-block; float: left; padding-right: 8px;":"display: flex"}static getPositionControllerStyle(e){return`
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0%;
|
|
4
|
+
left: 50%;
|
|
5
|
+
width: ${e?"66px":"100px"};
|
|
6
|
+
height: ${P.CONTROLLER_HEIGHT};
|
|
7
|
+
z-index: 999;
|
|
8
|
+
background-color: ${P.COLORS.BACKGROUND};
|
|
9
|
+
border-radius: 3px;
|
|
10
|
+
border: 1px solid ${P.COLORS.BORDER};
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
transform: translate(-50%, -50%);
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
align-items: center;
|
|
15
|
+
padding: 0 6px;
|
|
16
|
+
display: none;
|
|
17
|
+
`.replace(/\s+/g," ").trim()}static getDotStyle(e){const t=ne.getDotPosition(),n=ne.getDotSize(),i=[`top: ${t}; left: ${t}; cursor: nwse-resize;`,`top: ${t}; right: ${t}; cursor: nesw-resize;`,`bottom: ${t}; left: ${t}; cursor: nesw-resize;`,`bottom: ${t}; right: ${t}; cursor: nwse-resize;`];return`
|
|
18
|
+
position: absolute;
|
|
19
|
+
width: ${n}px;
|
|
20
|
+
height: ${n}px;
|
|
21
|
+
border: 1.5px solid ${P.COLORS.BORDER};
|
|
22
|
+
border-radius: 50%;
|
|
23
|
+
${i[e]}
|
|
24
|
+
`.replace(/\s+/g," ").trim()}}class zn{constructor(e,t,n){R(this,"elements");R(this,"inline");R(this,"dispatchNodeView");this.elements=e,this.inline=t,this.dispatchNodeView=n}createControllerIcon(e){const t=document.createElement("img");return t.setAttribute("src",e),t.setAttribute("style",`width: ${P.ICON_SIZE}; height: ${P.ICON_SIZE}; cursor: pointer;`),t.addEventListener("mouseover",n=>{n.target.style.opacity="0.6"}),t.addEventListener("mouseout",n=>{n.target.style.opacity="1"}),t}handleLeftClick(){if(!this.inline)this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 auto 0 0;`);else{const e="display: inline-block; float: left; padding-right: 8px;";this.elements.wrapper.setAttribute("style",e),this.elements.container.setAttribute("style",e)}this.dispatchNodeView()}handleCenterClick(){this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 auto;`),this.dispatchNodeView()}handleRightClick(){if(!this.inline)this.elements.container.setAttribute("style",`${this.elements.container.style.cssText} margin: 0 0 0 auto;`);else{const e="display: inline-block; float: right; padding-left: 8px;";this.elements.wrapper.setAttribute("style",e),this.elements.container.setAttribute("style",e)}this.dispatchNodeView()}createPositionControls(){const e=document.createElement("div");e.setAttribute("style",ce.getPositionControllerStyle(this.inline));const t=this.createControllerIcon(P.ICONS.LEFT);if(t.addEventListener("click",()=>this.handleLeftClick()),e.appendChild(t),!this.inline){const i=this.createControllerIcon(P.ICONS.CENTER);i.addEventListener("click",()=>this.handleCenterClick()),e.appendChild(i)}const n=this.createControllerIcon(P.ICONS.RIGHT);return n.addEventListener("click",()=>this.handleRightClick()),e.appendChild(n),this.elements.container.appendChild(e),this}}class Mn{constructor(e,t,n=()=>({})){R(this,"elements");R(this,"dispatchNodeView");R(this,"getResizeLimits");R(this,"state",{isResizing:!1,startX:0,startWidth:0});R(this,"handleMouseMove",(e,t)=>{if(!this.state.isResizing)return;const n=t%2===0?-(e.clientX-this.state.startX):e.clientX-this.state.startX,i=et(this.state.startWidth+n,this.getResizeLimits());this.elements.container.style.width=i+"px",this.elements.img.style.width=i+"px"});R(this,"handleMouseUp",()=>{this.state.isResizing&&(this.state.isResizing=!1),this.dispatchNodeView()});R(this,"handleTouchMove",(e,t)=>{if(!this.state.isResizing)return;const n=t%2===0?-(e.touches[0].clientX-this.state.startX):e.touches[0].clientX-this.state.startX,i=et(this.state.startWidth+n,this.getResizeLimits());this.elements.container.style.width=i+"px",this.elements.img.style.width=i+"px"});R(this,"handleTouchEnd",()=>{this.state.isResizing&&(this.state.isResizing=!1),this.dispatchNodeView()});this.elements=e,this.dispatchNodeView=t,this.getResizeLimits=n}createResizeHandle(e){const t=document.createElement("div");return t.setAttribute("style",ce.getDotStyle(e)),t.addEventListener("mousedown",n=>{n.preventDefault(),this.state.isResizing=!0,this.state.startX=n.clientX,this.state.startWidth=this.elements.container.offsetWidth;const i=l=>this.handleMouseMove(l,e),s=()=>{this.handleMouseUp(),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",s)}),t.addEventListener("touchstart",n=>{n.cancelable&&n.preventDefault(),this.state.isResizing=!0,this.state.startX=n.touches[0].clientX,this.state.startWidth=this.elements.container.offsetWidth;const i=l=>this.handleTouchMove(l,e),s=()=>{this.handleTouchEnd(),document.removeEventListener("touchmove",i),document.removeEventListener("touchend",s)};document.addEventListener("touchmove",i),document.addEventListener("touchend",s)},{passive:!1}),t}}class Pn{constructor(e={}){R(this,"limits");this.limits=e}update(e){this.limits={...this.limits,...e}}get(){return this.limits}}class Dn{constructor(e,t,n={},i){R(this,"context");R(this,"elements");R(this,"inline");R(this,"resizeLimitsRef");R(this,"resizeEventName");R(this,"handleResizeEvent");R(this,"clearContainerBorder",()=>{ne.clearContainerBorder(this.elements.container)});R(this,"dispatchNodeView",()=>{const{view:e,getPos:t}=this.context;if(typeof t=="function"){this.clearContainerBorder();const n={...this.context.node.attrs,width:Qe.extractWidthFromStyle(this.elements.container.style.cssText)??this.context.node.attrs.width,containerStyle:`${this.elements.container.style.cssText}`,wrapperStyle:`${this.elements.wrapper.style.cssText}`};e.dispatch(e.state.tr.setNodeMarkup(t(),null,n))}});R(this,"removeResizeElements",()=>{ne.removeResizeElements(this.elements.container)});this.context=e,this.inline=t,this.resizeLimitsRef=new Pn(n),this.resizeEventName=i,this.elements=this.createElements(),i&&(this.handleResizeEvent=(s=>{const l=s;l.detail&&this.updateResizeLimits({maxWidth:l.detail.maxWidth})}),window.addEventListener(i,this.handleResizeEvent))}destroy(){this.resizeEventName&&this.handleResizeEvent&&window.removeEventListener(this.resizeEventName,this.handleResizeEvent)}updateResizeLimits(e){this.resizeLimitsRef.update(e)}createElements(){return{wrapper:document.createElement("div"),container:document.createElement("div"),img:document.createElement("img")}}setupImageAttributes(){Qe.parseImageAttributes(this.context.node.attrs,this.elements.img)}setupDOMStructure(){const{wrapperStyle:e,containerStyle:t}=this.context.node.attrs;this.elements.wrapper.setAttribute("style",e),this.elements.wrapper.appendChild(this.elements.container),this.elements.container.setAttribute("style",t),this.elements.container.appendChild(this.elements.img)}applyResizeLimits(){const e=this.resizeLimitsRef.get();let t=Qe.extractWidthFromStyle(this.elements.container.style.cssText);if(t===null){const l=e.maxWidth;if(!l)return;t=l.toString()}const n=Number(t);if(Number.isNaN(n))return;const i=et(n,e),s=`${i}px`;this.elements.container.style.width=s,this.elements.img.style.width=s,this.elements.img.setAttribute("width",String(i))}createPositionController(){new zn(this.elements,this.inline,this.dispatchNodeView).createPositionControls()}createResizeHandler(){const e=new Mn(this.elements,this.dispatchNodeView,()=>this.resizeLimitsRef.get());Array.from({length:4},(t,n)=>{const i=e.createResizeHandle(n);this.elements.container.appendChild(i)})}setupContainerClick(){this.elements.container.addEventListener("click",()=>{var t;ne.isMobile()&&((t=document.querySelector(".ProseMirror-focused"))==null||t.blur()),this.removeResizeElements(),this.createPositionController(),this.elements.container.setAttribute("style",`position: relative; border: 1px dashed ${P.COLORS.BORDER}; ${this.context.node.attrs.containerStyle}`),this.applyResizeLimits(),this.createResizeHandler()})}setupContentClick(){document.addEventListener("click",e=>{const t=e.target;this.elements.container.contains(t)||t.style.cssText===`width: ${P.ICON_SIZE}; height: ${P.ICON_SIZE}; cursor: pointer;`||(this.clearContainerBorder(),this.removeResizeElements())})}initialize(){this.setupDOMStructure(),this.setupImageAttributes(),this.applyResizeLimits();const{editable:e}=this.context.editor.options;return e?(this.setupContainerClick(),this.setupContentClick(),{dom:this.elements.wrapper,destroy:()=>this.destroy()}):{dom:this.elements.container,destroy:()=>this.destroy()}}}const Wt="image-resize-limit-update";class _n{constructor(e){R(this,"currentMaxWidth");R(this,"resizeTimeout");R(this,"rafId");R(this,"handleResize",()=>{this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{const e=this.measureContainerWidth();if(e!==this.currentMaxWidth){this.currentMaxWidth=e;const t=new CustomEvent(Wt,{detail:{maxWidth:e}});window.dispatchEvent(t)}})},150)});this.editorElement=e,this.currentMaxWidth=this.measureContainerWidth(),window.addEventListener("resize",this.handleResize)}measureContainerWidth(){return this.editorElement.clientWidth}getCurrentMaxWidth(){return this.currentMaxWidth}destroy(){window.removeEventListener("resize",this.handleResize),this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.rafId&&cancelAnimationFrame(this.rafId)}}const tt=wt.extend({name:"imageResize",addOptions(){var r;return{...(r=this.parent)==null?void 0:r.call(this),inline:!1,minWidth:void 0,maxWidth:void 0,allowBase64:!1}},onCreate(){const r=new _n(this.editor.view.dom);return this.resizeHandler=r,()=>{r.destroy()}},renderHTML({HTMLAttributes:r}){const e={...r};if(r!=null&&r.id&&(e["data-id"]=r.id),!(r!=null&&r.wrapperStyle))return["img",e];const t=(r==null?void 0:r.width)??this.options.maxWidth??0,n=this.options.inline,i=(r==null?void 0:r.containerStyle)??ce.getContainerStyle(n,`${t}px`),s=(r==null?void 0:r.wrapperStyle)??ce.getWrapperStyle(n);return["div",{style:i},["div",{style:s},["img",e]]]},addAttributes(){var e;const r=this.options.inline;return{...(e=this.parent)==null?void 0:e.call(this),id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id,style:"margin-block: 10px;"}:{}},width:{renderHTML:t=>t.width?{width:t.width}:{}},containerStyle:{default:null,parseHTML:t=>{const n=t.getAttribute("containerstyle");if(n)return n;const i=t.getAttribute("width");return i?ce.getContainerStyle(r,`${i}px`):`${t.style.cssText}`},renderHTML:t=>t.width?{width:t.width}:{}},wrapperStyle:{default:ce.getWrapperStyle(r)}}},addNodeView(){return({node:r,editor:e,getPos:t})=>{var u;if(r.type.name!=="imageResize"){const p=document.createElement("img");return p.src=r.attrs.src,p.alt=r.attrs.alt||"",r.attrs.width&&(p.width=r.attrs.width),r.attrs.height&&(p.height=r.attrs.height),{dom:p}}const{inline:n,minWidth:i,maxWidth:s}=this.options,l={node:r,editor:e,view:e.view,getPos:typeof t=="function"?t:void 0},a={minWidth:i,maxWidth:s??((u=this.resizeHandler)==null?void 0:u.getCurrentMaxWidth())},f=new Dn(l,n,a,Wt).initialize();return f.dom.addEventListener("click",p=>{p.preventDefault();const y=t();if(y!==void 0){const{state:w,view:g}=e,b=w.tr.setSelection(B.create(w.doc,y));g.dispatch(b)}}),f}},addCommands(){var r;return{...(r=this.parent)==null?void 0:r.call(this),setResizableImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addKeyboardShortcuts(){return{Backspace:()=>Bn(this.editor)}}}),Bn=r=>{var t,n;const e=[];return r.state.doc.nodesBetween(r.state.selection.$from.pos,r.state.selection.$to.pos,i=>{e==null||e.push(i)}),e.length!==1||((n=(t=e.at(0))==null?void 0:t.type)==null?void 0:n.name)!=="imageResize"?(console.log("trace 1: handled?"),!1):(r.commands.deleteSelection(),!0)},U=r=>r==="bulletList"||r==="orderedList",ke=r=>r==="listItem",J=r=>r==="paragraph"||r==="heading";function nt(r,e){for(const t of r)if(t(e))return!0;return!1}function $n(r,e){for(const t of r)if(t(e))return!0;return!1}const Fn=({editor:r,$from:e,currentNode:t})=>{const n=e.pos===e.start(),i=t.attrs.indent>0;return J(t.type.name)&&i&&n?r.commands.outdent():!1},Jn=({state:r,view:e,$from:t,currentNode:n})=>{const i=n.content.size===0,s=n.attrs.indent>0;if(!(J(n.type.name)&&s&&i))return!1;const a=t.before(t.depth),c=r.tr;return c.delete(a,a+n.nodeSize),e.dispatch(c),!0},Wn=({state:r,view:e,$from:t,currentNode:n})=>{const i=t.pos===t.start(),s=n.content.size===0,l=n.attrs.indent>0,a=t.before(t.depth),c=r.doc.resolve(a).nodeBefore,f=c!=null&&U(c.type.name);if(J(n.type.name)&&!l&&s&&i&&f){const p=r.tr;return p.delete(a,a+n.nodeSize),e.dispatch(p),!0}return!1},Hn=r=>{const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s,$to:l}=i;if(i.empty)return!1;let a=0;if(t.doc.nodesBetween(s.pos,l.pos,u=>{(U(u.type.name)||J(u.type.name))&&a++}),a<=1)return!1;const c=new Set;let f=!1;return t.doc.nodesBetween(s.pos,l.pos,(u,p)=>{var w;return!(U(u.type.name)||J(u.type.name))||c.has(p)?!0:(c.add(p),e.setNodeAttribute(p,"indent",(((w=u.attrs)==null?void 0:w.indent)??0)+1),f=!0,!1)}),f?(e.setMeta("addToHistory",!0),n==null||n(e),!0):!1},jn=r=>{var f;const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s}=i;let l=null,a=null;for(let u=s.depth;u>0;u--){const p=s.node(u);if(U(p.type.name)){l={...p,pos:s.before(u)},a={...s.node(u+1),pos:s.before(u+1)};break}}if(!l||!a)return!1;if(((f=l.content)==null?void 0:f.childCount)===1&&i instanceof F){const u=l.attrs.indent??0;return e.setNodeAttribute(l.pos,"indent",u+1),e.setMeta("addToHistory",!1),n==null||n(e),!0}return r.chain().focus().sinkListItem("listItem").updateAttributes("bulletList",{indent:1}).updateAttributes("orderedList",{indent:1}).run(),!0},qn=r=>{const{tr:e,state:t,dispatch:n}=r,{selection:i}=t,{$from:s}=i,l=s.node();if(!(J(l.type.name)&&i instanceof F))return!1;const c=l.attrs.indent??0;return e.setNodeAttribute(s.before(s.depth),"indent",c+1),e.setMeta("addToHistory",!1),n==null||n(e),!0},Ht=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if(U(p.type.name)&&(p.attrs.indent??0)>0){if(!u.has(y)){u.add(y);const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0;const g=r.doc.resolve(y),b=r.doc.resolve(y+p.nodeSize),M=new Rt(g,b,g.depth),A=Mt(M);A!=null&&(a.lift(M,A),f=!0)}return!1}if(J(p.type.name)&&(p.attrs.indent??0)>0){const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Vn=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if(U(p.type.name)&&(p.attrs.indent??0)>0){if(!u.has(y)){u.add(y);const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0;const g=r.doc.resolve(y),b=r.doc.resolve(y+p.nodeSize),M=new Rt(g,b,g.depth),A=Mt(M);A!=null&&(a.lift(M,A),f=!0)}return!1}if(J(p.type.name)&&(p.attrs.indent??0)>0){const w=p.attrs.indent??0;a.setNodeAttribute(y,"indent",Math.max(0,w-1)),f=!0}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Un=({$from:r,selectionIsEmpty:e})=>{var l;if(!e)return!1;let t=!1,n=!1,i=0;for(let a=r.depth;a>0;a--){const c=r.node(a);if(U(c.type.name))if(!t)t=!0,i=((l=c.attrs)==null?void 0:l.indent)??0;else{n=!0;break}}return t&&!n?i===0:!1},Kn=({state:r,view:e,$from:t,currentNode:n,selectionIsEmpty:i})=>{if(!i||!(n.type.name==="paragraph"&&n.content.size===0))return!1;const l=t.before(t.depth),a=r.doc.resolve(l).nodeBefore;if(!(a!=null&&U(a.type.name)))return!1;const f=r.doc.resolve(l-1),u=r.tr.setSelection(F.near(f,-1));return e.dispatch(u),!0},Xn=({state:r,view:e,$from:t,$to:n,selectionIsEmpty:i})=>{if(i)return!1;let s=0;if(r.doc.nodesBetween(t.pos,n.pos,p=>{(ke(p.type.name)||J(p.type.name))&&s++}),!(s>1))return!1;const{tr:a,doc:c}=r;let f=!1;const u=new Set;return c.nodesBetween(t.pos,n.pos,(p,y)=>{if((U(p.type.name)||J(p.type.name))&&!u.has(y)){u.add(y);const g=p.attrs.indent??0;return a.setNodeAttribute(y,"indent",g+1),f=!0,!1}return!0}),f?(a.setMeta("addToHistory",!0),e.dispatch(a),!0):!1},Yn=({state:r,view:e,$from:t,selectionIsEmpty:n})=>n||t.path.some(s=>{var l;return((l=s==null?void 0:s.type)==null?void 0:l.name)==="listItem"})?!1:(e.dispatch(r.tr.insertText(" ")),!0),Gn=({editor:r,currentNode:e,$from:t})=>{const n=e.content.size===0,i=t.node(t.depth-1);return i&&ke(i.type.name)&&!n?(r.chain().focus().indent().focus().run(),!0):!1},Zn=({state:r,view:e,$from:t,currentNode:n})=>{const i=t.pos===t.start(),s=n.content.size===0;return!i&&!s?(e.dispatch(r.tr.insertText(" ")),!0):!1};function rt(r){const{state:e,view:t}=r,{$from:n,$to:i,empty:s}=e.selection;return{editor:r,state:e,view:t,$from:n,$to:i,selectionIsEmpty:s,currentNode:n.node()}}const jt=Ee.Extension.create({name:"indent",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands._handleEnterKeyDown(),Tab:()=>{const r=rt(this.editor);return nt([Xn,Yn,Gn,Zn],r)||this.editor.commands.indent()},Backspace:()=>{const r=rt(this.editor);return nt([Fn,Jn,Wn],r)},"Shift-Tab":()=>{const r=rt(this.editor);return nt([Vn,Kn,Un],r)||this.editor.chain().outdentShiftTab().run()},Space:()=>this.editor.commands._handleSpaceKeyDown()}},addProseMirrorPlugins(){return[new le({appendTransaction:(r,e,t)=>{if(!r.some(s=>s.docChanged))return null;let i=null;return t.doc.descendants((s,l)=>{var y;if(!(J(s.type.name)&&(((y=s==null?void 0:s.attrs)==null?void 0:y.indent)??0)>0))return;const c=t.doc.resolve(l);if(!(c.parent.type.name==="listItem"))return;let u=null;for(let w=c.depth-1;w>0;w--)if(U(c.node(w).type.name)){u=c.start(w)-1;break}if(u===null||u<0)return;i||(i=t.tr);const p=s.attrs.indent;i.setNodeAttribute(l,"indent",0),i.setNodeAttribute(u,"indent",p)}),i}})]},addGlobalAttributes(){return[{types:this.options.types??["orderedList","bulletList","paragraph","heading"],attributes:{indent:{default:1,parseHTML:r=>parseInt(r.getAttribute("data-indent")||"1",10),renderHTML:r=>r!=null&&r.indent?{style:`padding-left: ${r.indent*20}px`}:{}}}}]},addCommands(){return{_handleEnterKeyDown:()=>r=>{var c;const{tr:e,state:t,dispatch:n}=r,{$from:i}=t.selection,s=i.node();if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)==="paragraph"&&s.attrs.indent))return!1;const a=s.attrs.indent;return e.split(i.pos),e.setNodeAttribute(e.selection.$from.before(),"indent",a),e.scrollIntoView(),e.setMeta("addToHistory",!1),n==null||n(e),!0},_handleSpaceKeyDown:()=>()=>!1,indent:()=>r=>$n([Hn,jn,qn],r),outdent:()=>r=>{const{state:e,view:t,tr:n,dispatch:i}=r,{$from:s,$to:l,empty:a}=e.selection,c={editor:r.editor,state:e,view:t,$from:s,$to:l,selectionIsEmpty:a,currentNode:s.node()};if(Ht(c))return!0;const f=s.node();if(!(J(f.type.name)&&f.attrs.indent>0)||!(s.pos===s.start()))return!1;const y=Math.max(0,f.attrs.indent-1);return n.setNodeAttribute(s.before(s.depth),"indent",y),n.setMeta("addToHistory",!1),i==null||i(n),!0},outdentShiftTab:()=>r=>{const{state:e,tr:t,dispatch:n}=r,{$from:i}=e.selection,s=i.node();if(!(J(s.type.name)&&s.attrs.indent>0))return!1;const a=Math.max(0,s.attrs.indent-1);return t.setNodeAttribute(i.before(i.depth),"indent",a),t.setMeta("addToHistory",!1),n==null||n(t),!0},increaseIndent:()=>({commands:r})=>r.indent(),decreaseIndent:()=>r=>{const{state:e,view:t}=r,{$from:n,$to:i,empty:s}=e.selection,l={editor:r.editor,state:e,view:t,$from:n,$to:i,selectionIsEmpty:s,currentNode:n.node()};return Ht(l)?!0:r.chain().outdentShiftTab().run()}}}});var Qn=D.BulletList,er=D.ListItem,tr=D.OrderedList;const qt=Qn.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}},addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("ul");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}}}),Vt=tr.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}},addNodeView(){return({node:r})=>{const e=r.attrs.indent||0,t=document.createElement("ol");return t.setAttribute("data-indent",String(e)),e>0&&(t.style.paddingLeft=`${e*20}px`),{dom:t,contentDOM:t}}}}),it=er.extend({addAttributes(){var r;return{...(r=this.parent)==null?void 0:r.call(this),class:{default:null,parseHTML:e=>e.getAttribute("class"),renderHTML:e=>e.class?{class:e.class,...e}:{}},indent:{default:0,parseHTML:e=>parseInt(e.getAttribute("data-indent")||"0",10),renderHTML:e=>e.indent?{"data-indent":e.indent}:{}}}}}),st=se.Extension.create({name:"dynamicBulletStyling",addProseMirrorPlugins(){return[new le({key:new An("dynamicBulletStyling"),appendTransaction:(r,e,t)=>{const n=t.tr;let i=!1;return t.doc.descendants((s,l)=>{if(s.type.name==="listItem"){let a=0;const c=t.doc.resolve(l);for(let f=c.depth;f>0;f--)if(c.node(f).type.name==="bulletList"){a=1;break}a>0&&(n.setNodeAttribute(c.pos,"[data-style]","line-height: inherit"),i=!0)}}),i?n:null}})]}}),nr=r=>r==="bulletList"||r==="orderedList",rr=r=>r==="paragraph"||r==="heading",Ut=se.Extension.create({name:"listIndentIntegration",addProseMirrorPlugins(){return[new le({appendTransaction:(r,e,t)=>{if(!r.find(i=>i.docChanged))return null;let n=null;return t.doc.descendants((i,s)=>{var l;if(rr(i.type.name)&&(((l=i==null?void 0:i.attrs)==null?void 0:l.indent)??0)>0){const a=t.doc.resolve(s);if(a.parent.type.name==="listItem"){let f=null;for(let u=a.depth-1;u>0;u--){const p=a.node(u);if(nr(p.type.name)){f=a.start(u)-1;break}}if(f!==null&&f>=0){n||(n=t.tr);const u=i.attrs.indent;n.setNodeAttribute(s,"indent",0),n.setNodeAttribute(f,"indent",u)}}}}),n}}),new le({props:{transformPastedHTML(r){const e=/<p[^>]*style="[^"]*(?:padding|margin)-left:\s*(\d+)(?:px|pt|em)[^"]*"[^>]*>/gi;r=r.replace(e,(i,s)=>`<p data-indent="${Math.floor(parseInt(s,10)/40)}">`);const t=/<ol[^>]*style="[^"]*list-style-type:\s*(upper-roman|lower-roman|upper-alpha|lower-alpha)[^"]*"[^>]*>/gi;r=r.replace(t,()=>"<ol>");const n=/<li[^>]*style="[^"]*list-style-type:\s*[^;"\s]+[^"]*"[^>]*>/gi;return r=r.replace(n,i=>i.replace(/list-style-type:\s*[^;"\s]+;?/gi,"")),r}}})]}}),ot=se.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"],getStyle:r=>`font-size: ${r}`}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:r=>r.style.fontSize.replace(/['"]+/g,""),renderHTML:r=>r.fontSize?{style:this.options.getStyle(r.fontSize)}:{}}}}]},addCommands(){return{setFontSize:r=>({chain:e})=>e().setMark("textStyle",{fontSize:r}).run(),unsetFontSize:()=>({chain:r})=>r().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),at=se.Extension.create({name:"lineHeight",addOptions(){return{types:["textStyle"],getStyle:r=>`line-height: ${r};`}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:r=>r.style.lineHeight.replace(/['"]+/g,""),renderHTML:r=>r.lineHeight?{style:this.options.getStyle(r.lineHeight)}:{}}}}]},addCommands(){return{setLineHeight:r=>({chain:e})=>e().setMark("textStyle",{lineHeight:r}).run(),unsetLineHeight:()=>({chain:r})=>r().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),ir=[$,Z.CharacterCount,X,Pe,gt,yt,vt,tt,Ze,D.ListItem,D.ListKeymap,It,D.OrderedList,Z.Placeholder,Y.Table,Y.TableCell,Y.TableHeader,Y.TableRow,D.TaskItem,D.TaskList,Fe,Je.TextStyle,We,Be,$e,_e,De,Z.UndoRedo,it,ot,at,D.BulletList,st],sr=[Jt,Je.TextStyle,X,Z.UndoRedo.configure({newGroupDelay:500,depth:100}),De,We,$,_e,D.TaskItem,it,Pe,$e,ot,at,qt,st,tt,Ut,Fe.configure({types:["heading","paragraph"]}),Vt.configure({itemTypeName:"listItem",keepMarks:!0,keepAttributes:!0}),Ze,jt],or=se.Extension.create({name:"MentionStorage",addStorage(){return{suggestions:[]}}});var ue={},Kt;function ar(){if(Kt)return ue;Kt=1;var r=xn;if(process.env.NODE_ENV==="production")ue.createRoot=r.createRoot,ue.hydrateRoot=r.hydrateRoot;else{var e=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ue.createRoot=function(t,n){e.usingClientEntryPoint=!0;try{return r.createRoot(t,n)}finally{e.usingClientEntryPoint=!1}},ue.hydrateRoot=function(t,n,i){e.usingClientEntryPoint=!0;try{return r.hydrateRoot(t,n,i)}finally{e.usingClientEntryPoint=!1}}}return ue}var lr=ar(),Ne={exports:{}},ge={};/**
|
|
25
|
+
* @license React
|
|
26
|
+
* react-jsx-runtime.production.min.js
|
|
27
|
+
*
|
|
28
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the MIT license found in the
|
|
31
|
+
* LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/var Xt;function cr(){if(Xt)return ge;Xt=1;var r=He,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(a,c,f){var u,p={},y=null,w=null;f!==void 0&&(y=""+f),c.key!==void 0&&(y=""+c.key),c.ref!==void 0&&(w=c.ref);for(u in c)n.call(c,u)&&!s.hasOwnProperty(u)&&(p[u]=c[u]);if(a&&a.defaultProps)for(u in c=a.defaultProps,c)p[u]===void 0&&(p[u]=c[u]);return{$$typeof:e,type:a,key:y,ref:w,props:p,_owner:i.current}}return ge.Fragment=t,ge.jsx=l,ge.jsxs=l,ge}var ye={};/**
|
|
33
|
+
* @license React
|
|
34
|
+
* react-jsx-runtime.development.js
|
|
35
|
+
*
|
|
36
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
37
|
+
*
|
|
38
|
+
* This source code is licensed under the MIT license found in the
|
|
39
|
+
* LICENSE file in the root directory of this source tree.
|
|
40
|
+
*/var Yt;function ur(){return Yt||(Yt=1,process.env.NODE_ENV!=="production"&&(function(){var r=He,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),g=Symbol.iterator,b="@@iterator";function M(o){if(o===null||typeof o!="object")return null;var d=g&&o[g]||o[b];return typeof d=="function"?d:null}var A=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(o){{for(var d=arguments.length,m=new Array(d>1?d-1:0),v=1;v<d;v++)m[v-1]=arguments[v];Se("error",o,m)}}function Se(o,d,m){{var v=A.ReactDebugCurrentFrame,E=v.getStackAddendum();E!==""&&(d+="%s",m=m.concat([E]));var x=m.map(function(I){return String(I)});x.unshift("Warning: "+d),Function.prototype.apply.call(console[o],console,x)}}var pr=!1,mr=!1,gr=!1,yr=!1,vr=!1,Zt;Zt=Symbol.for("react.module.reference");function wr(o){return!!(typeof o=="string"||typeof o=="function"||o===n||o===s||vr||o===i||o===f||o===u||yr||o===w||pr||mr||gr||typeof o=="object"&&o!==null&&(o.$$typeof===y||o.$$typeof===p||o.$$typeof===l||o.$$typeof===a||o.$$typeof===c||o.$$typeof===Zt||o.getModuleId!==void 0))}function Sr(o,d,m){var v=o.displayName;if(v)return v;var E=d.displayName||d.name||"";return E!==""?m+"("+E+")":m}function Qt(o){return o.displayName||"Context"}function G(o){if(o==null)return null;if(typeof o.tag=="number"&&C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case n:return"Fragment";case t:return"Portal";case s:return"Profiler";case i:return"StrictMode";case f:return"Suspense";case u:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case a:var d=o;return Qt(d)+".Consumer";case l:var m=o;return Qt(m._context)+".Provider";case c:return Sr(o,o.render,"ForwardRef");case p:var v=o.displayName||null;return v!==null?v:G(o.type)||"Memo";case y:{var E=o,x=E._payload,I=E._init;try{return G(I(x))}catch{return null}}}return null}var re=Object.assign,Ie=0,en,tn,nn,rn,sn,on,an;function ln(){}ln.__reactDisabledLog=!0;function Ir(){{if(Ie===0){en=console.log,tn=console.info,nn=console.warn,rn=console.error,sn=console.group,on=console.groupCollapsed,an=console.groupEnd;var o={configurable:!0,enumerable:!0,value:ln,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}Ie++}}function br(){{if(Ie--,Ie===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:re({},o,{value:en}),info:re({},o,{value:tn}),warn:re({},o,{value:nn}),error:re({},o,{value:rn}),group:re({},o,{value:sn}),groupCollapsed:re({},o,{value:on}),groupEnd:re({},o,{value:an})})}Ie<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var lt=A.ReactCurrentDispatcher,ct;function Le(o,d,m){{if(ct===void 0)try{throw Error()}catch(E){var v=E.stack.trim().match(/\n( *(at )?)/);ct=v&&v[1]||""}return`
|
|
41
|
+
`+ct+o}}var ut=!1,Ae;{var Er=typeof WeakMap=="function"?WeakMap:Map;Ae=new Er}function cn(o,d){if(!o||ut)return"";{var m=Ae.get(o);if(m!==void 0)return m}var v;ut=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var x;x=lt.current,lt.current=null,Ir();try{if(d){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(H){v=H}Reflect.construct(o,[],I)}else{try{I.call()}catch(H){v=H}o.call(I.prototype)}}else{try{throw Error()}catch(H){v=H}o()}}catch(H){if(H&&v&&typeof H.stack=="string"){for(var S=H.stack.split(`
|
|
42
|
+
`),W=v.stack.split(`
|
|
43
|
+
`),k=S.length-1,L=W.length-1;k>=1&&L>=0&&S[k]!==W[L];)L--;for(;k>=1&&L>=0;k--,L--)if(S[k]!==W[L]){if(k!==1||L!==1)do if(k--,L--,L<0||S[k]!==W[L]){var q=`
|
|
44
|
+
`+S[k].replace(" at new "," at ");return o.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",o.displayName)),typeof o=="function"&&Ae.set(o,q),q}while(k>=1&&L>=0);break}}}finally{ut=!1,lt.current=x,br(),Error.prepareStackTrace=E}var fe=o?o.displayName||o.name:"",ie=fe?Le(fe):"";return typeof o=="function"&&Ae.set(o,ie),ie}function xr(o,d,m){return cn(o,!1)}function Tr(o){var d=o.prototype;return!!(d&&d.isReactComponent)}function ze(o,d,m){if(o==null)return"";if(typeof o=="function")return cn(o,Tr(o));if(typeof o=="string")return Le(o);switch(o){case f:return Le("Suspense");case u:return Le("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case c:return xr(o.render);case p:return ze(o.type,d,m);case y:{var v=o,E=v._payload,x=v._init;try{return ze(x(E),d,m)}catch{}}}return""}var be=Object.prototype.hasOwnProperty,un={},dn=A.ReactDebugCurrentFrame;function Me(o){if(o){var d=o._owner,m=ze(o.type,o._source,d?d.type:null);dn.setExtraStackFrame(m)}else dn.setExtraStackFrame(null)}function Rr(o,d,m,v,E){{var x=Function.call.bind(be);for(var I in o)if(x(o,I)){var S=void 0;try{if(typeof o[I]!="function"){var W=Error((v||"React class")+": "+m+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}S=o[I](d,I,v,m,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(k){S=k}S&&!(S instanceof Error)&&(Me(E),C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",m,I,typeof S),Me(null)),S instanceof Error&&!(S.message in un)&&(un[S.message]=!0,Me(E),C("Failed %s type: %s",m,S.message),Me(null))}}}var Or=Array.isArray;function dt(o){return Or(o)}function Cr(o){{var d=typeof Symbol=="function"&&Symbol.toStringTag,m=d&&o[Symbol.toStringTag]||o.constructor.name||"Object";return m}}function kr(o){try{return fn(o),!1}catch{return!0}}function fn(o){return""+o}function hn(o){if(kr(o))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Cr(o)),fn(o)}var pn=A.ReactCurrentOwner,Nr={key:!0,ref:!0,__self:!0,__source:!0},mn,gn;function Lr(o){if(be.call(o,"ref")){var d=Object.getOwnPropertyDescriptor(o,"ref").get;if(d&&d.isReactWarning)return!1}return o.ref!==void 0}function Ar(o){if(be.call(o,"key")){var d=Object.getOwnPropertyDescriptor(o,"key").get;if(d&&d.isReactWarning)return!1}return o.key!==void 0}function zr(o,d){typeof o.ref=="string"&&pn.current}function Mr(o,d){{var m=function(){mn||(mn=!0,C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",d))};m.isReactWarning=!0,Object.defineProperty(o,"key",{get:m,configurable:!0})}}function Pr(o,d){{var m=function(){gn||(gn=!0,C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",d))};m.isReactWarning=!0,Object.defineProperty(o,"ref",{get:m,configurable:!0})}}var Dr=function(o,d,m,v,E,x,I){var S={$$typeof:e,type:o,key:d,ref:m,props:I,_owner:x};return S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(S,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(S,"_source",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S};function _r(o,d,m,v,E){{var x,I={},S=null,W=null;m!==void 0&&(hn(m),S=""+m),Ar(d)&&(hn(d.key),S=""+d.key),Lr(d)&&(W=d.ref,zr(d,E));for(x in d)be.call(d,x)&&!Nr.hasOwnProperty(x)&&(I[x]=d[x]);if(o&&o.defaultProps){var k=o.defaultProps;for(x in k)I[x]===void 0&&(I[x]=k[x])}if(S||W){var L=typeof o=="function"?o.displayName||o.name||"Unknown":o;S&&Mr(I,L),W&&Pr(I,L)}return Dr(o,S,W,E,v,pn.current,I)}}var ft=A.ReactCurrentOwner,yn=A.ReactDebugCurrentFrame;function de(o){if(o){var d=o._owner,m=ze(o.type,o._source,d?d.type:null);yn.setExtraStackFrame(m)}else yn.setExtraStackFrame(null)}var ht;ht=!1;function pt(o){return typeof o=="object"&&o!==null&&o.$$typeof===e}function vn(){{if(ft.current){var o=G(ft.current.type);if(o)return`
|
|
45
|
+
|
|
46
|
+
Check the render method of \``+o+"`."}return""}}function Br(o){return""}var wn={};function $r(o){{var d=vn();if(!d){var m=typeof o=="string"?o:o.displayName||o.name;m&&(d=`
|
|
47
|
+
|
|
48
|
+
Check the top-level render call using <`+m+">.")}return d}}function Sn(o,d){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var m=$r(d);if(wn[m])return;wn[m]=!0;var v="";o&&o._owner&&o._owner!==ft.current&&(v=" It was passed a child from "+G(o._owner.type)+"."),de(o),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,v),de(null)}}function In(o,d){{if(typeof o!="object")return;if(dt(o))for(var m=0;m<o.length;m++){var v=o[m];pt(v)&&Sn(v,d)}else if(pt(o))o._store&&(o._store.validated=!0);else if(o){var E=M(o);if(typeof E=="function"&&E!==o.entries)for(var x=E.call(o),I;!(I=x.next()).done;)pt(I.value)&&Sn(I.value,d)}}}function Fr(o){{var d=o.type;if(d==null||typeof d=="string")return;var m;if(typeof d=="function")m=d.propTypes;else if(typeof d=="object"&&(d.$$typeof===c||d.$$typeof===p))m=d.propTypes;else return;if(m){var v=G(d);Rr(m,o.props,"prop",v,o)}else if(d.PropTypes!==void 0&&!ht){ht=!0;var E=G(d);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof d.getDefaultProps=="function"&&!d.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Jr(o){{for(var d=Object.keys(o.props),m=0;m<d.length;m++){var v=d[m];if(v!=="children"&&v!=="key"){de(o),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),de(null);break}}o.ref!==null&&(de(o),C("Invalid attribute `ref` supplied to `React.Fragment`."),de(null))}}var bn={};function En(o,d,m,v,E,x){{var I=wr(o);if(!I){var S="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var W=Br();W?S+=W:S+=vn();var k;o===null?k="null":dt(o)?k="array":o!==void 0&&o.$$typeof===e?(k="<"+(G(o.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):k=typeof o,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,S)}var L=_r(o,d,m,E,x);if(L==null)return L;if(I){var q=d.children;if(q!==void 0)if(v)if(dt(q)){for(var fe=0;fe<q.length;fe++)In(q[fe],o);Object.freeze&&Object.freeze(q)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else In(q,o)}if(be.call(d,"key")){var ie=G(o),H=Object.keys(d).filter(function(Ur){return Ur!=="key"}),mt=H.length>0?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}";if(!bn[ie+mt]){var Vr=H.length>0?"{"+H.join(": ..., ")+": ...}":"{}";C(`A props object containing a "key" prop is being spread into JSX:
|
|
49
|
+
let props = %s;
|
|
50
|
+
<%s {...props} />
|
|
51
|
+
React keys must be passed directly to JSX without using spread:
|
|
52
|
+
let props = %s;
|
|
53
|
+
<%s key={someKey} {...props} />`,mt,ie,Vr,ie),bn[ie+mt]=!0}}return o===n?Jr(L):Fr(L),L}}function Wr(o,d,m){return En(o,d,m,!0)}function Hr(o,d,m){return En(o,d,m,!1)}var jr=Hr,qr=Wr;ye.Fragment=n,ye.jsx=jr,ye.jsxs=qr})()),ye}var Gt;function dr(){return Gt||(Gt=1,process.env.NODE_ENV==="production"?Ne.exports=cr():Ne.exports=ur()),Ne.exports}var ve=dr();const fr=({images:r,onAdd:e,onDelete:t,onImageClick:n,focusedImageIndex:i})=>ve.jsxs("div",{className:"batch-image-gallery",style:{display:"flex",gap:"8px",overflowX:"auto",padding:"8px"},children:[r.map((s,l)=>ve.jsxs("div",{style:{position:"relative",border:i===l?"2px solid blue":"2px solid transparent",cursor:"pointer"},onClick:()=>n(s),children:[ve.jsx("img",{src:s.src,alt:s.alt,style:{width:"80px",height:"80px",objectFit:"cover"}}),ve.jsx("button",{onClick:a=>{a.stopPropagation(),t(l)},style:{position:"absolute",top:0,right:0},children:"×"})]},s.id)),ve.jsx("button",{onClick:e,style:{width:"80px",height:"80px"},children:"+"})]});let we=null;const hr=se.Node.create({name:"batchSegmentImages",group:"block",inline:!1,atom:!0,addOptions(){return{maxImageAmount:void 0,height:void 0,onAdd:void 0,onRemove:void 0,onImageClick:void 0,initialImageRegistry:void 0}},addStorage(){return{imageRegistry:new Map(this.options.initialImageRegistry)}},addAttributes(){return{batchId:{default:null,parseHTML:r=>r.getAttribute("data-batch-id"),renderHTML:r=>({"data-batch-id":r.batchId})},id:{default:null,parseHTML:r=>r.getAttribute("data-id"),renderHTML:r=>({"data-id":r.id})},images:{default:[],parseHTML:r=>{const e=r.querySelectorAll("img"),t=[];return e.forEach(n=>{const i=n.getAttribute("data-id"),s=n.getAttribute("src"),l=n.getAttribute("alt"),a=n.getAttribute("title");i&&s&&t.push({id:i,src:s,alt:l??void 0,title:a??void 0})}),t},renderHTML:()=>({})},imageVersion:{default:0,parseHTML:()=>0,renderHTML:()=>({})},focusedImageIndex:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},addProseMirrorPlugins(){return[new le({props:{handleKeyDown(r,e){return e.key==="ArrowLeft"||e.key==="ArrowUp"?we="left":e.key==="ArrowRight"||e.key==="ArrowDown"?we="right":we=null,!1}}})]},addKeyboardShortcuts(){const r=(n,i)=>{const s=this.editor.state.tr.setNodeMarkup(n,void 0,{...i.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);s.setSelection(F.near(s.doc.resolve(n))),this.editor.view.dispatch(s)},e=(n,i)=>{const s=n+i.nodeSize,l=this.editor.state.tr.setNodeMarkup(n,void 0,{...i.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);l.setSelection(F.near(l.doc.resolve(s))),this.editor.view.dispatch(l)},t=n=>{var p,y;const{selection:i}=this.editor.state;if(!(i instanceof B))return!1;const s=i.node;if(s.type.name!=="batchSegmentImages")return!1;const l=((y=(p=this.editor.storage.batchSegmentImages)==null?void 0:p.imageRegistry)==null?void 0:y.get(s.attrs.batchId))??s.attrs.images;if(!l.length)return!1;const a=i.from,c=s.attrs.focusedImageIndex,f=!!this.options.onAdd;let u;if(n==="right"){if(c===null)return e(a,s),!0;if(c<l.length-1)u=c+1;else if(c===l.length-1&&f)u=null;else return e(a,s),!0}else if(c===null)u=l.length-1;else if(c>0)u=c-1;else return r(a,s),!0;if(this.editor.view.dispatch(this.editor.state.tr.setNodeMarkup(a,void 0,{...s.attrs,focusedImageIndex:u}).setMeta("addToHistory",!1)),u!==null&&u>=0&&u<l.length){const w=this.editor.view.nodeDOM(a);w instanceof HTMLElement&&requestAnimationFrame(()=>{var b;(b=w.querySelectorAll("img")[u])==null||b.scrollIntoView({block:"nearest",inline:"nearest"})})}return!0};return{ArrowLeft:()=>t("left"),ArrowRight:()=>t("right"),Space:()=>{var c,f,u,p,y,w;const{selection:n}=this.editor.state;if(!(n instanceof B))return!1;const i=n.node;if(i.type.name!=="batchSegmentImages")return!1;const s=((f=(c=this.editor.storage.batchSegmentImages)==null?void 0:c.imageRegistry)==null?void 0:f.get(i.attrs.batchId))??i.attrs.images,l=i.attrs.focusedImageIndex,a=n.from;if(l===null)return(p=(u=this.options).onAdd)==null||p.call(u,{position:"last",batchId:i.attrs.batchId,currentImages:s,getPos:()=>a,editor:this.editor}),!0;if(l>=0&&l<s.length){const g=s[l];return(w=(y=this.options).onImageClick)==null||w.call(y,{imageId:g.id,batchId:i.attrs.batchId,src:g.src,getPos:()=>a,editor:this.editor}),!0}return!1}}},renderHTML({node:r}){const e=r.attrs.images??[];return["div",{"data-batch-id":r.attrs.batchId,style:"display: flex; overflow-x: auto; gap: 10px; white-space: nowrap; padding: 10px 0;"},...e.map(t=>["img",{"data-id":t.id,src:t.src,alt:t.alt??"",title:t.title??"",style:"width: 80px; height: 80px; object-fit: cover; flex-shrink: 0;"}])]},addNodeView(){return({node:r,getPos:e,editor:t})=>{const n=this.options,i=this.storage,s=document.createElement("div");s.style.width="100%",s.classList.add("batch-segment-gallery"),i.imageRegistry.has(r.attrs.batchId)||i.imageRegistry.set(r.attrs.batchId,r.attrs.images??[]);const l=lr.createRoot(s),a={current:r};let c=null;const f=()=>{var g;(g=n.onAdd)==null||g.call(n,{position:"last",batchId:a.current.attrs.batchId,currentImages:i.imageRegistry.get(a.current.attrs.batchId)??[],getPos:e,editor:t})},u=g=>{var b,M;(M=n.onRemove)==null||M.call(n,{index:g,imageId:(b=(i.imageRegistry.get(a.current.attrs.batchId)??[])[g])==null?void 0:b.id,batchId:a.current.attrs.batchId,getPos:e,editor:t})},p=g=>{var M;const b=e();if(b!==void 0){const A=(i.imageRegistry.get(a.current.attrs.batchId)??[]).findIndex(C=>C.id===g.id);t.view.dispatch(t.state.tr.setNodeMarkup(b,void 0,{...a.current.attrs,focusedImageIndex:A}).setMeta("addToHistory",!1))}(M=n.onImageClick)==null||M.call(n,{imageId:g.id,batchId:a.current.attrs.batchId,src:g.src,getPos:e,editor:t})},y=()=>{const[g,b]=je.useState({images:i.imageRegistry.get(r.attrs.batchId)??[],focusedImageIndex:r.attrs.focusedImageIndex,batchId:r.attrs.batchId});return c=b,je.createElement(fr,{batchId:g.batchId,images:g.images,maxImageAmount:n.maxImageAmount,height:n.height,focusedImageIndex:g.focusedImageIndex,onAdd:f,onDelete:u,onImageClick:p})};l.render(je.createElement(y));let w=r;return s.addEventListener("click",()=>{const g=e();if(g!==void 0){const{state:b,view:M}=t,A=b.doc.nodeAt(g);if(!A)return;const C=b.tr.setNodeMarkup(g,void 0,{...A.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1);M.dispatch(C.setSelection(B.create(C.doc,g)))}}),{dom:s,update:g=>g.type!==r.type?!1:(g===w||(w=g,a.current=g,c==null||c({images:i.imageRegistry.get(g.attrs.batchId)??[],focusedImageIndex:g.attrs.focusedImageIndex,batchId:g.attrs.batchId})),!0),selectNode:()=>{const g=we;we=null;const b=e();if(b===void 0)return;const M=t.state.doc.nodeAt(b);if(!M||M.attrs.focusedImageIndex!==null)return;const A=g==="left"?null:0;queueMicrotask(()=>{const C=e();if(C===void 0)return;const Se=t.state.doc.nodeAt(C);!Se||Se.attrs.focusedImageIndex!==null||t.state.selection instanceof B&&t.view.dispatch(t.state.tr.setNodeMarkup(C,void 0,{...Se.attrs,focusedImageIndex:A}).setMeta("addToHistory",!1))})},deselectNode:()=>{const g=e();if(g===void 0)return;const b=t.state.doc.nodeAt(g);!b||b.attrs.focusedImageIndex===null||t.view.dispatch(t.state.tr.setNodeMarkup(g,void 0,{...b.attrs,focusedImageIndex:null}).setMeta("addToHistory",!1))},destroy:()=>{i.imageRegistry.delete(r.attrs.batchId),queueMicrotask(()=>l.unmount())}}}},addCommands(){return{insertBatchImages:({batchId:r,images:e})=>t=>(t.editor.storage.batchSegmentImages.imageRegistry.set(r,e),t.chain().insertContent({type:"batchSegmentImages",attrs:{batchId:r,images:e,id:crypto.randomUUID()}}).run())}},parseHTML(){return[{tag:"div[data-batch-id]"}]}});h.Bold=$,h.Color=X,h.Document=Pe,h.FileHandler=gt,h.HardBreak=De,h.Heading=yt,h.Highlight=vt,h.Image=wt,h.Italic=_e,h.Link=St,Object.defineProperty(h,"BulletList",{enumerable:!0,get:()=>D.BulletList}),Object.defineProperty(h,"ListItem",{enumerable:!0,get:()=>D.ListItem}),Object.defineProperty(h,"ListKeymap",{enumerable:!0,get:()=>D.ListKeymap}),Object.defineProperty(h,"OrderedList",{enumerable:!0,get:()=>D.OrderedList}),Object.defineProperty(h,"TaskItem",{enumerable:!0,get:()=>D.TaskItem}),Object.defineProperty(h,"TaskList",{enumerable:!0,get:()=>D.TaskList}),h.Mention=It,h.Paragraph=Be,Object.defineProperty(h,"Table",{enumerable:!0,get:()=>Y.Table}),Object.defineProperty(h,"TableCell",{enumerable:!0,get:()=>Y.TableCell}),Object.defineProperty(h,"TableHeader",{enumerable:!0,get:()=>Y.TableHeader}),Object.defineProperty(h,"TableRow",{enumerable:!0,get:()=>Y.TableRow}),h.Text=$e,h.TextAlign=Fe,Object.defineProperty(h,"TextStyle",{enumerable:!0,get:()=>Je.TextStyle}),h.Underline=We,Object.defineProperty(h,"CharacterCount",{enumerable:!0,get:()=>Z.CharacterCount}),Object.defineProperty(h,"History",{enumerable:!0,get:()=>Z.UndoRedo}),Object.defineProperty(h,"Placeholder",{enumerable:!0,get:()=>Z.Placeholder}),Object.defineProperty(h,"Editor",{enumerable:!0,get:()=>Ee.Editor}),Object.defineProperty(h,"EditorContent",{enumerable:!0,get:()=>Ee.EditorContent}),Object.defineProperty(h,"useEditor",{enumerable:!0,get:()=>Ee.useEditor}),h.ALL_EXTENSIONS=ir,h.BASE_EXTENSIONS=sr,h.BatchSegmentImagesExtension=hr,h.CustomBulletList=qt,h.CustomLink=Ze,h.CustomListItem=it,h.CustomOrderedList=Vt,h.CustomParagraph=Jt,h.DynamicBulletStyling=st,h.FontSize=ot,h.ImageResize=tt,h.IndentExtension=jt,h.LineHeight=at,h.ListIndentIntegration=Ut,h.MentionStorage=or,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sovann72-dev/lynqify-ui",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"main": "
|
|
5
|
-
"module": "
|
|
6
|
-
"types": "
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"main": "dist/lynqify-ui.umd.cjs",
|
|
5
|
+
"module": "dist/lynqify-ui.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"
|
|
8
|
+
"dist"
|
|
9
9
|
],
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -89,30 +89,6 @@
|
|
|
89
89
|
"@react-google-maps/api": "^2.20.8",
|
|
90
90
|
"@tailwindcss/forms": "^0.5.7",
|
|
91
91
|
"@tanstack/react-table": "^8.12.0",
|
|
92
|
-
"@tiptap/core": "^3.22.5",
|
|
93
|
-
"@tiptap/extension-bold": "^3.22.5",
|
|
94
|
-
"@tiptap/extension-color": "^3.22.5",
|
|
95
|
-
"@tiptap/extension-document": "^3.22.5",
|
|
96
|
-
"@tiptap/extension-file-handler": "^3.22.5",
|
|
97
|
-
"@tiptap/extension-hard-break": "^3.22.5",
|
|
98
|
-
"@tiptap/extension-heading": "^3.22.5",
|
|
99
|
-
"@tiptap/extension-highlight": "^3.22.5",
|
|
100
|
-
"@tiptap/extension-image": "^3.22.5",
|
|
101
|
-
"@tiptap/extension-italic": "^3.22.5",
|
|
102
|
-
"@tiptap/extension-link": "^3.22.5",
|
|
103
|
-
"@tiptap/extension-list": "^3.22.5",
|
|
104
|
-
"@tiptap/extension-mention": "^3.22.5",
|
|
105
|
-
"@tiptap/extension-paragraph": "^3.22.5",
|
|
106
|
-
"@tiptap/extension-table": "^3.22.5",
|
|
107
|
-
"@tiptap/extension-text": "^3.22.5",
|
|
108
|
-
"@tiptap/extension-text-align": "^3.22.5",
|
|
109
|
-
"@tiptap/extension-text-style": "^3.22.5",
|
|
110
|
-
"@tiptap/extension-underline": "^3.22.5",
|
|
111
|
-
"@tiptap/extensions": "^3.22.5",
|
|
112
|
-
"@tiptap/pm": "^3.22.5",
|
|
113
|
-
"@tiptap/react": "^3.22.5",
|
|
114
|
-
"@tiptap/starter-kit": "^3.22.5",
|
|
115
|
-
"@tiptap/suggestion": "^3.22.5",
|
|
116
92
|
"@types/react-input-mask": "^3.0.6",
|
|
117
93
|
"@uiw/react-color-sketch": "^2.3.1",
|
|
118
94
|
"@userback/react": "^0.3.7",
|
|
@@ -141,11 +117,9 @@
|
|
|
141
117
|
"platform": "^1.3.6",
|
|
142
118
|
"posthog-js": "^1.310.1",
|
|
143
119
|
"qs": "^6.14.0",
|
|
144
|
-
"react": "^18.2.0",
|
|
145
120
|
"react-color": "^2.19.3",
|
|
146
121
|
"react-datepicker": "^8.2.0",
|
|
147
122
|
"react-day-picker": "^8.10.1",
|
|
148
|
-
"react-dom": "^18.2.0",
|
|
149
123
|
"react-draggable": "^4.4.6",
|
|
150
124
|
"react-dropzone": "^14.3.8",
|
|
151
125
|
"react-easy-crop": "^5.0.8",
|
|
@@ -179,6 +153,34 @@
|
|
|
179
153
|
"yjs": "^13.6.27",
|
|
180
154
|
"zod": "^3.22.4"
|
|
181
155
|
},
|
|
156
|
+
"peerDependencies": {
|
|
157
|
+
"@tiptap/core": "^3.0.0",
|
|
158
|
+
"@tiptap/extension-bold": "^3.0.0",
|
|
159
|
+
"@tiptap/extension-color": "^3.0.0",
|
|
160
|
+
"@tiptap/extension-document": "^3.0.0",
|
|
161
|
+
"@tiptap/extension-file-handler": "^3.0.0",
|
|
162
|
+
"@tiptap/extension-hard-break": "^3.0.0",
|
|
163
|
+
"@tiptap/extension-heading": "^3.0.0",
|
|
164
|
+
"@tiptap/extension-highlight": "^3.0.0",
|
|
165
|
+
"@tiptap/extension-image": "^3.0.0",
|
|
166
|
+
"@tiptap/extension-italic": "^3.0.0",
|
|
167
|
+
"@tiptap/extension-link": "^3.0.0",
|
|
168
|
+
"@tiptap/extension-list": "^3.0.0",
|
|
169
|
+
"@tiptap/extension-mention": "^3.0.0",
|
|
170
|
+
"@tiptap/extension-paragraph": "^3.0.0",
|
|
171
|
+
"@tiptap/extension-table": "^3.0.0",
|
|
172
|
+
"@tiptap/extension-text": "^3.0.0",
|
|
173
|
+
"@tiptap/extension-text-align": "^3.0.0",
|
|
174
|
+
"@tiptap/extension-text-style": "^3.0.0",
|
|
175
|
+
"@tiptap/extension-underline": "^3.0.0",
|
|
176
|
+
"@tiptap/extensions": "^3.0.0",
|
|
177
|
+
"@tiptap/pm": "^3.0.0",
|
|
178
|
+
"@tiptap/react": "^3.0.0",
|
|
179
|
+
"@tiptap/starter-kit": "^3.0.0",
|
|
180
|
+
"@tiptap/suggestion": "^3.0.0",
|
|
181
|
+
"react": "^18.2.0",
|
|
182
|
+
"react-dom": "^18.2.0"
|
|
183
|
+
},
|
|
182
184
|
"devDependencies": {
|
|
183
185
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
184
186
|
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
@@ -191,6 +193,30 @@
|
|
|
191
193
|
"@testing-library/jest-dom": "^5.17.0",
|
|
192
194
|
"@testing-library/react": "^13.4.0",
|
|
193
195
|
"@testing-library/user-event": "^13.5.0",
|
|
196
|
+
"@tiptap/core": "^3.22.5",
|
|
197
|
+
"@tiptap/extension-bold": "^3.22.5",
|
|
198
|
+
"@tiptap/extension-color": "^3.22.5",
|
|
199
|
+
"@tiptap/extension-document": "^3.22.5",
|
|
200
|
+
"@tiptap/extension-file-handler": "^3.22.5",
|
|
201
|
+
"@tiptap/extension-hard-break": "^3.22.5",
|
|
202
|
+
"@tiptap/extension-heading": "^3.22.5",
|
|
203
|
+
"@tiptap/extension-highlight": "^3.22.5",
|
|
204
|
+
"@tiptap/extension-image": "^3.22.5",
|
|
205
|
+
"@tiptap/extension-italic": "^3.22.5",
|
|
206
|
+
"@tiptap/extension-link": "^3.22.5",
|
|
207
|
+
"@tiptap/extension-list": "^3.22.5",
|
|
208
|
+
"@tiptap/extension-mention": "^3.22.5",
|
|
209
|
+
"@tiptap/extension-paragraph": "^3.22.5",
|
|
210
|
+
"@tiptap/extension-table": "^3.22.5",
|
|
211
|
+
"@tiptap/extension-text": "^3.22.5",
|
|
212
|
+
"@tiptap/extension-text-align": "^3.22.5",
|
|
213
|
+
"@tiptap/extension-text-style": "^3.22.5",
|
|
214
|
+
"@tiptap/extension-underline": "^3.22.5",
|
|
215
|
+
"@tiptap/extensions": "^3.22.5",
|
|
216
|
+
"@tiptap/pm": "^3.22.5",
|
|
217
|
+
"@tiptap/react": "^3.22.5",
|
|
218
|
+
"@tiptap/starter-kit": "^3.22.5",
|
|
219
|
+
"@tiptap/suggestion": "^3.22.5",
|
|
194
220
|
"@types/jest": "^27.5.2",
|
|
195
221
|
"@types/js-cookie": "^3.0.6",
|
|
196
222
|
"@types/lodash": "^4.14.202",
|
|
@@ -224,6 +250,8 @@
|
|
|
224
250
|
"lint-staged": "^15.2.0",
|
|
225
251
|
"prettier": "^3.3.3",
|
|
226
252
|
"prettier-plugin-tailwindcss": "^0.6.6",
|
|
253
|
+
"react": "^18.2.0",
|
|
254
|
+
"react-dom": "^18.2.0",
|
|
227
255
|
"rollup-plugin-visualizer": "6.0.5",
|
|
228
256
|
"source-map-explorer": "^2.5.3",
|
|
229
257
|
"tailwindcss": "^3.4.1",
|
|
@@ -232,6 +260,7 @@
|
|
|
232
260
|
"vite": "^6.1.0",
|
|
233
261
|
"vite-plugin-checker": "^0.9.0",
|
|
234
262
|
"vite-plugin-compression": "^0.5.1",
|
|
263
|
+
"vite-plugin-dts": "^5.0.0",
|
|
235
264
|
"vite-plugin-svgr": "^4.3.0",
|
|
236
265
|
"vite-tsconfig-paths": "^5.1.4",
|
|
237
266
|
"vitest": "^3.0.7"
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { type ShortcutHandler, isListParent, isTextNode } from './indent.types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WHY: When the cursor is at the very start of an indented text block,
|
|
5
|
-
* Backspace should visually un-indent the line rather than delete backwards.
|
|
6
|
-
* This mirrors how Google Docs treats Backspace at the start of an indented line.
|
|
7
|
-
*/
|
|
8
|
-
export const handleBackspaceOutdentAtLineStart: ShortcutHandler = ({
|
|
9
|
-
editor,
|
|
10
|
-
$from,
|
|
11
|
-
currentNode,
|
|
12
|
-
}) => {
|
|
13
|
-
const isAtStart = $from.pos === $from.start();
|
|
14
|
-
const hasIndent = currentNode.attrs.indent > 0;
|
|
15
|
-
const isIndentedTextNode = isTextNode(currentNode.type.name) && hasIndent;
|
|
16
|
-
|
|
17
|
-
if (isIndentedTextNode && isAtStart) {
|
|
18
|
-
return editor.commands.outdent();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return false;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* WHY: An empty indented line has no meaningful content to merge with the previous block.
|
|
26
|
-
* Deleting it entirely (rather than joining it) keeps the document structure clean.
|
|
27
|
-
*/
|
|
28
|
-
export const handleBackspaceDeleteEmptyIndentedLine: ShortcutHandler = ({
|
|
29
|
-
state,
|
|
30
|
-
view,
|
|
31
|
-
$from,
|
|
32
|
-
currentNode,
|
|
33
|
-
}) => {
|
|
34
|
-
const isEmpty = currentNode.content.size === 0;
|
|
35
|
-
const hasIndent = currentNode.attrs.indent > 0;
|
|
36
|
-
const isEmptyIndentedTextNode = isTextNode(currentNode.type.name) && hasIndent && isEmpty;
|
|
37
|
-
|
|
38
|
-
if (!isEmptyIndentedTextNode) return false;
|
|
39
|
-
|
|
40
|
-
const nodePos = $from.before($from.depth);
|
|
41
|
-
const tr = state.tr;
|
|
42
|
-
tr.delete(nodePos, nodePos + currentNode.nodeSize);
|
|
43
|
-
view.dispatch(tr);
|
|
44
|
-
return true;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* WHY: Backspace on an empty unindented paragraph right after a list would normally
|
|
49
|
-
* cause ProseMirror to merge the paragraph into the last list item, which is confusing.
|
|
50
|
-
* We delete the empty paragraph outright to prevent that unwanted merge.
|
|
51
|
-
*/
|
|
52
|
-
export const handleBackspaceDeleteEmptyParagraphAfterList: ShortcutHandler = ({
|
|
53
|
-
state,
|
|
54
|
-
view,
|
|
55
|
-
$from,
|
|
56
|
-
currentNode,
|
|
57
|
-
}) => {
|
|
58
|
-
const isAtStart = $from.pos === $from.start();
|
|
59
|
-
const isEmpty = currentNode.content.size === 0;
|
|
60
|
-
const hasIndent = currentNode.attrs.indent > 0;
|
|
61
|
-
|
|
62
|
-
const nodePos = $from.before($from.depth);
|
|
63
|
-
const prevNode = state.doc.resolve(nodePos).nodeBefore;
|
|
64
|
-
const prevNodeIsList = prevNode != null && isListParent(prevNode.type.name);
|
|
65
|
-
|
|
66
|
-
const isEmptyUnindentedTextNode =
|
|
67
|
-
isTextNode(currentNode.type.name) && !hasIndent && isEmpty && isAtStart;
|
|
68
|
-
|
|
69
|
-
if (isEmptyUnindentedTextNode && prevNodeIsList) {
|
|
70
|
-
const tr = state.tr;
|
|
71
|
-
tr.delete(nodePos, nodePos + currentNode.nodeSize);
|
|
72
|
-
view.dispatch(tr);
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return false;
|
|
77
|
-
};
|