@edifice.io/tiptap-extensions 2.2.9 → 2.2.10-develop-integration.20250619152658
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/abbr/abbr.cjs.map +1 -1
- package/dist/abbr/abbr.js.map +1 -1
- package/dist/alert/alert.cjs.map +1 -1
- package/dist/alert/alert.js.map +1 -1
- package/dist/attachment/attachment-transformer.cjs.map +1 -1
- package/dist/attachment/attachment-transformer.js.map +1 -1
- package/dist/attachment/attachment.cjs.map +1 -1
- package/dist/attachment/attachment.js.map +1 -1
- package/dist/audio/audio.cjs.map +1 -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 +2 -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/conversation-history-body/conversation-history-body.cjs +2 -0
- package/dist/conversation-history-body/conversation-history-body.cjs.map +1 -0
- package/dist/conversation-history-body/conversation-history-body.d.ts +2 -0
- package/dist/conversation-history-body/conversation-history-body.js +24 -0
- package/dist/conversation-history-body/conversation-history-body.js.map +1 -0
- package/dist/conversation-history-body/index.d.ts +1 -0
- package/dist/font-size/font-size.cjs.map +1 -1
- package/dist/font-size/font-size.js.map +1 -1
- package/dist/heading/heading.cjs.map +1 -1
- package/dist/heading/heading.js.map +1 -1
- package/dist/highlight/highlight.cjs.map +1 -1
- package/dist/highlight/highlight.js.map +1 -1
- package/dist/hyperlink/hyperlink.cjs.map +1 -1
- package/dist/hyperlink/hyperlink.js.map +1 -1
- package/dist/iframe/iframe.cjs.map +1 -1
- package/dist/iframe/iframe.js.map +1 -1
- package/dist/iframe/transformers/index.cjs.map +1 -1
- package/dist/iframe/transformers/index.js.map +1 -1
- package/dist/iframe/transformers/pad-transformer.cjs.map +1 -1
- package/dist/iframe/transformers/pad-transformer.js.map +1 -1
- package/dist/image/image.cjs.map +1 -1
- package/dist/image/image.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/information-pane/information-pane.cjs.map +1 -1
- package/dist/information-pane/information-pane.js.map +1 -1
- package/dist/line-height/line-height.cjs.map +1 -1
- package/dist/line-height/line-height.js.map +1 -1
- package/dist/linker/linker.cjs.map +1 -1
- package/dist/linker/linker.js.map +1 -1
- package/dist/mathjax/mathjax.cjs.map +1 -1
- package/dist/mathjax/mathjax.js.map +1 -1
- package/dist/paragraph/paragraph.cjs.map +1 -1
- package/dist/paragraph/paragraph.js.map +1 -1
- package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
- package/dist/speech-recognition/speech-recognition.js.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
- package/dist/table-cell/table-cell.cjs.map +1 -1
- package/dist/table-cell/table-cell.js.map +1 -1
- package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
- package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
- package/dist/video/video.cjs.map +1 -1
- package/dist/video/video.js.map +1 -1
- package/package.json +11 -3
package/dist/abbr/abbr.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abbr.cjs","sources":["../../src/abbr/abbr.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n abbr: {\n /**\n * Set an abbr mark\n */\n setAbbr: (src: string) => ReturnType;\n /**\n * Toggle an abbr mark\n */\n toggleAbbr: (src: string) => ReturnType;\n };\n }\n}\n\nexport const Abbr = Mark.create({\n name: 'abbr',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'abbr',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'abbr',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setAbbr:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name);\n },\n toggleAbbr:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name);\n },\n };\n },\n});\n"],"names":["Mark","mergeAttributes"],"mappings":"mHAiBa,KAAOA,
|
|
1
|
+
{"version":3,"file":"abbr.cjs","sources":["../../src/abbr/abbr.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n abbr: {\n /**\n * Set an abbr mark\n */\n setAbbr: (src: string) => ReturnType;\n /**\n * Toggle an abbr mark\n */\n toggleAbbr: (src: string) => ReturnType;\n };\n }\n}\n\nexport const Abbr = Mark.create({\n name: 'abbr',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'abbr',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'abbr',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setAbbr:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name);\n },\n toggleAbbr:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name);\n },\n };\n },\n});\n"],"names":["Mark","mergeAttributes"],"mappings":"mHAiBa,KAAOA,KAAAA,KAAK,OAAO,CAC9B,KAAM,OAEN,YAAa,CACX,MAAO,CACL,eAAgB,CAAA,CAAC,CACnB,EAGF,WAAY,CACV,MAAO,CACL,CACE,IAAK,MAAA,CACP,CACF,EAGF,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,OACAC,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CAAA,CACF,EAGF,aAAc,CACZ,MAAO,CACL,QACE,IACA,CAAC,CAAE,YACM,SAAS,QAAQ,KAAK,IAAI,EAErC,WACE,IACA,CAAC,CAAE,YACM,SAAS,WAAW,KAAK,IAAI,CACtC,CACJ,CAEJ,CAAC"}
|
package/dist/abbr/abbr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abbr.js","sources":["../../src/abbr/abbr.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n abbr: {\n /**\n * Set an abbr mark\n */\n setAbbr: (src: string) => ReturnType;\n /**\n * Toggle an abbr mark\n */\n toggleAbbr: (src: string) => ReturnType;\n };\n }\n}\n\nexport const Abbr = Mark.create({\n name: 'abbr',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'abbr',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'abbr',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setAbbr:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name);\n },\n toggleAbbr:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name);\n },\n };\n },\n});\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"abbr.js","sources":["../../src/abbr/abbr.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n abbr: {\n /**\n * Set an abbr mark\n */\n setAbbr: (src: string) => ReturnType;\n /**\n * Toggle an abbr mark\n */\n toggleAbbr: (src: string) => ReturnType;\n };\n }\n}\n\nexport const Abbr = Mark.create({\n name: 'abbr',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'abbr',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'abbr',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setAbbr:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name);\n },\n toggleAbbr:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name);\n },\n };\n },\n});\n"],"names":[],"mappings":";AAiBO,MAAM,OAAO,KAAK,OAAO;AAAA,EAC9B,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAA;AAAA,IAAC;AAAA,EACnB;AAAA,EAGF,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EACF;AAAA,EAGF,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EACF;AAAA,EAGF,cAAc;AACZ,WAAO;AAAA,MACL,SACE,MACA,CAAC,EAAE,eACM,SAAS,QAAQ,KAAK,IAAI;AAAA,MAErC,YACE,MACA,CAAC,EAAE,eACM,SAAS,WAAW,KAAK,IAAI;AAAA,IACtC;AAAA,EACJ;AAEJ,CAAC;"}
|
package/dist/alert/alert.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.cjs","sources":["../../src/alert/alert.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const Alert = Node.create({\n name: 'alert',\n content: 'inline+',\n marks: '',\n group: 'block',\n\n inline: false,\n selectable: true,\n draggable: true,\n\n parseHTML() {\n return [\n {\n tag: 'p.info',\n priority: 60,\n },\n {\n tag: 'p.warning',\n priority: 60,\n },\n {\n tag: 'div.info',\n priority: 60,\n },\n {\n tag: 'div.warning',\n priority: 60,\n },\n ];\n },\n addAttributes() {\n return {\n class: {\n default: 'info',\n parseHTML: (element) => {\n return element.getAttribute('class');\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n});\n"],"names":["Node"],"mappings":"mHAEa,MAAQA,
|
|
1
|
+
{"version":3,"file":"alert.cjs","sources":["../../src/alert/alert.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const Alert = Node.create({\n name: 'alert',\n content: 'inline+',\n marks: '',\n group: 'block',\n\n inline: false,\n selectable: true,\n draggable: true,\n\n parseHTML() {\n return [\n {\n tag: 'p.info',\n priority: 60,\n },\n {\n tag: 'p.warning',\n priority: 60,\n },\n {\n tag: 'div.info',\n priority: 60,\n },\n {\n tag: 'div.warning',\n priority: 60,\n },\n ];\n },\n addAttributes() {\n return {\n class: {\n default: 'info',\n parseHTML: (element) => {\n return element.getAttribute('class');\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n});\n"],"names":["Node"],"mappings":"mHAEa,MAAQA,KAAAA,KAAK,OAAO,CAC/B,KAAM,QACN,QAAS,UACT,MAAO,GACP,MAAO,QAEP,OAAQ,GACR,WAAY,GACZ,UAAW,GAEX,WAAY,CACV,MAAO,CACL,CACE,IAAK,SACL,SAAU,EAAA,EAEZ,CACE,IAAK,YACL,SAAU,EAAA,EAEZ,CACE,IAAK,WACL,SAAU,EAAA,EAEZ,CACE,IAAK,cACL,SAAU,EAAA,CACZ,CACF,EAEF,eAAgB,CACd,MAAO,CACL,MAAO,CACL,QAAS,OACT,UAAY,SACH,QAAQ,aAAa,OAAO,CACrC,CACF,CACF,EAEF,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CAAC,MAAO,eAAgB,CAAC,CAAA,CAEpC,CAAC"}
|
package/dist/alert/alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sources":["../../src/alert/alert.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const Alert = Node.create({\n name: 'alert',\n content: 'inline+',\n marks: '',\n group: 'block',\n\n inline: false,\n selectable: true,\n draggable: true,\n\n parseHTML() {\n return [\n {\n tag: 'p.info',\n priority: 60,\n },\n {\n tag: 'p.warning',\n priority: 60,\n },\n {\n tag: 'div.info',\n priority: 60,\n },\n {\n tag: 'div.warning',\n priority: 60,\n },\n ];\n },\n addAttributes() {\n return {\n class: {\n default: 'info',\n parseHTML: (element) => {\n return element.getAttribute('class');\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n});\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"alert.js","sources":["../../src/alert/alert.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const Alert = Node.create({\n name: 'alert',\n content: 'inline+',\n marks: '',\n group: 'block',\n\n inline: false,\n selectable: true,\n draggable: true,\n\n parseHTML() {\n return [\n {\n tag: 'p.info',\n priority: 60,\n },\n {\n tag: 'p.warning',\n priority: 60,\n },\n {\n tag: 'div.info',\n priority: 60,\n },\n {\n tag: 'div.warning',\n priority: 60,\n },\n ];\n },\n addAttributes() {\n return {\n class: {\n default: 'info',\n parseHTML: (element) => {\n return element.getAttribute('class');\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n});\n"],"names":[],"mappings":";AAEO,MAAM,QAAQ,KAAK,OAAO;AAAA,EAC/B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EAEP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW;AAAA,EAEX,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MAAA;AAAA,MAEZ;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MAAA;AAAA,MAEZ;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MAAA;AAAA,MAEZ;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,EACF;AAAA,EAEF,gBAAgB;AACd,WAAO;AAAA,MACL,OAAO;AAAA,QACL,SAAS;AAAA,QACT,WAAW,CAAC,YACH,QAAQ,aAAa,OAAO;AAAA,MACrC;AAAA,IACF;AAAA,EACF;AAAA,EAEF,WAAW,EAAE,kBAAkB;AAC7B,WAAO,CAAC,OAAO,gBAAgB,CAAC;AAAA,EAAA;AAEpC,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-transformer.cjs","sources":["../../src/attachment/attachment-transformer.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 AttachmentTransformer = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'inline',\n inline: true,\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":"mHAca,sBAAwBA,
|
|
1
|
+
{"version":3,"file":"attachment-transformer.cjs","sources":["../../src/attachment/attachment-transformer.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 AttachmentTransformer = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'inline',\n inline: true,\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":"mHAca,sBAAwBA,KAAAA,KAAK,OAA0B,CAClE,KAAM,cACN,QAAS,GACT,MAAO,GACP,MAAO,SACP,OAAQ,GACR,WAAY,GACZ,KAAM,GACN,UAAW,GAEX,YAAa,CACX,MAAO,CACL,eAAgB,CACd,MAAO,aAAA,CACT,CACF,EAGF,WAAY,CACV,MAAO,CAAC,CAAE,IAAK,yBAA0B,CAAA,EAG3C,WAAW,CAAE,gBAAkB,CAG7B,MAAM,cAFQ,eAAe,MAED,IAAK,IACxB,CACL,IACA,CACE,KAAM,GAAG,KACT,KAAM,GAAG,KACT,WAAY,GAAG,WACf,gBAAiB,GAAG,eAAA,EAEtB,GAAG,IAAA,CAEN,EAED,MAAO,CAAC,MAAO,KAAK,QAAQ,eAAgB,GAAG,aAAa,CAAA,EAG9D,eAAgB,CACd,MAAO,CACL,MAAO,CACL,QAAS,CAAA,EACT,UAAY,SAAY,CACtB,MAAM,MAAQ,QAAQ,qBAAqB,GAAG,EACxC,YAAc,CAAA,EAEpB,QAAS,EAAI,EAAG,EAAI,MAAM,OAAQ,IAAK,CACrC,MAAM,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,CAGH,OAAO,WAAA,EAET,WAAa,aACJ,CACL,MAAO,WAAW,MAAM,IAAK,OAAU,CACrC,KAAM,KAAK,KACX,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,gBAAiB,KAAK,eAAA,EACtB,CAAA,EAEN,CACF,CACF,EAGF,aAAc,CACZ,MAAO,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,IAAA,CAC3D,CACJ,CAEJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-transformer.js","sources":["../../src/attachment/attachment-transformer.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 AttachmentTransformer = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'inline',\n inline: true,\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-transformer.js","sources":["../../src/attachment/attachment-transformer.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 AttachmentTransformer = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'inline',\n inline: true,\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":";AAcO,MAAM,wBAAwB,KAAK,OAA0B;AAAA,EAClE,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB;AAAA,QACd,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,EACF;AAAA,EAGF,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,0BAA0B;AAAA,EAAA;AAAA,EAG3C,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,MAAA;AAAA,MAEtB,GAAG;AAAA,IAAA,CAEN;AAED,WAAO,CAAC,OAAO,KAAK,QAAQ,gBAAgB,GAAG,aAAa;AAAA,EAAA;AAAA,EAG9D,gBAAgB;AACd,WAAO;AAAA,MACL,OAAO;AAAA,QACL,SAAS,CAAA;AAAA,QACT,WAAW,CAAC,YAAY;AACtB,gBAAM,QAAQ,QAAQ,qBAAqB,GAAG,GACxC,cAAc,CAAA;AAEpB,mBAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,kBAAM,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;AAGH,iBAAO;AAAA,QAAA;AAAA,QAET,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,QAAA;AAAA,MAEN;AAAA,IACF;AAAA,EACF;AAAA,EAGF,cAAc;AACZ,WAAO;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,IAAA;AAAA,IAC3D;AAAA,EACJ;AAEJ,CAAC;"}
|
|
@@ -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 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,
|
|
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,KAAAA,KAAK,OAA0B,CACvD,KAAM,cACN,QAAS,GACT,MAAO,GACP,MAAO,QACP,WAAY,GACZ,KAAM,GACN,UAAW,GAEX,YAAa,CACX,MAAO,CACL,eAAgB,CACd,MAAO,aAAA,CACT,CACF,EAGF,WAAY,CACV,MAAO,CAAC,CAAE,IAAK,yBAA0B,CAAA,EAG3C,WAAW,CAAE,gBAAkB,CAG7B,MAAM,cAFQ,eAAe,MAED,IAAK,IACxB,CACL,IACA,CACE,KAAM,GAAG,KACT,KAAM,GAAG,KACT,WAAY,GAAG,WACf,gBAAiB,GAAG,eAAA,EAEtB,GAAG,IAAA,CAEN,EAED,MAAO,CAAC,MAAO,KAAK,QAAQ,eAAgB,GAAG,aAAa,CAAA,EAG9D,eAAgB,CACd,MAAO,CACL,MAAO,CACL,QAAS,CAAA,EACT,UAAY,SAAY,CACtB,MAAM,MAAQ,QAAQ,qBAAqB,GAAG,EACxC,YAAc,CAAA,EAEpB,QAAS,EAAI,EAAG,EAAI,MAAM,OAAQ,IAAK,CACrC,MAAM,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,CAGH,OAAO,WAAA,EAET,WAAa,aACJ,CACL,MAAO,WAAW,MAAM,IAAK,OAAU,CACrC,KAAM,KAAK,KACX,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,gBAAiB,KAAK,eAAA,EACtB,CAAA,EAEN,CACF,CACF,EAGF,aAAc,CACZ,MAAO,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,IAAA,EAE7D,gBACG,YACD,CAAC,CAAE,MAAO,YAAe,CACvB,KAAM,CAAE,WAAc,MAChB,CAAE,KAAM,EAAA,EAAO,UACrB,aAAM,IAAI,aAAa,KAAM,GAAI,CAAC,KAAM,MAAQ,CAC9C,GAAI,KAAK,KAAK,OAAS,KAAK,MAAQ,KAAK,MAAM,MAAM,OAAS,EAAG,CAC/D,MAAM,SAAW,KAAK,MAAM,MAAM,OAC/B,MAAS,KAAK,aAAe,UAAA,EAEhC,GAAI,SAAS,SAAW,KAAK,MAAM,MAAM,OAAQ,CAC/C,MAAM,SAAW,CAAE,GAAG,KAAK,MAAO,MAAO,QAAA,EACzC,SAAS,MAAM,GAAG,cAAc,IAAK,OAAW,QAAQ,CAAC,CAAA,CAC3D,MAEA,SAAS,MAAM,GAAG,OAAO,KAAM,EAAE,CAAC,CACpC,CACD,EACM,EAAA,CACT,CACJ,CAEJ,CAAC"}
|
|
@@ -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 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":";
|
|
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":";AAeO,MAAM,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;AACX,WAAO;AAAA,MACL,gBAAgB;AAAA,QACd,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,EACF;AAAA,EAGF,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,0BAA0B;AAAA,EAAA;AAAA,EAG3C,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,MAAA;AAAA,MAEtB,GAAG;AAAA,IAAA,CAEN;AAED,WAAO,CAAC,OAAO,KAAK,QAAQ,gBAAgB,GAAG,aAAa;AAAA,EAAA;AAAA,EAG9D,gBAAgB;AACd,WAAO;AAAA,MACL,OAAO;AAAA,QACL,SAAS,CAAA;AAAA,QACT,WAAW,CAAC,YAAY;AACtB,gBAAM,QAAQ,QAAQ,qBAAqB,GAAG,GACxC,cAAc,CAAA;AAEpB,mBAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,kBAAM,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;AAGH,iBAAO;AAAA,QAAA;AAAA,QAET,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,QAAA;AAAA,MAEN;AAAA,IACF;AAAA,EACF;AAAA,EAGF,cAAc;AACZ,WAAO;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,IAAA;AAAA,MAE7D,iBACE,CAAC,eACD,CAAC,EAAE,OAAO,eAAe;AACvB,cAAM,EAAE,cAAc,OAChB,EAAE,MAAM,GAAA,IAAO;AACrB,qBAAM,IAAI,aAAa,MAAM,IAAI,CAAC,MAAM,QAAQ;AAC9C,cAAI,KAAK,KAAK,SAAS,KAAK,QAAQ,KAAK,MAAM,MAAM,SAAS,GAAG;AAC/D,kBAAM,WAAW,KAAK,MAAM,MAAM;AAAA,cAChC,CAAC,SAAS,KAAK,eAAe;AAAA,YAAA;AAEhC,gBAAI,SAAS,WAAW,KAAK,MAAM,MAAM,QAAQ;AAC/C,oBAAM,WAAW,EAAE,GAAG,KAAK,OAAO,OAAO,SAAA;AACzC,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,IACT;AAAA,EACJ;AAEJ,CAAC;"}
|
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 group: 'block',\n\n selectable: true,\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLAudioElement).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,
|
|
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: 'block',\n\n selectable: true,\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLAudioElement).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,KAAAA,KAAK,OAAO,CAC/B,KAAM,QACN,MAAO,QAEP,WAAY,GACZ,UAAW,GAEX,eAAgB,CACd,MAAO,CACL,IAAK,CACH,QAAS,KACT,UAAY,IAAa,GAAwB,aAAa,KAAK,EACnE,WAAa,QAAgB,CAAE,IAAK,MAAM,GAAA,EAAI,EAEhD,WAAY,CACV,QAAS,GACT,WAAa,aACJ,CAAE,mBAAoB,WAAW,UAAA,GAE1C,UAAY,SAAiB,QAAQ,aAAa,kBAAkB,CAAA,CACtE,CACF,EAGF,WAAY,CACV,MAAO,CACL,CACE,IAAK,gCACL,SAAW,KAAa,CACtB,IAAM,GAAwB,aAAa,KAAK,CAAA,EAClD,CACF,CACF,EAGF,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACA,CAAE,MAAO,eAAA,EACT,CAAC,QAASC,KAAAA,gBAAgB,cAAc,CAAC,CAAA,CAC3C,EAGF,aAAc,CACZ,MAAO,CACL,SACE,CAAC,GAAI,IAAK,UACV,CAAC,CAAE,SAAU,SACJ,SAAS,gBACd,MAAM,UACN;AAAA,qBACS,GAAG;AAAA;AAAA,kCAEU,EAAE,aACxB,OAAA,CAEJ,CACJ,CAEJ,CAAC"}
|
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 group: 'block',\n\n selectable: true,\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLAudioElement).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":";
|
|
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: 'block',\n\n selectable: true,\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLAudioElement).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":";AAuBO,MAAM,QAAQ,KAAK,OAAO;AAAA,EAC/B,MAAM;AAAA,EACN,OAAO;AAAA,EAEP,YAAY;AAAA,EACZ,WAAW;AAAA,EAEX,gBAAgB;AACd,WAAO;AAAA,MACL,KAAK;AAAA,QACH,SAAS;AAAA,QACT,WAAW,CAAC,OAAa,GAAwB,aAAa,KAAK;AAAA,QACnE,YAAY,CAAC,WAAgB,EAAE,KAAK,MAAM,IAAA;AAAA,MAAI;AAAA,MAEhD,YAAY;AAAA,QACV,SAAS;AAAA,QACT,YAAY,CAAC,gBACJ,EAAE,oBAAoB,WAAW,WAAA;AAAA,QAE1C,WAAW,CAAC,YAAiB,QAAQ,aAAa,kBAAkB;AAAA,MAAA;AAAA,IACtE;AAAA,EACF;AAAA,EAGF,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU,CAAC,QAAa;AAAA,UACtB,KAAM,GAAwB,aAAa,KAAK;AAAA,QAAA;AAAA,MAClD;AAAA,IACF;AAAA,EACF;AAAA,EAGF,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,EAAE,OAAO,gBAAA;AAAA,MACT,CAAC,SAAS,gBAAgB,cAAc,CAAC;AAAA,IAAA;AAAA,EAC3C;AAAA,EAGF,cAAc;AACZ,WAAO;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,MAAA;AAAA,IAEJ;AAAA,EACJ;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,parent)=>{if(node.type.name==="horizontalRule"&&parent.type.name==="doc"){const start=pos,end=newState.doc.content.size;if(newState.doc.nodesBetween(start,end,(n,p,parent2)=>{if(n.type.name!=="horizontalRule"&&parent2.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":["/**\n * A Tiptap Node extension that creates a conversation history container.\n * This extension groups content blocks that appear after a horizontal rule\n * into a conversation history section.\n *\n * @extends Node\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history'.\n * It can parse HTML elements that match the same structure.\n *\n * For retrocompatibility, this extension also includes a ProseMirror plugin\n * that handles the grouping all the content after an horizontal rules into the\n * conversation-history children block.\n *\n * Usage:\n * ```\n * // Add to your Tiptap editor extensions\n * import { ConversationHistory } from './conversation-history'\n *\n * new Editor({\n * extensions: [\n * ConversationHistory,\n * // ... other extensions\n * ],\n * })\n * ```\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\nimport { Plugin } from 'prosemirror-state';\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, parent) => {\n if (\n node.type.name === 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\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","parent"],"mappings":"iKA+Ba,oBAAsBA,KAAAA,KAAK,OAAO,CAC7C,KAAM,uBACN,MAAO,QACP,QAAS,SAET,WAAY,CACV,MAAO,CACL,CACE,IAAK,0BAAA,CACP,CACF,EAGF,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAAE,MAAO,uBAAwB,EACjE,CAAA,CACF,EAYF,uBAAwB,CACtB,MAAO,CACL,IAAIC,wBAAO,CACT,kBAAmB,CAAC,aAAc,SAAU,WAAa,CACvD,MAAM,GAAK,SAAS,GACpB,IAAI,SAAW,GACf,MAAM,aAAe,CAAA,EAErB,gBAAS,IAAI,YAAY,CAAC,KAAM,IAAK,SAAW,CAC9C,GACE,KAAK,KAAK,OAAS,kBACnB,OAAO,KAAK,OAAS,MACrB,CACA,MAAM,MAAQ,IACR,IAAM,SAAS,IAAI,QAAQ,KAajC,GAXA,SAAS,IAAI,aAAa,MAAO,IAAK,CAAC,EAAG,EAAGC,UAAW,CACtD,GACE,EAAE,KAAK,OAAS,kBAChBA,QAAO,KAAK,OAAS,MAErB,aAAa,KAAK,CAAE,KAAM,EAAG,IAAK,EAAG,MAErC,OAAO,EACT,CACD,EAEG,aAAa,OAAS,EAAG,CAC3B,MAAM,UAAY,KAAK,KAAK,OAC1B,CAAA,EACA,aAAa,IAAK,GAAM,EAAE,IAAI,CAAA,EAEhC,GAAG,YAAY,MAAO,IAAK,SAAS,EACpC,SAAW,EAAA,CAEb,MAAO,EAAA,CACT,CACD,EAEM,SAAW,GAAK,IAAA,CACzB,CACD,CAAA,CACH,CAEJ,CAAC"}
|
|
@@ -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, parent) => {
|
|
38
|
+
if (node.type.name === "horizontalRule" && parent.type.name === "doc") {
|
|
39
|
+
const start = pos, end = newState.doc.content.size;
|
|
40
|
+
if (newState.doc.nodesBetween(start, end, (n, p, parent2) => {
|
|
41
|
+
if (n.type.name !== "horizontalRule" && parent2.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":["/**\n * A Tiptap Node extension that creates a conversation history container.\n * This extension groups content blocks that appear after a horizontal rule\n * into a conversation history section.\n *\n * @extends Node\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history'.\n * It can parse HTML elements that match the same structure.\n *\n * For retrocompatibility, this extension also includes a ProseMirror plugin\n * that handles the grouping all the content after an horizontal rules into the\n * conversation-history children block.\n *\n * Usage:\n * ```\n * // Add to your Tiptap editor extensions\n * import { ConversationHistory } from './conversation-history'\n *\n * new Editor({\n * extensions: [\n * ConversationHistory,\n * // ... other extensions\n * ],\n * })\n * ```\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\nimport { Plugin } from 'prosemirror-state';\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, parent) => {\n if (\n node.type.name === 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\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":["parent"],"mappings":";;AA+BO,MAAM,sBAAsB,KAAK,OAAO;AAAA,EAC7C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EAET,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EACF;AAAA,EAGF,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB,EAAE,OAAO,wBAAwB;AAAA,MACjE;AAAA,IAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYF,wBAAwB;AACtB,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,QACT,mBAAmB,CAAC,cAAc,UAAU,aAAa;AACvD,gBAAM,KAAK,SAAS;AACpB,cAAI,WAAW;AACf,gBAAM,eAAe,CAAA;AAErB,0BAAS,IAAI,YAAY,CAAC,MAAM,KAAK,WAAW;AAC9C,gBACE,KAAK,KAAK,SAAS,oBACnB,OAAO,KAAK,SAAS,OACrB;AACA,oBAAM,QAAQ,KACR,MAAM,SAAS,IAAI,QAAQ;AAajC,kBAXA,SAAS,IAAI,aAAa,OAAO,KAAK,CAAC,GAAG,GAAGA,YAAW;AACtD,oBACE,EAAE,KAAK,SAAS,oBAChBA,QAAO,KAAK,SAAS;AAErB,+BAAa,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG;AAAA;AAErC,yBAAO;AAAA,cACT,CACD,GAEG,aAAa,SAAS,GAAG;AAC3B,sBAAM,YAAY,KAAK,KAAK;AAAA,kBAC1B,CAAA;AAAA,kBACA,aAAa,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,gBAAA;AAEhC,mBAAG,YAAY,OAAO,KAAK,SAAS,GACpC,WAAW;AAAA,cAAA;AAEb,qBAAO;AAAA,YAAA;AAAA,UACT,CACD,GAEM,WAAW,KAAK;AAAA,QAAA;AAAA,MACzB,CACD;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './conversation-history';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),ConversationHistoryBody=core.Node.create({name:"converstationHistoryBody",group:"block",content:"block+",parseHTML(){return[{tag:"div.conversation-history-body"}]},renderHTML({HTMLAttributes}){return["div",core.mergeAttributes(HTMLAttributes,{class:"conversation-history-body"}),0]}});exports.ConversationHistoryBody=ConversationHistoryBody;
|
|
2
|
+
//# sourceMappingURL=conversation-history-body.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-history-body.cjs","sources":["../../src/conversation-history-body/conversation-history-body.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that represents a conversation history body.\n * This node is a block-level element that can contain one or more block elements.\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history-body'.\n * It can parse HTML elements that match the same structure.\n *\n * @group Block Nodes\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\n\nexport const ConversationHistoryBody = Node.create({\n name: 'converstationHistoryBody',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history-body',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history-body' }),\n 0,\n ];\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAYa,wBAA0BA,KAAAA,KAAK,OAAO,CACjD,KAAM,2BACN,MAAO,QACP,QAAS,SAET,WAAY,CACV,MAAO,CACL,CACE,IAAK,+BAAA,CACP,CACF,EAGF,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAAE,MAAO,4BAA6B,EACtE,CAAA,CACF,CAEJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
const ConversationHistoryBody = Node.create({
|
|
3
|
+
name: "converstationHistoryBody",
|
|
4
|
+
group: "block",
|
|
5
|
+
content: "block+",
|
|
6
|
+
parseHTML() {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
tag: "div.conversation-history-body"
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
},
|
|
13
|
+
renderHTML({ HTMLAttributes }) {
|
|
14
|
+
return [
|
|
15
|
+
"div",
|
|
16
|
+
mergeAttributes(HTMLAttributes, { class: "conversation-history-body" }),
|
|
17
|
+
0
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
ConversationHistoryBody
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=conversation-history-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-history-body.js","sources":["../../src/conversation-history-body/conversation-history-body.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that represents a conversation history body.\n * This node is a block-level element that can contain one or more block elements.\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history-body'.\n * It can parse HTML elements that match the same structure.\n *\n * @group Block Nodes\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\n\nexport const ConversationHistoryBody = Node.create({\n name: 'converstationHistoryBody',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history-body',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history-body' }),\n 0,\n ];\n },\n});\n"],"names":[],"mappings":";AAYO,MAAM,0BAA0B,KAAK,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EAET,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EACF;AAAA,EAGF,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB,EAAE,OAAO,6BAA6B;AAAA,MACtE;AAAA,IAAA;AAAA,EACF;AAEJ,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './conversation-history-body';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-size.cjs","sources":["../../src/font-size/font-size.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontSize: {\n /**\n * Set the font size\n */\n setFontSize: (fontSize: string) => ReturnType;\n /**\n * Unset the font size\n */\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n"],"names":["Extension"],"mappings":"2JAuBa,SAAWA,
|
|
1
|
+
{"version":3,"file":"font-size.cjs","sources":["../../src/font-size/font-size.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontSize: {\n /**\n * Set the font size\n */\n setFontSize: (fontSize: string) => ReturnType;\n /**\n * Unset the font size\n */\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n"],"names":["Extension"],"mappings":"2JAuBa,SAAWA,KAAAA,UAAU,OAAwB,CACxD,KAAM,WAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CAAA,CACrB,EAGF,qBAAsB,CACpB,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,SAAU,CACR,QAAS,KACT,UAAY,SAAA,QACV,kBAAQ,MAAM,WAAd,eAAwB,QAAQ,SAAU,KAC5C,WAAa,YACN,WAAW,SAIT,CACL,MAAO,cAAc,WAAW,QAAQ,EAAA,EAJjC,CAAA,CAMX,CACF,CACF,CACF,CACF,EAGF,aAAc,CACZ,MAAO,CACL,YACG,UACD,CAAC,CAAE,SACM,MAAA,EAAQ,QAAQ,YAAa,CAAE,QAAA,CAAU,EAAE,IAAA,EAEtD,cACE,IACA,CAAC,CAAE,SACM,MAAA,EACJ,QAAQ,YAAa,CAAE,SAAU,KAAM,EACvC,qBAAA,EACA,IAAA,CACL,CACJ,CAEJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-size.js","sources":["../../src/font-size/font-size.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontSize: {\n /**\n * Set the font size\n */\n setFontSize: (fontSize: string) => ReturnType;\n /**\n * Unset the font size\n */\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"font-size.js","sources":["../../src/font-size/font-size.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontSize: {\n /**\n * Set the font size\n */\n setFontSize: (fontSize: string) => ReturnType;\n /**\n * Unset the font size\n */\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n"],"names":[],"mappings":";;AAuBO,MAAM,WAAW,UAAU,OAAwB;AAAA,EACxD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO,CAAC,WAAW;AAAA,IAAA;AAAA,EACrB;AAAA,EAGF,sBAAsB;AACpB,WAAO;AAAA,MACL;AAAA,QACE,OAAO,KAAK,QAAQ;AAAA,QACpB,YAAY;AAAA,UACV,UAAU;AAAA,YACR,SAAS;AAAA,YACT,WAAW,CAAC,YAAA;;AACV,mCAAQ,MAAM,aAAd,mBAAwB,QAAQ,UAAU;AAAA;AAAA,YAC5C,YAAY,CAAC,eACN,WAAW,WAIT;AAAA,cACL,OAAO,cAAc,WAAW,QAAQ;AAAA,YAAA,IAJjC,CAAA;AAAA,UAMX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAGF,cAAc;AACZ,WAAO;AAAA,MACL,aACE,CAAC,aACD,CAAC,EAAE,YACM,MAAA,EAAQ,QAAQ,aAAa,EAAE,SAAA,CAAU,EAAE,IAAA;AAAA,MAEtD,eACE,MACA,CAAC,EAAE,YACM,MAAA,EACJ,QAAQ,aAAa,EAAE,UAAU,MAAM,EACvC,qBAAA,EACA,IAAA;AAAA,IACL;AAAA,EACJ;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.cjs","sources":["../../src/heading/heading.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport { Heading } from '@tiptap/extension-heading';\nimport '@tiptap/extension-text-style';\n\nexport declare type Level = 1 | 2;\n\ninterface Options {\n levels: Level[];\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customHeading: {\n /**\n * Apply Heading Level\n */\n setCustomHeading: (attributes: { level: Level }) => ReturnType;\n };\n }\n}\n\nexport const CustomHeading = Heading.extend<Options>({\n name: 'customHeading',\n\n addOptions() {\n return {\n ...this.parent?.(),\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return this.options.levels.map((level: Level) => ({\n tag: `h${level}`,\n attrs: { level },\n }));\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setCustomHeading:\n (attributes) =>\n ({ tr, dispatch, commands }) => {\n if (!this.options.levels.includes(attributes.level)) {\n return false;\n }\n\n const { selection } = tr;\n const { from, to } = selection;\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isBlock && from >= pos && to <= pos + node.nodeSize) {\n /* get node content and iterate through */\n node.content.forEach((content) => {\n /* get content marks and iterate through */\n content.marks.forEach((mark) => {\n /* find textStyle mark and if has fontSize attrs */\n if (\n mark.type.name === 'textStyle' &&\n mark.attrs['fontSize'] &&\n mark.attrs['fontSize'] !== null\n ) {\n /* remove any fontSize attr to reset heading style */\n tr = tr.removeMark(pos, pos + node.nodeSize, mark.type);\n }\n });\n });\n }\n });\n\n if (dispatch) {\n dispatch(tr);\n }\n return commands.setHeading({ level: attributes.level });\n },\n };\n },\n});\n"],"names":["Heading","mergeAttributes"],"mappings":"
|
|
1
|
+
{"version":3,"file":"heading.cjs","sources":["../../src/heading/heading.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport { Heading } from '@tiptap/extension-heading';\nimport '@tiptap/extension-text-style';\n\nexport declare type Level = 1 | 2;\n\ninterface Options {\n levels: Level[];\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customHeading: {\n /**\n * Apply Heading Level\n */\n setCustomHeading: (attributes: { level: Level }) => ReturnType;\n };\n }\n}\n\nexport const CustomHeading = Heading.extend<Options>({\n name: 'customHeading',\n\n addOptions() {\n return {\n ...this.parent?.(),\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return this.options.levels.map((level: Level) => ({\n tag: `h${level}`,\n attrs: { level },\n }));\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setCustomHeading:\n (attributes) =>\n ({ tr, dispatch, commands }) => {\n if (!this.options.levels.includes(attributes.level)) {\n return false;\n }\n\n const { selection } = tr;\n const { from, to } = selection;\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isBlock && from >= pos && to <= pos + node.nodeSize) {\n /* get node content and iterate through */\n node.content.forEach((content) => {\n /* get content marks and iterate through */\n content.marks.forEach((mark) => {\n /* find textStyle mark and if has fontSize attrs */\n if (\n mark.type.name === 'textStyle' &&\n mark.attrs['fontSize'] &&\n mark.attrs['fontSize'] !== null\n ) {\n /* remove any fontSize attr to reset heading style */\n tr = tr.removeMark(pos, pos + node.nodeSize, mark.type);\n }\n });\n });\n }\n });\n\n if (dispatch) {\n dispatch(tr);\n }\n return commands.setHeading({ level: attributes.level });\n },\n };\n },\n});\n"],"names":["Heading","mergeAttributes"],"mappings":"iNAsBO,MAAM,cAAgBA,iBAAAA,QAAQ,OAAgB,CACnD,KAAM,gBAEN,YAAa,QACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,eAAgB,CAAA,CAAC,CACnB,EAGF,WAAY,CACV,OAAO,KAAK,QAAQ,OAAO,IAAK,QAAkB,CAChD,IAAK,IAAI,KAAK,GACd,MAAO,CAAE,KAAA,CAAM,EACf,CAAA,EAGJ,WAAW,CAAE,KAAM,gBAAkB,CAInC,MAAO,CACL,IAJe,KAAK,QAAQ,OAAO,SAAS,KAAK,MAAM,KAAK,EACrC,KAAK,MAAM,MAAQ,KAAK,QAAQ,OAAO,CAAC,CAGtD,GACTC,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CAAA,CACF,EAGF,aAAc,CACZ,MAAO,CACL,iBACG,YACD,CAAC,CAAE,GAAI,SAAU,YAAe,CAC9B,GAAI,CAAC,KAAK,QAAQ,OAAO,SAAS,WAAW,KAAK,EAChD,MAAO,GAGT,KAAM,CAAE,WAAc,GAChB,CAAE,KAAM,EAAA,EAAO,UAErB,UAAG,IAAI,aAAa,KAAM,GAAI,CAAC,KAAM,MAAQ,CACvC,KAAK,SAAW,MAAQ,KAAO,IAAM,IAAM,KAAK,UAElD,KAAK,QAAQ,QAAS,SAAY,CAEhC,QAAQ,MAAM,QAAS,MAAS,CAG5B,KAAK,KAAK,OAAS,aACnB,KAAK,MAAM,UACX,KAAK,MAAM,WAAgB,OAG3B,GAAK,GAAG,WAAW,IAAK,IAAM,KAAK,SAAU,KAAK,IAAI,EACxD,CACD,CAAA,CACF,CACH,CACD,EAEG,UACF,SAAS,EAAE,EAEN,SAAS,WAAW,CAAE,MAAO,WAAW,MAAO,CAAA,CACxD,CACJ,CAEJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.js","sources":["../../src/heading/heading.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport { Heading } from '@tiptap/extension-heading';\nimport '@tiptap/extension-text-style';\n\nexport declare type Level = 1 | 2;\n\ninterface Options {\n levels: Level[];\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customHeading: {\n /**\n * Apply Heading Level\n */\n setCustomHeading: (attributes: { level: Level }) => ReturnType;\n };\n }\n}\n\nexport const CustomHeading = Heading.extend<Options>({\n name: 'customHeading',\n\n addOptions() {\n return {\n ...this.parent?.(),\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return this.options.levels.map((level: Level) => ({\n tag: `h${level}`,\n attrs: { level },\n }));\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setCustomHeading:\n (attributes) =>\n ({ tr, dispatch, commands }) => {\n if (!this.options.levels.includes(attributes.level)) {\n return false;\n }\n\n const { selection } = tr;\n const { from, to } = selection;\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isBlock && from >= pos && to <= pos + node.nodeSize) {\n /* get node content and iterate through */\n node.content.forEach((content) => {\n /* get content marks and iterate through */\n content.marks.forEach((mark) => {\n /* find textStyle mark and if has fontSize attrs */\n if (\n mark.type.name === 'textStyle' &&\n mark.attrs['fontSize'] &&\n mark.attrs['fontSize'] !== null\n ) {\n /* remove any fontSize attr to reset heading style */\n tr = tr.removeMark(pos, pos + node.nodeSize, mark.type);\n }\n });\n });\n }\n });\n\n if (dispatch) {\n dispatch(tr);\n }\n return commands.setHeading({ level: attributes.level });\n },\n };\n },\n});\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"heading.js","sources":["../../src/heading/heading.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport { Heading } from '@tiptap/extension-heading';\nimport '@tiptap/extension-text-style';\n\nexport declare type Level = 1 | 2;\n\ninterface Options {\n levels: Level[];\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customHeading: {\n /**\n * Apply Heading Level\n */\n setCustomHeading: (attributes: { level: Level }) => ReturnType;\n };\n }\n}\n\nexport const CustomHeading = Heading.extend<Options>({\n name: 'customHeading',\n\n addOptions() {\n return {\n ...this.parent?.(),\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return this.options.levels.map((level: Level) => ({\n tag: `h${level}`,\n attrs: { level },\n }));\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setCustomHeading:\n (attributes) =>\n ({ tr, dispatch, commands }) => {\n if (!this.options.levels.includes(attributes.level)) {\n return false;\n }\n\n const { selection } = tr;\n const { from, to } = selection;\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isBlock && from >= pos && to <= pos + node.nodeSize) {\n /* get node content and iterate through */\n node.content.forEach((content) => {\n /* get content marks and iterate through */\n content.marks.forEach((mark) => {\n /* find textStyle mark and if has fontSize attrs */\n if (\n mark.type.name === 'textStyle' &&\n mark.attrs['fontSize'] &&\n mark.attrs['fontSize'] !== null\n ) {\n /* remove any fontSize attr to reset heading style */\n tr = tr.removeMark(pos, pos + node.nodeSize, mark.type);\n }\n });\n });\n }\n });\n\n if (dispatch) {\n dispatch(tr);\n }\n return commands.setHeading({ level: attributes.level });\n },\n };\n },\n});\n"],"names":[],"mappings":";;;AAsBO,MAAM,gBAAgB,QAAQ,OAAgB;AAAA,EACnD,MAAM;AAAA,EAEN,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,gBAAgB,CAAA;AAAA,IAAC;AAAA,EACnB;AAAA,EAGF,YAAY;AACV,WAAO,KAAK,QAAQ,OAAO,IAAI,CAAC,WAAkB;AAAA,MAChD,KAAK,IAAI,KAAK;AAAA,MACd,OAAO,EAAE,MAAA;AAAA,IAAM,EACf;AAAA,EAAA;AAAA,EAGJ,WAAW,EAAE,MAAM,kBAAkB;AAInC,WAAO;AAAA,MACL,IAJe,KAAK,QAAQ,OAAO,SAAS,KAAK,MAAM,KAAK,IACrC,KAAK,MAAM,QAAQ,KAAK,QAAQ,OAAO,CAAC,CAGtD;AAAA,MACT,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EACF;AAAA,EAGF,cAAc;AACZ,WAAO;AAAA,MACL,kBACE,CAAC,eACD,CAAC,EAAE,IAAI,UAAU,eAAe;AAC9B,YAAI,CAAC,KAAK,QAAQ,OAAO,SAAS,WAAW,KAAK;AAChD,iBAAO;AAGT,cAAM,EAAE,cAAc,IAChB,EAAE,MAAM,GAAA,IAAO;AAErB,kBAAG,IAAI,aAAa,MAAM,IAAI,CAAC,MAAM,QAAQ;AAC3C,UAAI,KAAK,WAAW,QAAQ,OAAO,MAAM,MAAM,KAAK,YAElD,KAAK,QAAQ,QAAQ,CAAC,YAAY;AAEhC,oBAAQ,MAAM,QAAQ,CAAC,SAAS;AAE9B,cACE,KAAK,KAAK,SAAS,eACnB,KAAK,MAAM,YACX,KAAK,MAAM,aAAgB,SAG3B,KAAK,GAAG,WAAW,KAAK,MAAM,KAAK,UAAU,KAAK,IAAI;AAAA,YACxD,CACD;AAAA,UAAA,CACF;AAAA,QACH,CACD,GAEG,YACF,SAAS,EAAE,GAEN,SAAS,WAAW,EAAE,OAAO,WAAW,OAAO;AAAA,MAAA;AAAA,IACxD;AAAA,EACJ;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.cjs","sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":"uIAEa,gBAAkB,UAAU,OAAO,CAC9C,KAAM,kBAEN,YAAa,
|
|
1
|
+
{"version":3,"file":"highlight.cjs","sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":"uIAEa,gBAAkB,UAAU,OAAO,CAC9C,KAAM,kBAEN,YAAa,QACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,WAAY,GACZ,eAAgB,CAAA,CAAC,CACnB,EAGF,WAAY,QACV,MAAO,CACL,CACE,IAAG,QAAK,SAAL,0BACH,MAAO,mBACP,SAAW,QACF,CACL,MAAO,KAAA,EAEX,CACF,CACF,CAEJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.js","sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"highlight.js","sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":";AAEO,MAAM,kBAAkB,UAAU,OAAO;AAAA,EAC9C,MAAM;AAAA,EAEN,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,YAAY;AAAA,MACZ,gBAAgB,CAAA;AAAA,IAAC;AAAA,EACnB;AAAA,EAGF,YAAY;;AACV,WAAO;AAAA,MACL;AAAA,QACE,IAAG,UAAK,WAAL;AAAA,QACH,OAAO;AAAA,QACP,UAAU,CAAC,WACF;AAAA,UACL,OAAO;AAAA,QAAA;AAAA,MAEX;AAAA,IACF;AAAA,EACF;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hyperlink.cjs","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":["Link"],"mappings":"sIAsCa,UAAYA,
|
|
1
|
+
{"version":3,"file":"hyperlink.cjs","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":["Link"],"mappings":"sIAsCa,UAAYA,cAAAA,KAAK,OAAO,CACnC,KAAM,YAEN,WAAY,CACV,MAAO,CACL,CACE,IAAK,yCAGL,SAAW,MAA4B,CAErC,GACE,KAAK,aAAa,SAAS,GAC3B,KAAK,aAAa,iBAAiB,EAEnC,MAAO,EAAA,CACX,CACF,CACF,EAGF,YAAa,WACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,YAAa,GACb,eAAgB,CACd,IAAG,QAAK,SAAL,0BAAgB,eACnB,OAAQ,IAAA,CACV,CACF,EAIF,eAAgB,QACd,MAAO,CAEL,IAAG,QAAK,SAAL,0BAGH,OAAQ,CACN,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAW,KAAO,SACvD,WAAa,aAAgB,CAC3B,OAAQ,WAAW,MAAQ,EAC7B,EAEF,MAAO,CACL,QAAS,KAAK,QAAQ,eAAe,KAAA,CACvC,CACF,CAEJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hyperlink.js","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"hyperlink.js","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":[],"mappings":";AAsCO,MAAM,YAAY,KAAK,OAAO;AAAA,EACnC,MAAM;AAAA,EAEN,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA;AAAA;AAAA,QAGL,UAAU,CAAC,SAA4B;AAErC,cACE,KAAK,aAAa,SAAS,KAC3B,KAAK,aAAa,iBAAiB;AAEnC,mBAAO;AAAA,QAAA;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EAGF,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,aAAa;AAAA,MACb,gBAAgB;AAAA,QACd,IAAG,UAAK,WAAL,8BAAgB;AAAA,QACnB,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,EACF;AAAA;AAAA,EAIF,gBAAgB;;AACd,WAAO;AAAA;AAAA,MAEL,IAAG,UAAK,WAAL;AAAA;AAAA;AAAA,MAGH,QAAQ;AAAA,QACN,SAAS,KAAK,QAAQ,eAAe;AAAA;AAAA,QAErC,WAAW,CAAC,YACV,QAAQ,aAAa,QAAQ,MAAM,WAAW,OAAO;AAAA,QACvD,YAAY,CAAC,gBAAgB;AAAA,UAC3B,QAAQ,WAAW;AAAA,QAAQ;AAAA,MAC7B;AAAA,MAEF,OAAO;AAAA,QACL,SAAS,KAAK,QAAQ,eAAe;AAAA,MAAA;AAAA,IACvC;AAAA,EACF;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":["Node","iframeTransformer"],"mappings":"6JAqBa,OAASA,
|
|
1
|
+
{"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":["Node","iframeTransformer"],"mappings":"6JAqBa,OAASA,KAAAA,KAAK,OAAsB,CAC/C,KAAM,SACN,MAAO,QACP,KAAM,GACN,UAAW,GAEX,YAAa,CACX,MAAO,CACL,gBAAiB,GACjB,eAAgB,CACd,MAAO,gBAAA,CACT,CACF,EAGF,eAAgB,CACd,MAAO,CACL,IAAK,CACH,QAAS,IAAA,EAEX,YAAa,CACX,QAAS,CAAA,EAEX,gBAAiB,CACf,QAAS,KAAK,QAAQ,gBACtB,UAAW,IAAM,KAAK,QAAQ,eAAA,EAEhC,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MACE,WAAW,QAAU,OACjB,OACA,SAAS,WAAW,KAAK,CAAA,EAEjC,CAAA,EAEN,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,EAEtD,OAAQ,CACN,WAAa,YACJ,WAAW,OACd,CACE,OAAQ,SAAS,WAAW,MAAM,CAAA,EAEpC,CAAA,EAEN,UAAY,SAAY,QAAQ,aAAa,QAAQ,CAAA,EAEvD,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MAAO,WAAW,KAAA,EAEpB,CAAA,EAEN,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,CACtD,CACF,EAGF,WAAY,CACV,MAAO,CACL,CACE,IAAK,QAAA,CACP,CACF,EAGF,WAAW,CAAE,gBAAkB,CAE7BC,+BAAkB,aAAa,CAAE,eAAgB,EAC1C,CAAC,MAAO,KAAK,QAAQ,eAAgB,CAAC,SAAU,cAAc,CAAC,CAAA,EAGxE,aAAc,CACZ,MAAO,CACL,UACG,SACD,CAAC,CAAE,GAAI,YAAe,CACpB,KAAM,CAAE,WAAc,GAChB,KAAO,KAAK,KAAK,OAAO,OAAO,EAErC,OAAI,UACF,GAAG,iBAAiB,UAAU,KAAM,UAAU,GAAI,IAAI,EAGjD,EAAA,CACT,CACJ,CAEJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.js","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"iframe.js","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":[],"mappings":";;AAqBO,MAAM,SAAS,KAAK,OAAsB;AAAA,EAC/C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACX,WAAO;AAAA,MACL,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,QACd,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,EACF;AAAA,EAGF,gBAAgB;AACd,WAAO;AAAA,MACL,KAAK;AAAA,QACH,SAAS;AAAA,MAAA;AAAA,MAEX,aAAa;AAAA,QACX,SAAS;AAAA,MAAA;AAAA,MAEX,iBAAiB;AAAA,QACf,SAAS,KAAK,QAAQ;AAAA,QACtB,WAAW,MAAM,KAAK,QAAQ;AAAA,MAAA;AAAA,MAEhC,OAAO;AAAA,QACL,YAAY,CAAC,eACJ,WAAW,QACd;AAAA,UACE,OACE,WAAW,UAAU,SACjB,SACA,SAAS,WAAW,KAAK;AAAA,QAAA,IAEjC,CAAA;AAAA,QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MAAA;AAAA,MAEtD,QAAQ;AAAA,QACN,YAAY,CAAC,eACJ,WAAW,SACd;AAAA,UACE,QAAQ,SAAS,WAAW,MAAM;AAAA,QAAA,IAEpC,CAAA;AAAA,QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,QAAQ;AAAA,MAAA;AAAA,MAEvD,OAAO;AAAA,QACL,YAAY,CAAC,eACJ,WAAW,QACd;AAAA,UACE,OAAO,WAAW;AAAA,QAAA,IAEpB,CAAA;AAAA,QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MAAA;AAAA,IACtD;AAAA,EACF;AAAA,EAGF,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EACF;AAAA,EAGF,WAAW,EAAE,kBAAkB;AAE7B,6BAAkB,aAAa,EAAE,gBAAgB,GAC1C,CAAC,OAAO,KAAK,QAAQ,gBAAgB,CAAC,UAAU,cAAc,CAAC;AAAA,EAAA;AAAA,EAGxE,cAAc;AACZ,WAAO;AAAA,MACL,WACE,CAAC,YACD,CAAC,EAAE,IAAI,eAAe;AACpB,cAAM,EAAE,cAAc,IAChB,OAAO,KAAK,KAAK,OAAO,OAAO;AAErC,eAAI,YACF,GAAG,iBAAiB,UAAU,MAAM,UAAU,IAAI,IAAI,GAGjD;AAAA,MAAA;AAAA,IACT;AAAA,EACJ;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"names":["PadIframeTransformer"],"mappings":"0kBAMA,MAAM,wBAAsD,CAA5D,cACE,gCAAgB,CAAC,IAAIA,eAAAA,oBAAsB,GAC3C,aAAa,CAAE,gBAAkB,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"names":["PadIframeTransformer"],"mappings":"0kBAMA,MAAM,wBAAsD,CAA5D,cACE,gCAAgB,CAAC,IAAIA,eAAAA,oBAAsB,GAC3C,aAAa,CAAE,gBAAkB,CAC/B,UAAW,eAAe,kBAAK,eAC7B,YAAY,aAAa,CAAE,eAAgB,CAC7C,CAEJ,CANE,0BAQK,MAAM,kBACX,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,yBAAsD;AAAA,EAA5D;AACE,sCAAgB,CAAC,IAAI,sBAAsB;AAAA;AAAA,EAC3C,aAAa,EAAE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,yBAAsD;AAAA,EAA5D;AACE,sCAAgB,CAAC,IAAI,sBAAsB;AAAA;AAAA,EAC3C,aAAa,EAAE,kBAAkB;AAC/B,eAAW,eAAe,mBAAK;AAC7B,kBAAY,aAAa,EAAE,gBAAgB;AAAA,EAC7C;AAEJ;AANE;AAQK,MAAM,oBACX,IAAI,yBAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pad-transformer.cjs","sources":["../../../src/iframe/transformers/pad-transformer.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\n\n/**\n * This transformer is used to transform the pad URL to the embed URL inside the iframe\n * The embed URL is used to create a session for the pad before redirecting to the pad url\n */\nexport class PadIframeTransformer implements IframeTransformer {\n // Define the pad path\n private padPath = '/pad/';\n // Define the embed path\n private embedPath = '/collaborativeeditor/embed/';\n onRenderHTML({ HTMLAttributes }) {\n try {\n // Get host URL from the current window\n const currentUrl = window.location.href.split('?')[0];\n const baseUrl = new URL(currentUrl).origin;\n // Get Iframe src URL\n const srcUrl = new URL(HTMLAttributes.src);\n const pathMatch = srcUrl.pathname.match(\n new RegExp(`^${this.padPath}(.+)$`),\n );\n // Check if the src URL is from the same origin and matches the pad path\n if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {\n // Extract pad ID from the URL\n const padId = pathMatch[1].replace(/^p\\//i, '');\n // Create a new URL with the embed path\n const newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);\n // Copy search params from the src URL to the new URL\n srcUrl.searchParams.forEach((value, key) => {\n newUrl.searchParams.set(key, value);\n });\n // Set the new URL\n HTMLAttributes.src = newUrl.toString();\n }\n } catch (e) {\n console.error('Error transforming pad URL:', e);\n }\n }\n}\n"],"names":[],"mappings":"gFAMO,MAAM,oBAAkD,CAAxD,aAAA,CAEL,KAAQ,QAAU,QAElB,KAAQ,UAAY,6BAAA,CACpB,aAAa,CAAE,gBAAkB,
|
|
1
|
+
{"version":3,"file":"pad-transformer.cjs","sources":["../../../src/iframe/transformers/pad-transformer.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\n\n/**\n * This transformer is used to transform the pad URL to the embed URL inside the iframe\n * The embed URL is used to create a session for the pad before redirecting to the pad url\n */\nexport class PadIframeTransformer implements IframeTransformer {\n // Define the pad path\n private padPath = '/pad/';\n // Define the embed path\n private embedPath = '/collaborativeeditor/embed/';\n onRenderHTML({ HTMLAttributes }) {\n try {\n // Get host URL from the current window\n const currentUrl = window.location.href.split('?')[0];\n const baseUrl = new URL(currentUrl).origin;\n // Get Iframe src URL\n const srcUrl = new URL(HTMLAttributes.src);\n const pathMatch = srcUrl.pathname.match(\n new RegExp(`^${this.padPath}(.+)$`),\n );\n // Check if the src URL is from the same origin and matches the pad path\n if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {\n // Extract pad ID from the URL\n const padId = pathMatch[1].replace(/^p\\//i, '');\n // Create a new URL with the embed path\n const newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);\n // Copy search params from the src URL to the new URL\n srcUrl.searchParams.forEach((value, key) => {\n newUrl.searchParams.set(key, value);\n });\n // Set the new URL\n HTMLAttributes.src = newUrl.toString();\n }\n } catch (e) {\n console.error('Error transforming pad URL:', e);\n }\n }\n}\n"],"names":[],"mappings":"gFAMO,MAAM,oBAAkD,CAAxD,aAAA,CAEL,KAAQ,QAAU,QAElB,KAAQ,UAAY,6BAAA,CACpB,aAAa,CAAE,gBAAkB,CAC/B,GAAI,CAEF,MAAM,WAAa,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,CAAC,EAC9C,QAAU,IAAI,IAAI,UAAU,EAAE,OAE9B,OAAS,IAAI,IAAI,eAAe,GAAG,EACnC,UAAY,OAAO,SAAS,MAChC,IAAI,OAAO,IAAI,KAAK,OAAO,OAAO,CAAA,EAGpC,GAAI,OAAO,SAAW,SAAW,WAAa,UAAU,CAAC,EAAG,CAE1D,MAAM,MAAQ,UAAU,CAAC,EAAE,QAAQ,QAAS,EAAE,EAExC,OAAS,IAAI,IAAI,GAAG,OAAO,GAAG,KAAK,SAAS,GAAG,KAAK,EAAE,EAE5D,OAAO,aAAa,QAAQ,CAAC,MAAO,MAAQ,CAC1C,OAAO,aAAa,IAAI,IAAK,KAAK,CAAA,CACnC,EAED,eAAe,IAAM,OAAO,SAAA,CAAS,CACvC,OACO,EAAG,CACV,QAAQ,MAAM,8BAA+B,CAAC,CAAA,CAChD,CAEJ"}
|