reactjs-tiptap-editor 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/RichTextEditor-B4ASZID5.cjs +138 -0
- package/lib/{RichTextEditor-S3oDQ7DG.js → RichTextEditor-yL5SRS_H.js} +675 -684
- package/lib/extension-bundle.cjs +2 -2
- package/lib/extension-bundle.d.cts +42 -42
- package/lib/extension-bundle.d.ts +42 -42
- package/lib/extension-bundle.js +578 -601
- package/lib/{index-BEUeIQfa.js → index-BUxFK1y_.js} +1 -1
- package/lib/{index-CvbViqY1.cjs → index-DGpT32KX.cjs} +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +42 -42
- package/lib/index.d.ts +42 -42
- package/lib/index.js +2 -2
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +42 -42
- package/lib/locale-bundle.d.ts +42 -42
- package/lib/locale-bundle.js +1 -1
- package/lib/{tiptap-CYz8BQhm.cjs → tiptap-BhYF9Ndj.cjs} +1 -1
- package/lib/{tiptap-B9VypLMv.js → tiptap-DXj1s_xP.js} +1 -1
- package/lib/vendor-DIvoV5tx.js +41663 -0
- package/lib/vendor-Dp07eU0H.cjs +266 -0
- package/package.json +1 -5
- package/lib/RichTextEditor-BNLeCZNj.cjs +0 -138
- package/lib/vendor-BeclCw8p.js +0 -60431
- package/lib/vendor-CwNzD6m_.cjs +0 -457
package/lib/locale-bundle.d.cts
CHANGED
|
@@ -918,6 +918,16 @@ declare module '@tiptap/core' {
|
|
|
918
918
|
}
|
|
919
919
|
|
|
920
920
|
|
|
921
|
+
declare module '@tiptap/core' {
|
|
922
|
+
interface Commands<ReturnType> {
|
|
923
|
+
lineHeight: {
|
|
924
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
925
|
+
unsetLineHeight: () => ReturnType;
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
|
|
921
931
|
declare module '@tiptap/core' {
|
|
922
932
|
interface Commands<ReturnType> {
|
|
923
933
|
indent: {
|
|
@@ -973,21 +983,6 @@ declare module '@tiptap/core' {
|
|
|
973
983
|
}
|
|
974
984
|
|
|
975
985
|
|
|
976
|
-
declare module '@tiptap/core' {
|
|
977
|
-
interface Commands<ReturnType> {
|
|
978
|
-
iframe: {
|
|
979
|
-
/**
|
|
980
|
-
* Add an iframe
|
|
981
|
-
*/
|
|
982
|
-
setIframe: (options: {
|
|
983
|
-
src: string;
|
|
984
|
-
service: string;
|
|
985
|
-
}) => ReturnType;
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
|
|
991
986
|
declare module '@tiptap/core' {
|
|
992
987
|
interface Commands<ReturnType> {
|
|
993
988
|
columns: {
|
|
@@ -1004,10 +999,13 @@ declare module '@tiptap/core' {
|
|
|
1004
999
|
|
|
1005
1000
|
declare module '@tiptap/core' {
|
|
1006
1001
|
interface Commands<ReturnType> {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1002
|
+
iframe: {
|
|
1003
|
+
/**
|
|
1004
|
+
* Add an iframe
|
|
1005
|
+
*/
|
|
1006
|
+
setIframe: (options: {
|
|
1007
|
+
src: string;
|
|
1008
|
+
service: string;
|
|
1011
1009
|
}) => ReturnType;
|
|
1012
1010
|
};
|
|
1013
1011
|
}
|
|
@@ -1016,9 +1014,11 @@ declare module '@tiptap/core' {
|
|
|
1016
1014
|
|
|
1017
1015
|
declare module '@tiptap/core' {
|
|
1018
1016
|
interface Commands<ReturnType> {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1017
|
+
emoji: {
|
|
1018
|
+
setEmoji: (emoji: {
|
|
1019
|
+
name: string;
|
|
1020
|
+
emoji: string;
|
|
1021
|
+
}) => ReturnType;
|
|
1022
1022
|
};
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
@@ -1076,6 +1076,26 @@ declare module '@tiptap/core' {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
|
|
1078
1078
|
|
|
1079
|
+
declare module '@tiptap/core' {
|
|
1080
|
+
interface Commands<ReturnType> {
|
|
1081
|
+
imageGifUpload: {
|
|
1082
|
+
/**
|
|
1083
|
+
* Add an image gif
|
|
1084
|
+
*/
|
|
1085
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
1086
|
+
/**
|
|
1087
|
+
* Update an image gif
|
|
1088
|
+
*/
|
|
1089
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
1090
|
+
/**
|
|
1091
|
+
* Set image alignment
|
|
1092
|
+
*/
|
|
1093
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
|
|
1079
1099
|
declare module '@tiptap/core' {
|
|
1080
1100
|
interface Commands<ReturnType> {
|
|
1081
1101
|
attachment: {
|
|
@@ -1108,23 +1128,3 @@ declare module '@tiptap/core' {
|
|
|
1108
1128
|
};
|
|
1109
1129
|
}
|
|
1110
1130
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
declare module '@tiptap/core' {
|
|
1114
|
-
interface Commands<ReturnType> {
|
|
1115
|
-
imageGifUpload: {
|
|
1116
|
-
/**
|
|
1117
|
-
* Add an image gif
|
|
1118
|
-
*/
|
|
1119
|
-
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
1120
|
-
/**
|
|
1121
|
-
* Update an image gif
|
|
1122
|
-
*/
|
|
1123
|
-
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
1124
|
-
/**
|
|
1125
|
-
* Set image alignment
|
|
1126
|
-
*/
|
|
1127
|
-
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
1128
|
-
};
|
|
1129
|
-
}
|
|
1130
|
-
}
|
package/lib/locale-bundle.d.ts
CHANGED
|
@@ -918,6 +918,16 @@ declare module '@tiptap/core' {
|
|
|
918
918
|
}
|
|
919
919
|
|
|
920
920
|
|
|
921
|
+
declare module '@tiptap/core' {
|
|
922
|
+
interface Commands<ReturnType> {
|
|
923
|
+
lineHeight: {
|
|
924
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
925
|
+
unsetLineHeight: () => ReturnType;
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
|
|
921
931
|
declare module '@tiptap/core' {
|
|
922
932
|
interface Commands<ReturnType> {
|
|
923
933
|
indent: {
|
|
@@ -973,21 +983,6 @@ declare module '@tiptap/core' {
|
|
|
973
983
|
}
|
|
974
984
|
|
|
975
985
|
|
|
976
|
-
declare module '@tiptap/core' {
|
|
977
|
-
interface Commands<ReturnType> {
|
|
978
|
-
iframe: {
|
|
979
|
-
/**
|
|
980
|
-
* Add an iframe
|
|
981
|
-
*/
|
|
982
|
-
setIframe: (options: {
|
|
983
|
-
src: string;
|
|
984
|
-
service: string;
|
|
985
|
-
}) => ReturnType;
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
|
|
991
986
|
declare module '@tiptap/core' {
|
|
992
987
|
interface Commands<ReturnType> {
|
|
993
988
|
columns: {
|
|
@@ -1004,10 +999,13 @@ declare module '@tiptap/core' {
|
|
|
1004
999
|
|
|
1005
1000
|
declare module '@tiptap/core' {
|
|
1006
1001
|
interface Commands<ReturnType> {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1002
|
+
iframe: {
|
|
1003
|
+
/**
|
|
1004
|
+
* Add an iframe
|
|
1005
|
+
*/
|
|
1006
|
+
setIframe: (options: {
|
|
1007
|
+
src: string;
|
|
1008
|
+
service: string;
|
|
1011
1009
|
}) => ReturnType;
|
|
1012
1010
|
};
|
|
1013
1011
|
}
|
|
@@ -1016,9 +1014,11 @@ declare module '@tiptap/core' {
|
|
|
1016
1014
|
|
|
1017
1015
|
declare module '@tiptap/core' {
|
|
1018
1016
|
interface Commands<ReturnType> {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1017
|
+
emoji: {
|
|
1018
|
+
setEmoji: (emoji: {
|
|
1019
|
+
name: string;
|
|
1020
|
+
emoji: string;
|
|
1021
|
+
}) => ReturnType;
|
|
1022
1022
|
};
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
@@ -1076,6 +1076,26 @@ declare module '@tiptap/core' {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
|
|
1078
1078
|
|
|
1079
|
+
declare module '@tiptap/core' {
|
|
1080
|
+
interface Commands<ReturnType> {
|
|
1081
|
+
imageGifUpload: {
|
|
1082
|
+
/**
|
|
1083
|
+
* Add an image gif
|
|
1084
|
+
*/
|
|
1085
|
+
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
1086
|
+
/**
|
|
1087
|
+
* Update an image gif
|
|
1088
|
+
*/
|
|
1089
|
+
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
1090
|
+
/**
|
|
1091
|
+
* Set image alignment
|
|
1092
|
+
*/
|
|
1093
|
+
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
|
|
1079
1099
|
declare module '@tiptap/core' {
|
|
1080
1100
|
interface Commands<ReturnType> {
|
|
1081
1101
|
attachment: {
|
|
@@ -1108,23 +1128,3 @@ declare module '@tiptap/core' {
|
|
|
1108
1128
|
};
|
|
1109
1129
|
}
|
|
1110
1130
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
declare module '@tiptap/core' {
|
|
1114
|
-
interface Commands<ReturnType> {
|
|
1115
|
-
imageGifUpload: {
|
|
1116
|
-
/**
|
|
1117
|
-
* Add an image gif
|
|
1118
|
-
*/
|
|
1119
|
-
setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
1120
|
-
/**
|
|
1121
|
-
* Update an image gif
|
|
1122
|
-
*/
|
|
1123
|
-
updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
|
|
1124
|
-
/**
|
|
1125
|
-
* Set image alignment
|
|
1126
|
-
*/
|
|
1127
|
-
setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
|
|
1128
|
-
};
|
|
1129
|
-
}
|
|
1130
|
-
}
|
package/lib/locale-bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var We=Object.defineProperty;var Ke=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var et=(e,t,n)=>Ke(e,typeof t!="symbol"?t+"":t,n);const ye=require("tippy.js"),g=require("./vendor-
|
|
1
|
+
"use strict";var We=Object.defineProperty;var Ke=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var et=(e,t,n)=>Ke(e,typeof t!="symbol"?t+"":t,n);const ye=require("tippy.js"),g=require("./vendor-Dp07eU0H.cjs"),x=require("react"),ve=require("react-dom");function pt(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}class ht{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:r}=this,{view:o}=n,{tr:s}=r,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>{const d=c(...u)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:r,editor:o,state:s}=this,{view:i}=o,a=[],c=!!t,l=t||s.tr,u=()=>(!c&&n&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),a.every(p=>p===!0)),d={...Object.fromEntries(Object.entries(r).map(([p,h])=>[p,(...f)=>{const y=this.buildProps(l,n),v=h(...f)(y);return a.push(v),d}])),run:u};return d}createCan(t){const{rawCommands:n,state:r}=this,o=!1,s=t||r.tr,i=this.buildProps(s,o);return{...Object.fromEntries(Object.entries(n).map(([c,l])=>[c,(...u)=>l(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,o)}}buildProps(t,n=!0){const{rawCommands:r,editor:o,state:s}=this,{view:i}=o,a={tr:t,editor:o,view:i,state:pt({state:s,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([c,l])=>[c,(...u)=>l(...u)(a)]))}};return a}}class Ue{constructor(){this.callbacks={}}on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),this}emit(t,...n){const r=this.callbacks[t];return r&&r.forEach(o=>o.apply(this,n)),this}off(t,n){const r=this.callbacks[t];return r&&(n?this.callbacks[t]=r.filter(o=>o!==n):delete this.callbacks[t]),this}once(t,n){const r=(...o)=>{this.off(t,r),n.apply(this,o)};return this.on(t,r)}removeAllListeners(){this.callbacks={}}}function w(e,t,n){return e.config[t]===void 0&&e.parent?w(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?w(e.parent,t,n):null}):e.config[t]}function ft(e){const t=e.filter(o=>o.type==="extension"),n=e.filter(o=>o.type==="node"),r=e.filter(o=>o.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function be(e){const t=[],{nodeExtensions:n,markExtensions:r}=ft(e),o=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage,extensions:o},c=w(i,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([p,h])=>{t.push({type:d,name:p,attribute:{...s,...h}})})})})}),o.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage},c=w(i,"addAttributes",a);if(!c)return;const l=c();Object.entries(l).forEach(([u,d])=>{const p={...s,...d};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,t.push({type:i.name,name:u,attribute:p})})}),t}function _(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function A(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const a=s?String(s).split(" "):[],c=r[o]?r[o].split(" "):[],l=a.filter(u=>!c.includes(u));r[o]=[...c,...l].join(" ")}else if(o==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],l=new Map;c.forEach(u=>{const[d,p]=u.split(":").map(h=>h.trim());l.set(d,p)}),a.forEach(u=>{const[d,p]=u.split(":").map(h=>h.trim());l.set(d,p)}),r[o]=Array.from(l.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[o]=s}),r},{})}function ct(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>A(n,r),{})}function Me(e){return typeof e=="function"}function T(e,t=void 0,...n){return Me(e)?t?e.bind(t)(...n):e(...n):e}function qe(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Ge(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function Yt(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const o=t.reduce((s,i)=>{const a=i.attribute.parseHTML?i.attribute.parseHTML(n):Ge(n.getAttribute(i.name));return a==null?s:{...s,[i.name]:a}},{});return{...r,...o}}}}function Xt(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&qe(n)?!1:n!=null))}function Je(e,t){var n;const r=be(e),{nodeExtensions:o,markExtensions:s}=ft(e),i=(n=o.find(l=>w(l,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(o.map(l=>{const u=r.filter(v=>v.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:t},p=e.reduce((v,S)=>{const M=w(S,"extendNodeSchema",d);return{...v,...M?M(l):{}}},{}),h=Xt({...p,content:T(w(l,"content",d)),marks:T(w(l,"marks",d)),group:T(w(l,"group",d)),inline:T(w(l,"inline",d)),atom:T(w(l,"atom",d)),selectable:T(w(l,"selectable",d)),draggable:T(w(l,"draggable",d)),code:T(w(l,"code",d)),whitespace:T(w(l,"whitespace",d)),linebreakReplacement:T(w(l,"linebreakReplacement",d)),defining:T(w(l,"defining",d)),isolating:T(w(l,"isolating",d)),attrs:Object.fromEntries(u.map(v=>{var S;return[v.name,{default:(S=v==null?void 0:v.attribute)===null||S===void 0?void 0:S.default}]}))}),m=T(w(l,"parseHTML",d));m&&(h.parseDOM=m.map(v=>Yt(v,u)));const f=w(l,"renderHTML",d);f&&(h.toDOM=v=>f({node:v,HTMLAttributes:ct(v,u)}));const y=w(l,"renderText",d);return y&&(h.toText=y),[l.name,h]})),c=Object.fromEntries(s.map(l=>{const u=r.filter(y=>y.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:t},p=e.reduce((y,v)=>{const S=w(v,"extendMarkSchema",d);return{...y,...S?S(l):{}}},{}),h=Xt({...p,inclusive:T(w(l,"inclusive",d)),excludes:T(w(l,"excludes",d)),group:T(w(l,"group",d)),spanning:T(w(l,"spanning",d)),code:T(w(l,"code",d)),attrs:Object.fromEntries(u.map(y=>{var v;return[y.name,{default:(v=y==null?void 0:y.attribute)===null||v===void 0?void 0:v.default}]}))}),m=T(w(l,"parseHTML",d));m&&(h.parseDOM=m.map(y=>Yt(y,u)));const f=w(l,"renderHTML",d);return f&&(h.toDOM=y=>f({mark:y,HTMLAttributes:ct(y,u)})),[l.name,h]}));return new g.Schema({topNode:i,nodes:a,marks:c})}function Tt(e,t){return t.nodes[e]||t.marks[e]||null}function Qt(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function Ft(e,t){const n=g.DOMSerializer.fromSchema(t).serializeFragment(e),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}const Ye=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(o,s,i,a)=>{var c,l;const u=((l=(c=o.type.spec).toText)===null||l===void 0?void 0:l.call(c,{node:o,pos:s,parent:i,index:a}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-s))}),n};function zt(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class mt{constructor(t){this.find=t.find,this.handler=t.handler}}const Xe=(e,t)=>{if(zt(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function nt(e){var t;const{editor:n,from:r,to:o,text:s,rules:i,plugin:a}=e,{view:c}=n;if(c.composing)return!1;const l=c.state.doc.resolve(r);if(l.parent.type.spec.code||!((t=l.nodeBefore||l.nodeAfter)===null||t===void 0)&&t.marks.find(p=>p.type.spec.code))return!1;let u=!1;const d=Ye(l)+s;return i.forEach(p=>{if(u)return;const h=Xe(d,p.find);if(!h)return;const m=c.state.tr,f=pt({state:c.state,transaction:m}),y={from:r-(h[0].length-s.length),to:o},{commands:v,chain:S,can:M}=new ht({editor:n,state:f});p.handler({state:f,range:y,match:h,commands:v,chain:S,can:M})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:o,text:s}),c.dispatch(m),u=!0)}),u}function Qe(e){const{editor:t,rules:n}=e,r=new g.Plugin({state:{init(){return null},apply(o,s,i){const a=o.getMeta(r);if(a)return a;const c=o.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Ft(g.Fragment.from(u),i.schema);const{from:d}=c,p=d+u.length;nt({editor:t,from:d,to:p,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,i,a){return nt({editor:t,from:s,to:i,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&nt({editor:t,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:i}=o.state.selection;return i?nt({editor:t,from:i.pos,to:i.pos,text:`
|
|
2
2
|
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Ze(e){return Object.prototype.toString.call(e).slice(8,-1)}function rt(e){return Ze(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function gt(e,t){const n={...e};return rt(e)&&rt(t)&&Object.keys(t).forEach(r=>{rt(t[r])&&rt(e[r])?n[r]=gt(e[r],t[r]):n[r]=t[r]}),n}class N{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=T(w(this,"addOptions",{name:this.name}))),this.storage=T(w(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new N(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>gt(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new N(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=T(w(n,"addOptions",{name:n.name})),n.storage=T(w(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){const i=o.marks();if(!!!i.find(l=>(l==null?void 0:l.type.name)===n.name))return!1;const c=i.find(l=>(l==null?void 0:l.type.name)===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",o.pos),t.view.dispatch(r),!0}return!1}}function Se(e){return typeof e=="number"}class ke{constructor(t){this.find=t.find,this.handler=t.handler}}const tn=(e,t,n)=>{if(zt(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=e,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function en(e){const{editor:t,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:a}=e,{commands:c,chain:l,can:u}=new ht({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,m)=>{if(!h.isTextblock||h.type.spec.code)return;const f=Math.max(r,m),y=Math.min(o,m+h.content.size),v=h.textBetween(f-m,y-m,void 0,"");tn(v,s.find,i).forEach(M=>{if(M.index===void 0)return;const b=f+M.index+1,E=b+M[0].length,k={from:n.tr.mapping.map(b),to:n.tr.mapping.map(E)},C=s.handler({state:n,range:k,match:M,commands:c,chain:l,can:u,pasteEvent:i,dropEvent:a});d.push(C)})}),d.every(h=>h!==null)}let ot=null;const nn=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function rn(e){const{editor:t,rules:n}=e;let r=null,o=!1,s=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:u,from:d,to:p,rule:h,pasteEvt:m})=>{const f=u.tr,y=pt({state:u,transaction:f});if(!(!en({editor:t,state:y,from:Math.max(d-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:a})||!f.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,f}};return n.map(u=>new g.Plugin({view(d){const p=m=>{var f;r=!((f=d.dom.parentElement)===null||f===void 0)&&f.contains(m.target)?d.dom.parentElement:null,r&&(ot=t)},h=()=>{ot&&(ot=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,p)=>{if(s=r===d.dom.parentElement,a=p,!s){const h=ot;h&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,p)=>{var h;const m=(h=p.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return i=p,o=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(d,p,h)=>{const m=d[0],f=m.getMeta("uiEvent")==="paste"&&!o,y=m.getMeta("uiEvent")==="drop"&&!s,v=m.getMeta("applyPasteRules"),S=!!v;if(!f&&!y&&!S)return;if(S){let{text:E}=v;typeof E=="string"?E=E:E=Ft(g.Fragment.from(E),h.schema);const{from:k}=v,C=k+E.length,L=nn(E);return c({rule:u,state:h,from:k,to:{b:C},pasteEvt:L})}const M=p.doc.content.findDiffStart(h.doc.content),b=p.doc.content.findDiffEnd(h.doc.content);if(!(!Se(M)||!b||M===b.b))return c({rule:u,state:h,from:M,to:b,pasteEvt:i})}}))}function on(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}class Y{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=Y.resolve(t),this.schema=Je(this.extensions,n),this.setupExtensions()}static resolve(t){const n=Y.sort(Y.flatten(t)),r=on(n.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),n}static flatten(t){return t.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},o=w(n,"addExtensions",r);return o?[n,...this.flatten(o())]:n}).flat(10)}static sort(t){return t.sort((r,o)=>{const s=w(r,"priority")||100,i=w(o,"priority")||100;return s>i?-1:s<i?1:0})}get commands(){return this.extensions.reduce((t,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Tt(n.name,this.schema)},o=w(n,"addCommands",r);return o?{...t,...o()}:t},{})}get plugins(){const{editor:t}=this,n=Y.sort([...this.extensions].reverse()),r=[],o=[],s=n.map(i=>{const a={name:i.name,options:i.options,storage:i.storage,editor:t,type:Tt(i.name,this.schema)},c=[],l=w(i,"addKeyboardShortcuts",a);let u={};if(i.type==="mark"&&w(i,"exitable",a)&&(u.ArrowRight=()=>N.handleExit({editor:t,mark:i})),l){const f=Object.fromEntries(Object.entries(l()).map(([y,v])=>[y,()=>v({editor:t})]));u={...u,...f}}const d=g.keymap(u);c.push(d);const p=w(i,"addInputRules",a);Qt(i,t.options.enableInputRules)&&p&&r.push(...p());const h=w(i,"addPasteRules",a);Qt(i,t.options.enablePasteRules)&&h&&o.push(...h());const m=w(i,"addProseMirrorPlugins",a);if(m){const f=m();c.push(...f)}return c}).flat();return[Qe({editor:t,rules:r}),...rn({editor:t,rules:o}),...s]}get attributes(){return be(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=ft(this.extensions);return Object.fromEntries(n.filter(r=>!!w(r,"addNodeView")).map(r=>{const o=this.attributes.filter(c=>c.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:t,type:_(r.name,this.schema)},i=w(r,"addNodeView",s);if(!i)return[];const a=(c,l,u,d,p)=>{const h=ct(c,o);return i()({node:c,view:l,getPos:u,decorations:d,innerDecorations:p,editor:t,extension:r,HTMLAttributes:h})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(t=>{var n;this.editor.extensionStorage[t.name]=t.storage;const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Tt(t.name,this.schema)};t.type==="mark"&&(!((n=T(w(t,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const o=w(t,"onBeforeCreate",r),s=w(t,"onCreate",r),i=w(t,"onUpdate",r),a=w(t,"onSelectionUpdate",r),c=w(t,"onTransaction",r),l=w(t,"onFocus",r),u=w(t,"onBlur",r),d=w(t,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),i&&this.editor.on("update",i),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),l&&this.editor.on("focus",l),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}}class H{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=T(w(this,"addOptions",{name:this.name}))),this.storage=T(w(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new H(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>gt(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new H({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=T(w(n,"addOptions",{name:n.name})),n.storage=T(w(n,"addStorage",{name:n.name,options:n.options})),n}}function we(e,t,n){const{from:r,to:o}=t,{blockSeparator:s=`
|
|
3
3
|
|
|
4
4
|
`,textSerializers:i={}}=n||{};let a="";return e.nodesBetween(r,o,(c,l,u,d)=>{var p;c.isBlock&&l>r&&(a+=s);const h=i==null?void 0:i[c.type.name];if(h)return u&&(a+=h({node:c,pos:l,parent:u,index:d,range:t})),!1;c.isText&&(a+=(p=c==null?void 0:c.text)===null||p===void 0?void 0:p.slice(Math.max(r,l)-l,o-l))}),a}function Ee(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const sn=H.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new g.Plugin({key:new g.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:s}=o,i=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),c=Ee(n);return we(r,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),an=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),ln=(e=!1)=>({commands:t})=>t.setContent("",e),cn=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:i})=>{e.doc.nodesBetween(s.pos,i.pos,(a,c)=>{if(a.type.isText)return;const{doc:l,mapping:u}=t,d=l.resolve(u.map(c)),p=l.resolve(u.map(c+a.nodeSize)),h=d.blockRange(p);if(!h)return;const m=g.liftTarget(h);if(a.type.isTextblock){const{defaultType:f}=d.parent.contentMatchAt(d.index());t.setNodeMarkup(h.start,f)}(m||m===0)&&t.lift(h,m)})}),!0},dn=e=>t=>e(t),un=()=>({state:e,dispatch:t})=>g.createParagraphNear(e,t),pn=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const i=r.mapping.map(t);return r.insert(i,s.content),r.setSelection(new g.TextSelection(r.doc.resolve(i-1))),!0},hn=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(t){const a=o.before(s),c=o.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},fn=e=>({tr:t,state:n,dispatch:r})=>{const o=_(e,n.schema),s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===o){if(r){const c=s.before(i),l=s.after(i);t.delete(c,l).scrollIntoView()}return!0}return!1},mn=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},gn=()=>({state:e,dispatch:t})=>g.deleteSelection(e,t),yn=()=>({commands:e})=>e.keyboardShortcut("Enter"),vn=()=>({state:e,dispatch:t})=>g.exitCode(e,t);function dt(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(o=>n.strict?t[o]===e[o]:zt(t[o])?t[o].test(e[o]):t[o]===e[o]):!0}function Te(e,t,n={}){return e.find(r=>r.type===t&&dt(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function Zt(e,t,n={}){return!!Te(e,t,n)}function yt(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===t))&&(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===t)||(n=n||((r=o.node.marks[0])===null||r===void 0?void 0:r.attrs),!Te([...o.node.marks],t,n)))return;let i=o.index,a=e.start()+o.offset,c=i+1,l=a+o.node.nodeSize;for(;i>0&&Zt([...e.parent.child(i-1).marks],t,n);)i-=1,a-=e.parent.child(i).nodeSize;for(;c<e.parent.childCount&&Zt([...e.parent.child(c).marks],t,n);)l+=e.parent.child(c).nodeSize,c+=1;return{from:a,to:l}}function V(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}const bn=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const s=V(e,r.schema),{doc:i,selection:a}=n,{$from:c,from:l,to:u}=a;if(o){const d=yt(c,s,t);if(d&&d.from<=l&&d.to>=u){const p=g.TextSelection.create(i,d.from,d.to);n.setSelection(p)}}return!0},Mn=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function Vt(e){return e instanceof g.TextSelection}function j(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Ce(e,t=null){if(!t)return null;const n=g.Selection.atStart(e),r=g.Selection.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const o=n.from,s=r.to;return t==="all"?g.TextSelection.create(e,j(0,o,s),j(e.content.size,o,s)):g.TextSelection.create(e,j(t,o,s),j(t,o,s))}function xe(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function vt(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Sn=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:s})=>{t={scrollIntoView:!0,...t};const i=()=>{(vt()||xe())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&e===null||e===!1)return!0;if(s&&e===null&&!Vt(n.state.selection))return i(),!0;const a=Ce(o.doc,e)||n.state.selection,c=n.state.selection.eq(a);return s&&(c||o.setSelection(a),c&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),!0},kn=(e,t)=>n=>e.every((r,o)=>t(r,{...n,index:o})),wn=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Ae=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&Ae(r)}return e};function st(e){const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return Ae(n)}function ut(e,t,n){if(e instanceof g.Node||e instanceof g.Fragment)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,o=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return g.Fragment.fromArray(e.map(a=>t.nodeFromJSON(a)));const i=t.nodeFromJSON(e);return n.errorOnInvalidContent&&i.check(),i}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",s),ut("",t,n)}if(o){if(n.errorOnInvalidContent){let i=!1,a="";const c=new g.Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:l=>(i=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?g.DOMParser.fromSchema(c).parseSlice(st(e),n.parseOptions):g.DOMParser.fromSchema(c).parse(st(e),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=g.DOMParser.fromSchema(t);return n.slice?s.parseSlice(st(e),n.parseOptions).content:s.parse(st(e),n.parseOptions)}return ut("",t,n)}function En(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof g.ReplaceStep||o instanceof g.ReplaceAroundStep))return;const s=e.mapping.maps[r];let i=0;s.forEach((a,c,l,u)=>{i===0&&(i=u)}),e.setSelection(g.Selection.near(e.doc.resolve(i),n))}const Tn=e=>!("type"in e),Cn=(e,t,n)=>({tr:r,dispatch:o,editor:s})=>{var i;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=ut(t,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(i=n.errorOnInvalidContent)!==null&&i!==void 0?i:s.options.enableContentCheck})}catch(m){return s.emit("contentError",{editor:s,error:m,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:l}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((Tn(a)?a:[a]).forEach(m=>{m.check(),u=u?m.isText&&m.marks.length===0:!1,d=d?m.isBlock:!1}),c===l&&d){const{parent:m}=r.doc.resolve(c);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(c-=1,l+=1)}let h;if(u){if(Array.isArray(t))h=t.map(m=>m.text||"").join("");else if(t instanceof g.Fragment){let m="";t.forEach(f=>{f.text&&(m+=f.text)}),h=m}else typeof t=="object"&&t&&t.text?h=t.text:h=t;r.insertText(h,c,l)}else h=a,r.replaceWith(c,l,h);n.updateSelection&&En(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:h})}return!0},xn=()=>({state:e,dispatch:t})=>g.joinUp(e,t),An=()=>({state:e,dispatch:t})=>g.joinDown(e,t),On=()=>({state:e,dispatch:t})=>g.joinBackward(e,t),Ln=()=>({state:e,dispatch:t})=>g.joinForward(e,t),Pn=()=>({state:e,dispatch:t,tr:n})=>{try{const r=g.joinPoint(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Rn=()=>({state:e,dispatch:t,tr:n})=>{try{const r=g.joinPoint(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Hn=()=>({state:e,dispatch:t})=>g.joinTextblockBackward(e,t),_n=()=>({state:e,dispatch:t})=>g.joinTextblockForward(e,t);function Oe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Dn(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,o,s,i;for(let a=0;a<t.length-1;a+=1){const c=t[a];if(/^(cmd|meta|m)$/i.test(c))i=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))vt()||Oe()?i=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const Nn=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const s=Dn(e).split(/-(?!$)/),i=s.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=t.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,a))});return c==null||c.steps.forEach(l=>{const u=l.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function tt(e,t,n={}){const{from:r,to:o,empty:s}=e.selection,i=t?_(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(d,p)=>{if(d.isText)return;const h=Math.max(r,p),m=Math.min(o,p+d.nodeSize);a.push({node:d,from:h,to:m})});const c=o-r,l=a.filter(d=>i?i.name===d.node.type.name:!0).filter(d=>dt(d.node.attrs,n,{strict:!1}));return s?!!l.length:l.reduce((d,p)=>d+p.to-p.from,0)>=c}const In=(e,t={})=>({state:n,dispatch:r})=>{const o=_(e,n.schema);return tt(n,o,t)?g.lift(n,r):!1},$n=()=>({state:e,dispatch:t})=>g.liftEmptyBlock(e,t),Bn=e=>({state:t,dispatch:n})=>{const r=_(e,t.schema);return g.liftListItem(r)(t,n)},jn=()=>({state:e,dispatch:t})=>g.newlineInCode(e,t);function bt(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function te(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,o)=>(n.includes(o)||(r[o]=e[o]),r),{})}const Fn=(e,t)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=bt(typeof e=="string"?e:e.name,r.schema);return a?(a==="node"&&(s=_(e,r.schema)),a==="mark"&&(i=V(e,r.schema)),o&&n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(l,u)=>{s&&s===l.type&&n.setNodeMarkup(u,void 0,te(l.attrs,t)),i&&l.marks.length&&l.marks.forEach(d=>{i===d.type&&n.addMark(u,u+l.nodeSize,i.create(te(d.attrs,t)))})})}),!0):!1},zn=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Vn=()=>({tr:e,dispatch:t})=>{if(t){const n=new g.AllSelection(e.doc);e.setSelection(n)}return!0},Wn=()=>({state:e,dispatch:t})=>g.selectNodeBackward(e,t),Kn=()=>({state:e,dispatch:t})=>g.selectNodeForward(e,t),Un=()=>({state:e,dispatch:t})=>g.selectParentNode(e,t),qn=()=>({state:e,dispatch:t})=>g.selectTextblockEnd(e,t),Gn=()=>({state:e,dispatch:t})=>g.selectTextblockStart(e,t);function Ht(e,t,n={},r={}){return ut(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const Jn=(e,t=!1,n={},r={})=>({editor:o,tr:s,dispatch:i,commands:a})=>{var c,l;const{doc:u}=s;if(n.preserveWhitespace!=="full"){const d=Ht(e,o.schema,n,{errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:o.options.enableContentCheck});return i&&s.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!t),!0}return i&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:u.content.size},e,{parseOptions:n,errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})};function Le(e,t){const n=V(t,e.schema),{from:r,to:o,empty:s}=e.selection,i=[];s?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,c=>{i.push(...c.marks)});const a=i.find(c=>c.type.name===n.name);return a?{...a.attrs}:{}}function Yn(e,t){const n=new g.Transform(e);return t.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Xn(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Qn(e,t){const n=[];return e.descendants((r,o)=>{t(r)&&n.push({node:r,pos:o})}),n}function Zn(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function Pe(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Mt(e){return t=>Pe(t.$from,e)}function tr(e,t){const n={from:0,to:e.content.size};return we(e,n,t)}function er(e,t){const n=_(t,e.schema),{from:r,to:o}=e.selection,s=[];e.doc.nodesBetween(r,o,a=>{s.push(a)});const i=s.reverse().find(a=>a.type.name===n.name);return i?{...i.attrs}:{}}function Re(e,t){const n=bt(typeof t=="string"?t:t.name,e.schema);return n==="node"?er(e,t):n==="mark"?Le(e,t):{}}function nr(e,t=JSON.stringify){const n={};return e.filter(r=>{const o=t(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function rr(e){const t=nr(e);return t.length===1?t:t.filter((n,r)=>!t.filter((s,i)=>i!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function or(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((o,s)=>{const i=[];if(o.ranges.length)o.forEach((a,c)=>{i.push({from:a,to:c})});else{const{from:a,to:c}=n[s];if(a===void 0||c===void 0)return;i.push({from:a,to:c})}i.forEach(({from:a,to:c})=>{const l=t.slice(s).map(a,-1),u=t.slice(s).map(c),d=t.invert().map(l,-1),p=t.invert().map(u);r.push({oldRange:{from:d,to:p},newRange:{from:l,to:u}})})}),rr(r)}function Wt(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(o=>{const s=n.resolve(e),i=yt(s,o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(e,t,(o,s)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(i=>({from:s,to:s+o.nodeSize,mark:i})))}),r}function lt(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=e.find(s=>s.type===t&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}function _t(e,t,n={}){const{empty:r,ranges:o}=e.selection,s=t?V(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>dt(d.attrs,n,{strict:!1}));let i=0;const a=[];if(o.forEach(({$from:d,$to:p})=>{const h=d.pos,m=p.pos;e.doc.nodesBetween(h,m,(f,y)=>{if(!f.isText&&!f.marks.length)return;const v=Math.max(h,y),S=Math.min(m,y+f.nodeSize),M=S-v;i+=M,a.push(...f.marks.map(b=>({mark:b,from:v,to:S})))})}),i===0)return!1;const c=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>dt(d.mark.attrs,n,{strict:!1})).reduce((d,p)=>d+p.to-p.from,0),l=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,p)=>d+p.to-p.from,0);return(c>0?c+l:c)>=i}function He(e,t,n={}){if(!t)return tt(e,null,n)||_t(e,null,n);const r=bt(t,e.schema);return r==="node"?tt(e,t,n):r==="mark"?_t(e,t,n):!1}function Dt(e,t){const{nodeExtensions:n}=ft(t),r=n.find(i=>i.name===e);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=T(w(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function St(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((r=e.text)!==null&&r!==void 0?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let o=!0;return e.content.forEach(s=>{o!==!1&&(St(s,{ignoreWhitespace:n,checkChildren:t})||(o=!1))}),o}return!1}function _e(e){return e instanceof g.NodeSelection}function sr(e,t,n){const o=e.state.doc.content.size,s=j(t,0,o),i=j(n,0,o),a=e.coordsAtPos(s),c=e.coordsAtPos(i,-1),l=Math.min(a.top,c.top),u=Math.max(a.bottom,c.bottom),d=Math.min(a.left,c.left),p=Math.max(a.right,c.right),h=p-d,m=u-l,v={top:l,bottom:u,left:d,right:p,width:h,height:m,x:d,y:l};return{...v,toJSON:()=>v}}function ir(e,t,n){var r;const{selection:o}=t;let s=null;if(Vt(o)&&(s=o.$cursor),s){const a=(r=e.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(c=>c.type.excludes(n))}const{ranges:i}=o;return i.some(({$from:a,$to:c})=>{let l=a.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(a.pos,c.pos,(u,d,p)=>{if(l)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(f=>f.type.excludes(n));l=h&&m}return!l}),l})}const ar=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:a}=s,c=V(e,r.schema);if(o)if(i){const l=Le(r,c);n.addStoredMark(c.create({...l,...t}))}else a.forEach(l=>{const u=l.$from.pos,d=l.$to.pos;r.doc.nodesBetween(u,d,(p,h)=>{const m=Math.max(h,u),f=Math.min(h+p.nodeSize,d);p.marks.find(v=>v.type===c)?p.marks.forEach(v=>{c===v.type&&n.addMark(m,f,c.create({...v.attrs,...t}))}):n.addMark(m,f,c.create(t))})});return ir(r,n,c)},lr=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),cr=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const s=_(e,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:a})=>g.setBlockType(s,{...i,...t})(n)?!0:a.clearNodes()).command(({state:a})=>g.setBlockType(s,{...i,...t})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},dr=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,o=j(e,0,r.content.size),s=g.NodeSelection.create(r,o);t.setSelection(s)}return!0},ur=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:o,to:s}=typeof e=="number"?{from:e,to:e}:e,i=g.TextSelection.atStart(r).from,a=g.TextSelection.atEnd(r).to,c=j(o,i,a),l=j(s,i,a),u=g.TextSelection.create(r,c,l);t.setSelection(u)}return!0},pr=e=>({state:t,dispatch:n})=>{const r=_(e,t.schema);return g.sinkListItem(r)(t,n)};function ee(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(o=>t==null?void 0:t.includes(o.type.name));e.tr.ensureMarks(r)}}const hr=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:i}=t,{$from:a,$to:c}=s,l=o.extensionManager.attributes,u=lt(l,a.node().type.name,a.node().attrs);if(s instanceof g.NodeSelection&&s.node.isBlock)return!a.parentOffset||!g.canSplit(i,a.pos)?!1:(r&&(e&&ee(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=c.parentOffset===c.parent.content.size,p=a.depth===0?void 0:Xn(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&p?[{type:p,attrs:u}]:void 0,m=g.canSplit(t.doc,t.mapping.map(a.pos),1,h);if(!h&&!m&&g.canSplit(t.doc,t.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),r){if(m&&(s instanceof g.TextSelection&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),p&&!d&&!a.parentOffset&&a.parent.type!==p)){const f=t.mapping.map(a.before()),y=t.doc.resolve(f);a.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&t.setNodeMarkup(t.mapping.map(a.before()),p)}e&&ee(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return m},fr=(e,t={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var i;const a=_(e,r.schema),{$from:c,$to:l}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(l))return!1;const d=c.node(-1);if(d.type!==a)return!1;const p=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(o){let v=g.Fragment.empty;const S=c.index(-1)?1:c.index(-2)?2:3;for(let L=c.depth-S;L>=c.depth-3;L-=1)v=g.Fragment.from(c.node(L).copy(v));const M=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,b={...lt(p,c.node().type.name,c.node().attrs),...t},E=((i=a.contentMatch.defaultType)===null||i===void 0?void 0:i.createAndFill(b))||void 0;v=v.append(g.Fragment.from(a.createAndFill(null,E)||void 0));const k=c.before(c.depth-(S-1));n.replace(k,c.after(-M),new g.Slice(v,4-S,0));let C=-1;n.doc.nodesBetween(k,n.doc.content.size,(L,P)=>{if(C>-1)return!1;L.isTextblock&&L.content.size===0&&(C=P+1)}),C>-1&&n.setSelection(g.TextSelection.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const h=l.pos===c.end()?d.contentMatchAt(0).defaultType:null,m={...lt(p,d.type.name,d.attrs),...t},f={...lt(p,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,l.pos);const y=h?[{type:a,attrs:m},{type:h,attrs:f}]:[{type:a,attrs:m}];if(!g.canSplit(n.doc,c.pos,2))return!1;if(o){const{selection:v,storedMarks:S}=r,{splittableMarks:M}=s.extensionManager,b=S||v.$to.parentOffset&&v.$from.marks();if(n.split(c.pos,2,y).scrollIntoView(),!b||!o)return!0;const E=b.filter(k=>M.includes(k.type.name));n.ensureMarks(E)}return!0},Ct=(e,t)=>{const n=Mt(i=>i.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=e.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&g.canJoin(e.doc,n.pos)&&e.join(n.pos),!0},xt=(e,t)=>{const n=Mt(i=>i.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=e.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&g.canJoin(e.doc,r)&&e.join(r),!0},mr=(e,t,n,r={})=>({editor:o,tr:s,state:i,dispatch:a,chain:c,commands:l,can:u})=>{const{extensions:d,splittableMarks:p}=o.extensionManager,h=_(e,i.schema),m=_(t,i.schema),{selection:f,storedMarks:y}=i,{$from:v,$to:S}=f,M=v.blockRange(S),b=y||f.$to.parentOffset&&f.$from.marks();if(!M)return!1;const E=Mt(k=>Dt(k.type.name,d))(f);if(M.depth>=1&&E&&M.depth-E.depth<=1){if(E.node.type===h)return l.liftListItem(m);if(Dt(E.node.type.name,d)&&h.validContent(E.node.content)&&a)return c().command(()=>(s.setNodeMarkup(E.pos,h),!0)).command(()=>Ct(s,h)).command(()=>xt(s,h)).run()}return!n||!b||!a?c().command(()=>u().wrapInList(h,r)?!0:l.clearNodes()).wrapInList(h,r).command(()=>Ct(s,h)).command(()=>xt(s,h)).run():c().command(()=>{const k=u().wrapInList(h,r),C=b.filter(L=>p.includes(L.type.name));return s.ensureMarks(C),k?!0:l.clearNodes()}).wrapInList(h,r).command(()=>Ct(s,h)).command(()=>xt(s,h)).run()},gr=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=V(e,r.schema);return _t(r,i,t)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,t)},yr=(e,t,n={})=>({state:r,commands:o})=>{const s=_(e,r.schema),i=_(t,r.schema),a=tt(r,s,n);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?o.setNode(i,c):o.setNode(s,{...c,...n})},vr=(e,t={})=>({state:n,commands:r})=>{const o=_(e,n.schema);return tt(n,o,t)?r.lift(o):r.wrapIn(o,t)},br=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(e))){if(t){const i=e.tr,a=s.transform;for(let c=a.steps.length-1;c>=0;c-=1)i.step(a.steps[c].invert(a.docs[c]));if(s.text){const c=i.doc.resolve(s.from).marks();i.replaceWith(s.from,s.to,e.schema.text(s.text,c))}else i.delete(s.from,s.to)}return!0}}return!1},Mr=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(s=>{e.removeMark(s.$from.pos,s.$to.pos)}),!0},Sr=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=t,{selection:a}=n,c=V(e,r.schema),{$from:l,empty:u,ranges:d}=a;if(!o)return!0;if(u&&i){let{from:p,to:h}=a;const m=(s=l.marks().find(y=>y.type===c))===null||s===void 0?void 0:s.attrs,f=yt(l,c,m);f&&(p=f.from,h=f.to),n.removeMark(p,h,c)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},kr=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=bt(typeof e=="string"?e:e.name,r.schema);return a?(a==="node"&&(s=_(e,r.schema)),a==="mark"&&(i=V(e,r.schema)),o&&n.selection.ranges.forEach(c=>{const l=c.$from.pos,u=c.$to.pos;let d,p,h,m;n.selection.empty?r.doc.nodesBetween(l,u,(f,y)=>{s&&s===f.type&&(h=Math.max(y,l),m=Math.min(y+f.nodeSize,u),d=y,p=f)}):r.doc.nodesBetween(l,u,(f,y)=>{y<l&&s&&s===f.type&&(h=Math.max(y,l),m=Math.min(y+f.nodeSize,u),d=y,p=f),y>=l&&y<=u&&(s&&s===f.type&&n.setNodeMarkup(y,void 0,{...f.attrs,...t}),i&&f.marks.length&&f.marks.forEach(v=>{if(i===v.type){const S=Math.max(y,l),M=Math.min(y+f.nodeSize,u);n.addMark(S,M,i.create({...v.attrs,...t}))}}))}),p&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...p.attrs,...t}),i&&p.marks.length&&p.marks.forEach(f=>{i===f.type&&n.addMark(h,m,i.create({...f.attrs,...t}))}))}),!0):!1},wr=(e,t={})=>({state:n,dispatch:r})=>{const o=_(e,n.schema);return g.wrapIn(o,t)(n,r)},Er=(e,t={})=>({state:n,dispatch:r})=>{const o=_(e,n.schema);return g.wrapInList(o,t)(n,r)};var Tr=Object.freeze({__proto__:null,blur:an,clearContent:ln,clearNodes:cn,command:dn,createParagraphNear:un,cut:pn,deleteCurrentNode:hn,deleteNode:fn,deleteRange:mn,deleteSelection:gn,enter:yn,exitCode:vn,extendMarkRange:bn,first:Mn,focus:Sn,forEach:kn,insertContent:wn,insertContentAt:Cn,joinBackward:On,joinDown:An,joinForward:Ln,joinItemBackward:Pn,joinItemForward:Rn,joinTextblockBackward:Hn,joinTextblockForward:_n,joinUp:xn,keyboardShortcut:Nn,lift:In,liftEmptyBlock:$n,liftListItem:Bn,newlineInCode:jn,resetAttributes:Fn,scrollIntoView:zn,selectAll:Vn,selectNodeBackward:Wn,selectNodeForward:Kn,selectParentNode:Un,selectTextblockEnd:qn,selectTextblockStart:Gn,setContent:Jn,setMark:ar,setMeta:lr,setNode:cr,setNodeSelection:dr,setTextSelection:ur,sinkListItem:pr,splitBlock:hr,splitListItem:fr,toggleList:mr,toggleMark:gr,toggleNode:yr,toggleWrap:vr,undoInputRule:br,unsetAllMarks:Mr,unsetMark:Sr,updateAttributes:kr,wrapIn:wr,wrapInList:Er});const Cr=H.create({name:"commands",addCommands(){return{...Tr}}}),xr=H.create({name:"drop",addProseMirrorPlugins(){return[new g.Plugin({key:new g.PluginKey("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Ar=H.create({name:"editable",addProseMirrorPlugins(){return[new g.Plugin({key:new g.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Or=H.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new g.Plugin({key:new g.PluginKey("focusEvents"),props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Lr=H.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:a})=>{const{selection:c,doc:l}=a,{empty:u,$anchor:d}=c,{pos:p,parent:h}=d,m=d.parent.isTextblock&&p>0?a.doc.resolve(p-1):d,f=m.parent.type.spec.isolating,y=d.pos-d.parentOffset,v=f&&m.parent.childCount===1?y===d.pos:g.Selection.atStart(l).from===p;return!u||!h.type.isTextblock||h.textContent.length||!v||v&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return vt()||Oe()?s:o},addProseMirrorPlugins(){return[new g.Plugin({key:new g.PluginKey("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(f=>f.getMeta("composition")))return;const r=e.some(f=>f.docChanged)&&!t.doc.eq(n.doc),o=e.some(f=>f.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:i,to:a}=t.selection,c=g.Selection.atStart(t.doc).from,l=g.Selection.atEnd(t.doc).to;if(s||!(i===c&&a===l)||!St(n.doc))return;const p=n.tr,h=pt({state:n,transaction:p}),{commands:m}=new ht({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Pr=H.create({name:"paste",addProseMirrorPlugins(){return[new g.Plugin({key:new g.PluginKey("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Rr=H.create({name:"tabindex",addProseMirrorPlugins(){return[new g.Plugin({key:new g.PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class K{get name(){return this.node.type.name}constructor(t,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new K(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new K(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new K(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,i=this.pos+r+(s?0:1),a=this.resolvedPos.doc.resolve(i);if(!o&&a.depth<=this.depth)return;const c=new K(a,this.editor,o,o?n:null);o&&(c.actualDepth=this.depth+1),t.push(new K(a,this.editor,o,o?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===t)if(Object.keys(n).length>0){const s=o.node.attrs,i=Object.keys(n);for(let a=0;a<i.length;a+=1){const c=i[a];if(s[c]!==n[c])break}}else r=o;o=o.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(n);return this.children.forEach(i=>{r&&o.length>0||(i.node.type.name===t&&s.every(c=>n[c]===i.node.attrs[c])&&o.push(i),!(r&&o.length>0)&&(o=o.concat(i.querySelectorAll(t,n,r))))}),o}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}}const Hr=`.ProseMirror {
|
|
@@ -2,7 +2,7 @@ var dn = Object.defineProperty;
|
|
|
2
2
|
var un = (e, t, n) => t in e ? dn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var it = (e, t, n) => un(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import _e from "tippy.js";
|
|
5
|
-
import { E as pn, a as hn, P as $, b as _, S as W, k as fn, T as I, D as mn, c as He, F as K, N as gn, d as Lt, w as yn, e as vn, f as bn, g as ht, h as et, s as Mn, i as ie, j as Sn, l as wn, m as kn, n as En, o as Tn, A as Cn, p as xn, q as An, r as On, t as Ln, u as Pn, v as Rn, x as $n, y as De, z as _n, B as Hn, C as Dn, G as In, H as Nn, I as Bn, J as jn, K as Ut, R as Fn, L as zn, M as Vn, O as Wn, Q as ae, U as Kn, V as Ie, W as Un, X as qn, Y as Gn, Z as Jn, _ as Yn, $ as mt, a0 as qt, a1 as Xn, a2 as Qn, a3 as Zn, a4 as Ne, a5 as tr, a6 as le, a7 as er, a8 as ce, a9 as de, aa as nr, ab as ue, ac as rr, ad as sr, ae as or, af as ir, ag as ar, ah as lr, ai as cr, aj as dr, ak as ur, al as pr, am as hr } from "./vendor-
|
|
5
|
+
import { E as pn, a as hn, P as $, b as _, S as W, k as fn, T as I, D as mn, c as He, F as K, N as gn, d as Lt, w as yn, e as vn, f as bn, g as ht, h as et, s as Mn, i as ie, j as Sn, l as wn, m as kn, n as En, o as Tn, A as Cn, p as xn, q as An, r as On, t as Ln, u as Pn, v as Rn, x as $n, y as De, z as _n, B as Hn, C as Dn, G as In, H as Nn, I as Bn, J as jn, K as Ut, R as Fn, L as zn, M as Vn, O as Wn, Q as ae, U as Kn, V as Ie, W as Un, X as qn, Y as Gn, Z as Jn, _ as Yn, $ as mt, a0 as qt, a1 as Xn, a2 as Qn, a3 as Zn, a4 as Ne, a5 as tr, a6 as le, a7 as er, a8 as ce, a9 as de, aa as nr, ab as ue, ac as rr, ad as sr, ae as or, af as ir, ag as ar, ah as lr, ai as cr, aj as dr, ak as ur, al as pr, am as hr } from "./vendor-DIvoV5tx.js";
|
|
6
6
|
import L, { useRef as fr, useState as Gt, useDebugValue as Be, useEffect as Jt, forwardRef as mr, useLayoutEffect as gr, useContext as je, createContext as Fe } from "react";
|
|
7
7
|
import yr, { flushSync as vr } from "react-dom";
|
|
8
8
|
function bt(e) {
|