@ni/ok-components 0.3.7 → 0.3.8
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.
|
@@ -6395,14 +6395,14 @@ return ux.fromReplace(t,this.pos,this.pos+1,new iw(Xy.from(n),0,e.isLeaf?0:1))}i
|
|
|
6395
6395
|
return e&&this.mark.isInSet(e.marks)?new gx(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1)
|
|
6396
6396
|
return e.deletedAfter?null:new vx(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON")
|
|
6397
6397
|
return new vx(e.pos,t.markFromJSON(e.mark))}}hx.jsonID("removeNodeMark",vx)
|
|
6398
|
-
class bx extends hx{constructor(t,e,n,i=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=i}apply(t){return this.structure&&wx(t,this.from,this.to)?ux.fail("Structure replace would overwrite content"):ux.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new lx([this.from,this.to-this.from,this.slice.size])}invert(t){return new bx(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.
|
|
6399
|
-
return
|
|
6398
|
+
class bx extends hx{constructor(t,e,n,i=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=i}apply(t){return this.structure&&wx(t,this.from,this.to)?ux.fail("Structure replace would overwrite content"):ux.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new lx([this.from,this.to-this.from,this.slice.size])}invert(t){return new bx(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.to,-1),n=this.from==this.to&&bx.MAP_BIAS<0?e:t.mapResult(this.from,1)
|
|
6399
|
+
return n.deletedAcross&&e.deletedAcross?null:new bx(n.pos,Math.max(n.pos,e.pos),this.slice,this.structure)}merge(t){if(!(t instanceof bx)||t.structure||this.structure)return null
|
|
6400
6400
|
if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null
|
|
6401
6401
|
{let e=this.slice.size+t.slice.size==0?iw.empty:new iw(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd)
|
|
6402
6402
|
return new bx(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?iw.empty:new iw(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd)
|
|
6403
6403
|
return new bx(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to}
|
|
6404
6404
|
return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON")
|
|
6405
|
-
return new bx(e.from,e.to,iw.fromJSON(t,e.slice),!!e.structure)}}hx.jsonID("replace",bx)
|
|
6405
|
+
return new bx(e.from,e.to,iw.fromJSON(t,e.slice),!!e.structure)}}bx.MAP_BIAS=1,hx.jsonID("replace",bx)
|
|
6406
6406
|
class yx extends hx{constructor(t,e,n,i,o,r,s=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=i,this.slice=o,this.insert=r,this.structure=s}apply(t){if(this.structure&&(wx(t,this.from,this.gapFrom)||wx(t,this.gapTo,this.to)))return ux.fail("Structure gap-replace would overwrite content")
|
|
6407
6407
|
let e=t.slice(this.gapFrom,this.gapTo)
|
|
6408
6408
|
if(e.openStart||e.openEnd)return ux.fail("Gap is not a flat range")
|
|
@@ -6570,7 +6570,13 @@ if(i.node(t).canReplaceWith(e,e,n))return i.before(t+1)
|
|
|
6570
6570
|
if(e>0)return null}if(i.parentOffset==i.parent.content.size)for(let t=i.depth-1;t>=0;t--){let e=i.indexAfter(t)
|
|
6571
6571
|
if(i.node(t).canReplaceWith(e,e,n))return i.after(t+1)
|
|
6572
6572
|
if(e<i.node(t).childCount)return null}return null}(t.doc,e,i.type)
|
|
6573
|
-
null!=o&&(e=n=o)}t.replaceRange(e,n,new iw(Xy.from(i),0,0))}(this,t,e,n),this}deleteRange(t,e){return function(t,e,n){let i=t.doc.resolve(e),o=t.doc.resolve(n)
|
|
6573
|
+
null!=o&&(e=n=o)}t.replaceRange(e,n,new iw(Xy.from(i),0,0))}(this,t,e,n),this}deleteRange(t,e){return function(t,e,n){let i=t.doc.resolve(e),o=t.doc.resolve(n)
|
|
6574
|
+
if(i.parent.isTextblock&&o.parent.isTextblock&&i.start()!=o.start()&&0==i.parentOffset&&0==o.parentOffset){let r=i.sharedDepth(n),s=!1
|
|
6575
|
+
for(let t=i.depth;t>r;t--)i.node(t).type.spec.isolating&&(s=!0)
|
|
6576
|
+
for(let t=o.depth;t>r;t--)o.node(t).type.spec.isolating&&(s=!0)
|
|
6577
|
+
if(!s){for(let t=i.depth;t>0&&e==i.start(t);t--)e=i.before(t)
|
|
6578
|
+
for(let t=o.depth;t>0&&n==o.start(t);t--)n=o.before(t)
|
|
6579
|
+
i=t.doc.resolve(e),o=t.doc.resolve(n)}}let r=Ux(i,o)
|
|
6574
6580
|
for(let e=0;e<r.length;e++){let n=r[e],s=e==r.length-1
|
|
6575
6581
|
if(s&&0==n||i.node(n).type.contentMatch.validEnd)return t.delete(i.start(n),o.end(n))
|
|
6576
6582
|
if(n>0&&(s||i.node(n-1).canReplace(i.index(n-1),o.indexAfter(n-1))))return t.delete(i.before(n),o.after(n))}for(let r=1;r<=i.depth&&r<=o.depth;r++)if(e-i.start(r)==i.depth-r&&n>i.end(r)&&o.end(r)-n!=o.depth-r&&i.start(r-1)==o.start(r-1)&&i.node(r-1).canReplace(i.index(r-1),o.index(r-1)))return t.delete(i.before(r),n)
|
|
@@ -7778,17 +7784,16 @@ if(!s||!o.canReplaceWith(r,r,s))return!1
|
|
|
7778
7784
|
if(e){let i=n.after(),o=t.tr.replaceWith(i,i,s.createAndFill())
|
|
7779
7785
|
o.setSelection(Kx.near(o.doc.resolve(i),1)),e(o.scrollIntoView())}return!0})(t,e)
|
|
7780
7786
|
function O$(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function R$(t,e,n={strict:!0}){const i=Object.keys(e)
|
|
7781
|
-
return!i.length||i.every(i=>n.strict?e[i]===t[i]:O$(e[i])?e[i].test(t[i]):e[i]===t[i])}function F$(t,e,n={}){return t.find(t=>t.type===e&&R$(Object.fromEntries(Object.keys(n).map(e=>[e,t.attrs[e]])),n))}function N$(t,e,n={}){return!!F$(t,e,n)}function L$(t,e,n){
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
if(
|
|
7785
|
-
n=
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
for(;
|
|
7789
|
-
|
|
7790
|
-
return
|
|
7791
|
-
return e.marks[t]}return t}var P$=(t,e={})=>({tr:n,state:i,dispatch:o})=>{const r=B$(t,i.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a
|
|
7787
|
+
return!i.length||i.every(i=>n.strict?e[i]===t[i]:O$(e[i])?e[i].test(t[i]):e[i]===t[i])}function F$(t,e,n={}){return t.find(t=>t.type===e&&R$(Object.fromEntries(Object.keys(n).map(e=>[e,t.attrs[e]])),n))}function N$(t,e,n={}){return!!F$(t,e,n)}function L$(t,e,n){if(!t||!e)return
|
|
7788
|
+
let i=t.parent.childAfter(t.parentOffset)
|
|
7789
|
+
if(i.node&&i.node.marks.some(t=>t.type===e)||(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(t=>t.type===e))return
|
|
7790
|
+
if(!n){const t=i.node.marks.find(t=>t.type===e)
|
|
7791
|
+
t&&(n=t.attrs)}if(!F$([...i.node.marks],e,n))return
|
|
7792
|
+
let o=i.index,r=t.start()+i.offset,s=o+1,a=r+i.node.nodeSize
|
|
7793
|
+
for(;o>0&&N$([...t.parent.child(o-1).marks],e,n);)o-=1,r-=t.parent.child(o).nodeSize
|
|
7794
|
+
for(;s<t.parent.childCount&&N$([...t.parent.child(s).marks],e,n);)a+=t.parent.child(s).nodeSize,s+=1
|
|
7795
|
+
return{from:r,to:a}}function B$(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`)
|
|
7796
|
+
return e.marks[t]}return t}var P$=(t,e)=>({tr:n,state:i,dispatch:o})=>{const r=B$(t,i.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a
|
|
7792
7797
|
if(o){const t=L$(l,r,e)
|
|
7793
7798
|
if(t&&t.from<=c&&t.to>=d){const e=Qx.create(s,t.from,t.to)
|
|
7794
7799
|
n.setSelection(e)}}return!0},z$=t=>e=>{const n="function"==typeof t?t(e):t
|
|
@@ -8216,7 +8221,7 @@ ZM(s).forEach(e=>{s.mapping.mapResult(e.oldRange.from).deletedAfter&&s.mapping.m
|
|
|
8216
8221
|
this.editor.emit("delete",{type:"node",node:n,from:i,to:o,newFrom:s.mapping.map(i),newTo:s.mapping.map(o),deletedRange:e.oldRange,newRange:e.newRange,partial:!r,editor:this.editor,transaction:t,combinedTransform:s})})})
|
|
8217
8222
|
const a=s.mapping
|
|
8218
8223
|
s.steps.forEach((e,n)=>{var i,o
|
|
8219
|
-
if(e instanceof mx){const r=a.slice(n).map(e.from,-1),l=a.slice(n).map(e.to),c=a.invert().map(r,-1),d=a.invert().map(l),h=null==(i=s.doc.nodeAt(r-1))?void 0:i.marks.some(t=>t.eq(e.mark)),u=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(t=>t.eq(e.mark))
|
|
8224
|
+
if(e instanceof mx){const r=a.slice(n).map(e.from,-1),l=a.slice(n).map(e.to),c=a.invert().map(r,-1),d=a.invert().map(l),h=r>0&&(null==(i=s.doc.nodeAt(r-1))?void 0:i.marks.some(t=>t.eq(e.mark))),u=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(t=>t.eq(e.mark))
|
|
8220
8225
|
this.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:c,to:d},newRange:{from:r,to:l},partial:Boolean(u||h),editor:this.editor,transaction:t,combinedTransform:s})}})}
|
|
8221
8226
|
null==(o=null==(i=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:i.async)||o?setTimeout(r,0):r()}}),qI=zI.create({name:"drop",addProseMirrorPlugins(){return[new fC({key:new vC("tiptapDrop"),props:{handleDrop:(t,e,n,i)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:i})}}})]}}),jI=zI.create({name:"editable",addProseMirrorPlugins(){return[new fC({key:new vC("editable"),props:{editable:()=>this.editor.options.editable}})]}}),WI=new vC("focusEvents"),GI=zI.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this
|
|
8222
8227
|
return[new fC({key:WI,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0
|
|
@@ -10137,34 +10142,35 @@ let w=y+g[0].length
|
|
|
10137
10142
|
return l&&d.test(f.slice(w-1,w+1))&&(g[0]+=" ",w+=1),y<a.pos&&w>=a.pos?{range:{from:y,to:w},query:g[0].slice(n.length),text:g[0]}:null}zI.create({name:"listKit",addExtensions(){const t=[]
|
|
10138
10143
|
return!1!==this.options.bulletList&&t.push(yF.configure(this.options.bulletList)),!1!==this.options.listItem&&t.push(wF.configure(this.options.listItem)),!1!==this.options.listKeymap&&t.push(TF.configure(this.options.listKeymap)),!1!==this.options.orderedList&&t.push(LF.configure(this.options.orderedList)),!1!==this.options.taskItem&&t.push(PF.configure(this.options.taskItem)),!1!==this.options.taskList&&t.push(zF.configure(this.options.taskList)),t}})
|
|
10139
10144
|
var HF=new vC("suggestion")
|
|
10140
|
-
function UF({pluginKey:t=HF,editor:e,char:n="@",allowSpaces:i=!1,allowToIncludeChar:o=!1,allowedPrefixes:r=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:h=()=>null,items:u=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:m=VF,shouldShow:g}){let
|
|
10141
|
-
const
|
|
10142
|
-
try{return new DOMRect(s,i,o-s,r-i)}catch{return null}},
|
|
10143
|
-
return(null==r?void 0:r.getBoundingClientRect())||null}:
|
|
10144
|
-
const
|
|
10145
|
-
const d=null==(i=this.key)?void 0:i.getState(n),p=null==(o=this.key)?void 0:o.getState(t.state),f=d.active&&p.active&&d.range.from!==p.range.from,m=!d.active&&p.active,g=d.active&&!p.active,
|
|
10146
|
-
if(!x&&!
|
|
10147
|
-
const S=k&&!
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
if(
|
|
10151
|
-
if(
|
|
10145
|
+
function UF({pluginKey:t=HF,editor:e,char:n="@",allowSpaces:i=!1,allowToIncludeChar:o=!1,allowedPrefixes:r=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:h=()=>null,items:u=()=>[],render:p=()=>({}),allow:f=()=>!0,findSuggestionMatch:m=VF,shouldShow:g,shouldResetDismissed:v}){let b
|
|
10146
|
+
const y=null==p?void 0:p(),w=i&&!o,x=()=>{const t=e.state.selection.$anchor.pos,n=e.view.coordsAtPos(t),{top:i,right:o,bottom:r,left:s}=n
|
|
10147
|
+
try{return new DOMRect(s,i,o-s,r-i)}catch{return null}},C=(n,i)=>i?()=>{const i=t.getState(e.state),o=null==i?void 0:i.decorationId,r=n.dom.querySelector(`[data-decoration-id="${o}"]`)
|
|
10148
|
+
return(null==r?void 0:r.getBoundingClientRect())||null}:x
|
|
10149
|
+
const k=new fC({key:t,view(){return{update:async(t,n)=>{var i,o,r,s,a,l,c
|
|
10150
|
+
const d=null==(i=this.key)?void 0:i.getState(n),p=null==(o=this.key)?void 0:o.getState(t.state),f=d.active&&p.active&&d.range.from!==p.range.from,m=!d.active&&p.active,g=d.active&&!p.active,v=!m&&!g&&d.query!==p.query,w=m||f&&v,x=v||f,k=g||f&&v
|
|
10151
|
+
if(!w&&!x&&!k)return
|
|
10152
|
+
const S=k&&!w?d:p,_=t.dom.querySelector(`[data-decoration-id="${S.decorationId}"]`)
|
|
10153
|
+
b={editor:e,range:S.range,query:S.query,text:S.text,items:[],command:t=>h({editor:e,range:S.range,props:t}),decorationNode:_,clientRect:C(t,_)},w&&(null==(r=null==y?void 0:y.onBeforeStart)||r.call(y,b)),x&&(null==(s=null==y?void 0:y.onBeforeUpdate)||s.call(y,b)),(x||w)&&(b.items=await u({editor:e,query:S.query})),k&&(null==(a=null==y?void 0:y.onExit)||a.call(y,b)),x&&(null==(l=null==y?void 0:y.onUpdate)||l.call(y,b)),w&&(null==(c=null==y?void 0:y.onStart)||c.call(y,b))},destroy:()=>{var t
|
|
10154
|
+
b&&(null==(t=null==y?void 0:y.onExit)||t.call(y,b))}}},state:{init:()=>({active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}),apply(a,l,c,d){const{isEditable:h}=e,{composing:u}=e.view,{selection:p}=a,{empty:b,from:y}=p,x={...l},C=a.getMeta(t)
|
|
10155
|
+
if(C&&C.exit)return x.active=!1,x.decorationId=null,x.range={from:0,to:0},x.query=null,x.text=null,x.dismissedRange=l.active?{...l.range}:l.dismissedRange,x
|
|
10156
|
+
if(x.composing=u,a.docChanged&&null!==x.dismissedRange&&(x.dismissedRange={from:a.mapping.map(x.dismissedRange.from),to:a.mapping.map(x.dismissedRange.to)}),h&&(b||e.view.composing)){!(y<l.range.from||y>l.range.to)||u||l.composing||(x.active=!1)
|
|
10152
10157
|
const t=m({char:n,allowSpaces:i,allowToIncludeChar:o,allowedPrefixes:r,startOfLine:s,$position:p.$from}),c=`id_${Math.floor(4294967295*Math.random())}`
|
|
10153
|
-
t&&f({editor:e,state:d,range:t.range,isActive:l.active})&&(!g||g({editor:e,range:t.range,query:t.query,text:t.text,transaction:a}))?(
|
|
10154
|
-
|
|
10155
|
-
const
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10158
|
+
t&&f({editor:e,state:d,range:t.range,isActive:l.active})&&(!g||g({editor:e,range:t.range,query:t.query,text:t.text,transaction:a}))?(null===x.dismissedRange||(({match:t,dismissedRange:n,state:i,transaction:o})=>!(null==v?void 0:v({editor:e,state:i,range:n,match:t,transaction:o,allowSpaces:w}))&&(w?t.range.from===n.from:t.range.from===n.from&&!function(t){return!!t.docChanged&&t.steps.some(t=>{const e=t.slice
|
|
10159
|
+
if(!(null==e?void 0:e.content))return!1
|
|
10160
|
+
const n=e.content.textBetween(0,e.content.size,"\n")
|
|
10161
|
+
return/\s/.test(n)})}(o)))({match:t,dismissedRange:x.dismissedRange,state:d,transaction:a})||(x.dismissedRange=null),null===x.dismissedRange?(x.active=!0,x.decorationId=l.decorationId?l.decorationId:c,x.range=t.range,x.query=t.query,x.text=t.text):x.active=!1):(t||(x.dismissedRange=null),x.active=!1)}else x.active=!1
|
|
10162
|
+
return x.active||(x.decorationId=null,x.range={from:0,to:0},x.query=null,x.text=null),x}},props:{handleKeyDown(n,i){var o,r
|
|
10163
|
+
const{active:s,range:a}=k.getState(n.state)
|
|
10164
|
+
if(!s)return!1
|
|
10165
|
+
if("Escape"===i.key||"Esc"===i.key){const r=k.getState(n.state)
|
|
10166
|
+
return null==(o=null==y?void 0:y.onKeyDown)||o.call(y,{view:n,event:i,range:r.range}),function(n,i){var o
|
|
10167
|
+
try{const i=t.getState(n.state),r=(null==i?void 0:i.decorationId)?n.dom.querySelector(`[data-decoration-id="${i.decorationId}"]`):null,s={editor:e,range:(null==i?void 0:i.range)||{from:0,to:0},query:(null==i?void 0:i.query)||null,text:(null==i?void 0:i.text)||null,items:[],command:t=>h({editor:e,range:(null==i?void 0:i.range)||{from:0,to:0},props:t}),decorationNode:r,clientRect:C(n,r)}
|
|
10168
|
+
null==(o=null==y?void 0:y.onExit)||o.call(y,s)}catch{}const r=n.state.tr.setMeta(i,{exit:!0})
|
|
10169
|
+
n.dispatch(r)}(n,t),!0}return(null==(r=null==y?void 0:y.onKeyDown)?void 0:r.call(y,{view:n,event:i,range:a}))||!1},decorations(t){const{active:e,range:n,decorationId:i,query:o}=k.getState(t)
|
|
10164
10170
|
if(!e)return null
|
|
10165
10171
|
const r=!(null==o?void 0:o.length),s=[l]
|
|
10166
10172
|
return r&&s.push(d),M_.create(t.doc,[S_.inline(n.from,n.to,{nodeName:a,class:s.join(" "),"data-decoration-id":i,"data-decoration-content":c})])}}})
|
|
10167
|
-
return
|
|
10173
|
+
return k}function qF(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>function({editor:t,overrideSuggestionOptions:e,extensionName:n,char:i="@"}){const o=new vC
|
|
10168
10174
|
return{editor:t,char:i,pluginKey:o,command:({editor:t,range:e,props:o})=>{var r,s,a
|
|
10169
10175
|
const l=t.view.state.selection.$to.nodeAfter;(null==(r=null==l?void 0:l.text)?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:n,attrs:{...o,mentionSuggestionChar:i}},{type:"text",text:" "}]).run(),null==(a=null==(s=t.view.dom.ownerDocument.defaultView)?void 0:s.getSelection())||a.collapseToEnd()},allow:({state:t,range:e})=>{const i=t.doc.resolve(e.from),o=t.schema.nodes[n]
|
|
10170
10176
|
return!!i.parent.type.contentMatch.matchType(o)},...e}}({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function jF(t,e){const n=qF(t),i=n.find(t=>t.char===e)
|
|
@@ -10186,7 +10192,7 @@ let s=new xw,a=0
|
|
|
10186
10192
|
return e.doc.nodesBetween(r-1,r,(t,e)=>{if(t.type.name===this.name)return n=!0,s=t,a=e,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return qF(this).map(UF)}}),GF=WF,ZF=" ",KF=hE.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",LM(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[]
|
|
10187
10193
|
if(1===n.length&&"image"===n[0].type)return e.parseChildren([n[0]])
|
|
10188
10194
|
const i=e.parseInline(n)
|
|
10189
|
-
return
|
|
10195
|
+
return!(1===n.length&&"text"===n[0].type&&(n[0].raw===ZF||n[0].text===ZF||" "===n[0].raw||" "===n[0].text))||1!==i.length||"text"!==i[0].type||i[0].text!==ZF&&" "!==i[0].text?e.createNode("paragraph",void 0,i):e.createNode("paragraph",void 0,[])},renderMarkdown:(t,e,n)=>{var i,o
|
|
10190
10196
|
if(!t)return""
|
|
10191
10197
|
const r=Array.isArray(t.content)?t.content:[]
|
|
10192
10198
|
if(0===r.length){const t=Array.isArray(null==(i=null==n?void 0:n.previousNode)?void 0:i.content)?n.previousNode.content:[]
|
|
@@ -10372,11 +10378,12 @@ if((i||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass]
|
|
|
10372
10378
|
s&&o.push(this.options.emptyEditorClass)
|
|
10373
10379
|
const a=S_.node(n,n+e.nodeSize,{class:o.join(" "),[t]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:n,hasAnchor:i}):this.options.placeholder})
|
|
10374
10380
|
r.push(a)}return this.options.includeChildren}),M_.create(e,r)}}})]}})
|
|
10375
|
-
|
|
10376
|
-
return[new fC({key:new vC("selection"),props:{decorations:n=>n.selection.empty||t.isFocused||!t.isEditable||n.selection instanceof eC||t.view.dragging?null:M_.create(n.doc,[S_.inline(n.selection.from,n.selection.to,{class:e.className})])}})]}})
|
|
10381
|
+
zI.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:t,options:e}=this
|
|
10382
|
+
return[new fC({key:new vC("selection"),props:{decorations:n=>n.selection.empty||t.isFocused||!t.isEditable||n.selection instanceof eC||t.view.dragging?null:M_.create(n.doc,[S_.inline(n.selection.from,n.selection.to,{class:e.className})])}})]}})
|
|
10383
|
+
function EN({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(null==e?void 0:e.type)===t}zI.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var t
|
|
10377
10384
|
const e=new vC(this.name),n=this.options.node||(null==(t=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:t.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(n).includes(t.name))
|
|
10378
10385
|
return[new fC({key:e,appendTransaction:(t,i,o)=>{const{doc:r,tr:s,schema:a}=o,l=e.getState(o),c=r.content.size,d=a.nodes[n]
|
|
10379
|
-
if(l)return s.insert(c,d.create())},state:{init:(t,e)=>!EN({node:e.tr.doc.lastChild,types:i}),apply:(t,e)=>{if(!t.docChanged)return e
|
|
10386
|
+
if(!t.some(t=>t.getMeta("skipTrailingNode"))&&l)return s.insert(c,d.create())},state:{init:(t,e)=>!EN({node:e.tr.doc.lastChild,types:i}),apply:(t,e)=>{if(!t.docChanged)return e
|
|
10380
10387
|
if(t.getMeta("__uniqueIDTransaction"))return e
|
|
10381
10388
|
return!EN({node:t.doc.lastChild,types:i})}}})]}})
|
|
10382
10389
|
var AN=zI.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:e})=>_N(t,e),redo:()=>({state:t,dispatch:e})=>$N(t,e)}),addProseMirrorPlugins(){return[kN(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}})
|