@open-commune/editor 0.1.4 → 0.1.5

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/index.d.mts CHANGED
@@ -42,9 +42,9 @@ interface FileNodeOptions {
42
42
  }>) | null;
43
43
  }
44
44
  /**
45
- * Attached-file block (attrs src/id/alt/title). The residual legacy `data`
46
- * attr is intentionally NOT declared: the schema drops it on save, as the
47
- * previous editor already did — a documented harness exception.
45
+ * Attached-file block (attrs src/id/alt/title). A residual `data` attribute
46
+ * some stored documents carry is intentionally NOT declared: the schema drops
47
+ * it on save — a documented harness exception.
48
48
  */
49
49
  declare const FileNode: Node<FileNodeOptions, any>;
50
50
 
@@ -59,7 +59,7 @@ declare const FileNode: Node<FileNodeOptions, any>;
59
59
  * a silent mutation the conservation harness forbids. `link` and
60
60
  * `orderedList` are replaced below to keep the stored attribute sets.
61
61
  */
62
- declare const communStarterKit: {
62
+ declare const openCommuneStarterKit: {
63
63
  readonly code: false;
64
64
  readonly codeBlock: false;
65
65
  readonly strike: false;
@@ -69,10 +69,10 @@ declare const communStarterKit: {
69
69
  readonly orderedList: false;
70
70
  };
71
71
  /** Link without v3's `title` attr: declaring it would add a null key to every stored link on save. */
72
- declare const CommunLink: _tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any>;
73
- /** OrderedList without v3's `type` attr (same rationale as CommunLink). */
74
- declare const CommunOrderedList: _tiptap_core.Node<_tiptap_extension_list.OrderedListOptions, any>;
75
- interface CommunEditorMedia {
72
+ declare const OpenCommuneLink: _tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any>;
73
+ /** OrderedList without v3's `type` attr (same rationale as OpenCommuneLink). */
74
+ declare const OpenCommuneOrderedList: _tiptap_core.Node<_tiptap_extension_list.OrderedListOptions, any>;
75
+ interface OpenCommuneEditorMedia {
76
76
  upload: FileNodeOptions['upload'];
77
77
  fetch: FileNodeOptions['fetch'];
78
78
  }
@@ -80,7 +80,7 @@ interface CommunEditorMedia {
80
80
  * The parity extension set. UEditor must ALSO receive `:image="false"` and
81
81
  * `:mention="false"`: its defaults collide with our node names.
82
82
  */
83
- declare function communSchemaExtensions(media?: Partial<CommunEditorMedia>): (_tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any> | _tiptap_core.Node<_tiptap_extension_list.OrderedListOptions, any> | _tiptap_core.Extension<_tiptap_extension_unique_id.UniqueIDOptions, any> | _tiptap_core.Extension<Omit<_tiptap_extension_file_handler.FileHandlePluginOptions, "key" | "editor">, any> | _tiptap_core.Extension<_tiptap_extension_text_align.TextAlignOptions, any> | _tiptap_core.Mark<_tiptap_extension_text_style.TextStyleOptions, any> | _tiptap_core.Mark<_tiptap_extension_highlight.HighlightOptions, any> | _tiptap_core.Extension<_tiptap_extension_typography.TypographyOptions, any> | _tiptap_core.Node<any, any> | _tiptap_core.Node<UploadPlaceholderOptions, any> | _tiptap_core.Node<FileNodeOptions, any> | _tiptap_core.Node<_tiptap_extension_details.DetailsOptions, any> | _tiptap_core.Node<_tiptap_extension_details.DetailsSummaryOptions, any>)[];
83
+ declare function openCommuneSchemaExtensions(media?: Partial<OpenCommuneEditorMedia>): (_tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any> | _tiptap_core.Node<_tiptap_extension_list.OrderedListOptions, any> | _tiptap_core.Extension<_tiptap_extension_unique_id.UniqueIDOptions, any> | _tiptap_core.Extension<Omit<_tiptap_extension_file_handler.FileHandlePluginOptions, "key" | "editor">, any> | _tiptap_core.Extension<_tiptap_extension_text_align.TextAlignOptions, any> | _tiptap_core.Mark<_tiptap_extension_text_style.TextStyleOptions, any> | _tiptap_core.Mark<_tiptap_extension_highlight.HighlightOptions, any> | _tiptap_core.Extension<_tiptap_extension_typography.TypographyOptions, any> | _tiptap_core.Node<any, any> | _tiptap_core.Node<UploadPlaceholderOptions, any> | _tiptap_core.Node<FileNodeOptions, any> | _tiptap_core.Node<_tiptap_extension_details.DetailsOptions, any> | _tiptap_core.Node<_tiptap_extension_details.DetailsSummaryOptions, any>)[];
84
84
 
85
85
  /**
86
86
  * Stable block ids matching stored content: attribute `uid`, UUID v4.
@@ -151,5 +151,5 @@ declare function sanitizeDoc<T extends {
151
151
  content?: any[];
152
152
  }>(doc: T): T;
153
153
 
154
- export { Callout, CommunLink, CommunOrderedList, Details, DetailsContent, DetailsSummary, EMBED_SERVICES, Embed, FileNode, ImageNode, UID_TYPES, Uid, UploadPlaceholder, communSchemaExtensions, communStarterKit, fileInputRegex, sanitizeDoc };
155
- export type { CommunEditorMedia, EmbedService, FileNodeOptions };
154
+ export { Callout, Details, DetailsContent, DetailsSummary, EMBED_SERVICES, Embed, FileNode, ImageNode, OpenCommuneLink, OpenCommuneOrderedList, UID_TYPES, Uid, UploadPlaceholder, fileInputRegex, openCommuneSchemaExtensions, openCommuneStarterKit, sanitizeDoc };
155
+ export type { EmbedService, FileNodeOptions, OpenCommuneEditorMedia };
package/dist/index.d.ts CHANGED
@@ -42,9 +42,9 @@ interface FileNodeOptions {
42
42
  }>) | null;
43
43
  }
44
44
  /**
45
- * Attached-file block (attrs src/id/alt/title). The residual legacy `data`
46
- * attr is intentionally NOT declared: the schema drops it on save, as the
47
- * previous editor already did — a documented harness exception.
45
+ * Attached-file block (attrs src/id/alt/title). A residual `data` attribute
46
+ * some stored documents carry is intentionally NOT declared: the schema drops
47
+ * it on save — a documented harness exception.
48
48
  */
49
49
  declare const FileNode: Node<FileNodeOptions, any>;
50
50
 
@@ -59,7 +59,7 @@ declare const FileNode: Node<FileNodeOptions, any>;
59
59
  * a silent mutation the conservation harness forbids. `link` and
60
60
  * `orderedList` are replaced below to keep the stored attribute sets.
61
61
  */
62
- declare const communStarterKit: {
62
+ declare const openCommuneStarterKit: {
63
63
  readonly code: false;
64
64
  readonly codeBlock: false;
65
65
  readonly strike: false;
@@ -69,10 +69,10 @@ declare const communStarterKit: {
69
69
  readonly orderedList: false;
70
70
  };
71
71
  /** Link without v3's `title` attr: declaring it would add a null key to every stored link on save. */
72
- declare const CommunLink: _tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any>;
73
- /** OrderedList without v3's `type` attr (same rationale as CommunLink). */
74
- declare const CommunOrderedList: _tiptap_core.Node<_tiptap_extension_list.OrderedListOptions, any>;
75
- interface CommunEditorMedia {
72
+ declare const OpenCommuneLink: _tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any>;
73
+ /** OrderedList without v3's `type` attr (same rationale as OpenCommuneLink). */
74
+ declare const OpenCommuneOrderedList: _tiptap_core.Node<_tiptap_extension_list.OrderedListOptions, any>;
75
+ interface OpenCommuneEditorMedia {
76
76
  upload: FileNodeOptions['upload'];
77
77
  fetch: FileNodeOptions['fetch'];
78
78
  }
@@ -80,7 +80,7 @@ interface CommunEditorMedia {
80
80
  * The parity extension set. UEditor must ALSO receive `:image="false"` and
81
81
  * `:mention="false"`: its defaults collide with our node names.
82
82
  */
83
- declare function communSchemaExtensions(media?: Partial<CommunEditorMedia>): (_tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any> | _tiptap_core.Node<_tiptap_extension_list.OrderedListOptions, any> | _tiptap_core.Extension<_tiptap_extension_unique_id.UniqueIDOptions, any> | _tiptap_core.Extension<Omit<_tiptap_extension_file_handler.FileHandlePluginOptions, "key" | "editor">, any> | _tiptap_core.Extension<_tiptap_extension_text_align.TextAlignOptions, any> | _tiptap_core.Mark<_tiptap_extension_text_style.TextStyleOptions, any> | _tiptap_core.Mark<_tiptap_extension_highlight.HighlightOptions, any> | _tiptap_core.Extension<_tiptap_extension_typography.TypographyOptions, any> | _tiptap_core.Node<any, any> | _tiptap_core.Node<UploadPlaceholderOptions, any> | _tiptap_core.Node<FileNodeOptions, any> | _tiptap_core.Node<_tiptap_extension_details.DetailsOptions, any> | _tiptap_core.Node<_tiptap_extension_details.DetailsSummaryOptions, any>)[];
83
+ declare function openCommuneSchemaExtensions(media?: Partial<OpenCommuneEditorMedia>): (_tiptap_core.Mark<_tiptap_extension_link.LinkOptions, any> | _tiptap_core.Node<_tiptap_extension_list.OrderedListOptions, any> | _tiptap_core.Extension<_tiptap_extension_unique_id.UniqueIDOptions, any> | _tiptap_core.Extension<Omit<_tiptap_extension_file_handler.FileHandlePluginOptions, "key" | "editor">, any> | _tiptap_core.Extension<_tiptap_extension_text_align.TextAlignOptions, any> | _tiptap_core.Mark<_tiptap_extension_text_style.TextStyleOptions, any> | _tiptap_core.Mark<_tiptap_extension_highlight.HighlightOptions, any> | _tiptap_core.Extension<_tiptap_extension_typography.TypographyOptions, any> | _tiptap_core.Node<any, any> | _tiptap_core.Node<UploadPlaceholderOptions, any> | _tiptap_core.Node<FileNodeOptions, any> | _tiptap_core.Node<_tiptap_extension_details.DetailsOptions, any> | _tiptap_core.Node<_tiptap_extension_details.DetailsSummaryOptions, any>)[];
84
84
 
85
85
  /**
86
86
  * Stable block ids matching stored content: attribute `uid`, UUID v4.
@@ -151,5 +151,5 @@ declare function sanitizeDoc<T extends {
151
151
  content?: any[];
152
152
  }>(doc: T): T;
153
153
 
154
- export { Callout, CommunLink, CommunOrderedList, Details, DetailsContent, DetailsSummary, EMBED_SERVICES, Embed, FileNode, ImageNode, UID_TYPES, Uid, UploadPlaceholder, communSchemaExtensions, communStarterKit, fileInputRegex, sanitizeDoc };
155
- export type { CommunEditorMedia, EmbedService, FileNodeOptions };
154
+ export { Callout, Details, DetailsContent, DetailsSummary, EMBED_SERVICES, Embed, FileNode, ImageNode, OpenCommuneLink, OpenCommuneOrderedList, UID_TYPES, Uid, UploadPlaceholder, fileInputRegex, openCommuneSchemaExtensions, openCommuneStarterKit, sanitizeDoc };
155
+ export type { EmbedService, FileNodeOptions, OpenCommuneEditorMedia };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import S from"@tiptap/extension-text-align";import{TextStyle as H}from"@tiptap/extension-text-style";import D from"@tiptap/extension-highlight";import w from"@tiptap/extension-typography";import k from"@tiptap/extension-link";import{OrderedList as E}from"@tiptap/extension-list";import v from"@tiptap/extension-file-handler";import P from"@tiptap/extension-unique-id";import{Node as u,nodeInputRule as I,mergeAttributes as d}from"@tiptap/core";import $ from"@tiptap/extension-image";import{DetailsContent as O,DetailsSummary as z,Details as N}from"@tiptap/extension-details";import{Plugin as R,PluginKey as U,TextSelection as F}from"@tiptap/pm/state";const c=["paragraph","heading","listItem","bulletList","orderedList","blockquote","callout","file","image"],m=P.configure({attributeName:"uid",types:[...c]}),p=u.create({name:"callout",group:"block",content:"text*",draggable:!0,selectable:!0,inline:!1,defining:!1,addAttributes(){return{icon:{default:null,parseHTML:e=>e.getAttribute("data-icon"),renderHTML:e=>({"data-icon":e.icon})}}},parseHTML(){return[{tag:"aside"}]},renderHTML({HTMLAttributes:e}){return["aside",e,0]},addCommands(){return{setCallout:(e={})=>({commands:t})=>t.setNode(this.name,e)}}}),f=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,g=u.create({name:"file",group:"block",draggable:!0,inline:!1,addOptions(){return{upload:null,fetch:null,HTMLAttributes:{type:"file"}}},addAttributes(){return{src:{default:null,parseHTML:e=>{if(e.getAttribute("type")==="file")return e.getAttribute("src")}},id:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:"input",attrs:{type:"file"}}]},renderHTML({HTMLAttributes:e}){return["input",d(this.options.HTMLAttributes,e)]},addCommands(){return{setFile:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[I({find:f,type:this.type,getAttributes:e=>{const[,,t,n,o]=e;return{src:n,alt:t,title:o}}})]}}),h=$.extend({addOptions(){return{...this.parent?.(),upload:null,fetch:null}},addAttributes(){const{width:e,height:t,...n}=this.parent?.()??{};return{...n,src:{default:null},id:{default:null},title:{default:null}}}}),b=u.create({name:"embed",group:"block",atom:!0,draggable:!0,selectable:!0,inline:!1,defining:!1,addAttributes(){return{service:{default:null},icon:{default:null},placeholder:{default:null},src:{default:null},title:{default:null},height:{default:null},frameborder:{default:"0"},allow:{default:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"},allowfullscreen:{default:!0}}},parseHTML(){return[{tag:"iframe[src]"}]},renderHTML({HTMLAttributes:e}){return["div",["iframe",e]]},addCommands(){return{setEmbed:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}}}),V={video:{label:"Vid\xE9o",icon:"iconoir:youtube",placeholder:"Collez l'url YouTube ou Vimeo\u2026",title:"Lecteur vid\xE9o",height:315,toSrc:e=>{const t=e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/);if(t)return`https://www.youtube.com/embed/${t[1]}`;const n=e.match(/vimeo\.com\/(\d+)/);return n?`https://player.vimeo.com/video/${n[1]}`:e}},map:{label:"Carte",icon:"iconoir:map-pin",placeholder:"Collez l'url d'int\xE9gration Google Maps\u2026",title:"Carte",height:400,toSrc:e=>e},form:{label:"Formulaire",icon:"iconoir:list-select",placeholder:"Collez l'url du formulaire (Typeform\u2026)\u2026",title:"Formulaire",height:500,toSrc:e=>e}},B=e=>e.content.childCount===1&&e.content.firstChild!==null&&e.content.firstChild.isTextblock&&e.openStart>0&&e.openEnd>0,y=N.extend({addAttributes(){return{toggle:{default:!0}}},addProseMirrorPlugins(){return[...this.parent?.()??[],new R({key:new U("communDetailsSummaryPaste"),props:{handlePaste:(e,t,n)=>{if(B(n))return!1;const{$head:o}=e.state.selection;for(let r=o.depth;r>0;r--){if(o.node(r).type.name!=="detailsSummary")continue;if(o.node(r-1).type.name!=="details")return!1;const a=o.after(r),l=e.state.tr.replaceRange(a+1,a+1,n),i=Math.min(a+1+n.size,l.doc.content.size);return l.setSelection(F.near(l.doc.resolve(i),-1)),l.setMeta("communDetailsOpenAt",a+1),e.dispatch(l.scrollIntoView()),!0}return!1}}})]}}),C=z,L=O,A=u.create({name:"imageUpload",group:"block",atom:!0,draggable:!0,addOptions(){return{upload:null}},parseHTML(){return[{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:e}){return["div",d(e,{"data-type":"image-upload"})]},addCommands(){return{insertUploadPlaceholder:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}}}),_={code:!1,codeBlock:!1,strike:!1,underline:!1,trailingNode:!1,link:!1,orderedList:!1},T=k.extend({addAttributes(){const{title:e,...t}=this.parent?.()??{};return t}}).configure({openOnClick:!1,HTMLAttributes:{class:"underline text-primary",target:"_blank"}}),M=E.extend({addAttributes(){const{type:e,...t}=this.parent?.()??{};return t}});function K(e){const t=async(n,o,r)=>{for(const a of o){const{id:l,src:i,title:x}=await e(a),s={type:a.type.startsWith("image/")?"image":"file",attrs:{id:l,src:i,title:x}};r==null?n.chain().focus().insertContent(s).run():n.chain().insertContentAt(r,s).run()}};return v.configure({onDrop:(n,o,r)=>{t(n,o,r)},onPaste:(n,o)=>{t(n,o)}})}function Y(e={}){const t={upload:e.upload??null,fetch:e.fetch??null};return[m,...e.upload?[K(e.upload)]:[],T,M,S.configure({types:["heading","paragraph"]}),H.extend({priority:100}),D.configure({multicolor:!0}),w,p,A.configure({upload:t.upload}),g.configure(t),h.configure(t),b,y,C,L]}function j(e){let t=!1;const n=r=>{if(!r||typeof r!="object")return r;if(r.type==="text"&&!r.text)return t=!0,null;if(Array.isArray(r.content)){const a=r.content.map(n).filter(Boolean);return a.length!==r.content.length?{...r,content:a}:a.some((l,i)=>l!==r.content[i])?{...r,content:a}:r}return r},o=n(e);return t&&typeof console<"u"&&console.warn("[editor] repaired document: empty text node(s) dropped"),o}export{p as Callout,T as CommunLink,M as CommunOrderedList,y as Details,L as DetailsContent,C as DetailsSummary,V as EMBED_SERVICES,b as Embed,g as FileNode,h as ImageNode,c as UID_TYPES,m as Uid,A as UploadPlaceholder,Y as communSchemaExtensions,_ as communStarterKit,f as fileInputRegex,j as sanitizeDoc};
1
+ import S from"@tiptap/extension-text-align";import{TextStyle as H}from"@tiptap/extension-text-style";import D from"@tiptap/extension-highlight";import w from"@tiptap/extension-typography";import k from"@tiptap/extension-link";import{OrderedList as E}from"@tiptap/extension-list";import v from"@tiptap/extension-file-handler";import P from"@tiptap/extension-unique-id";import{Node as u,nodeInputRule as O,mergeAttributes as d}from"@tiptap/core";import I from"@tiptap/extension-image";import{DetailsContent as $,DetailsSummary as z,Details as N}from"@tiptap/extension-details";import{Plugin as R,PluginKey as U,TextSelection as F}from"@tiptap/pm/state";const c=["paragraph","heading","listItem","bulletList","orderedList","blockquote","callout","file","image"],m=P.configure({attributeName:"uid",types:[...c]}),p=u.create({name:"callout",group:"block",content:"text*",draggable:!0,selectable:!0,inline:!1,defining:!1,addAttributes(){return{icon:{default:null,parseHTML:e=>e.getAttribute("data-icon"),renderHTML:e=>({"data-icon":e.icon})}}},parseHTML(){return[{tag:"aside"}]},renderHTML({HTMLAttributes:e}){return["aside",e,0]},addCommands(){return{setCallout:(e={})=>({commands:t})=>t.setNode(this.name,e)}}}),f=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,g=u.create({name:"file",group:"block",draggable:!0,inline:!1,addOptions(){return{upload:null,fetch:null,HTMLAttributes:{type:"file"}}},addAttributes(){return{src:{default:null,parseHTML:e=>{if(e.getAttribute("type")==="file")return e.getAttribute("src")}},id:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:"input",attrs:{type:"file"}}]},renderHTML({HTMLAttributes:e}){return["input",d(this.options.HTMLAttributes,e)]},addCommands(){return{setFile:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[O({find:f,type:this.type,getAttributes:e=>{const[,,t,n,o]=e;return{src:n,alt:t,title:o}}})]}}),h=I.extend({addOptions(){return{...this.parent?.(),upload:null,fetch:null}},addAttributes(){const{width:e,height:t,...n}=this.parent?.()??{};return{...n,src:{default:null},id:{default:null},title:{default:null}}}}),b=u.create({name:"embed",group:"block",atom:!0,draggable:!0,selectable:!0,inline:!1,defining:!1,addAttributes(){return{service:{default:null},icon:{default:null},placeholder:{default:null},src:{default:null},title:{default:null},height:{default:null},frameborder:{default:"0"},allow:{default:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"},allowfullscreen:{default:!0}}},parseHTML(){return[{tag:"iframe[src]"}]},renderHTML({HTMLAttributes:e}){return["div",["iframe",e]]},addCommands(){return{setEmbed:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}}}),V={video:{label:"Vid\xE9o",icon:"iconoir:youtube",placeholder:"Collez l'url YouTube ou Vimeo\u2026",title:"Lecteur vid\xE9o",height:315,toSrc:e=>{const t=e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/);if(t)return`https://www.youtube.com/embed/${t[1]}`;const n=e.match(/vimeo\.com\/(\d+)/);return n?`https://player.vimeo.com/video/${n[1]}`:e}},map:{label:"Carte",icon:"iconoir:map-pin",placeholder:"Collez l'url d'int\xE9gration Google Maps\u2026",title:"Carte",height:400,toSrc:e=>e},form:{label:"Formulaire",icon:"iconoir:list-select",placeholder:"Collez l'url du formulaire (Typeform\u2026)\u2026",title:"Formulaire",height:500,toSrc:e=>e}},B=e=>e.content.childCount===1&&e.content.firstChild!==null&&e.content.firstChild.isTextblock&&e.openStart>0&&e.openEnd>0,y=N.extend({addAttributes(){return{toggle:{default:!0}}},addProseMirrorPlugins(){return[...this.parent?.()??[],new R({key:new U("communDetailsSummaryPaste"),props:{handlePaste:(e,t,n)=>{if(B(n))return!1;const{$head:o}=e.state.selection;for(let r=o.depth;r>0;r--){if(o.node(r).type.name!=="detailsSummary")continue;if(o.node(r-1).type.name!=="details")return!1;const a=o.after(r),l=e.state.tr.replaceRange(a+1,a+1,n),i=Math.min(a+1+n.size,l.doc.content.size);return l.setSelection(F.near(l.doc.resolve(i),-1)),l.setMeta("communDetailsOpenAt",a+1),e.dispatch(l.scrollIntoView()),!0}return!1}}})]}}),C=z,L=$,A=u.create({name:"imageUpload",group:"block",atom:!0,draggable:!0,addOptions(){return{upload:null}},parseHTML(){return[{tag:'div[data-type="image-upload"]'}]},renderHTML({HTMLAttributes:e}){return["div",d(e,{"data-type":"image-upload"})]},addCommands(){return{insertUploadPlaceholder:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}}}),_={code:!1,codeBlock:!1,strike:!1,underline:!1,trailingNode:!1,link:!1,orderedList:!1},T=k.extend({addAttributes(){const{title:e,...t}=this.parent?.()??{};return t}}).configure({openOnClick:!1,HTMLAttributes:{class:"underline text-primary",target:"_blank"}}),M=E.extend({addAttributes(){const{type:e,...t}=this.parent?.()??{};return t}});function K(e){const t=async(n,o,r)=>{for(const a of o){const{id:l,src:i,title:x}=await e(a),s={type:a.type.startsWith("image/")?"image":"file",attrs:{id:l,src:i,title:x}};r==null?n.chain().focus().insertContent(s).run():n.chain().insertContentAt(r,s).run()}};return v.configure({onDrop:(n,o,r)=>{t(n,o,r)},onPaste:(n,o)=>{t(n,o)}})}function Y(e={}){const t={upload:e.upload??null,fetch:e.fetch??null};return[m,...e.upload?[K(e.upload)]:[],T,M,S.configure({types:["heading","paragraph"]}),H.extend({priority:100}),D.configure({multicolor:!0}),w,p,A.configure({upload:t.upload}),g.configure(t),h.configure(t),b,y,C,L]}function j(e){let t=!1;const n=r=>{if(!r||typeof r!="object")return r;if(r.type==="text"&&!r.text)return t=!0,null;if(Array.isArray(r.content)){const a=r.content.map(n).filter(Boolean);return a.length!==r.content.length?{...r,content:a}:a.some((l,i)=>l!==r.content[i])?{...r,content:a}:r}return r},o=n(e);return t&&typeof console<"u"&&console.warn("[editor] repaired document: empty text node(s) dropped"),o}export{p as Callout,y as Details,L as DetailsContent,C as DetailsSummary,V as EMBED_SERVICES,b as Embed,g as FileNode,h as ImageNode,T as OpenCommuneLink,M as OpenCommuneOrderedList,c as UID_TYPES,m as Uid,A as UploadPlaceholder,f as fileInputRegex,Y as openCommuneSchemaExtensions,_ as openCommuneStarterKit,j as sanitizeDoc};
package/package.json CHANGED
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "description": "The rich-text editor: document schema, extensions and their sanitisation.",
38
38
  "license": "AGPL-3.0-or-later",
39
- "version": "0.1.4",
39
+ "version": "0.1.5",
40
40
  "sideEffects": false,
41
41
  "files": [
42
42
  "dist"