@edifice.io/tiptap-extensions 2.1.0-develop-enabling.0 → 2.1.0-develop-b2school.20250204153130
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/attachment/attachment.cjs +1 -1
- package/dist/attachment/attachment.cjs.map +1 -1
- package/dist/attachment/attachment.d.ts +1 -0
- package/dist/attachment/attachment.js +16 -1
- package/dist/attachment/attachment.js.map +1 -1
- package/dist/audio/audio.cjs +1 -1
- package/dist/audio/audio.cjs.map +1 -1
- package/dist/audio/audio.js +4 -1
- package/dist/audio/audio.js.map +1 -1
- package/dist/conversation-history/conversation-history.cjs +2 -0
- package/dist/conversation-history/conversation-history.cjs.map +1 -0
- package/dist/conversation-history/conversation-history.d.ts +32 -0
- package/dist/conversation-history/conversation-history.js +63 -0
- package/dist/conversation-history/conversation-history.js.map +1 -0
- package/dist/conversation-history/index.d.ts +1 -0
- package/dist/image/image.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/video/video.js +1 -1
- package/package.json +31 -21
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Attachment=core.Node.create({name:"attachments",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:"attachments"}}},parseHTML(){return[{tag:"div[class=attachments]"}]},renderHTML({HTMLAttributes}){const renderedLinks=HTMLAttributes.links.map(el=>["a",{name:el.name,href:el.href,documentId:el.documentId,dataContentType:el.dataContentType},el.name]);return["div",this.options.HTMLAttributes,...renderedLinks]},addAttributes(){return{links:{default:[],parseHTML:element=>{const links=element.getElementsByTagName("a"),parsedLinks=[];for(let i=0;i<links.length;i++){const link=links[i],href=link.getAttribute("href"),name=link.textContent,regexResult=href.match(/([^/]+$)/),documentId=link.getAttribute("data-document-id")||regexResult&®exResult[0],dataContentType=link.getAttribute("data-content-type");parsedLinks.push({href,name,documentId,dataContentType})}return parsedLinks},renderHTML:attributes=>({links:attributes.links.map(link=>({href:link.href,name:link.name,documentId:link.documentId,dataContentType:link.dataContentType}))})}}},addCommands(){return{setAttachment:(attrs={dataContentType:"",name:"",documentId:"",href:""})=>({chain})=>chain().insertContent({type:this.name,attrs}).run()}}});exports.Attachment=Attachment;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Attachment=core.Node.create({name:"attachments",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:"attachments"}}},parseHTML(){return[{tag:"div[class=attachments]"}]},renderHTML({HTMLAttributes}){const renderedLinks=HTMLAttributes.links.map(el=>["a",{name:el.name,href:el.href,documentId:el.documentId,dataContentType:el.dataContentType},el.name]);return["div",this.options.HTMLAttributes,...renderedLinks]},addAttributes(){return{links:{default:[],parseHTML:element=>{const links=element.getElementsByTagName("a"),parsedLinks=[];for(let i=0;i<links.length;i++){const link=links[i],href=link.getAttribute("href"),name=link.textContent,regexResult=href.match(/([^/]+$)/),documentId=link.getAttribute("data-document-id")||regexResult&®exResult[0],dataContentType=link.getAttribute("data-content-type");parsedLinks.push({href,name,documentId,dataContentType})}return parsedLinks},renderHTML:attributes=>({links:attributes.links.map(link=>({href:link.href,name:link.name,documentId:link.documentId,dataContentType:link.dataContentType}))})}}},addCommands(){return{setAttachment:(attrs={dataContentType:"",name:"",documentId:"",href:""})=>({chain})=>chain().insertContent({type:this.name,attrs}).run(),unsetAttachment:documentId=>({state,dispatch})=>{const{selection}=state,{from,to}=selection;return state.doc.nodesBetween(from,to,(node,pos)=>{if(node.type.name===this.name&&node.attrs.links.length>1){const newLinks=node.attrs.links.filter(link=>link.documentId!==documentId);if(newLinks.length!==node.attrs.links.length){const newAttrs={...node.attrs,links:newLinks};dispatch(state.tr.setNodeMarkup(pos,void 0,newAttrs))}}else dispatch(state.tr.delete(from,to))}),!0}}}});exports.Attachment=Attachment;
|
|
2
2
|
//# sourceMappingURL=attachment.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.cjs","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"
|
|
1
|
+
{"version":3,"file":"attachment.cjs","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n unsetAttachment: (documentId: string) => ReturnType; // Modification de la commande\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n unsetAttachment:\n (documentId: string) =>\n ({ state, dispatch }) => {\n const { selection } = state;\n const { from, to } = selection;\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.type.name === this.name && node.attrs.links.length > 1) {\n const newLinks = node.attrs.links.filter(\n (link) => link.documentId !== documentId,\n );\n if (newLinks.length !== node.attrs.links.length) {\n const newAttrs = { ...node.attrs, links: newLinks };\n dispatch(state.tr.setNodeMarkup(pos, undefined, newAttrs));\n }\n } else {\n dispatch(state.tr.delete(from, to));\n }\n });\n return true;\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAea,WAAaA,UAAK,OAA0B,CACvD,KAAM,cACN,QAAS,GACT,MAAO,GACP,MAAO,QACP,WAAY,GACZ,KAAM,GACN,UAAW,GAEX,YAAa,CACJ,MAAA,CACL,eAAgB,CACd,MAAO,aAAA,CAEX,CACF,EAEA,WAAY,CACV,MAAO,CAAC,CAAE,IAAK,yBAA0B,CAC3C,EAEA,WAAW,CAAE,gBAAkB,CAG7B,MAAM,cAFQ,eAAe,MAED,IAAK,IACxB,CACL,IACA,CACE,KAAM,GAAG,KACT,KAAM,GAAG,KACT,WAAY,GAAG,WACf,gBAAiB,GAAG,eACtB,EACA,GAAG,IACL,CACD,EAED,MAAO,CAAC,MAAO,KAAK,QAAQ,eAAgB,GAAG,aAAa,CAC9D,EAEA,eAAgB,CACP,MAAA,CACL,MAAO,CACL,QAAS,CAAC,EACV,UAAY,SAAY,CAChB,MAAA,MAAQ,QAAQ,qBAAqB,GAAG,EACxC,YAAc,CAAC,EAErB,QAAS,EAAI,EAAG,EAAI,MAAM,OAAQ,IAAK,CAC/B,MAAA,KAAO,MAAM,CAAC,EACd,KAAO,KAAK,aAAa,MAAM,EAC/B,KAAO,KAAK,YACZ,YAAc,KAAK,MAAM,UAAU,EACnC,WACJ,KAAK,aAAa,kBAAkB,GACnC,aAAe,YAAY,CAAC,EACzB,gBAAkB,KAAK,aAAa,mBAAmB,EAE7D,YAAY,KAAK,CACf,KACA,KACA,WACA,eAAA,CACD,CAAA,CAGI,OAAA,WACT,EACA,WAAa,aACJ,CACL,MAAO,WAAW,MAAM,IAAK,OAAU,CACrC,KAAM,KAAK,KACX,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,gBAAiB,KAAK,eAAA,EACtB,CACJ,EACF,CAEJ,CACF,EAEA,aAAc,CACL,MAAA,CACL,cACE,CACE,MAAQ,CACN,gBAAiB,GACjB,KAAM,GACN,WAAY,GACZ,KAAM,EAAA,IAGV,CAAC,CAAE,SACM,MAAA,EAAQ,cAAc,CAAE,KAAM,KAAK,KAAM,MAAO,EAAE,IAAI,EAEjE,gBACG,YACD,CAAC,CAAE,MAAO,YAAe,CACjB,KAAA,CAAE,WAAc,MAChB,CAAE,KAAM,EAAA,EAAO,UACrB,aAAM,IAAI,aAAa,KAAM,GAAI,CAAC,KAAM,MAAQ,CAC1C,GAAA,KAAK,KAAK,OAAS,KAAK,MAAQ,KAAK,MAAM,MAAM,OAAS,EAAG,CACzD,MAAA,SAAW,KAAK,MAAM,MAAM,OAC/B,MAAS,KAAK,aAAe,UAChC,EACA,GAAI,SAAS,SAAW,KAAK,MAAM,MAAM,OAAQ,CAC/C,MAAM,SAAW,CAAE,GAAG,KAAK,MAAO,MAAO,QAAS,EAClD,SAAS,MAAM,GAAG,cAAc,IAAK,OAAW,QAAQ,CAAC,CAAA,CAC3D,MAEA,SAAS,MAAM,GAAG,OAAO,KAAM,EAAE,CAAC,CACpC,CACD,EACM,EAAA,CAEb,CAAA,CAEJ,CAAC"}
|
|
@@ -65,7 +65,22 @@ const Attachment = Node.create({
|
|
|
65
65
|
name: "",
|
|
66
66
|
documentId: "",
|
|
67
67
|
href: ""
|
|
68
|
-
}) => ({ chain }) => chain().insertContent({ type: this.name, attrs }).run()
|
|
68
|
+
}) => ({ chain }) => chain().insertContent({ type: this.name, attrs }).run(),
|
|
69
|
+
unsetAttachment: (documentId) => ({ state, dispatch }) => {
|
|
70
|
+
const { selection } = state, { from, to } = selection;
|
|
71
|
+
return state.doc.nodesBetween(from, to, (node, pos) => {
|
|
72
|
+
if (node.type.name === this.name && node.attrs.links.length > 1) {
|
|
73
|
+
const newLinks = node.attrs.links.filter(
|
|
74
|
+
(link) => link.documentId !== documentId
|
|
75
|
+
);
|
|
76
|
+
if (newLinks.length !== node.attrs.links.length) {
|
|
77
|
+
const newAttrs = { ...node.attrs, links: newLinks };
|
|
78
|
+
dispatch(state.tr.setNodeMarkup(pos, void 0, newAttrs));
|
|
79
|
+
}
|
|
80
|
+
} else
|
|
81
|
+
dispatch(state.tr.delete(from, to));
|
|
82
|
+
}), !0;
|
|
83
|
+
}
|
|
69
84
|
};
|
|
70
85
|
}
|
|
71
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.js","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"attachment.js","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n unsetAttachment: (documentId: string) => ReturnType; // Modification de la commande\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n unsetAttachment:\n (documentId: string) =>\n ({ state, dispatch }) => {\n const { selection } = state;\n const { from, to } = selection;\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.type.name === this.name && node.attrs.links.length > 1) {\n const newLinks = node.attrs.links.filter(\n (link) => link.documentId !== documentId,\n );\n if (newLinks.length !== node.attrs.links.length) {\n const newAttrs = { ...node.attrs, links: newLinks };\n dispatch(state.tr.setNodeMarkup(pos, undefined, newAttrs));\n }\n } else {\n dispatch(state.tr.delete(from, to));\n }\n });\n return true;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAea,MAAA,aAAa,KAAK,OAA0B;AAAA,EACvD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACJ,WAAA;AAAA,MACL,gBAAgB;AAAA,QACd,OAAO;AAAA,MAAA;AAAA,IAEX;AAAA,EACF;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,0BAA0B;AAAA,EAC3C;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAG7B,UAAM,gBAFQ,eAAe,MAED,IAAI,CAAC,OACxB;AAAA,MACL;AAAA,MACA;AAAA,QACE,MAAM,GAAG;AAAA,QACT,MAAM,GAAG;AAAA,QACT,YAAY,GAAG;AAAA,QACf,iBAAiB,GAAG;AAAA,MACtB;AAAA,MACA,GAAG;AAAA,IACL,CACD;AAED,WAAO,CAAC,OAAO,KAAK,QAAQ,gBAAgB,GAAG,aAAa;AAAA,EAC9D;AAAA,EAEA,gBAAgB;AACP,WAAA;AAAA,MACL,OAAO;AAAA,QACL,SAAS,CAAC;AAAA,QACV,WAAW,CAAC,YAAY;AAChB,gBAAA,QAAQ,QAAQ,qBAAqB,GAAG,GACxC,cAAc,CAAC;AAErB,mBAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AAC/B,kBAAA,OAAO,MAAM,CAAC,GACd,OAAO,KAAK,aAAa,MAAM,GAC/B,OAAO,KAAK,aACZ,cAAc,KAAK,MAAM,UAAU,GACnC,aACJ,KAAK,aAAa,kBAAkB,KACnC,eAAe,YAAY,CAAC,GACzB,kBAAkB,KAAK,aAAa,mBAAmB;AAE7D,wBAAY,KAAK;AAAA,cACf;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YAAA,CACD;AAAA,UAAA;AAGI,iBAAA;AAAA,QACT;AAAA,QACA,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,WAAW,MAAM,IAAI,CAAC,UAAU;AAAA,YACrC,MAAM,KAAK;AAAA,YACX,MAAM,KAAK;AAAA,YACX,YAAY,KAAK;AAAA,YACjB,iBAAiB,KAAK;AAAA,UAAA,EACtB;AAAA,QACJ;AAAA,MACF;AAAA,IAEJ;AAAA,EACF;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,eACE,CACE,QAAQ;AAAA,QACN,iBAAiB;AAAA,QACjB,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,MAAM;AAAA,MAAA,MAGV,CAAC,EAAE,YACM,MAAA,EAAQ,cAAc,EAAE,MAAM,KAAK,MAAM,OAAO,EAAE,IAAI;AAAA,MAEjE,iBACE,CAAC,eACD,CAAC,EAAE,OAAO,eAAe;AACjB,cAAA,EAAE,cAAc,OAChB,EAAE,MAAM,GAAA,IAAO;AACrB,qBAAM,IAAI,aAAa,MAAM,IAAI,CAAC,MAAM,QAAQ;AAC1C,cAAA,KAAK,KAAK,SAAS,KAAK,QAAQ,KAAK,MAAM,MAAM,SAAS,GAAG;AACzD,kBAAA,WAAW,KAAK,MAAM,MAAM;AAAA,cAChC,CAAC,SAAS,KAAK,eAAe;AAAA,YAChC;AACA,gBAAI,SAAS,WAAW,KAAK,MAAM,MAAM,QAAQ;AAC/C,oBAAM,WAAW,EAAE,GAAG,KAAK,OAAO,OAAO,SAAS;AAClD,uBAAS,MAAM,GAAG,cAAc,KAAK,QAAW,QAAQ,CAAC;AAAA,YAAA;AAAA,UAC3D;AAEA,qBAAS,MAAM,GAAG,OAAO,MAAM,EAAE,CAAC;AAAA,QACpC,CACD,GACM;AAAA,MAAA;AAAA,IAEb;AAAA,EAAA;AAEJ,CAAC;"}
|
package/dist/audio/audio.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Audio=core.Node.create({name:"audio",group:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Audio=core.Node.create({name:"audio",group:"inline",inline:!0,selectable:!0,draggable:!0,addAttributes(){return{src:{default:null,parseHTML:el=>el.getAttribute("src"),renderHTML:attrs=>({src:attrs.src})},documentId:{default:"",renderHTML:attributes=>({"data-document-id":attributes.documentId}),parseHTML:element=>element.getAttribute("data-document-id")}}},parseHTML(){return[{tag:"div.audio-wrapper>audio,audio",getAttrs:el=>({src:el.getAttribute("src")})}]},renderHTML({HTMLAttributes}){return["div",{class:"audio-wrapper"},["audio",core.mergeAttributes(HTMLAttributes)]]},addCommands(){return{setAudio:(id,src,options)=>({commands,state})=>commands.insertContentAt(state.selection,`<audio
|
|
2
2
|
src="${src}"
|
|
3
3
|
controls preload="none"
|
|
4
4
|
data-document-id="${id}"></audio>`,options)}}});exports.Audio=Audio;
|
package/dist/audio/audio.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.cjs","sources":["../../src/audio/audio.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core';\n\nexport interface AudioOptions {\n url: string;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n audio: {\n /**\n * Set a audio node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setAudio: (\n id: string,\n src: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n };\n }\n}\n\nexport const Audio = Node.create({\n name: 'audio',\n
|
|
1
|
+
{"version":3,"file":"audio.cjs","sources":["../../src/audio/audio.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core';\n\nexport interface AudioOptions {\n url: string;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n audio: {\n /**\n * Set a audio node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setAudio: (\n id: string,\n src: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n };\n }\n}\n\nexport const Audio = Node.create({\n name: 'audio',\n group: 'inline',\n\n inline: true,\n selectable: true,\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n documentId: {\n default: '',\n renderHTML: (attributes: any) => {\n return { 'data-document-id': attributes.documentId };\n },\n parseHTML: (element: any) => element.getAttribute('data-document-id'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.audio-wrapper>audio,audio',\n getAttrs: (el: any) => ({\n src: (el as HTMLAudioElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'audio-wrapper' },\n ['audio', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setAudio:\n (id, src, options) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<audio \n src=\"${src}\" \n controls preload=\"none\"\n data-document-id=\"${id}\"></audio>`,\n options,\n );\n },\n };\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAuBa,MAAQA,UAAK,OAAO,CAC/B,KAAM,QACN,MAAO,SAEP,OAAQ,GACR,WAAY,GACZ,UAAW,GAEX,eAAgB,CACP,MAAA,CACL,IAAK,CACH,QAAS,KACT,UAAY,IAAa,GAAuB,aAAa,KAAK,EAClE,WAAa,QAAgB,CAAE,IAAK,MAAM,GAAI,EAChD,EACA,WAAY,CACV,QAAS,GACT,WAAa,aACJ,CAAE,mBAAoB,WAAW,UAAW,GAErD,UAAY,SAAiB,QAAQ,aAAa,kBAAkB,CAAA,CAExE,CACF,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,gCACL,SAAW,KAAa,CACtB,IAAM,GAAwB,aAAa,KAAK,CAClD,EAAA,CAEJ,CACF,EAEA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CACL,MACA,CAAE,MAAO,eAAgB,EACzB,CAAC,QAASC,KAAgB,gBAAA,cAAc,CAAC,CAC3C,CACF,EAEA,aAAc,CACL,MAAA,CACL,SACE,CAAC,GAAI,IAAK,UACV,CAAC,CAAE,SAAU,SACJ,SAAS,gBACd,MAAM,UACN;AAAA,qBACS,GAAG;AAAA;AAAA,kCAEU,EAAE,aACxB,OACF,CAEN,CAAA,CAEJ,CAAC"}
|
package/dist/audio/audio.js
CHANGED
package/dist/audio/audio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.js","sources":["../../src/audio/audio.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core';\n\nexport interface AudioOptions {\n url: string;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n audio: {\n /**\n * Set a audio node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setAudio: (\n id: string,\n src: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n };\n }\n}\n\nexport const Audio = Node.create({\n name: 'audio',\n
|
|
1
|
+
{"version":3,"file":"audio.js","sources":["../../src/audio/audio.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core';\n\nexport interface AudioOptions {\n url: string;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n audio: {\n /**\n * Set a audio node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setAudio: (\n id: string,\n src: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n };\n }\n}\n\nexport const Audio = Node.create({\n name: 'audio',\n group: 'inline',\n\n inline: true,\n selectable: true,\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n documentId: {\n default: '',\n renderHTML: (attributes: any) => {\n return { 'data-document-id': attributes.documentId };\n },\n parseHTML: (element: any) => element.getAttribute('data-document-id'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.audio-wrapper>audio,audio',\n getAttrs: (el: any) => ({\n src: (el as HTMLAudioElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'audio-wrapper' },\n ['audio', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setAudio:\n (id, src, options) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<audio \n src=\"${src}\" \n controls preload=\"none\"\n data-document-id=\"${id}\"></audio>`,\n options,\n );\n },\n };\n },\n});\n"],"names":[],"mappings":";AAuBa,MAAA,QAAQ,KAAK,OAAO;AAAA,EAC/B,MAAM;AAAA,EACN,OAAO;AAAA,EAEP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW;AAAA,EAEX,gBAAgB;AACP,WAAA;AAAA,MACL,KAAK;AAAA,QACH,SAAS;AAAA,QACT,WAAW,CAAC,OAAa,GAAuB,aAAa,KAAK;AAAA,QAClE,YAAY,CAAC,WAAgB,EAAE,KAAK,MAAM,IAAI;AAAA,MAChD;AAAA,MACA,YAAY;AAAA,QACV,SAAS;AAAA,QACT,YAAY,CAAC,gBACJ,EAAE,oBAAoB,WAAW,WAAW;AAAA,QAErD,WAAW,CAAC,YAAiB,QAAQ,aAAa,kBAAkB;AAAA,MAAA;AAAA,IAExE;AAAA,EACF;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU,CAAC,QAAa;AAAA,UACtB,KAAM,GAAwB,aAAa,KAAK;AAAA,QAClD;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AAAA,EAEA,WAAW,EAAE,kBAAkB;AACtB,WAAA;AAAA,MACL;AAAA,MACA,EAAE,OAAO,gBAAgB;AAAA,MACzB,CAAC,SAAS,gBAAgB,cAAc,CAAC;AAAA,IAC3C;AAAA,EACF;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,UACE,CAAC,IAAI,KAAK,YACV,CAAC,EAAE,UAAU,YACJ,SAAS;AAAA,QACd,MAAM;AAAA,QACN;AAAA,qBACS,GAAG;AAAA;AAAA,kCAEU,EAAE;AAAA,QACxB;AAAA,MACF;AAAA,IAEN;AAAA,EAAA;AAEJ,CAAC;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),prosemirrorState=require("prosemirror-state"),ConversationHistory=core.Node.create({name:"converstationHistory",group:"block",content:"block",parseHTML(){return[{tag:"div.conversation-history"}]},renderHTML({HTMLAttributes}){return["div",core.mergeAttributes(HTMLAttributes,{class:"conversation-history"}),0]},addProseMirrorPlugins(){return[new prosemirrorState.Plugin({appendTransaction:(transactions,oldState,newState)=>{const tr=newState.tr;let modified=!1;const nodesAfterHr=[];return newState.doc.descendants((node,pos)=>{if(node.type.name==="horizontalRule"){const start=pos,end=newState.doc.content.size;if(newState.doc.nodesBetween(start,end,(n,p,parent)=>{if(n.type.name!=="horizontalRule"&&parent.type.name==="doc")nodesAfterHr.push({node:n,pos:p});else return!1}),nodesAfterHr.length>0){const groupNode=this.type.create({},nodesAfterHr.map(n=>n.node));tr.replaceWith(start,end,groupNode),modified=!0}return!1}}),modified?tr:null}})]}});exports.ConversationHistory=ConversationHistory;
|
|
2
|
+
//# sourceMappingURL=conversation-history.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-history.cjs","sources":["../../src/conversation-history/conversation-history.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core';\nimport { Plugin } from 'prosemirror-state';\n\n/**\n * The `ConversationHistory` node is a custom ProseMirror node that represents a block-level\n * container for conversation history. It is implemented using the `@tiptap/core` library.\n *\n * @name ConversationHistory\n * @group block\n * @content block\n *\n * @parseHTML\n * This method defines how to parse the HTML representation of the node. It looks for a `div`\n * element with the class `conversation-history`.\n *\n * @renderHTML\n * This method defines how to render the node as HTML. It creates a `div` element with the class\n * `conversation-history`.\n *\n * @addProseMirrorPlugins\n * This method adds a ProseMirror plugin to the node. The plugin appends a transaction that groups\n * all nodes after a horizontal rule (`horizontalRule`) into a single `conversationHistory` node.\n *\n * @plugin\n * The plugin's `appendTransaction` method is called whenever a transaction is appended. It checks\n * for nodes after a horizontal rule and groups them into a `conversationHistory` node if any are\n * found.\n *\n * @param transactions - The list of transactions that have been applied.\n * @param oldState - The previous editor state.\n * @param newState - The new editor state.\n * @returns A new transaction if modifications were made, otherwise `null`.\n */\nexport const ConversationHistory = Node.create({\n name: 'converstationHistory',\n group: 'block',\n content: 'block',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history' }),\n 0,\n ];\n },\n\n /**\n * Adds custom ProseMirror plugins to the editor.\n * When a horizontal rule is encountered, this plugin collects all nodes\n * following the horizontal rule until the end of the document.\n * These nodes are then grouped together and replaced with\n * a single node of the same type as the plugin's type.\n *\n * @returns {Plugin[]} An array of ProseMirror plugins.\n */\n addProseMirrorPlugins() {\n return [\n new Plugin({\n appendTransaction: (transactions, oldState, newState) => {\n const tr = newState.tr;\n let modified = false;\n const nodesAfterHr = [];\n\n newState.doc.descendants((node, pos) => {\n if (node.type.name === 'horizontalRule') {\n const start = pos;\n const end = newState.doc.content.size;\n\n newState.doc.nodesBetween(start, end, (n, p, parent) => {\n if (\n n.type.name !== 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n nodesAfterHr.push({ node: n, pos: p });\n } else {\n return false;\n }\n });\n\n if (nodesAfterHr.length > 0) {\n const groupNode = this.type.create(\n {},\n nodesAfterHr.map((n) => n.node),\n );\n tr.replaceWith(start, end, groupNode);\n modified = true;\n }\n return false;\n }\n });\n\n return modified ? tr : null;\n },\n }),\n ];\n },\n});\n"],"names":["Node","mergeAttributes","Plugin"],"mappings":"iKAiCa,oBAAsBA,UAAK,OAAO,CAC7C,KAAM,uBACN,MAAO,QACP,QAAS,QAET,WAAY,CACH,MAAA,CACL,CACE,IAAK,0BAAA,CAET,CACF,EAEA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAAE,MAAO,uBAAwB,EACjE,CACF,CACF,EAWA,uBAAwB,CACf,MAAA,CACL,IAAIC,wBAAO,CACT,kBAAmB,CAAC,aAAc,SAAU,WAAa,CACvD,MAAM,GAAK,SAAS,GACpB,IAAI,SAAW,GACf,MAAM,aAAe,CAAC,EAEtB,gBAAS,IAAI,YAAY,CAAC,KAAM,MAAQ,CAClC,GAAA,KAAK,KAAK,OAAS,iBAAkB,CACvC,MAAM,MAAQ,IACR,IAAM,SAAS,IAAI,QAAQ,KAa7B,GAXJ,SAAS,IAAI,aAAa,MAAO,IAAK,CAAC,EAAG,EAAG,SAAW,CACtD,GACE,EAAE,KAAK,OAAS,kBAChB,OAAO,KAAK,OAAS,MAErB,aAAa,KAAK,CAAE,KAAM,EAAG,IAAK,EAAG,MAE9B,OAAA,EACT,CACD,EAEG,aAAa,OAAS,EAAG,CACrB,MAAA,UAAY,KAAK,KAAK,OAC1B,CAAC,EACD,aAAa,IAAK,GAAM,EAAE,IAAI,CAChC,EACG,GAAA,YAAY,MAAO,IAAK,SAAS,EACzB,SAAA,EAAA,CAEN,MAAA,EAAA,CACT,CACD,EAEM,SAAW,GAAK,IAAA,CAE1B,CAAA,CACH,CAAA,CAEJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* The `ConversationHistory` node is a custom ProseMirror node that represents a block-level
|
|
4
|
+
* container for conversation history. It is implemented using the `@tiptap/core` library.
|
|
5
|
+
*
|
|
6
|
+
* @name ConversationHistory
|
|
7
|
+
* @group block
|
|
8
|
+
* @content block
|
|
9
|
+
*
|
|
10
|
+
* @parseHTML
|
|
11
|
+
* This method defines how to parse the HTML representation of the node. It looks for a `div`
|
|
12
|
+
* element with the class `conversation-history`.
|
|
13
|
+
*
|
|
14
|
+
* @renderHTML
|
|
15
|
+
* This method defines how to render the node as HTML. It creates a `div` element with the class
|
|
16
|
+
* `conversation-history`.
|
|
17
|
+
*
|
|
18
|
+
* @addProseMirrorPlugins
|
|
19
|
+
* This method adds a ProseMirror plugin to the node. The plugin appends a transaction that groups
|
|
20
|
+
* all nodes after a horizontal rule (`horizontalRule`) into a single `conversationHistory` node.
|
|
21
|
+
*
|
|
22
|
+
* @plugin
|
|
23
|
+
* The plugin's `appendTransaction` method is called whenever a transaction is appended. It checks
|
|
24
|
+
* for nodes after a horizontal rule and groups them into a `conversationHistory` node if any are
|
|
25
|
+
* found.
|
|
26
|
+
*
|
|
27
|
+
* @param transactions - The list of transactions that have been applied.
|
|
28
|
+
* @param oldState - The previous editor state.
|
|
29
|
+
* @param newState - The new editor state.
|
|
30
|
+
* @returns A new transaction if modifications were made, otherwise `null`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ConversationHistory: Node<any, any>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
import { Plugin } from "prosemirror-state";
|
|
3
|
+
const ConversationHistory = Node.create({
|
|
4
|
+
name: "converstationHistory",
|
|
5
|
+
group: "block",
|
|
6
|
+
content: "block",
|
|
7
|
+
parseHTML() {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
tag: "div.conversation-history"
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
},
|
|
14
|
+
renderHTML({ HTMLAttributes }) {
|
|
15
|
+
return [
|
|
16
|
+
"div",
|
|
17
|
+
mergeAttributes(HTMLAttributes, { class: "conversation-history" }),
|
|
18
|
+
0
|
|
19
|
+
];
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Adds custom ProseMirror plugins to the editor.
|
|
23
|
+
* When a horizontal rule is encountered, this plugin collects all nodes
|
|
24
|
+
* following the horizontal rule until the end of the document.
|
|
25
|
+
* These nodes are then grouped together and replaced with
|
|
26
|
+
* a single node of the same type as the plugin's type.
|
|
27
|
+
*
|
|
28
|
+
* @returns {Plugin[]} An array of ProseMirror plugins.
|
|
29
|
+
*/
|
|
30
|
+
addProseMirrorPlugins() {
|
|
31
|
+
return [
|
|
32
|
+
new Plugin({
|
|
33
|
+
appendTransaction: (transactions, oldState, newState) => {
|
|
34
|
+
const tr = newState.tr;
|
|
35
|
+
let modified = !1;
|
|
36
|
+
const nodesAfterHr = [];
|
|
37
|
+
return newState.doc.descendants((node, pos) => {
|
|
38
|
+
if (node.type.name === "horizontalRule") {
|
|
39
|
+
const start = pos, end = newState.doc.content.size;
|
|
40
|
+
if (newState.doc.nodesBetween(start, end, (n, p, parent) => {
|
|
41
|
+
if (n.type.name !== "horizontalRule" && parent.type.name === "doc")
|
|
42
|
+
nodesAfterHr.push({ node: n, pos: p });
|
|
43
|
+
else
|
|
44
|
+
return !1;
|
|
45
|
+
}), nodesAfterHr.length > 0) {
|
|
46
|
+
const groupNode = this.type.create(
|
|
47
|
+
{},
|
|
48
|
+
nodesAfterHr.map((n) => n.node)
|
|
49
|
+
);
|
|
50
|
+
tr.replaceWith(start, end, groupNode), modified = !0;
|
|
51
|
+
}
|
|
52
|
+
return !1;
|
|
53
|
+
}
|
|
54
|
+
}), modified ? tr : null;
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
ConversationHistory
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=conversation-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-history.js","sources":["../../src/conversation-history/conversation-history.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core';\nimport { Plugin } from 'prosemirror-state';\n\n/**\n * The `ConversationHistory` node is a custom ProseMirror node that represents a block-level\n * container for conversation history. It is implemented using the `@tiptap/core` library.\n *\n * @name ConversationHistory\n * @group block\n * @content block\n *\n * @parseHTML\n * This method defines how to parse the HTML representation of the node. It looks for a `div`\n * element with the class `conversation-history`.\n *\n * @renderHTML\n * This method defines how to render the node as HTML. It creates a `div` element with the class\n * `conversation-history`.\n *\n * @addProseMirrorPlugins\n * This method adds a ProseMirror plugin to the node. The plugin appends a transaction that groups\n * all nodes after a horizontal rule (`horizontalRule`) into a single `conversationHistory` node.\n *\n * @plugin\n * The plugin's `appendTransaction` method is called whenever a transaction is appended. It checks\n * for nodes after a horizontal rule and groups them into a `conversationHistory` node if any are\n * found.\n *\n * @param transactions - The list of transactions that have been applied.\n * @param oldState - The previous editor state.\n * @param newState - The new editor state.\n * @returns A new transaction if modifications were made, otherwise `null`.\n */\nexport const ConversationHistory = Node.create({\n name: 'converstationHistory',\n group: 'block',\n content: 'block',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history' }),\n 0,\n ];\n },\n\n /**\n * Adds custom ProseMirror plugins to the editor.\n * When a horizontal rule is encountered, this plugin collects all nodes\n * following the horizontal rule until the end of the document.\n * These nodes are then grouped together and replaced with\n * a single node of the same type as the plugin's type.\n *\n * @returns {Plugin[]} An array of ProseMirror plugins.\n */\n addProseMirrorPlugins() {\n return [\n new Plugin({\n appendTransaction: (transactions, oldState, newState) => {\n const tr = newState.tr;\n let modified = false;\n const nodesAfterHr = [];\n\n newState.doc.descendants((node, pos) => {\n if (node.type.name === 'horizontalRule') {\n const start = pos;\n const end = newState.doc.content.size;\n\n newState.doc.nodesBetween(start, end, (n, p, parent) => {\n if (\n n.type.name !== 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n nodesAfterHr.push({ node: n, pos: p });\n } else {\n return false;\n }\n });\n\n if (nodesAfterHr.length > 0) {\n const groupNode = this.type.create(\n {},\n nodesAfterHr.map((n) => n.node),\n );\n tr.replaceWith(start, end, groupNode);\n modified = true;\n }\n return false;\n }\n });\n\n return modified ? tr : null;\n },\n }),\n ];\n },\n});\n"],"names":[],"mappings":";;AAiCa,MAAA,sBAAsB,KAAK,OAAO;AAAA,EAC7C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EAET,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IAET;AAAA,EACF;AAAA,EAEA,WAAW,EAAE,kBAAkB;AACtB,WAAA;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB,EAAE,OAAO,wBAAwB;AAAA,MACjE;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,wBAAwB;AACf,WAAA;AAAA,MACL,IAAI,OAAO;AAAA,QACT,mBAAmB,CAAC,cAAc,UAAU,aAAa;AACvD,gBAAM,KAAK,SAAS;AACpB,cAAI,WAAW;AACf,gBAAM,eAAe,CAAC;AAEtB,0BAAS,IAAI,YAAY,CAAC,MAAM,QAAQ;AAClC,gBAAA,KAAK,KAAK,SAAS,kBAAkB;AACvC,oBAAM,QAAQ,KACR,MAAM,SAAS,IAAI,QAAQ;AAa7B,kBAXJ,SAAS,IAAI,aAAa,OAAO,KAAK,CAAC,GAAG,GAAG,WAAW;AACtD,oBACE,EAAE,KAAK,SAAS,oBAChB,OAAO,KAAK,SAAS;AAErB,+BAAa,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG;AAAA;AAE9B,yBAAA;AAAA,cACT,CACD,GAEG,aAAa,SAAS,GAAG;AACrB,sBAAA,YAAY,KAAK,KAAK;AAAA,kBAC1B,CAAC;AAAA,kBACD,aAAa,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,gBAChC;AACG,mBAAA,YAAY,OAAO,KAAK,SAAS,GACzB,WAAA;AAAA,cAAA;AAEN,qBAAA;AAAA,YAAA;AAAA,UACT,CACD,GAEM,WAAW,KAAK;AAAA,QAAA;AAAA,MAE1B,CAAA;AAAA,IACH;AAAA,EAAA;AAEJ,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './conversation-history';
|
package/dist/image/image.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImageResizer } from "@edifice.io/utilities";
|
|
2
|
-
import {
|
|
2
|
+
import { nodeInputRule, mergeAttributes } from "@tiptap/core";
|
|
3
3
|
import TiptapImage from "@tiptap/extension-image";
|
|
4
4
|
import { Plugin } from "prosemirror-state";
|
|
5
5
|
const IMAGE_INPUT_REGEX = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Image = TiptapImage.extend({
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const abbr=require("./abbr/abbr.cjs"),alert=require("./alert/alert.cjs"),attachmentTransformer=require("./attachment/attachment-transformer.cjs"),attachment=require("./attachment/attachment.cjs"),audio=require("./audio/audio.cjs"),fontSize=require("./font-size/font-size.cjs"),heading=require("./heading/heading.cjs"),highlight=require("./highlight/highlight.cjs"),hyperlink=require("./hyperlink/hyperlink.cjs"),iframe=require("./iframe/iframe.cjs"),image=require("./image/image.cjs"),lineHeight=require("./line-height/line-height.cjs"),linker=require("./linker/linker.cjs"),mathjax=require("./mathjax/mathjax.cjs"),paragraph=require("./paragraph/paragraph.cjs"),speechRecognition=require("./speech-recognition/speech-recognition.cjs"),speechSynthesis=require("./speech-synthesis/speech-synthesis.cjs"),tableCell=require("./table-cell/table-cell.cjs"),htmlToJson=require("./transform/html-to-json/html-to-json.cjs"),jsonToHtml=require("./transform/json-to-html/json-to-html.cjs"),video=require("./video/video.cjs");exports.Abbr=abbr.Abbr;exports.Alert=alert.Alert;exports.AttachmentTransformer=attachmentTransformer.AttachmentTransformer;exports.Attachment=attachment.Attachment;exports.Audio=audio.Audio;exports.FontSize=fontSize.FontSize;exports.CustomHeading=heading.CustomHeading;exports.CustomHighlight=highlight.CustomHighlight;exports.Hyperlink=hyperlink.Hyperlink;exports.Iframe=iframe.Iframe;exports.IMAGE_INPUT_REGEX=image.IMAGE_INPUT_REGEX;exports.Image=image.Image;exports.LineHeight=lineHeight.LineHeight;exports.Linker=linker.Linker;exports.MathJax=mathjax.MathJax;exports.Paragraph=paragraph.Paragraph;exports.SpeechRecognition=speechRecognition.SpeechRecognition;exports.SpeechSynthesis=speechSynthesis.SpeechSynthesis;exports.TableCell=tableCell.TableCell;exports.htmlToJson=htmlToJson;exports.jsonToHtml=jsonToHtml;exports.Video=video.Video;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const abbr=require("./abbr/abbr.cjs"),alert=require("./alert/alert.cjs"),attachmentTransformer=require("./attachment/attachment-transformer.cjs"),attachment=require("./attachment/attachment.cjs"),audio=require("./audio/audio.cjs"),conversationHistory=require("./conversation-history/conversation-history.cjs"),fontSize=require("./font-size/font-size.cjs"),heading=require("./heading/heading.cjs"),highlight=require("./highlight/highlight.cjs"),hyperlink=require("./hyperlink/hyperlink.cjs"),iframe=require("./iframe/iframe.cjs"),image=require("./image/image.cjs"),lineHeight=require("./line-height/line-height.cjs"),linker=require("./linker/linker.cjs"),mathjax=require("./mathjax/mathjax.cjs"),paragraph=require("./paragraph/paragraph.cjs"),speechRecognition=require("./speech-recognition/speech-recognition.cjs"),speechSynthesis=require("./speech-synthesis/speech-synthesis.cjs"),tableCell=require("./table-cell/table-cell.cjs"),htmlToJson=require("./transform/html-to-json/html-to-json.cjs"),jsonToHtml=require("./transform/json-to-html/json-to-html.cjs"),video=require("./video/video.cjs");exports.Abbr=abbr.Abbr;exports.Alert=alert.Alert;exports.AttachmentTransformer=attachmentTransformer.AttachmentTransformer;exports.Attachment=attachment.Attachment;exports.Audio=audio.Audio;exports.ConversationHistory=conversationHistory.ConversationHistory;exports.FontSize=fontSize.FontSize;exports.CustomHeading=heading.CustomHeading;exports.CustomHighlight=highlight.CustomHighlight;exports.Hyperlink=hyperlink.Hyperlink;exports.Iframe=iframe.Iframe;exports.IMAGE_INPUT_REGEX=image.IMAGE_INPUT_REGEX;exports.Image=image.Image;exports.LineHeight=lineHeight.LineHeight;exports.Linker=linker.Linker;exports.MathJax=mathjax.MathJax;exports.Paragraph=paragraph.Paragraph;exports.SpeechRecognition=speechRecognition.SpeechRecognition;exports.SpeechSynthesis=speechSynthesis.SpeechSynthesis;exports.TableCell=tableCell.TableCell;exports.htmlToJson=htmlToJson;exports.jsonToHtml=jsonToHtml;exports.Video=video.Video;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Alert } from "./alert/alert.js";
|
|
|
3
3
|
import { AttachmentTransformer } from "./attachment/attachment-transformer.js";
|
|
4
4
|
import { Attachment } from "./attachment/attachment.js";
|
|
5
5
|
import { Audio } from "./audio/audio.js";
|
|
6
|
+
import { ConversationHistory } from "./conversation-history/conversation-history.js";
|
|
6
7
|
import { FontSize } from "./font-size/font-size.js";
|
|
7
8
|
import { CustomHeading } from "./heading/heading.js";
|
|
8
9
|
import { CustomHighlight } from "./highlight/highlight.js";
|
|
@@ -25,6 +26,7 @@ export {
|
|
|
25
26
|
Attachment,
|
|
26
27
|
AttachmentTransformer,
|
|
27
28
|
Audio,
|
|
29
|
+
ConversationHistory,
|
|
28
30
|
CustomHeading,
|
|
29
31
|
CustomHighlight,
|
|
30
32
|
FontSize,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/video/video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node,
|
|
1
|
+
import { Node, nodeInputRule, mergeAttributes } from "@tiptap/core";
|
|
2
2
|
const VIDEO_INPUT_REGEX = /!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/, Video = Node.create({
|
|
3
3
|
name: "video",
|
|
4
4
|
group: "block",
|
package/package.json
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/tiptap-extensions",
|
|
3
|
-
"version": "2.1.0-develop-
|
|
3
|
+
"version": "2.1.0-develop-b2school.20250204153130",
|
|
4
4
|
"description": "Edifice Rich Text Editor Extensions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"edifice",
|
|
7
|
+
"rich text editor",
|
|
8
|
+
"tiptap",
|
|
9
|
+
"extensions"
|
|
10
|
+
],
|
|
5
11
|
"homepage": "https://github.com/edificeio/edifice-frontend-framework/tree/main/packages/extensions#readme",
|
|
6
12
|
"bugs": {
|
|
7
13
|
"url": "https://github.com/edificeio/edifice-frontend-framework/issues"
|
|
@@ -36,6 +42,10 @@
|
|
|
36
42
|
"import": "./dist/audio/audio.js",
|
|
37
43
|
"require": "./dist/audio/audio.cjs"
|
|
38
44
|
},
|
|
45
|
+
"./conversation-history": {
|
|
46
|
+
"import": "./dist/conversation-history/conversation-history.js",
|
|
47
|
+
"require": "./dist/conversation-history/conversation-history.cjs"
|
|
48
|
+
},
|
|
39
49
|
"./font-size": {
|
|
40
50
|
"import": "./dist/font-size/font-size.js",
|
|
41
51
|
"require": "./dist/font-size/font-size.cjs"
|
|
@@ -104,41 +114,41 @@
|
|
|
104
114
|
"dist"
|
|
105
115
|
],
|
|
106
116
|
"dependencies": {
|
|
107
|
-
"@tiptap/core": "2.
|
|
108
|
-
"@tiptap/extension-bold": "2.
|
|
109
|
-
"@tiptap/extension-document": "2.
|
|
110
|
-
"@tiptap/extension-heading": "2.
|
|
111
|
-
"@tiptap/extension-highlight": "2.
|
|
112
|
-
"@tiptap/extension-image": "2.
|
|
113
|
-
"@tiptap/extension-link": "2.
|
|
114
|
-
"@tiptap/extension-paragraph": "2.
|
|
115
|
-
"@tiptap/extension-table-cell": "2.
|
|
116
|
-
"@tiptap/extension-text": "2.
|
|
117
|
-
"@tiptap/extension-text-style": "2.
|
|
118
|
-
"@tiptap/html": "2.
|
|
119
|
-
"@tiptap/pm": "2.
|
|
120
|
-
"@tiptap/starter-kit": "2.
|
|
117
|
+
"@tiptap/core": "2.11.0",
|
|
118
|
+
"@tiptap/extension-bold": "2.11.0",
|
|
119
|
+
"@tiptap/extension-document": "2.11.0",
|
|
120
|
+
"@tiptap/extension-heading": "2.11.0",
|
|
121
|
+
"@tiptap/extension-highlight": "2.11.0",
|
|
122
|
+
"@tiptap/extension-image": "2.11.0",
|
|
123
|
+
"@tiptap/extension-link": "2.11.0",
|
|
124
|
+
"@tiptap/extension-paragraph": "2.11.0",
|
|
125
|
+
"@tiptap/extension-table-cell": "2.11.0",
|
|
126
|
+
"@tiptap/extension-text": "2.11.0",
|
|
127
|
+
"@tiptap/extension-text-style": "2.11.0",
|
|
128
|
+
"@tiptap/html": "2.11.0",
|
|
129
|
+
"@tiptap/pm": "2.11.0",
|
|
130
|
+
"@tiptap/starter-kit": "2.11.0",
|
|
121
131
|
"prosemirror-model": "^1.0.0",
|
|
122
132
|
"prosemirror-state": "^1.4.3",
|
|
123
133
|
"prosemirror-transform": "^1.0.0",
|
|
124
134
|
"prosemirror-view": "^1.27.0",
|
|
125
|
-
"vite": "
|
|
126
|
-
"vite-plugin-dts": "
|
|
127
|
-
"@edifice.io/utilities": "2.1.0-develop-
|
|
135
|
+
"vite": "^5.4.11",
|
|
136
|
+
"vite-plugin-dts": "^4.1.0",
|
|
137
|
+
"@edifice.io/utilities": "2.1.0-develop-b2school.20250204153130"
|
|
128
138
|
},
|
|
129
139
|
"devDependencies": {
|
|
130
140
|
"@types/dom-speech-recognition": "^0.0.1",
|
|
131
|
-
"@edifice.io/client": "2.1.0-develop-
|
|
141
|
+
"@edifice.io/client": "2.1.0-develop-b2school.20250204153130"
|
|
132
142
|
},
|
|
133
143
|
"publishConfig": {
|
|
134
144
|
"access": "public"
|
|
135
145
|
},
|
|
136
146
|
"scripts": {
|
|
137
147
|
"build": "vite build",
|
|
138
|
-
"fix": "eslint
|
|
148
|
+
"fix": "eslint --fix --report-unused-disable-directives --max-warnings 0",
|
|
139
149
|
"format": "pnpm run format:write && pnpm run format:check",
|
|
140
150
|
"format:check": "npx prettier --check \"src/**/*.ts\"",
|
|
141
151
|
"format:write": "npx prettier --write \"src/**/*.ts\"",
|
|
142
|
-
"lint": "eslint
|
|
152
|
+
"lint": "eslint"
|
|
143
153
|
}
|
|
144
154
|
}
|