@edifice.io/tiptap-extensions 2.2.11 → 2.2.12
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.map +1 -1
- package/dist/conversation-history/conversation-history.js.map +1 -1
- package/dist/conversation-history-body/conversation-history-body.cjs.map +1 -1
- package/dist/conversation-history-body/conversation-history-body.js.map +1 -1
- 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/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/video/video.cjs.map +1 -1
- package/dist/video/video.js.map +1 -1
- package/package.json +3 -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,KAAAA,KAAK,OAAO,CAC9B,KAAM,OAEN,YAAa,CACX,MAAO,CACL,eAAgB,CAAA,CAAC,
|
|
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,CAErB,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,MAAA,CACP,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,OACAC,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CAAA,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,QACE,IACA,CAAC,CAAE,YACM,SAAS,QAAQ,KAAK,IAAI,EAErC,WACE,IACA,CAAC,CAAE,YACM,SAAS,WAAW,KAAK,IAAI,CACtC,CAEN,CACF,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":";AAiBO,MAAM,OAAO,KAAK,OAAO;AAAA,EAC9B,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAA;AAAA,IAAC;AAAA,
|
|
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,EAErB;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,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,EAEN;AACF,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,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,
|
|
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,CAEJ,EACA,eAAgB,CACd,MAAO,CACL,MAAO,CACL,QAAS,OACT,UAAY,SACH,QAAQ,aAAa,OAAO,CACrC,CACF,CAEJ,EACA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CAAC,MAAO,eAAgB,CAAC,CAClC,CACF,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":";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,
|
|
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,EAEJ;AAAA,EACA,gBAAgB;AACd,WAAO;AAAA,MACL,OAAO;AAAA,QACL,SAAS;AAAA,QACT,WAAW,CAAC,YACH,QAAQ,aAAa,OAAO;AAAA,MACrC;AAAA,IACF;AAAA,EAEJ;AAAA,EACA,WAAW,EAAE,kBAAkB;AAC7B,WAAO,CAAC,OAAO,gBAAgB,CAAC;AAAA,EAClC;AACF,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,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,
|
|
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,CAEJ,EAEA,WAAY,CACV,MAAO,CAAC,CAAE,IAAK,yBAA0B,CAC3C,EAEA,WAAW,CAAE,gBAAkB,CAG7B,MAAM,cAFQ,eAAe,MAED,IAAK,IACxB,CACL,IACA,CACE,KAAM,GAAG,KACT,KAAM,GAAG,KACT,WAAY,GAAG,WACf,gBAAiB,GAAG,eAAA,EAEtB,GAAG,IAAA,CAEN,EAED,MAAO,CAAC,MAAO,KAAK,QAAQ,eAAgB,GAAG,aAAa,CAC9D,EAEA,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,CACH,CAEA,OAAO,WACT,EACA,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,CAEJ,EAEA,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,CAEN,CACF,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":";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,
|
|
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,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,0BAA0B;AAAA,EAC3C;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAG7B,UAAM,gBAFQ,eAAe,MAED,IAAI,CAAC,OACxB;AAAA,MACL;AAAA,MACA;AAAA,QACE,MAAM,GAAG;AAAA,QACT,MAAM,GAAG;AAAA,QACT,YAAY,GAAG;AAAA,QACf,iBAAiB,GAAG;AAAA,MAAA;AAAA,MAEtB,GAAG;AAAA,IAAA,CAEN;AAED,WAAO,CAAC,OAAO,KAAK,QAAQ,gBAAgB,GAAG,aAAa;AAAA,EAC9D;AAAA,EAEA,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,UACH;AAEA,iBAAO;AAAA,QACT;AAAA,QACA,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,WAAW,MAAM,IAAI,CAAC,UAAU;AAAA,YACrC,MAAM,KAAK;AAAA,YACX,MAAM,KAAK;AAAA,YACX,YAAY,KAAK;AAAA,YACjB,iBAAiB,KAAK;AAAA,UAAA,EACtB;AAAA,QAAA;AAAA,MAEN;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,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,EAEN;AACF,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,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,
|
|
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,CAEJ,EAEA,WAAY,CACV,MAAO,CAAC,CAAE,IAAK,yBAA0B,CAC3C,EAEA,WAAW,CAAE,gBAAkB,CAG7B,MAAM,cAFQ,eAAe,MAED,IAAK,IACxB,CACL,IACA,CACE,KAAM,GAAG,KACT,KAAM,GAAG,KACT,WAAY,GAAG,WACf,gBAAiB,GAAG,eAAA,EAEtB,GAAG,IAAA,CAEN,EAED,MAAO,CAAC,MAAO,KAAK,QAAQ,eAAgB,GAAG,aAAa,CAC9D,EAEA,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,CACH,CAEA,OAAO,WACT,EACA,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,CAEJ,EAEA,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,CAC3D,CACF,MACE,SAAS,MAAM,GAAG,OAAO,KAAM,EAAE,CAAC,CAEtC,CAAC,EACM,EACT,CAAA,CAEN,CACF,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":";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,
|
|
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,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,0BAA0B;AAAA,EAC3C;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAG7B,UAAM,gBAFQ,eAAe,MAED,IAAI,CAAC,OACxB;AAAA,MACL;AAAA,MACA;AAAA,QACE,MAAM,GAAG;AAAA,QACT,MAAM,GAAG;AAAA,QACT,YAAY,GAAG;AAAA,QACf,iBAAiB,GAAG;AAAA,MAAA;AAAA,MAEtB,GAAG;AAAA,IAAA,CAEN;AAED,WAAO,CAAC,OAAO,KAAK,QAAQ,gBAAgB,GAAG,aAAa;AAAA,EAC9D;AAAA,EAEA,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,UACH;AAEA,iBAAO;AAAA,QACT;AAAA,QACA,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,WAAW,MAAM,IAAI,CAAC,UAAU;AAAA,YACrC,MAAM,KAAK;AAAA,YACX,MAAM,KAAK;AAAA,YACX,YAAY,KAAK;AAAA,YACjB,iBAAiB,KAAK;AAAA,UAAA,EACtB;AAAA,QAAA;AAAA,MAEN;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,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,YAC3D;AAAA,UACF;AACE,qBAAS,MAAM,GAAG,OAAO,MAAM,EAAE,CAAC;AAAA,QAEtC,CAAC,GACM;AAAA,MACT;AAAA,IAAA;AAAA,EAEN;AACF,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,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,
|
|
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,CAEJ,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,gCACL,SAAW,KAAa,CACtB,IAAM,GAAwB,aAAa,KAAK,CAAA,EAClD,CACF,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACA,CAAE,MAAO,eAAA,EACT,CAAC,QAASC,KAAAA,gBAAgB,cAAc,CAAC,CAAA,CAE7C,EAEA,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,CAEN,CACF,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":";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,
|
|
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,EAEJ;AAAA,EAEA,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,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,EAAE,OAAO,gBAAA;AAAA,MACT,CAAC,SAAS,gBAAgB,cAAc,CAAC;AAAA,IAAA;AAAA,EAE7C;AAAA,EAEA,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,EAEN;AACF,CAAC;"}
|
|
@@ -1 +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,
|
|
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,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAAE,MAAO,uBAAwB,EACjE,CAAA,CAEJ,EAWA,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,EAEX,CAAC,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,EACb,CACA,MAAO,EACT,CACF,CAAC,EAEM,SAAW,GAAK,IACzB,CAAA,CACD,CAAA,CAEL,CACF,CAAC"}
|
|
@@ -1 +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,
|
|
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,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB,EAAE,OAAO,wBAAwB;AAAA,MACjE;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,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,cAEX,CAAC,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,cACb;AACA,qBAAO;AAAA,YACT;AAAA,UACF,CAAC,GAEM,WAAW,KAAK;AAAA,QACzB;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,EAEL;AACF,CAAC;"}
|
|
@@ -1 +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,
|
|
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,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAAE,MAAO,4BAA6B,EACtE,CAAA,CAEJ,CACF,CAAC"}
|
|
@@ -1 +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,
|
|
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,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB,EAAE,OAAO,6BAA6B;AAAA,MACtE;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -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,KAAAA,UAAU,OAAwB,CACxD,KAAM,WAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CAAA,
|
|
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,CAEvB,EAEA,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,CAEJ,EAEA,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,CAEN,CACF,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":";;AAuBO,MAAM,WAAW,UAAU,OAAwB;AAAA,EACxD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO,CAAC,WAAW;AAAA,IAAA;AAAA,
|
|
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,EAEvB;AAAA,EAEA,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,EAEJ;AAAA,EAEA,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,EAEN;AACF,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":"iNAsBO,MAAM,cAAgBA,iBAAAA,QAAQ,OAAgB,CACnD,KAAM,gBAEN,YAAa,QACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,eAAgB,CAAA,CAAC,
|
|
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,CAErB,EAEA,WAAY,CACV,OAAO,KAAK,QAAQ,OAAO,IAAK,QAAkB,CAChD,IAAK,IAAI,KAAK,GACd,MAAO,CAAE,KAAA,CAAM,EACf,CACJ,EAEA,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,CAEJ,EAEA,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,EAE1D,CAAC,CACH,CAAC,CAEL,CAAC,EAEG,UACF,SAAS,EAAE,EAEN,SAAS,WAAW,CAAE,MAAO,WAAW,MAAO,CACxD,CAAA,CAEN,CACF,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":";;;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,
|
|
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,EAErB;AAAA,EAEA,YAAY;AACV,WAAO,KAAK,QAAQ,OAAO,IAAI,CAAC,WAAkB;AAAA,MAChD,KAAK,IAAI,KAAK;AAAA,MACd,OAAO,EAAE,MAAA;AAAA,IAAM,EACf;AAAA,EACJ;AAAA,EAEA,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,EAEJ;AAAA,EAEA,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,YAE1D,CAAC;AAAA,UACH,CAAC;AAAA,QAEL,CAAC,GAEG,YACF,SAAS,EAAE,GAEN,SAAS,WAAW,EAAE,OAAO,WAAW,OAAO;AAAA,MACxD;AAAA,IAAA;AAAA,EAEN;AACF,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,QACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,WAAY,GACZ,eAAgB,CAAA,CAAC,
|
|
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,CAErB,EAEA,WAAY,QACV,MAAO,CACL,CACE,IAAG,QAAK,SAAL,0BACH,MAAO,mBACP,SAAW,QACF,CACL,MAAO,KAAA,EAEX,CACF,CAEJ,CACF,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":";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,
|
|
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,EAErB;AAAA,EAEA,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,EAEJ;AACF,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,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,
|
|
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,EACX,CAAA,CACF,CAEJ,EAEA,YAAa,WACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,YAAa,GACb,eAAgB,CACd,IAAG,QAAK,SAAL,0BAAgB,eACnB,OAAQ,IAAA,CACV,CAEJ,EAGA,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,CAEJ,CACF,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":";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,
|
|
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,QACX;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,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,EAEJ;AAAA;AAAA,EAGA,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,EAEJ;AACF,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,KAAAA,KAAK,OAAsB,CAC/C,KAAM,SACN,MAAO,QACP,KAAM,GACN,UAAW,GAEX,YAAa,CACX,MAAO,CACL,gBAAiB,GACjB,eAAgB,CACd,MAAO,gBAAA,CACT,
|
|
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,CAEJ,EAEA,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,CAEJ,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,QAAA,CACP,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAE7BC,+BAAkB,aAAa,CAAE,eAAgB,EAC1C,CAAC,MAAO,KAAK,QAAQ,eAAgB,CAAC,SAAU,cAAc,CAAC,CACxE,EAEA,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,EACT,CAAA,CAEN,CACF,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":";;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,
|
|
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,EAEJ;AAAA,EAEA,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,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAE7B,6BAAkB,aAAa,EAAE,gBAAgB,GAC1C,CAAC,OAAO,KAAK,QAAQ,gBAAgB,CAAC,UAAU,cAAc,CAAC;AAAA,EACxE;AAAA,EAEA,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,MACT;AAAA,IAAA;AAAA,EAEN;AACF,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,CAC/B,UAAW,eAAe,kBAAK,eAC7B,YAAY,aAAa,CAAE,eAAgB,
|
|
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,CAE/C,CACF,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;AAC/B,eAAW,eAAe,mBAAK;AAC7B,kBAAY,aAAa,EAAE,gBAAgB;AAAA,
|
|
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,EAE/C;AACF;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,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,
|
|
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,CACpC,CAAC,EAED,eAAe,IAAM,OAAO,SAAA,CAC9B,CACF,OAAS,EAAG,CACV,QAAQ,MAAM,8BAA+B,CAAC,CAChD,CACF,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pad-transformer.js","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":"AAMO,MAAM,qBAAkD;AAAA,EAAxD,cAAA;AAEL,SAAQ,UAAU,SAElB,KAAQ,YAAY;AAAA,EAAA;AAAA,EACpB,aAAa,EAAE,kBAAkB;AAC/B,QAAI;AAEF,YAAM,aAAa,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,CAAC,GAC9C,UAAU,IAAI,IAAI,UAAU,EAAE,QAE9B,SAAS,IAAI,IAAI,eAAe,GAAG,GACnC,YAAY,OAAO,SAAS;AAAA,QAChC,IAAI,OAAO,IAAI,KAAK,OAAO,OAAO;AAAA,MAAA;AAGpC,UAAI,OAAO,WAAW,WAAW,aAAa,UAAU,CAAC,GAAG;AAE1D,cAAM,QAAQ,UAAU,CAAC,EAAE,QAAQ,SAAS,EAAE,GAExC,SAAS,IAAI,IAAI,GAAG,OAAO,GAAG,KAAK,SAAS,GAAG,KAAK,EAAE;AAE5D,eAAO,aAAa,QAAQ,CAAC,OAAO,QAAQ;AAC1C,iBAAO,aAAa,IAAI,KAAK,KAAK;AAAA,
|
|
1
|
+
{"version":3,"file":"pad-transformer.js","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":"AAMO,MAAM,qBAAkD;AAAA,EAAxD,cAAA;AAEL,SAAQ,UAAU,SAElB,KAAQ,YAAY;AAAA,EAAA;AAAA,EACpB,aAAa,EAAE,kBAAkB;AAC/B,QAAI;AAEF,YAAM,aAAa,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,CAAC,GAC9C,UAAU,IAAI,IAAI,UAAU,EAAE,QAE9B,SAAS,IAAI,IAAI,eAAe,GAAG,GACnC,YAAY,OAAO,SAAS;AAAA,QAChC,IAAI,OAAO,IAAI,KAAK,OAAO,OAAO;AAAA,MAAA;AAGpC,UAAI,OAAO,WAAW,WAAW,aAAa,UAAU,CAAC,GAAG;AAE1D,cAAM,QAAQ,UAAU,CAAC,EAAE,QAAQ,SAAS,EAAE,GAExC,SAAS,IAAI,IAAI,GAAG,OAAO,GAAG,KAAK,SAAS,GAAG,KAAK,EAAE;AAE5D,eAAO,aAAa,QAAQ,CAAC,OAAO,QAAQ;AAC1C,iBAAO,aAAa,IAAI,KAAK,KAAK;AAAA,QACpC,CAAC,GAED,eAAe,MAAM,OAAO,SAAA;AAAA,MAC9B;AAAA,IACF,SAAS,GAAG;AACV,cAAQ,MAAM,+BAA+B,CAAC;AAAA,IAChD;AAAA,EACF;AACF;"}
|
package/dist/image/image.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.cjs","sources":["../../src/image/image.ts"],"sourcesContent":["import { WorkspaceElement } from '@edifice.io/client';\nimport { ImageResizer } from '@edifice.io/utilities';\nimport { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport TiptapImage from '@tiptap/extension-image';\nimport { Plugin } from 'prosemirror-state';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\n uploadFile?: (file: File) => Promise<WorkspaceElement | null>;\n}\n\ninterface AttributesProps {\n width: number | string;\n height: number | string;\n size: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customImage: {\n setAttributes: (options: AttributesProps) => ReturnType;\n setNewImage: (options: {\n src: string;\n alt?: string;\n title?: string;\n }) => ReturnType;\n };\n }\n}\n\nexport const Image = TiptapImage.extend<CustomImageOptions>({\n name: 'custom-image',\n draggable: true,\n selectable: true,\n\n addOptions() {\n return {\n ...this.parent?.(),\n inline: true,\n content: 'inline*',\n sizes: ['small', 'medium', 'large'],\n HTMLAttributes: {\n class: 'custom-image',\n },\n uploadFile: () => {\n return Promise.resolve(null);\n },\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n size: {\n default: 'medium',\n rendered: false,\n },\n alt: {\n renderHTML: (attributes) => {\n return {\n alt: attributes.alt,\n };\n },\n parseHTML: (element) => element.getAttribute('alt'),\n },\n title: {\n renderHTML: (attributes) => {\n return {\n title: attributes.title,\n };\n },\n parseHTML: (element) => element.getAttribute('title'),\n },\n width: {\n default: '350',\n renderHTML: (attributes) => {\n if (\n attributes.width !== null &&\n attributes.width !== undefined &&\n !Number.isNaN(attributes.width)\n ) {\n return {\n width: parseInt(attributes.width),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n if (\n attributes.height !== null &&\n attributes.height !== undefined &&\n !Number.isNaN(attributes.height)\n ) {\n return {\n height: parseInt(attributes.height),\n };\n }\n return {};\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) => {\n return null;\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]:not([src^=\"data:\"])',\n getAttrs: (el: HTMLImageElement) => {\n const attr = { src: el.getAttribute('src') };\n // Check old content format and get the width from the parent element\n if (el.parentElement?.className.includes('image-container')) {\n if (el.parentElement.style?.width) {\n attr['width'] = el.parentElement.style.width;\n }\n }\n if (el.style?.width) {\n attr['width'] = el.style.width;\n }\n\n // Check old content smiley\n const oldSmileyList = [\n 'happy',\n 'proud',\n 'dreamy',\n 'love',\n 'tired',\n 'angry',\n 'worried',\n 'sick',\n 'joker',\n 'sad',\n ];\n if (\n oldSmileyList.filter((smiley) => attr.src.includes(smiley + '.png'))\n .length > 0\n ) {\n attr['style'] = {\n width: '1.5em',\n height: '1.5em',\n fontSize: '16px',\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\n }\n\n return attr;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'img',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: IMAGE_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , alt, src, title] = match;\n\n return {\n src,\n alt,\n title,\n };\n },\n }),\n ];\n },\n\n addCommands() {\n return {\n setNewImage:\n (attrs) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(attrs);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n setAttributes:\n (attributes) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n\n const nodeAttrs = tr.doc.nodeAt(tr.selection.from);\n const options = {\n ...nodeAttrs.attrs,\n ...attributes,\n };\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 addProseMirrorPlugins() {\n const uploadNode = async (file: File) => {\n /**\n * Resize the image\n */\n const resizedImage = await ImageResizer.resizeImageFile(file);\n\n /**\n * Upload the image\n */\n const image = await this.options.uploadFile(resizedImage);\n\n /**\n * Get the image url\n */\n const imageUrl = `/workspace/${image.public ? 'pub/' : ''}document/${\n image._id\n }?timestamp=${new Date().getTime()}`;\n\n /**\n * Create the image node\n */\n\n const node = this.type.create({\n src: imageUrl,\n alt: image.alt,\n title: image.title,\n });\n\n return node;\n };\n\n const getFilteredFiles = (files: FileList) => {\n return Array.from(files).filter((file) =>\n /image\\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type),\n );\n };\n\n const handleImageInsert = async (\n editor: any,\n file: File,\n position?: number,\n ) => {\n const node = await uploadNode(file);\n if (!node) return;\n\n const transaction =\n position !== undefined\n ? editor.state.tr.insert(position, node)\n : editor.state.tr.replaceSelectionWith(node);\n\n editor.dispatch(transaction);\n };\n\n return [\n new Plugin({\n props: {\n handlePaste: (editor, e) => {\n const files = getFilteredFiles(e.clipboardData?.files);\n if (files.length === 0) return false;\n\n for (const file of files) {\n handleImageInsert(editor, file);\n }\n\n return true;\n },\n handleDrop: (editor, e, _s, moved) => {\n if (moved) return false;\n\n const files = getFilteredFiles(e.dataTransfer.files);\n if (files.length === 0) return false;\n\n const { pos: position } = editor.posAtCoords({\n left: e.clientX,\n top: e.clientY,\n });\n\n for (const file of files) {\n handleImageInsert(editor, file, position);\n }\n return true;\n },\n },\n }),\n ];\n },\n});\n"],"names":["mergeAttributes","nodeInputRule","ImageResizer","Plugin"],"mappings":"2PAMa,kBACX,2DA2BW,MAAQ,YAAY,OAA2B,CAC1D,KAAM,eACN,UAAW,GACX,WAAY,GAEZ,YAAa,QACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,OAAQ,GACR,QAAS,UACT,MAAO,CAAC,QAAS,SAAU,OAAO,EAClC,eAAgB,CACd,MAAO,cAAA,EAET,WAAY,IACH,QAAQ,QAAQ,IAAI,CAC7B,CACF,EAGF,eAAgB,QACd,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,KAAM,CACJ,QAAS,SACT,SAAU,EAAA,EAEZ,IAAK,CACH,WAAa,aACJ,CACL,IAAK,WAAW,GAAA,GAGpB,UAAY,SAAY,QAAQ,aAAa,KAAK,CAAA,EAEpD,MAAO,CACL,WAAa,aACJ,CACL,MAAO,WAAW,KAAA,GAGtB,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,EAEtD,MAAO,CACL,QAAS,MACT,WAAa,YAET,WAAW,QAAU,MACrB,WAAW,QAAU,QACrB,CAAC,OAAO,MAAM,WAAW,KAAK,EAEvB,CACL,MAAO,SAAS,WAAW,KAAK,CAAA,EAG7B,CAAA,EAET,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,EAEtD,OAAQ,CACN,WAAa,YAET,WAAW,SAAW,MACtB,WAAW,SAAW,QACtB,CAAC,OAAO,MAAM,WAAW,MAAM,EAExB,CACL,OAAQ,SAAS,WAAW,MAAM,CAAA,EAG/B,CAAA,EAET,UAAY,SAAY,QAAQ,aAAa,QAAQ,CAAA,EAEvD,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MAAO,WAAW,KAAA,EAEpB,CAAA,EAEN,UAAY,SACH,IACT,CACF,CACF,EAGF,WAAY,CACV,MAAO,CACL,CACE,IAAK,+BACL,SAAW,IAAyB,cAClC,MAAM,KAAO,CAAE,IAAK,GAAG,aAAa,KAAK,CAAA,EAEzC,OAAI,MAAG,gBAAH,SAAkB,UAAU,SAAS,qBACnC,MAAG,cAAc,QAAjB,SAAwB,QAC1B,KAAK,MAAW,GAAG,cAAc,MAAM,QAGvC,MAAG,QAAH,SAAU,QACZ,KAAK,MAAW,GAAG,MAAM,OAIL,CACpB,QACA,QACA,SACA,OACA,QACA,QACA,UACA,OACA,QACA,KAAA,EAGc,OAAQ,QAAW,KAAK,IAAI,SAAS,OAAS,MAAM,CAAC,EAChE,OAAS,IAEZ,KAAK,MAAW,CACd,MAAO,QACP,OAAQ,QACR,SAAU,MAAA,EAEZ,KAAK,MAAW,OAChB,KAAK,OAAY,QAGZ,IAAA,CACT,CACF,CACF,EAGF,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACAA,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,CAAA,CAC7D,EAGF,eAAgB,CACd,MAAO,CACLC,mBAAc,CACZ,KAAM,kBACN,KAAM,KAAK,KACX,cAAgB,OAAU,CACxB,KAAM,GAAK,IAAK,IAAK,KAAK,EAAI,MAE9B,MAAO,CACL,IACA,IACA,KAAA,CACF,CACF,CACD,CAAA,CACH,EAGF,aAAc,CACZ,MAAO,CACL,YACG,OACD,CAAC,CAAE,GAAI,YAAe,CACpB,KAAM,CAAE,WAAc,GAChB,KAAO,KAAK,KAAK,OAAO,KAAK,EAEnC,OAAI,UACF,GAAG,iBAAiB,UAAU,KAAM,UAAU,GAAI,IAAI,EAGjD,EAAA,EAEX,cACG,YACD,CAAC,CAAE,GAAI,YAAe,CACpB,KAAM,CAAE,WAAc,GAGhB,QAAU,CACd,GAFgB,GAAG,IAAI,OAAO,GAAG,UAAU,IAAI,EAElC,MACb,GAAG,UAAA,EAEC,KAAO,KAAK,KAAK,OAAO,OAAO,EAErC,OAAI,UACF,GAAG,iBAAiB,UAAU,KAAM,UAAU,GAAI,IAAI,EAGjD,EAAA,CACT,CACJ,EAGF,uBAAwB,CACtB,MAAM,WAAa,MAAO,MAAe,CAIvC,MAAM,aAAe,MAAMC,uBAAa,gBAAgB,IAAI,EAKtD,MAAQ,MAAM,KAAK,QAAQ,WAAW,YAAY,EAKlD,SAAW,cAAc,MAAM,OAAS,OAAS,EAAE,YACvD,MAAM,GACR,cAAc,IAAI,KAAA,EAAO,SAAS,GAYlC,OANa,KAAK,KAAK,OAAO,CAC5B,IAAK,SACL,IAAK,MAAM,IACX,MAAO,MAAM,KAAA,CACd,CAEM,EAGH,iBAAoB,OACjB,MAAM,KAAK,KAAK,EAAE,OAAQ,MAC/B,2CAA2C,KAAK,KAAK,IAAI,CAAA,EAIvD,kBAAoB,MACxB,OACA,KACA,WACG,CACH,MAAM,KAAO,MAAM,WAAW,IAAI,EAClC,GAAI,CAAC,KAAM,OAEX,MAAM,YACJ,WAAa,OACT,OAAO,MAAM,GAAG,OAAO,SAAU,IAAI,EACrC,OAAO,MAAM,GAAG,qBAAqB,IAAI,EAE/C,OAAO,SAAS,WAAW,CAAA,EAG7B,MAAO,CACL,IAAIC,wBAAO,CACT,MAAO,CACL,YAAa,CAAC,OAAQ,IAAM,QAC1B,MAAM,MAAQ,kBAAiB,KAAE,gBAAF,eAAiB,KAAK,EACrD,GAAI,MAAM,SAAW,EAAG,MAAO,GAE/B,UAAW,QAAQ,MACjB,kBAAkB,OAAQ,IAAI,EAGhC,MAAO,EAAA,EAET,WAAY,CAAC,OAAQ,EAAG,GAAI,QAAU,CACpC,GAAI,MAAO,MAAO,GAElB,MAAM,MAAQ,iBAAiB,EAAE,aAAa,KAAK,EACnD,GAAI,MAAM,SAAW,EAAG,MAAO,GAE/B,KAAM,CAAE,IAAK,UAAa,OAAO,YAAY,CAC3C,KAAM,EAAE,QACR,IAAK,EAAE,OAAA,CACR,EAED,UAAW,QAAQ,MACjB,kBAAkB,OAAQ,KAAM,QAAQ,EAE1C,MAAO,EAAA,CACT,CACF,CACD,CAAA,CACH,CAEJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"image.cjs","sources":["../../src/image/image.ts"],"sourcesContent":["import { WorkspaceElement } from '@edifice.io/client';\nimport { ImageResizer } from '@edifice.io/utilities';\nimport { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport TiptapImage from '@tiptap/extension-image';\nimport { Plugin } from 'prosemirror-state';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\n uploadFile?: (file: File) => Promise<WorkspaceElement | null>;\n}\n\ninterface AttributesProps {\n width: number | string;\n height: number | string;\n size: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customImage: {\n setAttributes: (options: AttributesProps) => ReturnType;\n setNewImage: (options: {\n src: string;\n alt?: string;\n title?: string;\n }) => ReturnType;\n };\n }\n}\n\nexport const Image = TiptapImage.extend<CustomImageOptions>({\n name: 'custom-image',\n draggable: true,\n selectable: true,\n\n addOptions() {\n return {\n ...this.parent?.(),\n inline: true,\n content: 'inline*',\n sizes: ['small', 'medium', 'large'],\n HTMLAttributes: {\n class: 'custom-image',\n },\n uploadFile: () => {\n return Promise.resolve(null);\n },\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n size: {\n default: 'medium',\n rendered: false,\n },\n alt: {\n renderHTML: (attributes) => {\n return {\n alt: attributes.alt,\n };\n },\n parseHTML: (element) => element.getAttribute('alt'),\n },\n title: {\n renderHTML: (attributes) => {\n return {\n title: attributes.title,\n };\n },\n parseHTML: (element) => element.getAttribute('title'),\n },\n width: {\n default: '350',\n renderHTML: (attributes) => {\n if (\n attributes.width !== null &&\n attributes.width !== undefined &&\n !Number.isNaN(attributes.width)\n ) {\n return {\n width: parseInt(attributes.width),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n if (\n attributes.height !== null &&\n attributes.height !== undefined &&\n !Number.isNaN(attributes.height)\n ) {\n return {\n height: parseInt(attributes.height),\n };\n }\n return {};\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) => {\n return null;\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]:not([src^=\"data:\"])',\n getAttrs: (el: HTMLImageElement) => {\n const attr = { src: el.getAttribute('src') };\n // Check old content format and get the width from the parent element\n if (el.parentElement?.className.includes('image-container')) {\n if (el.parentElement.style?.width) {\n attr['width'] = el.parentElement.style.width;\n }\n }\n if (el.style?.width) {\n attr['width'] = el.style.width;\n }\n\n // Check old content smiley\n const oldSmileyList = [\n 'happy',\n 'proud',\n 'dreamy',\n 'love',\n 'tired',\n 'angry',\n 'worried',\n 'sick',\n 'joker',\n 'sad',\n ];\n if (\n oldSmileyList.filter((smiley) => attr.src.includes(smiley + '.png'))\n .length > 0\n ) {\n attr['style'] = {\n width: '1.5em',\n height: '1.5em',\n fontSize: '16px',\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\n }\n\n return attr;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'img',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: IMAGE_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , alt, src, title] = match;\n\n return {\n src,\n alt,\n title,\n };\n },\n }),\n ];\n },\n\n addCommands() {\n return {\n setNewImage:\n (attrs) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(attrs);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n setAttributes:\n (attributes) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n\n const nodeAttrs = tr.doc.nodeAt(tr.selection.from);\n const options = {\n ...nodeAttrs.attrs,\n ...attributes,\n };\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 addProseMirrorPlugins() {\n const uploadNode = async (file: File) => {\n /**\n * Resize the image\n */\n const resizedImage = await ImageResizer.resizeImageFile(file);\n\n /**\n * Upload the image\n */\n const image = await this.options.uploadFile(resizedImage);\n\n /**\n * Get the image url\n */\n const imageUrl = `/workspace/${image.public ? 'pub/' : ''}document/${\n image._id\n }?timestamp=${new Date().getTime()}`;\n\n /**\n * Create the image node\n */\n\n const node = this.type.create({\n src: imageUrl,\n alt: image.alt,\n title: image.title,\n });\n\n return node;\n };\n\n const getFilteredFiles = (files: FileList) => {\n return Array.from(files).filter((file) =>\n /image\\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type),\n );\n };\n\n const handleImageInsert = async (\n editor: any,\n file: File,\n position?: number,\n ) => {\n const node = await uploadNode(file);\n if (!node) return;\n\n const transaction =\n position !== undefined\n ? editor.state.tr.insert(position, node)\n : editor.state.tr.replaceSelectionWith(node);\n\n editor.dispatch(transaction);\n };\n\n return [\n new Plugin({\n props: {\n handlePaste: (editor, e) => {\n const files = getFilteredFiles(e.clipboardData?.files);\n if (files.length === 0) return false;\n\n for (const file of files) {\n handleImageInsert(editor, file);\n }\n\n return true;\n },\n handleDrop: (editor, e, _s, moved) => {\n if (moved) return false;\n\n const files = getFilteredFiles(e.dataTransfer.files);\n if (files.length === 0) return false;\n\n const { pos: position } = editor.posAtCoords({\n left: e.clientX,\n top: e.clientY,\n });\n\n for (const file of files) {\n handleImageInsert(editor, file, position);\n }\n return true;\n },\n },\n }),\n ];\n },\n});\n"],"names":["mergeAttributes","nodeInputRule","ImageResizer","Plugin"],"mappings":"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"}
|
package/dist/image/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sources":["../../src/image/image.ts"],"sourcesContent":["import { WorkspaceElement } from '@edifice.io/client';\nimport { ImageResizer } from '@edifice.io/utilities';\nimport { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport TiptapImage from '@tiptap/extension-image';\nimport { Plugin } from 'prosemirror-state';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\n uploadFile?: (file: File) => Promise<WorkspaceElement | null>;\n}\n\ninterface AttributesProps {\n width: number | string;\n height: number | string;\n size: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customImage: {\n setAttributes: (options: AttributesProps) => ReturnType;\n setNewImage: (options: {\n src: string;\n alt?: string;\n title?: string;\n }) => ReturnType;\n };\n }\n}\n\nexport const Image = TiptapImage.extend<CustomImageOptions>({\n name: 'custom-image',\n draggable: true,\n selectable: true,\n\n addOptions() {\n return {\n ...this.parent?.(),\n inline: true,\n content: 'inline*',\n sizes: ['small', 'medium', 'large'],\n HTMLAttributes: {\n class: 'custom-image',\n },\n uploadFile: () => {\n return Promise.resolve(null);\n },\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n size: {\n default: 'medium',\n rendered: false,\n },\n alt: {\n renderHTML: (attributes) => {\n return {\n alt: attributes.alt,\n };\n },\n parseHTML: (element) => element.getAttribute('alt'),\n },\n title: {\n renderHTML: (attributes) => {\n return {\n title: attributes.title,\n };\n },\n parseHTML: (element) => element.getAttribute('title'),\n },\n width: {\n default: '350',\n renderHTML: (attributes) => {\n if (\n attributes.width !== null &&\n attributes.width !== undefined &&\n !Number.isNaN(attributes.width)\n ) {\n return {\n width: parseInt(attributes.width),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n if (\n attributes.height !== null &&\n attributes.height !== undefined &&\n !Number.isNaN(attributes.height)\n ) {\n return {\n height: parseInt(attributes.height),\n };\n }\n return {};\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) => {\n return null;\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]:not([src^=\"data:\"])',\n getAttrs: (el: HTMLImageElement) => {\n const attr = { src: el.getAttribute('src') };\n // Check old content format and get the width from the parent element\n if (el.parentElement?.className.includes('image-container')) {\n if (el.parentElement.style?.width) {\n attr['width'] = el.parentElement.style.width;\n }\n }\n if (el.style?.width) {\n attr['width'] = el.style.width;\n }\n\n // Check old content smiley\n const oldSmileyList = [\n 'happy',\n 'proud',\n 'dreamy',\n 'love',\n 'tired',\n 'angry',\n 'worried',\n 'sick',\n 'joker',\n 'sad',\n ];\n if (\n oldSmileyList.filter((smiley) => attr.src.includes(smiley + '.png'))\n .length > 0\n ) {\n attr['style'] = {\n width: '1.5em',\n height: '1.5em',\n fontSize: '16px',\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\n }\n\n return attr;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'img',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: IMAGE_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , alt, src, title] = match;\n\n return {\n src,\n alt,\n title,\n };\n },\n }),\n ];\n },\n\n addCommands() {\n return {\n setNewImage:\n (attrs) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(attrs);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n setAttributes:\n (attributes) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n\n const nodeAttrs = tr.doc.nodeAt(tr.selection.from);\n const options = {\n ...nodeAttrs.attrs,\n ...attributes,\n };\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 addProseMirrorPlugins() {\n const uploadNode = async (file: File) => {\n /**\n * Resize the image\n */\n const resizedImage = await ImageResizer.resizeImageFile(file);\n\n /**\n * Upload the image\n */\n const image = await this.options.uploadFile(resizedImage);\n\n /**\n * Get the image url\n */\n const imageUrl = `/workspace/${image.public ? 'pub/' : ''}document/${\n image._id\n }?timestamp=${new Date().getTime()}`;\n\n /**\n * Create the image node\n */\n\n const node = this.type.create({\n src: imageUrl,\n alt: image.alt,\n title: image.title,\n });\n\n return node;\n };\n\n const getFilteredFiles = (files: FileList) => {\n return Array.from(files).filter((file) =>\n /image\\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type),\n );\n };\n\n const handleImageInsert = async (\n editor: any,\n file: File,\n position?: number,\n ) => {\n const node = await uploadNode(file);\n if (!node) return;\n\n const transaction =\n position !== undefined\n ? editor.state.tr.insert(position, node)\n : editor.state.tr.replaceSelectionWith(node);\n\n editor.dispatch(transaction);\n };\n\n return [\n new Plugin({\n props: {\n handlePaste: (editor, e) => {\n const files = getFilteredFiles(e.clipboardData?.files);\n if (files.length === 0) return false;\n\n for (const file of files) {\n handleImageInsert(editor, file);\n }\n\n return true;\n },\n handleDrop: (editor, e, _s, moved) => {\n if (moved) return false;\n\n const files = getFilteredFiles(e.dataTransfer.files);\n if (files.length === 0) return false;\n\n const { pos: position } = editor.posAtCoords({\n left: e.clientX,\n top: e.clientY,\n });\n\n for (const file of files) {\n handleImageInsert(editor, file, position);\n }\n return true;\n },\n },\n }),\n ];\n },\n});\n"],"names":[],"mappings":";;;;AAMO,MAAM,oBACX,4DA2BW,QAAQ,YAAY,OAA2B;AAAA,EAC1D,MAAM;AAAA,EACN,WAAW;AAAA,EACX,YAAY;AAAA,EAEZ,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,CAAC,SAAS,UAAU,OAAO;AAAA,MAClC,gBAAgB;AAAA,QACd,OAAO;AAAA,MAAA;AAAA,MAET,YAAY,MACH,QAAQ,QAAQ,IAAI;AAAA,IAC7B;AAAA,EACF;AAAA,EAGF,gBAAgB;;AACd,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,UAAU;AAAA,MAAA;AAAA,MAEZ,KAAK;AAAA,QACH,YAAY,CAAC,gBACJ;AAAA,UACL,KAAK,WAAW;AAAA,QAAA;AAAA,QAGpB,WAAW,CAAC,YAAY,QAAQ,aAAa,KAAK;AAAA,MAAA;AAAA,MAEpD,OAAO;AAAA,QACL,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,WAAW;AAAA,QAAA;AAAA,QAGtB,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MAAA;AAAA,MAEtD,OAAO;AAAA,QACL,SAAS;AAAA,QACT,YAAY,CAAC,eAET,WAAW,UAAU,QACrB,WAAW,UAAU,UACrB,CAAC,OAAO,MAAM,WAAW,KAAK,IAEvB;AAAA,UACL,OAAO,SAAS,WAAW,KAAK;AAAA,QAAA,IAG7B,CAAA;AAAA,QAET,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MAAA;AAAA,MAEtD,QAAQ;AAAA,QACN,YAAY,CAAC,eAET,WAAW,WAAW,QACtB,WAAW,WAAW,UACtB,CAAC,OAAO,MAAM,WAAW,MAAM,IAExB;AAAA,UACL,QAAQ,SAAS,WAAW,MAAM;AAAA,QAAA,IAG/B,CAAA;AAAA,QAET,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,YACH;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EAGF,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU,CAAC,OAAyB;;AAClC,gBAAM,OAAO,EAAE,KAAK,GAAG,aAAa,KAAK,EAAA;AAEzC,kBAAI,QAAG,kBAAH,WAAkB,UAAU,SAAS,uBACnC,QAAG,cAAc,UAAjB,WAAwB,UAC1B,KAAK,QAAW,GAAG,cAAc,MAAM,SAGvC,QAAG,UAAH,WAAU,UACZ,KAAK,QAAW,GAAG,MAAM,QAIL;AAAA,YACpB;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA,EAGc,OAAO,CAAC,WAAW,KAAK,IAAI,SAAS,SAAS,MAAM,CAAC,EAChE,SAAS,MAEZ,KAAK,QAAW;AAAA,YACd,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,UAAU;AAAA,UAAA,GAEZ,KAAK,QAAW,QAChB,KAAK,SAAY,SAGZ;AAAA,QAAA;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EAGF,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,IAAA;AAAA,EAC7D;AAAA,EAGF,gBAAgB;AACd,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,MAAM,KAAK;AAAA,QACX,eAAe,CAAC,UAAU;AACxB,gBAAM,KAAK,KAAK,KAAK,KAAK,IAAI;AAE9B,iBAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,MACF,CACD;AAAA,IAAA;AAAA,EACH;AAAA,EAGF,cAAc;AACZ,WAAO;AAAA,MACL,aACE,CAAC,UACD,CAAC,EAAE,IAAI,eAAe;AACpB,cAAM,EAAE,cAAc,IAChB,OAAO,KAAK,KAAK,OAAO,KAAK;AAEnC,eAAI,YACF,GAAG,iBAAiB,UAAU,MAAM,UAAU,IAAI,IAAI,GAGjD;AAAA,MAAA;AAAA,MAEX,eACE,CAAC,eACD,CAAC,EAAE,IAAI,eAAe;AACpB,cAAM,EAAE,cAAc,IAGhB,UAAU;AAAA,UACd,GAFgB,GAAG,IAAI,OAAO,GAAG,UAAU,IAAI,EAElC;AAAA,UACb,GAAG;AAAA,QAAA,GAEC,OAAO,KAAK,KAAK,OAAO,OAAO;AAErC,eAAI,YACF,GAAG,iBAAiB,UAAU,MAAM,UAAU,IAAI,IAAI,GAGjD;AAAA,MAAA;AAAA,IACT;AAAA,EACJ;AAAA,EAGF,wBAAwB;AACtB,UAAM,aAAa,OAAO,SAAe;AAIvC,YAAM,eAAe,MAAM,aAAa,gBAAgB,IAAI,GAKtD,QAAQ,MAAM,KAAK,QAAQ,WAAW,YAAY,GAKlD,WAAW,cAAc,MAAM,SAAS,SAAS,EAAE,YACvD,MAAM,GACR,eAAc,oBAAI,KAAA,GAAO,SAAS;AAYlC,aANa,KAAK,KAAK,OAAO;AAAA,QAC5B,KAAK;AAAA,QACL,KAAK,MAAM;AAAA,QACX,OAAO,MAAM;AAAA,MAAA,CACd;AAAA,IAEM,GAGH,mBAAmB,CAAC,UACjB,MAAM,KAAK,KAAK,EAAE;AAAA,MAAO,CAAC,SAC/B,2CAA2C,KAAK,KAAK,IAAI;AAAA,IAAA,GAIvD,oBAAoB,OACxB,QACA,MACA,aACG;AACH,YAAM,OAAO,MAAM,WAAW,IAAI;AAClC,UAAI,CAAC,KAAM;AAEX,YAAM,cACJ,aAAa,SACT,OAAO,MAAM,GAAG,OAAO,UAAU,IAAI,IACrC,OAAO,MAAM,GAAG,qBAAqB,IAAI;AAE/C,aAAO,SAAS,WAAW;AAAA,IAAA;AAG7B,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,QACT,OAAO;AAAA,UACL,aAAa,CAAC,QAAQ,MAAM;;AAC1B,kBAAM,QAAQ,kBAAiB,OAAE,kBAAF,mBAAiB,KAAK;AACrD,gBAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,uBAAW,QAAQ;AACjB,gCAAkB,QAAQ,IAAI;AAGhC,mBAAO;AAAA,UAAA;AAAA,UAET,YAAY,CAAC,QAAQ,GAAG,IAAI,UAAU;AACpC,gBAAI,MAAO,QAAO;AAElB,kBAAM,QAAQ,iBAAiB,EAAE,aAAa,KAAK;AACnD,gBAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,kBAAM,EAAE,KAAK,aAAa,OAAO,YAAY;AAAA,cAC3C,MAAM,EAAE;AAAA,cACR,KAAK,EAAE;AAAA,YAAA,CACR;AAED,uBAAW,QAAQ;AACjB,gCAAkB,QAAQ,MAAM,QAAQ;AAE1C,mBAAO;AAAA,UAAA;AAAA,QACT;AAAA,MACF,CACD;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"image.js","sources":["../../src/image/image.ts"],"sourcesContent":["import { WorkspaceElement } from '@edifice.io/client';\nimport { ImageResizer } from '@edifice.io/utilities';\nimport { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport TiptapImage from '@tiptap/extension-image';\nimport { Plugin } from 'prosemirror-state';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\n uploadFile?: (file: File) => Promise<WorkspaceElement | null>;\n}\n\ninterface AttributesProps {\n width: number | string;\n height: number | string;\n size: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customImage: {\n setAttributes: (options: AttributesProps) => ReturnType;\n setNewImage: (options: {\n src: string;\n alt?: string;\n title?: string;\n }) => ReturnType;\n };\n }\n}\n\nexport const Image = TiptapImage.extend<CustomImageOptions>({\n name: 'custom-image',\n draggable: true,\n selectable: true,\n\n addOptions() {\n return {\n ...this.parent?.(),\n inline: true,\n content: 'inline*',\n sizes: ['small', 'medium', 'large'],\n HTMLAttributes: {\n class: 'custom-image',\n },\n uploadFile: () => {\n return Promise.resolve(null);\n },\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n size: {\n default: 'medium',\n rendered: false,\n },\n alt: {\n renderHTML: (attributes) => {\n return {\n alt: attributes.alt,\n };\n },\n parseHTML: (element) => element.getAttribute('alt'),\n },\n title: {\n renderHTML: (attributes) => {\n return {\n title: attributes.title,\n };\n },\n parseHTML: (element) => element.getAttribute('title'),\n },\n width: {\n default: '350',\n renderHTML: (attributes) => {\n if (\n attributes.width !== null &&\n attributes.width !== undefined &&\n !Number.isNaN(attributes.width)\n ) {\n return {\n width: parseInt(attributes.width),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n if (\n attributes.height !== null &&\n attributes.height !== undefined &&\n !Number.isNaN(attributes.height)\n ) {\n return {\n height: parseInt(attributes.height),\n };\n }\n return {};\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) => {\n return null;\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]:not([src^=\"data:\"])',\n getAttrs: (el: HTMLImageElement) => {\n const attr = { src: el.getAttribute('src') };\n // Check old content format and get the width from the parent element\n if (el.parentElement?.className.includes('image-container')) {\n if (el.parentElement.style?.width) {\n attr['width'] = el.parentElement.style.width;\n }\n }\n if (el.style?.width) {\n attr['width'] = el.style.width;\n }\n\n // Check old content smiley\n const oldSmileyList = [\n 'happy',\n 'proud',\n 'dreamy',\n 'love',\n 'tired',\n 'angry',\n 'worried',\n 'sick',\n 'joker',\n 'sad',\n ];\n if (\n oldSmileyList.filter((smiley) => attr.src.includes(smiley + '.png'))\n .length > 0\n ) {\n attr['style'] = {\n width: '1.5em',\n height: '1.5em',\n fontSize: '16px',\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\n }\n\n return attr;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'img',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: IMAGE_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , alt, src, title] = match;\n\n return {\n src,\n alt,\n title,\n };\n },\n }),\n ];\n },\n\n addCommands() {\n return {\n setNewImage:\n (attrs) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(attrs);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n setAttributes:\n (attributes) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n\n const nodeAttrs = tr.doc.nodeAt(tr.selection.from);\n const options = {\n ...nodeAttrs.attrs,\n ...attributes,\n };\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 addProseMirrorPlugins() {\n const uploadNode = async (file: File) => {\n /**\n * Resize the image\n */\n const resizedImage = await ImageResizer.resizeImageFile(file);\n\n /**\n * Upload the image\n */\n const image = await this.options.uploadFile(resizedImage);\n\n /**\n * Get the image url\n */\n const imageUrl = `/workspace/${image.public ? 'pub/' : ''}document/${\n image._id\n }?timestamp=${new Date().getTime()}`;\n\n /**\n * Create the image node\n */\n\n const node = this.type.create({\n src: imageUrl,\n alt: image.alt,\n title: image.title,\n });\n\n return node;\n };\n\n const getFilteredFiles = (files: FileList) => {\n return Array.from(files).filter((file) =>\n /image\\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type),\n );\n };\n\n const handleImageInsert = async (\n editor: any,\n file: File,\n position?: number,\n ) => {\n const node = await uploadNode(file);\n if (!node) return;\n\n const transaction =\n position !== undefined\n ? editor.state.tr.insert(position, node)\n : editor.state.tr.replaceSelectionWith(node);\n\n editor.dispatch(transaction);\n };\n\n return [\n new Plugin({\n props: {\n handlePaste: (editor, e) => {\n const files = getFilteredFiles(e.clipboardData?.files);\n if (files.length === 0) return false;\n\n for (const file of files) {\n handleImageInsert(editor, file);\n }\n\n return true;\n },\n handleDrop: (editor, e, _s, moved) => {\n if (moved) return false;\n\n const files = getFilteredFiles(e.dataTransfer.files);\n if (files.length === 0) return false;\n\n const { pos: position } = editor.posAtCoords({\n left: e.clientX,\n top: e.clientY,\n });\n\n for (const file of files) {\n handleImageInsert(editor, file, position);\n }\n return true;\n },\n },\n }),\n ];\n },\n});\n"],"names":[],"mappings":";;;;AAMO,MAAM,oBACX,4DA2BW,QAAQ,YAAY,OAA2B;AAAA,EAC1D,MAAM;AAAA,EACN,WAAW;AAAA,EACX,YAAY;AAAA,EAEZ,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,CAAC,SAAS,UAAU,OAAO;AAAA,MAClC,gBAAgB;AAAA,QACd,OAAO;AAAA,MAAA;AAAA,MAET,YAAY,MACH,QAAQ,QAAQ,IAAI;AAAA,IAC7B;AAAA,EAEJ;AAAA,EAEA,gBAAgB;;AACd,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,UAAU;AAAA,MAAA;AAAA,MAEZ,KAAK;AAAA,QACH,YAAY,CAAC,gBACJ;AAAA,UACL,KAAK,WAAW;AAAA,QAAA;AAAA,QAGpB,WAAW,CAAC,YAAY,QAAQ,aAAa,KAAK;AAAA,MAAA;AAAA,MAEpD,OAAO;AAAA,QACL,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,WAAW;AAAA,QAAA;AAAA,QAGtB,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MAAA;AAAA,MAEtD,OAAO;AAAA,QACL,SAAS;AAAA,QACT,YAAY,CAAC,eAET,WAAW,UAAU,QACrB,WAAW,UAAU,UACrB,CAAC,OAAO,MAAM,WAAW,KAAK,IAEvB;AAAA,UACL,OAAO,SAAS,WAAW,KAAK;AAAA,QAAA,IAG7B,CAAA;AAAA,QAET,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MAAA;AAAA,MAEtD,QAAQ;AAAA,QACN,YAAY,CAAC,eAET,WAAW,WAAW,QACtB,WAAW,WAAW,UACtB,CAAC,OAAO,MAAM,WAAW,MAAM,IAExB;AAAA,UACL,QAAQ,SAAS,WAAW,MAAM;AAAA,QAAA,IAG/B,CAAA;AAAA,QAET,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,YACH;AAAA,MACT;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU,CAAC,OAAyB;;AAClC,gBAAM,OAAO,EAAE,KAAK,GAAG,aAAa,KAAK,EAAA;AAEzC,kBAAI,QAAG,kBAAH,WAAkB,UAAU,SAAS,uBACnC,QAAG,cAAc,UAAjB,WAAwB,UAC1B,KAAK,QAAW,GAAG,cAAc,MAAM,SAGvC,QAAG,UAAH,WAAU,UACZ,KAAK,QAAW,GAAG,MAAM,QAIL;AAAA,YACpB;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA,EAGc,OAAO,CAAC,WAAW,KAAK,IAAI,SAAS,SAAS,MAAM,CAAC,EAChE,SAAS,MAEZ,KAAK,QAAW;AAAA,YACd,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,UAAU;AAAA,UAAA,GAEZ,KAAK,QAAW,QAChB,KAAK,SAAY,SAGZ;AAAA,QACT;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,IAAA;AAAA,EAE/D;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,MAAM,KAAK;AAAA,QACX,eAAe,CAAC,UAAU;AACxB,gBAAM,KAAK,KAAK,KAAK,KAAK,IAAI;AAE9B,iBAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,EAEL;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,aACE,CAAC,UACD,CAAC,EAAE,IAAI,eAAe;AACpB,cAAM,EAAE,cAAc,IAChB,OAAO,KAAK,KAAK,OAAO,KAAK;AAEnC,eAAI,YACF,GAAG,iBAAiB,UAAU,MAAM,UAAU,IAAI,IAAI,GAGjD;AAAA,MACT;AAAA,MACF,eACE,CAAC,eACD,CAAC,EAAE,IAAI,eAAe;AACpB,cAAM,EAAE,cAAc,IAGhB,UAAU;AAAA,UACd,GAFgB,GAAG,IAAI,OAAO,GAAG,UAAU,IAAI,EAElC;AAAA,UACb,GAAG;AAAA,QAAA,GAEC,OAAO,KAAK,KAAK,OAAO,OAAO;AAErC,eAAI,YACF,GAAG,iBAAiB,UAAU,MAAM,UAAU,IAAI,IAAI,GAGjD;AAAA,MACT;AAAA,IAAA;AAAA,EAEN;AAAA,EAEA,wBAAwB;AACtB,UAAM,aAAa,OAAO,SAAe;AAIvC,YAAM,eAAe,MAAM,aAAa,gBAAgB,IAAI,GAKtD,QAAQ,MAAM,KAAK,QAAQ,WAAW,YAAY,GAKlD,WAAW,cAAc,MAAM,SAAS,SAAS,EAAE,YACvD,MAAM,GACR,eAAc,oBAAI,KAAA,GAAO,SAAS;AAYlC,aANa,KAAK,KAAK,OAAO;AAAA,QAC5B,KAAK;AAAA,QACL,KAAK,MAAM;AAAA,QACX,OAAO,MAAM;AAAA,MAAA,CACd;AAAA,IAGH,GAEM,mBAAmB,CAAC,UACjB,MAAM,KAAK,KAAK,EAAE;AAAA,MAAO,CAAC,SAC/B,2CAA2C,KAAK,KAAK,IAAI;AAAA,IAAA,GAIvD,oBAAoB,OACxB,QACA,MACA,aACG;AACH,YAAM,OAAO,MAAM,WAAW,IAAI;AAClC,UAAI,CAAC,KAAM;AAEX,YAAM,cACJ,aAAa,SACT,OAAO,MAAM,GAAG,OAAO,UAAU,IAAI,IACrC,OAAO,MAAM,GAAG,qBAAqB,IAAI;AAE/C,aAAO,SAAS,WAAW;AAAA,IAC7B;AAEA,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,QACT,OAAO;AAAA,UACL,aAAa,CAAC,QAAQ,MAAM;;AAC1B,kBAAM,QAAQ,kBAAiB,OAAE,kBAAF,mBAAiB,KAAK;AACrD,gBAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,uBAAW,QAAQ;AACjB,gCAAkB,QAAQ,IAAI;AAGhC,mBAAO;AAAA,UACT;AAAA,UACA,YAAY,CAAC,QAAQ,GAAG,IAAI,UAAU;AACpC,gBAAI,MAAO,QAAO;AAElB,kBAAM,QAAQ,iBAAiB,EAAE,aAAa,KAAK;AACnD,gBAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,kBAAM,EAAE,KAAK,aAAa,OAAO,YAAY;AAAA,cAC3C,MAAM,EAAE;AAAA,cACR,KAAK,EAAE;AAAA,YAAA,CACR;AAED,uBAAW,QAAQ;AACjB,gCAAkB,QAAQ,MAAM,QAAQ;AAE1C,mBAAO;AAAA,UACT;AAAA,QAAA;AAAA,MACF,CACD;AAAA,IAAA;AAAA,EAEL;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"information-pane.cjs","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n informationPane: {\n /**\n * Set a informationPane node\n * @param type The type of the informationPane\n */\n setInformationPane: (type?: string) => ReturnType;\n };\n }\n}\n\nexport const InformationPane = Node.create({\n name: 'information-pane',\n\n group: 'block',\n content: 'block+',\n defining: true,\n marks: '',\n\n addAttributes() {\n return {\n type: {\n default: 'info', // type par défaut\n parseHTML: (element) => element.getAttribute('data-type') || 'info',\n renderHTML: (attributes) => {\n return {\n 'data-type': attributes.type,\n };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-information-pane]',\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const type = node.attrs.type;\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-information-pane': '',\n 'class': `information-pane information-pane-${type}`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setInformationPane:\n (type = 'info') =>\n ({ commands }) => {\n return commands.insertContent([\n {\n type: this.name,\n attrs: { type },\n content: [\n {\n type: 'paragraph',\n },\n ],\n },\n ]);\n },\n };\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAca,gBAAkBA,KAAAA,KAAK,OAAO,CACzC,KAAM,mBAEN,MAAO,QACP,QAAS,SACT,SAAU,GACV,MAAO,GAEP,eAAgB,CACd,MAAO,CACL,KAAM,CACJ,QAAS,OACT,UAAY,SAAY,QAAQ,aAAa,WAAW,GAAK,OAC7D,WAAa,aACJ,CACL,YAAa,WAAW,IAAA,EAE5B,CACF,
|
|
1
|
+
{"version":3,"file":"information-pane.cjs","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n informationPane: {\n /**\n * Set a informationPane node\n * @param type The type of the informationPane\n */\n setInformationPane: (type?: string) => ReturnType;\n };\n }\n}\n\nexport const InformationPane = Node.create({\n name: 'information-pane',\n\n group: 'block',\n content: 'block+',\n defining: true,\n marks: '',\n\n addAttributes() {\n return {\n type: {\n default: 'info', // type par défaut\n parseHTML: (element) => element.getAttribute('data-type') || 'info',\n renderHTML: (attributes) => {\n return {\n 'data-type': attributes.type,\n };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-information-pane]',\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const type = node.attrs.type;\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-information-pane': '',\n 'class': `information-pane information-pane-${type}`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setInformationPane:\n (type = 'info') =>\n ({ commands }) => {\n return commands.insertContent([\n {\n type: this.name,\n attrs: { type },\n content: [\n {\n type: 'paragraph',\n },\n ],\n },\n ]);\n },\n };\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAca,gBAAkBA,KAAAA,KAAK,OAAO,CACzC,KAAM,mBAEN,MAAO,QACP,QAAS,SACT,SAAU,GACV,MAAO,GAEP,eAAgB,CACd,MAAO,CACL,KAAM,CACJ,QAAS,OACT,UAAY,SAAY,QAAQ,aAAa,WAAW,GAAK,OAC7D,WAAa,aACJ,CACL,YAAa,WAAW,IAAA,EAE5B,CACF,CAEJ,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,4BAAA,CACP,CAEJ,EAEA,WAAW,CAAE,KAAM,gBAAkB,CACnC,MAAM,KAAO,KAAK,MAAM,KACxB,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAC9B,wBAAyB,GACzB,MAAS,qCAAqC,IAAI,EAAA,CACnD,EACD,CAAA,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,mBACE,CAAC,KAAO,SACR,CAAC,CAAE,YACM,SAAS,cAAc,CAC5B,CACE,KAAM,KAAK,KACX,MAAO,CAAE,IAAA,EACT,QAAS,CACP,CACE,KAAM,WAAA,CACR,CACF,CACF,CACD,CACH,CAEN,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"information-pane.js","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n informationPane: {\n /**\n * Set a informationPane node\n * @param type The type of the informationPane\n */\n setInformationPane: (type?: string) => ReturnType;\n };\n }\n}\n\nexport const InformationPane = Node.create({\n name: 'information-pane',\n\n group: 'block',\n content: 'block+',\n defining: true,\n marks: '',\n\n addAttributes() {\n return {\n type: {\n default: 'info', // type par défaut\n parseHTML: (element) => element.getAttribute('data-type') || 'info',\n renderHTML: (attributes) => {\n return {\n 'data-type': attributes.type,\n };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-information-pane]',\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const type = node.attrs.type;\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-information-pane': '',\n 'class': `information-pane information-pane-${type}`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setInformationPane:\n (type = 'info') =>\n ({ commands }) => {\n return commands.insertContent([\n {\n type: this.name,\n attrs: { type },\n content: [\n {\n type: 'paragraph',\n },\n ],\n },\n ]);\n },\n };\n },\n});\n"],"names":[],"mappings":";AAcO,MAAM,kBAAkB,KAAK,OAAO;AAAA,EACzC,MAAM;AAAA,EAEN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EAEP,gBAAgB;AACd,WAAO;AAAA,MACL,MAAM;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,WAAW,CAAC,YAAY,QAAQ,aAAa,WAAW,KAAK;AAAA,QAC7D,YAAY,CAAC,gBACJ;AAAA,UACL,aAAa,WAAW;AAAA,QAAA;AAAA,MAE5B;AAAA,IACF;AAAA,
|
|
1
|
+
{"version":3,"file":"information-pane.js","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n informationPane: {\n /**\n * Set a informationPane node\n * @param type The type of the informationPane\n */\n setInformationPane: (type?: string) => ReturnType;\n };\n }\n}\n\nexport const InformationPane = Node.create({\n name: 'information-pane',\n\n group: 'block',\n content: 'block+',\n defining: true,\n marks: '',\n\n addAttributes() {\n return {\n type: {\n default: 'info', // type par défaut\n parseHTML: (element) => element.getAttribute('data-type') || 'info',\n renderHTML: (attributes) => {\n return {\n 'data-type': attributes.type,\n };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-information-pane]',\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const type = node.attrs.type;\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-information-pane': '',\n 'class': `information-pane information-pane-${type}`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setInformationPane:\n (type = 'info') =>\n ({ commands }) => {\n return commands.insertContent([\n {\n type: this.name,\n attrs: { type },\n content: [\n {\n type: 'paragraph',\n },\n ],\n },\n ]);\n },\n };\n },\n});\n"],"names":[],"mappings":";AAcO,MAAM,kBAAkB,KAAK,OAAO;AAAA,EACzC,MAAM;AAAA,EAEN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EAEP,gBAAgB;AACd,WAAO;AAAA,MACL,MAAM;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,WAAW,CAAC,YAAY,QAAQ,aAAa,WAAW,KAAK;AAAA,QAC7D,YAAY,CAAC,gBACJ;AAAA,UACL,aAAa,WAAW;AAAA,QAAA;AAAA,MAE5B;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,MAAM,kBAAkB;AACnC,UAAM,OAAO,KAAK,MAAM;AACxB,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB;AAAA,QAC9B,yBAAyB;AAAA,QACzB,OAAS,qCAAqC,IAAI;AAAA,MAAA,CACnD;AAAA,MACD;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,oBACE,CAAC,OAAO,WACR,CAAC,EAAE,eACM,SAAS,cAAc;AAAA,QAC5B;AAAA,UACE,MAAM,KAAK;AAAA,UACX,OAAO,EAAE,KAAA;AAAA,UACT,SAAS;AAAA,YACP;AAAA,cACE,MAAM;AAAA,YAAA;AAAA,UACR;AAAA,QACF;AAAA,MACF,CACD;AAAA,IACH;AAAA,EAEN;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-height.cjs","sources":["../../src/line-height/line-height.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport const LineHeight = Extension.create({\n name: 'lineHeight',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n lineHeight: {\n default: null,\n parseHTML: (element) =>\n element.style.lineHeight?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.lineHeight) {\n return {};\n }\n\n return {\n style: `line-height: ${attributes.lineHeight}`,\n };\n },\n },\n },\n },\n ];\n },\n});\n"],"names":["Extension"],"mappings":"2JAIa,WAAaA,KAAAA,UAAU,OAAO,CACzC,KAAM,aAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CAAA,
|
|
1
|
+
{"version":3,"file":"line-height.cjs","sources":["../../src/line-height/line-height.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport const LineHeight = Extension.create({\n name: 'lineHeight',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n lineHeight: {\n default: null,\n parseHTML: (element) =>\n element.style.lineHeight?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.lineHeight) {\n return {};\n }\n\n return {\n style: `line-height: ${attributes.lineHeight}`,\n };\n },\n },\n },\n },\n ];\n },\n});\n"],"names":["Extension"],"mappings":"2JAIa,WAAaA,KAAAA,UAAU,OAAO,CACzC,KAAM,aAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CAAA,CAEvB,EAEA,qBAAsB,CACpB,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,WAAY,CACV,QAAS,KACT,UAAY,SAAA,QACV,kBAAQ,MAAM,aAAd,eAA0B,QAAQ,SAAU,KAC9C,WAAa,YACN,WAAW,WAIT,CACL,MAAO,gBAAgB,WAAW,UAAU,EAAA,EAJrC,CAAA,CAMX,CACF,CACF,CACF,CAEJ,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-height.js","sources":["../../src/line-height/line-height.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport const LineHeight = Extension.create({\n name: 'lineHeight',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n lineHeight: {\n default: null,\n parseHTML: (element) =>\n element.style.lineHeight?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.lineHeight) {\n return {};\n }\n\n return {\n style: `line-height: ${attributes.lineHeight}`,\n };\n },\n },\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":";;AAIO,MAAM,aAAa,UAAU,OAAO;AAAA,EACzC,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO,CAAC,WAAW;AAAA,IAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"line-height.js","sources":["../../src/line-height/line-height.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport const LineHeight = Extension.create({\n name: 'lineHeight',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n lineHeight: {\n default: null,\n parseHTML: (element) =>\n element.style.lineHeight?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.lineHeight) {\n return {};\n }\n\n return {\n style: `line-height: ${attributes.lineHeight}`,\n };\n },\n },\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":";;AAIO,MAAM,aAAa,UAAU,OAAO;AAAA,EACzC,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO,CAAC,WAAW;AAAA,IAAA;AAAA,EAEvB;AAAA,EAEA,sBAAsB;AACpB,WAAO;AAAA,MACL;AAAA,QACE,OAAO,KAAK,QAAQ;AAAA,QACpB,YAAY;AAAA,UACV,YAAY;AAAA,YACV,SAAS;AAAA,YACT,WAAW,CAAC,YAAA;;AACV,mCAAQ,MAAM,eAAd,mBAA0B,QAAQ,UAAU;AAAA;AAAA,YAC9C,YAAY,CAAC,eACN,WAAW,aAIT;AAAA,cACL,OAAO,gBAAgB,WAAW,UAAU;AAAA,YAAA,IAJrC,CAAA;AAAA,UAMX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.cjs","sources":["../../src/linker/linker.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\nimport { NodeSelection } from '@tiptap/pm/state';\n\n/* Our own model of a link in a rich document. */\nexport type LinkerAttributes = {\n 'href': string | null;\n 'target': '_blank' | null;\n 'title': string | null;\n 'data-id': string | null;\n 'data-app-prefix': string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n linker: {\n /**\n * Set a linker node\n */\n setLinker: (attributes: LinkerAttributes) => ReturnType;\n /**\n * Unset a linker node\n */\n unsetLinker: () => ReturnType;\n };\n }\n}\n\n/**\n * Internal links extension.\n * Reproduces the legacy angularJs \"linker\" directive.\n *\n * Links to internal resources MAY have a `title` and MUST HAVE `data-id` and `data-app-prefix` attributes :\n * `<a href=\"/blog#/view/35fa4198-blog_id/5e654c71-article_id\" data-app-prefix=\"blog\" data-id=\"35fa4198-blog_id\" target=\"_blank\" title=\"Voir ce billet de blog\" class=\"ng-scope\">/blog#/view/35fa4198-57fe-45eb-94f4-a5e4defff305/5e654c71-1e61-4f84-86dc-6fcfaf33f513</a>`\n */\nexport const Linker = Node.create({\n name: 'linker',\n content: 'text*',\n marks: '',\n group: 'inline',\n\n inline: true,\n selectable: true,\n atom: true,\n draggable: true,\n isolating: true,\n allowGapCursor: false,\n\n priority: 1100,\n keepOnSplit: false,\n\n addOptions() {\n return {\n openOnClick: true,\n HTMLAttributes: {\n 'target': null,\n 'title': null,\n 'class': null,\n 'data-id': null,\n 'data-app-prefix': null,\n },\n validate: undefined,\n };\n },\n\n addAttributes() {\n return {\n 'href': {\n default: null,\n },\n 'class': {\n default: this.options.HTMLAttributes.class,\n },\n 'target': {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n },\n 'title': {\n default: this.options.HTMLAttributes.title,\n },\n 'data-id': {\n default: this.options.HTMLAttributes['data-id'],\n },\n 'data-app-prefix': {\n default: this.options.HTMLAttributes['data-app-prefix'],\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])[data-id][data-app-prefix]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n if (HTMLAttributes.href?.startsWith('javascript:')) {\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, {\n ...HTMLAttributes,\n href: '',\n }),\n 0,\n ];\n }\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setLinker:\n (attrs) =>\n ({ commands }) => {\n // Insert a Linker node with inner text node\n commands.insertContent({\n type: this.name,\n attrs,\n content: [\n {\n type: 'text',\n text: attrs.title,\n },\n ],\n });\n return true;\n },\n\n unsetLinker:\n () =>\n ({ state, tr }) => {\n // Which Linker node is actually selected ?\n const { node, from, to } = state.selection as NodeSelection;\n // Delete any selected Linker node\n if (node?.type.name === 'linker') {\n /* The following does not work as one would expected.\n commands.deleteNode(this.name);\n commands.deleteCurrentNode();\n * Replaced by : */\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n },\n };\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAkCa,OAASA,KAAAA,KAAK,OAAO,CAChC,KAAM,SACN,QAAS,QACT,MAAO,GACP,MAAO,SAEP,OAAQ,GACR,WAAY,GACZ,KAAM,GACN,UAAW,GACX,UAAW,GACX,eAAgB,GAEhB,SAAU,KACV,YAAa,GAEb,YAAa,CACX,MAAO,CACL,YAAa,GACb,eAAgB,CACd,OAAU,KACV,MAAS,KACT,MAAS,KACT,UAAW,KACX,kBAAmB,IAAA,EAErB,SAAU,MAAA,
|
|
1
|
+
{"version":3,"file":"linker.cjs","sources":["../../src/linker/linker.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\nimport { NodeSelection } from '@tiptap/pm/state';\n\n/* Our own model of a link in a rich document. */\nexport type LinkerAttributes = {\n 'href': string | null;\n 'target': '_blank' | null;\n 'title': string | null;\n 'data-id': string | null;\n 'data-app-prefix': string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n linker: {\n /**\n * Set a linker node\n */\n setLinker: (attributes: LinkerAttributes) => ReturnType;\n /**\n * Unset a linker node\n */\n unsetLinker: () => ReturnType;\n };\n }\n}\n\n/**\n * Internal links extension.\n * Reproduces the legacy angularJs \"linker\" directive.\n *\n * Links to internal resources MAY have a `title` and MUST HAVE `data-id` and `data-app-prefix` attributes :\n * `<a href=\"/blog#/view/35fa4198-blog_id/5e654c71-article_id\" data-app-prefix=\"blog\" data-id=\"35fa4198-blog_id\" target=\"_blank\" title=\"Voir ce billet de blog\" class=\"ng-scope\">/blog#/view/35fa4198-57fe-45eb-94f4-a5e4defff305/5e654c71-1e61-4f84-86dc-6fcfaf33f513</a>`\n */\nexport const Linker = Node.create({\n name: 'linker',\n content: 'text*',\n marks: '',\n group: 'inline',\n\n inline: true,\n selectable: true,\n atom: true,\n draggable: true,\n isolating: true,\n allowGapCursor: false,\n\n priority: 1100,\n keepOnSplit: false,\n\n addOptions() {\n return {\n openOnClick: true,\n HTMLAttributes: {\n 'target': null,\n 'title': null,\n 'class': null,\n 'data-id': null,\n 'data-app-prefix': null,\n },\n validate: undefined,\n };\n },\n\n addAttributes() {\n return {\n 'href': {\n default: null,\n },\n 'class': {\n default: this.options.HTMLAttributes.class,\n },\n 'target': {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n },\n 'title': {\n default: this.options.HTMLAttributes.title,\n },\n 'data-id': {\n default: this.options.HTMLAttributes['data-id'],\n },\n 'data-app-prefix': {\n default: this.options.HTMLAttributes['data-app-prefix'],\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])[data-id][data-app-prefix]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n if (HTMLAttributes.href?.startsWith('javascript:')) {\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, {\n ...HTMLAttributes,\n href: '',\n }),\n 0,\n ];\n }\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setLinker:\n (attrs) =>\n ({ commands }) => {\n // Insert a Linker node with inner text node\n commands.insertContent({\n type: this.name,\n attrs,\n content: [\n {\n type: 'text',\n text: attrs.title,\n },\n ],\n });\n return true;\n },\n\n unsetLinker:\n () =>\n ({ state, tr }) => {\n // Which Linker node is actually selected ?\n const { node, from, to } = state.selection as NodeSelection;\n // Delete any selected Linker node\n if (node?.type.name === 'linker') {\n /* The following does not work as one would expected.\n commands.deleteNode(this.name);\n commands.deleteCurrentNode();\n * Replaced by : */\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n },\n };\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAkCa,OAASA,KAAAA,KAAK,OAAO,CAChC,KAAM,SACN,QAAS,QACT,MAAO,GACP,MAAO,SAEP,OAAQ,GACR,WAAY,GACZ,KAAM,GACN,UAAW,GACX,UAAW,GACX,eAAgB,GAEhB,SAAU,KACV,YAAa,GAEb,YAAa,CACX,MAAO,CACL,YAAa,GACb,eAAgB,CACd,OAAU,KACV,MAAS,KACT,MAAS,KACT,UAAW,KACX,kBAAmB,IAAA,EAErB,SAAU,MAAA,CAEd,EAEA,eAAgB,CACd,MAAO,CACL,KAAQ,CACN,QAAS,IAAA,EAEX,MAAS,CACP,QAAS,KAAK,QAAQ,eAAe,KAAA,EAEvC,OAAU,CACR,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAW,KAAO,QAAA,EAEzD,MAAS,CACP,QAAS,KAAK,QAAQ,eAAe,KAAA,EAEvC,UAAW,CACT,QAAS,KAAK,QAAQ,eAAe,SAAS,CAAA,EAEhD,kBAAmB,CACjB,QAAS,KAAK,QAAQ,eAAe,iBAAiB,CAAA,CACxD,CAEJ,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,kEAAA,CACP,CAEJ,EAEA,WAAW,CAAE,gBAAkB,QAC7B,OAAI,kBAAe,OAAf,SAAqB,WAAW,eAC3B,CACL,IACAC,qBAAgB,KAAK,QAAQ,eAAgB,CAC3C,GAAG,eACH,KAAM,EAAA,CACP,EACD,CAAA,EAGG,CACL,IACAA,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CAAA,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,UACG,OACD,CAAC,CAAE,aAED,SAAS,cAAc,CACrB,KAAM,KAAK,KACX,MACA,QAAS,CACP,CACE,KAAM,OACN,KAAM,MAAM,KAAA,CACd,CACF,CACD,EACM,IAGX,YACE,IACA,CAAC,CAAE,MAAO,MAAS,CAEjB,KAAM,CAAE,KAAM,KAAM,EAAA,EAAO,MAAM,UAEjC,OAAI,uBAAM,KAAK,QAAS,UAKtB,GAAG,OAAO,KAAM,EAAE,EAAE,eAAA,EAEf,EACT,CAAA,CAEN,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.js","sources":["../../src/linker/linker.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\nimport { NodeSelection } from '@tiptap/pm/state';\n\n/* Our own model of a link in a rich document. */\nexport type LinkerAttributes = {\n 'href': string | null;\n 'target': '_blank' | null;\n 'title': string | null;\n 'data-id': string | null;\n 'data-app-prefix': string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n linker: {\n /**\n * Set a linker node\n */\n setLinker: (attributes: LinkerAttributes) => ReturnType;\n /**\n * Unset a linker node\n */\n unsetLinker: () => ReturnType;\n };\n }\n}\n\n/**\n * Internal links extension.\n * Reproduces the legacy angularJs \"linker\" directive.\n *\n * Links to internal resources MAY have a `title` and MUST HAVE `data-id` and `data-app-prefix` attributes :\n * `<a href=\"/blog#/view/35fa4198-blog_id/5e654c71-article_id\" data-app-prefix=\"blog\" data-id=\"35fa4198-blog_id\" target=\"_blank\" title=\"Voir ce billet de blog\" class=\"ng-scope\">/blog#/view/35fa4198-57fe-45eb-94f4-a5e4defff305/5e654c71-1e61-4f84-86dc-6fcfaf33f513</a>`\n */\nexport const Linker = Node.create({\n name: 'linker',\n content: 'text*',\n marks: '',\n group: 'inline',\n\n inline: true,\n selectable: true,\n atom: true,\n draggable: true,\n isolating: true,\n allowGapCursor: false,\n\n priority: 1100,\n keepOnSplit: false,\n\n addOptions() {\n return {\n openOnClick: true,\n HTMLAttributes: {\n 'target': null,\n 'title': null,\n 'class': null,\n 'data-id': null,\n 'data-app-prefix': null,\n },\n validate: undefined,\n };\n },\n\n addAttributes() {\n return {\n 'href': {\n default: null,\n },\n 'class': {\n default: this.options.HTMLAttributes.class,\n },\n 'target': {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n },\n 'title': {\n default: this.options.HTMLAttributes.title,\n },\n 'data-id': {\n default: this.options.HTMLAttributes['data-id'],\n },\n 'data-app-prefix': {\n default: this.options.HTMLAttributes['data-app-prefix'],\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])[data-id][data-app-prefix]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n if (HTMLAttributes.href?.startsWith('javascript:')) {\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, {\n ...HTMLAttributes,\n href: '',\n }),\n 0,\n ];\n }\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setLinker:\n (attrs) =>\n ({ commands }) => {\n // Insert a Linker node with inner text node\n commands.insertContent({\n type: this.name,\n attrs,\n content: [\n {\n type: 'text',\n text: attrs.title,\n },\n ],\n });\n return true;\n },\n\n unsetLinker:\n () =>\n ({ state, tr }) => {\n // Which Linker node is actually selected ?\n const { node, from, to } = state.selection as NodeSelection;\n // Delete any selected Linker node\n if (node?.type.name === 'linker') {\n /* The following does not work as one would expected.\n commands.deleteNode(this.name);\n commands.deleteCurrentNode();\n * Replaced by : */\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAkCO,MAAM,SAAS,KAAK,OAAO;AAAA,EAChC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EAEP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW;AAAA,EACX,gBAAgB;AAAA,EAEhB,UAAU;AAAA,EACV,aAAa;AAAA,EAEb,aAAa;AACX,WAAO;AAAA,MACL,aAAa;AAAA,MACb,gBAAgB;AAAA,QACd,QAAU;AAAA,QACV,OAAS;AAAA,QACT,OAAS;AAAA,QACT,WAAW;AAAA,QACX,mBAAmB;AAAA,MAAA;AAAA,MAErB,UAAU;AAAA,IAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"linker.js","sources":["../../src/linker/linker.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\nimport { NodeSelection } from '@tiptap/pm/state';\n\n/* Our own model of a link in a rich document. */\nexport type LinkerAttributes = {\n 'href': string | null;\n 'target': '_blank' | null;\n 'title': string | null;\n 'data-id': string | null;\n 'data-app-prefix': string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n linker: {\n /**\n * Set a linker node\n */\n setLinker: (attributes: LinkerAttributes) => ReturnType;\n /**\n * Unset a linker node\n */\n unsetLinker: () => ReturnType;\n };\n }\n}\n\n/**\n * Internal links extension.\n * Reproduces the legacy angularJs \"linker\" directive.\n *\n * Links to internal resources MAY have a `title` and MUST HAVE `data-id` and `data-app-prefix` attributes :\n * `<a href=\"/blog#/view/35fa4198-blog_id/5e654c71-article_id\" data-app-prefix=\"blog\" data-id=\"35fa4198-blog_id\" target=\"_blank\" title=\"Voir ce billet de blog\" class=\"ng-scope\">/blog#/view/35fa4198-57fe-45eb-94f4-a5e4defff305/5e654c71-1e61-4f84-86dc-6fcfaf33f513</a>`\n */\nexport const Linker = Node.create({\n name: 'linker',\n content: 'text*',\n marks: '',\n group: 'inline',\n\n inline: true,\n selectable: true,\n atom: true,\n draggable: true,\n isolating: true,\n allowGapCursor: false,\n\n priority: 1100,\n keepOnSplit: false,\n\n addOptions() {\n return {\n openOnClick: true,\n HTMLAttributes: {\n 'target': null,\n 'title': null,\n 'class': null,\n 'data-id': null,\n 'data-app-prefix': null,\n },\n validate: undefined,\n };\n },\n\n addAttributes() {\n return {\n 'href': {\n default: null,\n },\n 'class': {\n default: this.options.HTMLAttributes.class,\n },\n 'target': {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n },\n 'title': {\n default: this.options.HTMLAttributes.title,\n },\n 'data-id': {\n default: this.options.HTMLAttributes['data-id'],\n },\n 'data-app-prefix': {\n default: this.options.HTMLAttributes['data-app-prefix'],\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])[data-id][data-app-prefix]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n if (HTMLAttributes.href?.startsWith('javascript:')) {\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, {\n ...HTMLAttributes,\n href: '',\n }),\n 0,\n ];\n }\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setLinker:\n (attrs) =>\n ({ commands }) => {\n // Insert a Linker node with inner text node\n commands.insertContent({\n type: this.name,\n attrs,\n content: [\n {\n type: 'text',\n text: attrs.title,\n },\n ],\n });\n return true;\n },\n\n unsetLinker:\n () =>\n ({ state, tr }) => {\n // Which Linker node is actually selected ?\n const { node, from, to } = state.selection as NodeSelection;\n // Delete any selected Linker node\n if (node?.type.name === 'linker') {\n /* The following does not work as one would expected.\n commands.deleteNode(this.name);\n commands.deleteCurrentNode();\n * Replaced by : */\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAkCO,MAAM,SAAS,KAAK,OAAO;AAAA,EAChC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EAEP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW;AAAA,EACX,gBAAgB;AAAA,EAEhB,UAAU;AAAA,EACV,aAAa;AAAA,EAEb,aAAa;AACX,WAAO;AAAA,MACL,aAAa;AAAA,MACb,gBAAgB;AAAA,QACd,QAAU;AAAA,QACV,OAAS;AAAA,QACT,OAAS;AAAA,QACT,WAAW;AAAA,QACX,mBAAmB;AAAA,MAAA;AAAA,MAErB,UAAU;AAAA,IAAA;AAAA,EAEd;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,MACL,MAAQ;AAAA,QACN,SAAS;AAAA,MAAA;AAAA,MAEX,OAAS;AAAA,QACP,SAAS,KAAK,QAAQ,eAAe;AAAA,MAAA;AAAA,MAEvC,QAAU;AAAA,QACR,SAAS,KAAK,QAAQ,eAAe;AAAA;AAAA,QAErC,WAAW,CAAC,YACV,QAAQ,aAAa,QAAQ,MAAM,WAAW,OAAO;AAAA,MAAA;AAAA,MAEzD,OAAS;AAAA,QACP,SAAS,KAAK,QAAQ,eAAe;AAAA,MAAA;AAAA,MAEvC,WAAW;AAAA,QACT,SAAS,KAAK,QAAQ,eAAe,SAAS;AAAA,MAAA;AAAA,MAEhD,mBAAmB;AAAA,QACjB,SAAS,KAAK,QAAQ,eAAe,iBAAiB;AAAA,MAAA;AAAA,IACxD;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;;AAC7B,YAAI,oBAAe,SAAf,WAAqB,WAAW,iBAC3B;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB;AAAA,QAC3C,GAAG;AAAA,QACH,MAAM;AAAA,MAAA,CACP;AAAA,MACD;AAAA,IAAA,IAGG;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,WACE,CAAC,UACD,CAAC,EAAE,gBAED,SAAS,cAAc;AAAA,QACrB,MAAM,KAAK;AAAA,QACX;AAAA,QACA,SAAS;AAAA,UACP;AAAA,YACE,MAAM;AAAA,YACN,MAAM,MAAM;AAAA,UAAA;AAAA,QACd;AAAA,MACF,CACD,GACM;AAAA,MAGX,aACE,MACA,CAAC,EAAE,OAAO,SAAS;AAEjB,cAAM,EAAE,MAAM,MAAM,GAAA,IAAO,MAAM;AAEjC,gBAAI,6BAAM,KAAK,UAAS,YAKtB,GAAG,OAAO,MAAM,EAAE,EAAE,eAAA,GAEf;AAAA,MACT;AAAA,IAAA;AAAA,EAEN;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mathjax.cjs","sources":["../../src/mathjax/mathjax.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const MathJax = Node.create({\n name: 'mathjaxnode',\n group: 'inline',\n inline: true,\n atom: false,\n selectable: true,\n\n parseHTML() {\n return [\n {\n tag: 'mathjax',\n },\n ];\n },\n\n addAttributes() {\n return {\n equation: {\n default: null,\n parseHTML: (element: any) => {\n const children = [...element.childNodes];\n const textNodes = children.filter((child) => child.nodeType === 3);\n return textNodes.length > 0\n ? textNodes[textNodes.length - 1].nodeValue\n : null;\n },\n },\n };\n },\n\n renderHTML({ HTMLAttributes }) {\n let equation = (HTMLAttributes.equation || '')\n // Get what is between \\begin{equation}{... ...}\\end{equation}\n // Or between \\begin{equation}... ...\\end{equation} without enclosing brackets\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*{(.+?)}\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n )\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*(.+?)\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n );\n if (equation.length > 0) {\n if (equation.charAt(0) !== '$') {\n equation = `$${equation}`;\n }\n if (equation.charAt(equation.length - 1) !== '$') {\n equation = `${equation}$`;\n }\n }\n return ['span', {}, equation];\n },\n});\n"],"names":["Node"],"mappings":"mHAEa,QAAUA,KAAAA,KAAK,OAAO,CACjC,KAAM,cACN,MAAO,SACP,OAAQ,GACR,KAAM,GACN,WAAY,GAEZ,WAAY,CACV,MAAO,CACL,CACE,IAAK,SAAA,CACP,
|
|
1
|
+
{"version":3,"file":"mathjax.cjs","sources":["../../src/mathjax/mathjax.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const MathJax = Node.create({\n name: 'mathjaxnode',\n group: 'inline',\n inline: true,\n atom: false,\n selectable: true,\n\n parseHTML() {\n return [\n {\n tag: 'mathjax',\n },\n ];\n },\n\n addAttributes() {\n return {\n equation: {\n default: null,\n parseHTML: (element: any) => {\n const children = [...element.childNodes];\n const textNodes = children.filter((child) => child.nodeType === 3);\n return textNodes.length > 0\n ? textNodes[textNodes.length - 1].nodeValue\n : null;\n },\n },\n };\n },\n\n renderHTML({ HTMLAttributes }) {\n let equation = (HTMLAttributes.equation || '')\n // Get what is between \\begin{equation}{... ...}\\end{equation}\n // Or between \\begin{equation}... ...\\end{equation} without enclosing brackets\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*{(.+?)}\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n )\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*(.+?)\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n );\n if (equation.length > 0) {\n if (equation.charAt(0) !== '$') {\n equation = `$${equation}`;\n }\n if (equation.charAt(equation.length - 1) !== '$') {\n equation = `${equation}$`;\n }\n }\n return ['span', {}, equation];\n },\n});\n"],"names":["Node"],"mappings":"mHAEa,QAAUA,KAAAA,KAAK,OAAO,CACjC,KAAM,cACN,MAAO,SACP,OAAQ,GACR,KAAM,GACN,WAAY,GAEZ,WAAY,CACV,MAAO,CACL,CACE,IAAK,SAAA,CACP,CAEJ,EAEA,eAAgB,CACd,MAAO,CACL,SAAU,CACR,QAAS,KACT,UAAY,SAAiB,CAE3B,MAAM,UADW,CAAC,GAAG,QAAQ,UAAU,EACZ,OAAQ,OAAU,MAAM,WAAa,CAAC,EACjE,OAAO,UAAU,OAAS,EACtB,UAAU,UAAU,OAAS,CAAC,EAAE,UAChC,IACN,CAAA,CACF,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,IAAI,UAAY,eAAe,UAAY,IAGxC,WACC,sEACA,QAAA,EAED,WACC,oEACA,QAAA,EAEJ,OAAI,SAAS,OAAS,IAChB,SAAS,OAAO,CAAC,IAAM,MACzB,SAAW,IAAI,QAAQ,IAErB,SAAS,OAAO,SAAS,OAAS,CAAC,IAAM,MAC3C,SAAW,GAAG,QAAQ,MAGnB,CAAC,OAAQ,CAAA,EAAI,QAAQ,CAC9B,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mathjax.js","sources":["../../src/mathjax/mathjax.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const MathJax = Node.create({\n name: 'mathjaxnode',\n group: 'inline',\n inline: true,\n atom: false,\n selectable: true,\n\n parseHTML() {\n return [\n {\n tag: 'mathjax',\n },\n ];\n },\n\n addAttributes() {\n return {\n equation: {\n default: null,\n parseHTML: (element: any) => {\n const children = [...element.childNodes];\n const textNodes = children.filter((child) => child.nodeType === 3);\n return textNodes.length > 0\n ? textNodes[textNodes.length - 1].nodeValue\n : null;\n },\n },\n };\n },\n\n renderHTML({ HTMLAttributes }) {\n let equation = (HTMLAttributes.equation || '')\n // Get what is between \\begin{equation}{... ...}\\end{equation}\n // Or between \\begin{equation}... ...\\end{equation} without enclosing brackets\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*{(.+?)}\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n )\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*(.+?)\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n );\n if (equation.length > 0) {\n if (equation.charAt(0) !== '$') {\n equation = `$${equation}`;\n }\n if (equation.charAt(equation.length - 1) !== '$') {\n equation = `${equation}$`;\n }\n }\n return ['span', {}, equation];\n },\n});\n"],"names":[],"mappings":";AAEO,MAAM,UAAU,KAAK,OAAO;AAAA,EACjC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,YAAY;AAAA,EAEZ,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,
|
|
1
|
+
{"version":3,"file":"mathjax.js","sources":["../../src/mathjax/mathjax.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const MathJax = Node.create({\n name: 'mathjaxnode',\n group: 'inline',\n inline: true,\n atom: false,\n selectable: true,\n\n parseHTML() {\n return [\n {\n tag: 'mathjax',\n },\n ];\n },\n\n addAttributes() {\n return {\n equation: {\n default: null,\n parseHTML: (element: any) => {\n const children = [...element.childNodes];\n const textNodes = children.filter((child) => child.nodeType === 3);\n return textNodes.length > 0\n ? textNodes[textNodes.length - 1].nodeValue\n : null;\n },\n },\n };\n },\n\n renderHTML({ HTMLAttributes }) {\n let equation = (HTMLAttributes.equation || '')\n // Get what is between \\begin{equation}{... ...}\\end{equation}\n // Or between \\begin{equation}... ...\\end{equation} without enclosing brackets\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*{(.+?)}\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n )\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*(.+?)\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n );\n if (equation.length > 0) {\n if (equation.charAt(0) !== '$') {\n equation = `$${equation}`;\n }\n if (equation.charAt(equation.length - 1) !== '$') {\n equation = `${equation}$`;\n }\n }\n return ['span', {}, equation];\n },\n});\n"],"names":[],"mappings":";AAEO,MAAM,UAAU,KAAK,OAAO;AAAA,EACjC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,YAAY;AAAA,EAEZ,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,MACL,UAAU;AAAA,QACR,SAAS;AAAA,QACT,WAAW,CAAC,YAAiB;AAE3B,gBAAM,YADW,CAAC,GAAG,QAAQ,UAAU,EACZ,OAAO,CAAC,UAAU,MAAM,aAAa,CAAC;AACjE,iBAAO,UAAU,SAAS,IACtB,UAAU,UAAU,SAAS,CAAC,EAAE,YAChC;AAAA,QACN;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,QAAI,YAAY,eAAe,YAAY,IAGxC;AAAA,MACC;AAAA,MACA;AAAA,IAAA,EAED;AAAA,MACC;AAAA,MACA;AAAA,IAAA;AAEJ,WAAI,SAAS,SAAS,MAChB,SAAS,OAAO,CAAC,MAAM,QACzB,WAAW,IAAI,QAAQ,KAErB,SAAS,OAAO,SAAS,SAAS,CAAC,MAAM,QAC3C,WAAW,GAAG,QAAQ,OAGnB,CAAC,QAAQ,CAAA,GAAI,QAAQ;AAAA,EAC9B;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.cjs","sources":["../../src/paragraph/paragraph.ts"],"sourcesContent":["import { Paragraph as TiptapParagraph } from '@tiptap/extension-paragraph';\n\n/**\n * Extends `Paragraph` extension from TipTap.\n *\n * This extension is used to parse documents in old-format (version 0),\n * where text alignments were applied on a <div> wrapping a <span>.\n * The new format is a <p> with style attributes.\n *\n * For example :\n * `<div style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></div>`\n * is now parsed and rendered as\n * `<p style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></p>`\n */\nexport const Paragraph = TiptapParagraph.extend({\n parseHTML() {\n const parentRules = this.parent?.() ?? [];\n return [\n ...parentRules,\n {\n tag: 'div[style]:has(> span)',\n },\n ];\n },\n});\n"],"names":["TiptapParagraph"],"mappings":"gJAca,UAAYA,mBAAAA,UAAgB,OAAO,CAC9C,WAAY,QAEV,MAAO,CACL,KAFkB,QAAK,SAAL,4BAAmB,CAAA,EAGrC,CACE,IAAK,wBAAA,CACP,CACF,
|
|
1
|
+
{"version":3,"file":"paragraph.cjs","sources":["../../src/paragraph/paragraph.ts"],"sourcesContent":["import { Paragraph as TiptapParagraph } from '@tiptap/extension-paragraph';\n\n/**\n * Extends `Paragraph` extension from TipTap.\n *\n * This extension is used to parse documents in old-format (version 0),\n * where text alignments were applied on a <div> wrapping a <span>.\n * The new format is a <p> with style attributes.\n *\n * For example :\n * `<div style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></div>`\n * is now parsed and rendered as\n * `<p style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></p>`\n */\nexport const Paragraph = TiptapParagraph.extend({\n parseHTML() {\n const parentRules = this.parent?.() ?? [];\n return [\n ...parentRules,\n {\n tag: 'div[style]:has(> span)',\n },\n ];\n },\n});\n"],"names":["TiptapParagraph"],"mappings":"gJAca,UAAYA,mBAAAA,UAAgB,OAAO,CAC9C,WAAY,QAEV,MAAO,CACL,KAFkB,QAAK,SAAL,4BAAmB,CAAA,EAGrC,CACE,IAAK,wBAAA,CACP,CAEJ,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.js","sources":["../../src/paragraph/paragraph.ts"],"sourcesContent":["import { Paragraph as TiptapParagraph } from '@tiptap/extension-paragraph';\n\n/**\n * Extends `Paragraph` extension from TipTap.\n *\n * This extension is used to parse documents in old-format (version 0),\n * where text alignments were applied on a <div> wrapping a <span>.\n * The new format is a <p> with style attributes.\n *\n * For example :\n * `<div style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></div>`\n * is now parsed and rendered as\n * `<p style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></p>`\n */\nexport const Paragraph = TiptapParagraph.extend({\n parseHTML() {\n const parentRules = this.parent?.() ?? [];\n return [\n ...parentRules,\n {\n tag: 'div[style]:has(> span)',\n },\n ];\n },\n});\n"],"names":["TiptapParagraph"],"mappings":";AAcO,MAAM,YAAYA,YAAgB,OAAO;AAAA,EAC9C,YAAY;;AAEV,WAAO;AAAA,MACL,KAFkB,UAAK,WAAL,kCAAmB,CAAA;AAAA,MAGrC;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,
|
|
1
|
+
{"version":3,"file":"paragraph.js","sources":["../../src/paragraph/paragraph.ts"],"sourcesContent":["import { Paragraph as TiptapParagraph } from '@tiptap/extension-paragraph';\n\n/**\n * Extends `Paragraph` extension from TipTap.\n *\n * This extension is used to parse documents in old-format (version 0),\n * where text alignments were applied on a <div> wrapping a <span>.\n * The new format is a <p> with style attributes.\n *\n * For example :\n * `<div style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></div>`\n * is now parsed and rendered as\n * `<p style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></p>`\n */\nexport const Paragraph = TiptapParagraph.extend({\n parseHTML() {\n const parentRules = this.parent?.() ?? [];\n return [\n ...parentRules,\n {\n tag: 'div[style]:has(> span)',\n },\n ];\n },\n});\n"],"names":["TiptapParagraph"],"mappings":";AAcO,MAAM,YAAYA,YAAgB,OAAO;AAAA,EAC9C,YAAY;;AAEV,WAAO;AAAA,MACL,KAFkB,UAAK,WAAL,kCAAmB,CAAA;AAAA,MAGrC;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-recognition.cjs","sources":["../../src/speech-recognition/speech-recognition.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechRecognitionOptions {\n lang: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n SpeechRecognition: {\n startSpeechRecognition: () => ReturnType;\n stopSpeechRecognition: () => ReturnType;\n isSpeechRecognitionStarted: () => boolean;\n };\n }\n}\n\nclass SR_Node<O = any, S = any> extends Node<O, S> {\n protected constructor() {\n super();\n }\n\n recognition: SpeechRecognition | undefined;\n readonly isStarted: boolean = false;\n\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SR_Node<O, S>;\n }\n}\n\nexport const SpeechRecognition = SR_Node.create<SpeechRecognitionOptions>({\n name: 'SpeechRecognition',\n\n addOptions() {\n return {\n lang: 'fr-FR',\n };\n },\n\n onCreate() {\n if (\n !('SpeechRecognition' in window || 'webkitSpeechRecognition' in window)\n ) {\n console.warn(\n '\"@edifice.io/tiptap-extensions/speechrecognition\" requires a browser supporting the SpeechRecognition API\".',\n );\n }\n },\n\n addCommands() {\n return {\n startSpeechRecognition:\n () =>\n ({ commands }) => {\n const SpeechRecognition =\n window.SpeechRecognition || window.webkitSpeechRecognition;\n this.recognition = new SpeechRecognition();\n\n this.recognition.lang = this.options.lang;\n this.recognition.interimResults = true;\n this.recognition.maxAlternatives = 1;\n this.recognition.continuous = true;\n\n this.recognition.start();\n\n // Memoize initial caret positions\n let { from, to } = this.editor.state.selection;\n\n this.recognition.onresult = (event: SpeechRecognitionEvent) => {\n let currentResult = '';\n\n // Add to the currentResult variable the content of the last recognized sentence\n for (let i = event.resultIndex; i < event.results.length; i++) {\n currentResult += event.results[i][0].transcript;\n }\n\n // Is this the final recognition ?\n const isFinal = event.results[event.results.length - 1].isFinal;\n\n // Replace selection by the last recognized sentence (+ style and select, if not final)\n this.editor.commands.deleteRange({ from, to });\n this.editor.commands.insertContentAt(\n from,\n isFinal ? currentResult : `<code>${currentResult}</code>`,\n { updateSelection: !isFinal },\n );\n to = this.editor.state.selection.to;\n\n if (isFinal) {\n // Next content will go after last insertion\n from = to;\n }\n };\n\n this.recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n // TODO create a \"feedback\" tiptap extension, to display user friendly error messages ?\n console.log(\n `[@edifice.io/tiptap-extensions/speech-recognition][error][${event.error}]: ${event.message}`,\n );\n };\n\n this.recognition.onstart = () => {\n this.isStarted = true;\n };\n\n this.recognition.onend = () => {\n this.isStarted = false;\n };\n\n return commands;\n },\n\n stopSpeechRecognition:\n () =>\n ({ commands }) => {\n this.recognition.stop();\n this.editor.commands.focus();\n return commands;\n },\n\n isSpeechRecognitionStarted: () => () => this.isStarted,\n };\n },\n});\n"],"names":["Node","SpeechRecognition"],"mappings":"mHAgBA,MAAM,gBAAkCA,KAAAA,IAAW,CACvC,aAAc,CACtB,MAAA,EAIF,KAAS,UAAqB,
|
|
1
|
+
{"version":3,"file":"speech-recognition.cjs","sources":["../../src/speech-recognition/speech-recognition.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechRecognitionOptions {\n lang: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n SpeechRecognition: {\n startSpeechRecognition: () => ReturnType;\n stopSpeechRecognition: () => ReturnType;\n isSpeechRecognitionStarted: () => boolean;\n };\n }\n}\n\nclass SR_Node<O = any, S = any> extends Node<O, S> {\n protected constructor() {\n super();\n }\n\n recognition: SpeechRecognition | undefined;\n readonly isStarted: boolean = false;\n\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SR_Node<O, S>;\n }\n}\n\nexport const SpeechRecognition = SR_Node.create<SpeechRecognitionOptions>({\n name: 'SpeechRecognition',\n\n addOptions() {\n return {\n lang: 'fr-FR',\n };\n },\n\n onCreate() {\n if (\n !('SpeechRecognition' in window || 'webkitSpeechRecognition' in window)\n ) {\n console.warn(\n '\"@edifice.io/tiptap-extensions/speechrecognition\" requires a browser supporting the SpeechRecognition API\".',\n );\n }\n },\n\n addCommands() {\n return {\n startSpeechRecognition:\n () =>\n ({ commands }) => {\n const SpeechRecognition =\n window.SpeechRecognition || window.webkitSpeechRecognition;\n this.recognition = new SpeechRecognition();\n\n this.recognition.lang = this.options.lang;\n this.recognition.interimResults = true;\n this.recognition.maxAlternatives = 1;\n this.recognition.continuous = true;\n\n this.recognition.start();\n\n // Memoize initial caret positions\n let { from, to } = this.editor.state.selection;\n\n this.recognition.onresult = (event: SpeechRecognitionEvent) => {\n let currentResult = '';\n\n // Add to the currentResult variable the content of the last recognized sentence\n for (let i = event.resultIndex; i < event.results.length; i++) {\n currentResult += event.results[i][0].transcript;\n }\n\n // Is this the final recognition ?\n const isFinal = event.results[event.results.length - 1].isFinal;\n\n // Replace selection by the last recognized sentence (+ style and select, if not final)\n this.editor.commands.deleteRange({ from, to });\n this.editor.commands.insertContentAt(\n from,\n isFinal ? currentResult : `<code>${currentResult}</code>`,\n { updateSelection: !isFinal },\n );\n to = this.editor.state.selection.to;\n\n if (isFinal) {\n // Next content will go after last insertion\n from = to;\n }\n };\n\n this.recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n // TODO create a \"feedback\" tiptap extension, to display user friendly error messages ?\n console.log(\n `[@edifice.io/tiptap-extensions/speech-recognition][error][${event.error}]: ${event.message}`,\n );\n };\n\n this.recognition.onstart = () => {\n this.isStarted = true;\n };\n\n this.recognition.onend = () => {\n this.isStarted = false;\n };\n\n return commands;\n },\n\n stopSpeechRecognition:\n () =>\n ({ commands }) => {\n this.recognition.stop();\n this.editor.commands.focus();\n return commands;\n },\n\n isSpeechRecognitionStarted: () => () => this.isStarted,\n };\n },\n});\n"],"names":["Node","SpeechRecognition"],"mappings":"mHAgBA,MAAM,gBAAkCA,KAAAA,IAAW,CACvC,aAAc,CACtB,MAAA,EAIF,KAAS,UAAqB,EAH9B,CAKA,OAAO,OAAyB,OAAc,CAC5C,OAAOA,KAAAA,KAAK,OAAO,MAAM,CAC3B,CACF,CAEO,MAAM,kBAAoB,QAAQ,OAAiC,CACxE,KAAM,oBAEN,YAAa,CACX,MAAO,CACL,KAAM,OAAA,CAEV,EAEA,UAAW,CAEL,sBAAuB,QAAU,4BAA6B,QAEhE,QAAQ,KACN,6GAAA,CAGN,EAEA,aAAc,CACZ,MAAO,CACL,uBACE,IACA,CAAC,CAAE,YAAe,CAChB,MAAMC,mBACJ,OAAO,mBAAqB,OAAO,wBACrC,KAAK,YAAc,IAAIA,mBAEvB,KAAK,YAAY,KAAO,KAAK,QAAQ,KACrC,KAAK,YAAY,eAAiB,GAClC,KAAK,YAAY,gBAAkB,EACnC,KAAK,YAAY,WAAa,GAE9B,KAAK,YAAY,MAAA,EAGjB,GAAI,CAAE,KAAM,EAAA,EAAO,KAAK,OAAO,MAAM,UAErC,YAAK,YAAY,SAAY,OAAkC,CAC7D,IAAI,cAAgB,GAGpB,QAAS,EAAI,MAAM,YAAa,EAAI,MAAM,QAAQ,OAAQ,IACxD,eAAiB,MAAM,QAAQ,CAAC,EAAE,CAAC,EAAE,WAIvC,MAAM,QAAU,MAAM,QAAQ,MAAM,QAAQ,OAAS,CAAC,EAAE,QAGxD,KAAK,OAAO,SAAS,YAAY,CAAE,KAAM,GAAI,EAC7C,KAAK,OAAO,SAAS,gBACnB,KACA,QAAU,cAAgB,SAAS,aAAa,UAChD,CAAE,gBAAiB,CAAC,OAAA,CAAQ,EAE9B,GAAK,KAAK,OAAO,MAAM,UAAU,GAE7B,UAEF,KAAO,GAEX,EAEA,KAAK,YAAY,QAAW,OAAuC,CAEjE,QAAQ,IACN,6DAA6D,MAAM,KAAK,MAAM,MAAM,OAAO,EAAA,CAE/F,EAEA,KAAK,YAAY,QAAU,IAAM,CAC/B,KAAK,UAAY,EACnB,EAEA,KAAK,YAAY,MAAQ,IAAM,CAC7B,KAAK,UAAY,EACnB,EAEO,QACT,EAEF,sBACE,IACA,CAAC,CAAE,aACD,KAAK,YAAY,KAAA,EACjB,KAAK,OAAO,SAAS,MAAA,EACd,UAGX,2BAA4B,IAAM,IAAM,KAAK,SAAA,CAEjD,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-recognition.js","sources":["../../src/speech-recognition/speech-recognition.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechRecognitionOptions {\n lang: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n SpeechRecognition: {\n startSpeechRecognition: () => ReturnType;\n stopSpeechRecognition: () => ReturnType;\n isSpeechRecognitionStarted: () => boolean;\n };\n }\n}\n\nclass SR_Node<O = any, S = any> extends Node<O, S> {\n protected constructor() {\n super();\n }\n\n recognition: SpeechRecognition | undefined;\n readonly isStarted: boolean = false;\n\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SR_Node<O, S>;\n }\n}\n\nexport const SpeechRecognition = SR_Node.create<SpeechRecognitionOptions>({\n name: 'SpeechRecognition',\n\n addOptions() {\n return {\n lang: 'fr-FR',\n };\n },\n\n onCreate() {\n if (\n !('SpeechRecognition' in window || 'webkitSpeechRecognition' in window)\n ) {\n console.warn(\n '\"@edifice.io/tiptap-extensions/speechrecognition\" requires a browser supporting the SpeechRecognition API\".',\n );\n }\n },\n\n addCommands() {\n return {\n startSpeechRecognition:\n () =>\n ({ commands }) => {\n const SpeechRecognition =\n window.SpeechRecognition || window.webkitSpeechRecognition;\n this.recognition = new SpeechRecognition();\n\n this.recognition.lang = this.options.lang;\n this.recognition.interimResults = true;\n this.recognition.maxAlternatives = 1;\n this.recognition.continuous = true;\n\n this.recognition.start();\n\n // Memoize initial caret positions\n let { from, to } = this.editor.state.selection;\n\n this.recognition.onresult = (event: SpeechRecognitionEvent) => {\n let currentResult = '';\n\n // Add to the currentResult variable the content of the last recognized sentence\n for (let i = event.resultIndex; i < event.results.length; i++) {\n currentResult += event.results[i][0].transcript;\n }\n\n // Is this the final recognition ?\n const isFinal = event.results[event.results.length - 1].isFinal;\n\n // Replace selection by the last recognized sentence (+ style and select, if not final)\n this.editor.commands.deleteRange({ from, to });\n this.editor.commands.insertContentAt(\n from,\n isFinal ? currentResult : `<code>${currentResult}</code>`,\n { updateSelection: !isFinal },\n );\n to = this.editor.state.selection.to;\n\n if (isFinal) {\n // Next content will go after last insertion\n from = to;\n }\n };\n\n this.recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n // TODO create a \"feedback\" tiptap extension, to display user friendly error messages ?\n console.log(\n `[@edifice.io/tiptap-extensions/speech-recognition][error][${event.error}]: ${event.message}`,\n );\n };\n\n this.recognition.onstart = () => {\n this.isStarted = true;\n };\n\n this.recognition.onend = () => {\n this.isStarted = false;\n };\n\n return commands;\n },\n\n stopSpeechRecognition:\n () =>\n ({ commands }) => {\n this.recognition.stop();\n this.editor.commands.focus();\n return commands;\n },\n\n isSpeechRecognitionStarted: () => () => this.isStarted,\n };\n },\n});\n"],"names":["SpeechRecognition"],"mappings":";AAgBA,MAAM,gBAAkC,KAAW;AAAA,EACvC,cAAc;AACtB,UAAA,GAIF,KAAS,YAAqB;AAAA,
|
|
1
|
+
{"version":3,"file":"speech-recognition.js","sources":["../../src/speech-recognition/speech-recognition.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechRecognitionOptions {\n lang: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n SpeechRecognition: {\n startSpeechRecognition: () => ReturnType;\n stopSpeechRecognition: () => ReturnType;\n isSpeechRecognitionStarted: () => boolean;\n };\n }\n}\n\nclass SR_Node<O = any, S = any> extends Node<O, S> {\n protected constructor() {\n super();\n }\n\n recognition: SpeechRecognition | undefined;\n readonly isStarted: boolean = false;\n\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SR_Node<O, S>;\n }\n}\n\nexport const SpeechRecognition = SR_Node.create<SpeechRecognitionOptions>({\n name: 'SpeechRecognition',\n\n addOptions() {\n return {\n lang: 'fr-FR',\n };\n },\n\n onCreate() {\n if (\n !('SpeechRecognition' in window || 'webkitSpeechRecognition' in window)\n ) {\n console.warn(\n '\"@edifice.io/tiptap-extensions/speechrecognition\" requires a browser supporting the SpeechRecognition API\".',\n );\n }\n },\n\n addCommands() {\n return {\n startSpeechRecognition:\n () =>\n ({ commands }) => {\n const SpeechRecognition =\n window.SpeechRecognition || window.webkitSpeechRecognition;\n this.recognition = new SpeechRecognition();\n\n this.recognition.lang = this.options.lang;\n this.recognition.interimResults = true;\n this.recognition.maxAlternatives = 1;\n this.recognition.continuous = true;\n\n this.recognition.start();\n\n // Memoize initial caret positions\n let { from, to } = this.editor.state.selection;\n\n this.recognition.onresult = (event: SpeechRecognitionEvent) => {\n let currentResult = '';\n\n // Add to the currentResult variable the content of the last recognized sentence\n for (let i = event.resultIndex; i < event.results.length; i++) {\n currentResult += event.results[i][0].transcript;\n }\n\n // Is this the final recognition ?\n const isFinal = event.results[event.results.length - 1].isFinal;\n\n // Replace selection by the last recognized sentence (+ style and select, if not final)\n this.editor.commands.deleteRange({ from, to });\n this.editor.commands.insertContentAt(\n from,\n isFinal ? currentResult : `<code>${currentResult}</code>`,\n { updateSelection: !isFinal },\n );\n to = this.editor.state.selection.to;\n\n if (isFinal) {\n // Next content will go after last insertion\n from = to;\n }\n };\n\n this.recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n // TODO create a \"feedback\" tiptap extension, to display user friendly error messages ?\n console.log(\n `[@edifice.io/tiptap-extensions/speech-recognition][error][${event.error}]: ${event.message}`,\n );\n };\n\n this.recognition.onstart = () => {\n this.isStarted = true;\n };\n\n this.recognition.onend = () => {\n this.isStarted = false;\n };\n\n return commands;\n },\n\n stopSpeechRecognition:\n () =>\n ({ commands }) => {\n this.recognition.stop();\n this.editor.commands.focus();\n return commands;\n },\n\n isSpeechRecognitionStarted: () => () => this.isStarted,\n };\n },\n});\n"],"names":["SpeechRecognition"],"mappings":";AAgBA,MAAM,gBAAkC,KAAW;AAAA,EACvC,cAAc;AACtB,UAAA,GAIF,KAAS,YAAqB;AAAA,EAH9B;AAAA,EAKA,OAAO,OAAyB,QAAc;AAC5C,WAAO,KAAK,OAAO,MAAM;AAAA,EAC3B;AACF;AAEO,MAAM,oBAAoB,QAAQ,OAAiC;AAAA,EACxE,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,MAAM;AAAA,IAAA;AAAA,EAEV;AAAA,EAEA,WAAW;AACT,IACI,uBAAuB,UAAU,6BAA6B,UAEhE,QAAQ;AAAA,MACN;AAAA,IAAA;AAAA,EAGN;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,wBACE,MACA,CAAC,EAAE,eAAe;AAChB,cAAMA,qBACJ,OAAO,qBAAqB,OAAO;AACrC,aAAK,cAAc,IAAIA,mBAAAA,GAEvB,KAAK,YAAY,OAAO,KAAK,QAAQ,MACrC,KAAK,YAAY,iBAAiB,IAClC,KAAK,YAAY,kBAAkB,GACnC,KAAK,YAAY,aAAa,IAE9B,KAAK,YAAY,MAAA;AAGjB,YAAI,EAAE,MAAM,GAAA,IAAO,KAAK,OAAO,MAAM;AAErC,oBAAK,YAAY,WAAW,CAAC,UAAkC;AAC7D,cAAI,gBAAgB;AAGpB,mBAAS,IAAI,MAAM,aAAa,IAAI,MAAM,QAAQ,QAAQ;AACxD,6BAAiB,MAAM,QAAQ,CAAC,EAAE,CAAC,EAAE;AAIvC,gBAAM,UAAU,MAAM,QAAQ,MAAM,QAAQ,SAAS,CAAC,EAAE;AAGxD,eAAK,OAAO,SAAS,YAAY,EAAE,MAAM,IAAI,GAC7C,KAAK,OAAO,SAAS;AAAA,YACnB;AAAA,YACA,UAAU,gBAAgB,SAAS,aAAa;AAAA,YAChD,EAAE,iBAAiB,CAAC,QAAA;AAAA,UAAQ,GAE9B,KAAK,KAAK,OAAO,MAAM,UAAU,IAE7B,YAEF,OAAO;AAAA,QAEX,GAEA,KAAK,YAAY,UAAU,CAAC,UAAuC;AAEjE,kBAAQ;AAAA,YACN,6DAA6D,MAAM,KAAK,MAAM,MAAM,OAAO;AAAA,UAAA;AAAA,QAE/F,GAEA,KAAK,YAAY,UAAU,MAAM;AAC/B,eAAK,YAAY;AAAA,QACnB,GAEA,KAAK,YAAY,QAAQ,MAAM;AAC7B,eAAK,YAAY;AAAA,QACnB,GAEO;AAAA,MACT;AAAA,MAEF,uBACE,MACA,CAAC,EAAE,gBACD,KAAK,YAAY,KAAA,GACjB,KAAK,OAAO,SAAS,MAAA,GACd;AAAA,MAGX,4BAA4B,MAAM,MAAM,KAAK;AAAA,IAAA;AAAA,EAEjD;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-synthesis.cjs","sources":["../../src/speech-synthesis/speech-synthesis.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechSynthesisOptions {\n lang: string;\n pitch: number;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n speechSynthesis: {\n startSpeechSynthesis: () => ReturnType;\n stopSpeechSynthesis: () => ReturnType;\n };\n }\n}\n\nclass SS_Node<O = any, S = any> extends Node<O, S> {\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SS_Node<O, S>;\n }\n}\n\nexport const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({\n name: 'speechSynthesis',\n addOptions() {\n return {\n lang: 'fr-FR',\n pitch: 1,\n };\n },\n addCommands() {\n return {\n startSpeechSynthesis:\n () =>\n ({ commands }) => {\n this.speechSynthesis = new SpeechSynthesisUtterance();\n this.speechSynthesis.lang = this.options.lang;\n this.speechSynthesis.pitch = this.options.pitch;\n this.speechSynthesis.text = this.editor.getText();\n\n window.speechSynthesis.speak(this.speechSynthesis);\n return commands;\n },\n stopSpeechSynthesis:\n () =>\n ({ commands }) => {\n window.speechSynthesis.cancel();\n return commands;\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAgBA,MAAM,gBAAkCA,KAAAA,IAAW,CACjD,OAAO,OAAyB,OAAc,CAC5C,OAAOA,KAAAA,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"speech-synthesis.cjs","sources":["../../src/speech-synthesis/speech-synthesis.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechSynthesisOptions {\n lang: string;\n pitch: number;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n speechSynthesis: {\n startSpeechSynthesis: () => ReturnType;\n stopSpeechSynthesis: () => ReturnType;\n };\n }\n}\n\nclass SS_Node<O = any, S = any> extends Node<O, S> {\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SS_Node<O, S>;\n }\n}\n\nexport const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({\n name: 'speechSynthesis',\n addOptions() {\n return {\n lang: 'fr-FR',\n pitch: 1,\n };\n },\n addCommands() {\n return {\n startSpeechSynthesis:\n () =>\n ({ commands }) => {\n this.speechSynthesis = new SpeechSynthesisUtterance();\n this.speechSynthesis.lang = this.options.lang;\n this.speechSynthesis.pitch = this.options.pitch;\n this.speechSynthesis.text = this.editor.getText();\n\n window.speechSynthesis.speak(this.speechSynthesis);\n return commands;\n },\n stopSpeechSynthesis:\n () =>\n ({ commands }) => {\n window.speechSynthesis.cancel();\n return commands;\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAgBA,MAAM,gBAAkCA,KAAAA,IAAW,CACjD,OAAO,OAAyB,OAAc,CAC5C,OAAOA,KAAAA,KAAK,OAAO,MAAM,CAC3B,CACF,CAEO,MAAM,gBAAkB,QAAQ,OAA+B,CACpE,KAAM,kBACN,YAAa,CACX,MAAO,CACL,KAAM,QACN,MAAO,CAAA,CAEX,EACA,aAAc,CACZ,MAAO,CACL,qBACE,IACA,CAAC,CAAE,aACD,KAAK,gBAAkB,IAAI,yBAC3B,KAAK,gBAAgB,KAAO,KAAK,QAAQ,KACzC,KAAK,gBAAgB,MAAQ,KAAK,QAAQ,MAC1C,KAAK,gBAAgB,KAAO,KAAK,OAAO,QAAA,EAExC,OAAO,gBAAgB,MAAM,KAAK,eAAe,EAC1C,UAEX,oBACE,IACA,CAAC,CAAE,aACD,OAAO,gBAAgB,OAAA,EAChB,SACT,CAEN,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-synthesis.js","sources":["../../src/speech-synthesis/speech-synthesis.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechSynthesisOptions {\n lang: string;\n pitch: number;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n speechSynthesis: {\n startSpeechSynthesis: () => ReturnType;\n stopSpeechSynthesis: () => ReturnType;\n };\n }\n}\n\nclass SS_Node<O = any, S = any> extends Node<O, S> {\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SS_Node<O, S>;\n }\n}\n\nexport const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({\n name: 'speechSynthesis',\n addOptions() {\n return {\n lang: 'fr-FR',\n pitch: 1,\n };\n },\n addCommands() {\n return {\n startSpeechSynthesis:\n () =>\n ({ commands }) => {\n this.speechSynthesis = new SpeechSynthesisUtterance();\n this.speechSynthesis.lang = this.options.lang;\n this.speechSynthesis.pitch = this.options.pitch;\n this.speechSynthesis.text = this.editor.getText();\n\n window.speechSynthesis.speak(this.speechSynthesis);\n return commands;\n },\n stopSpeechSynthesis:\n () =>\n ({ commands }) => {\n window.speechSynthesis.cancel();\n return commands;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAgBA,MAAM,gBAAkC,KAAW;AAAA,EACjD,OAAO,OAAyB,QAAc;AAC5C,WAAO,KAAK,OAAO,MAAM;AAAA,
|
|
1
|
+
{"version":3,"file":"speech-synthesis.js","sources":["../../src/speech-synthesis/speech-synthesis.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechSynthesisOptions {\n lang: string;\n pitch: number;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n speechSynthesis: {\n startSpeechSynthesis: () => ReturnType;\n stopSpeechSynthesis: () => ReturnType;\n };\n }\n}\n\nclass SS_Node<O = any, S = any> extends Node<O, S> {\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SS_Node<O, S>;\n }\n}\n\nexport const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({\n name: 'speechSynthesis',\n addOptions() {\n return {\n lang: 'fr-FR',\n pitch: 1,\n };\n },\n addCommands() {\n return {\n startSpeechSynthesis:\n () =>\n ({ commands }) => {\n this.speechSynthesis = new SpeechSynthesisUtterance();\n this.speechSynthesis.lang = this.options.lang;\n this.speechSynthesis.pitch = this.options.pitch;\n this.speechSynthesis.text = this.editor.getText();\n\n window.speechSynthesis.speak(this.speechSynthesis);\n return commands;\n },\n stopSpeechSynthesis:\n () =>\n ({ commands }) => {\n window.speechSynthesis.cancel();\n return commands;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAgBA,MAAM,gBAAkC,KAAW;AAAA,EACjD,OAAO,OAAyB,QAAc;AAC5C,WAAO,KAAK,OAAO,MAAM;AAAA,EAC3B;AACF;AAEO,MAAM,kBAAkB,QAAQ,OAA+B;AAAA,EACpE,MAAM;AAAA,EACN,aAAa;AACX,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAAA,EAEX;AAAA,EACA,cAAc;AACZ,WAAO;AAAA,MACL,sBACE,MACA,CAAC,EAAE,gBACD,KAAK,kBAAkB,IAAI,yBAAA,GAC3B,KAAK,gBAAgB,OAAO,KAAK,QAAQ,MACzC,KAAK,gBAAgB,QAAQ,KAAK,QAAQ,OAC1C,KAAK,gBAAgB,OAAO,KAAK,OAAO,QAAA,GAExC,OAAO,gBAAgB,MAAM,KAAK,eAAe,GAC1C;AAAA,MAEX,qBACE,MACA,CAAC,EAAE,gBACD,OAAO,gBAAgB,OAAA,GAChB;AAAA,IACT;AAAA,EAEN;AACF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-cell.cjs","sources":["../../src/table-cell/table-cell.ts"],"sourcesContent":["import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';\n\n/**\n * This custom extension allows setting a background-color to table cells.\n * Apply with ̀`editor.chain().focus().setCellAttribute(\"backgroundColor\", color).run()`\n */\nexport const TableCell = TipTapTableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: {\n default: null,\n renderHTML: (attributes: { backgroundColor?: string }) => {\n if (!attributes.backgroundColor) {\n return {};\n }\n\n return {\n style: `background-color: ${attributes.backgroundColor}`,\n };\n },\n parseHTML: (element: { style?: { backgroundColor: string } }) => {\n return element.style?.backgroundColor?.replace(/['\"]+/g, '');\n },\n },\n };\n },\n});\n"],"names":["TipTapTableCell","_a"],"mappings":"iJAMa,UAAYA,mBAAAA,UAAgB,OAAO,CAC9C,eAAgB,QACd,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,gBAAiB,CACf,QAAS,KACT,WAAa,YACN,WAAW,gBAIT,CACL,MAAO,qBAAqB,WAAW,eAAe,EAAA,EAJ/C,CAAA,EAOX,UAAY,SAAqD,YAC/D,OAAO,IAAAC,IAAA,QAAQ,QAAR,YAAAA,IAAe,kBAAf,eAAgC,QAAQ,SAAU,
|
|
1
|
+
{"version":3,"file":"table-cell.cjs","sources":["../../src/table-cell/table-cell.ts"],"sourcesContent":["import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';\n\n/**\n * This custom extension allows setting a background-color to table cells.\n * Apply with ̀`editor.chain().focus().setCellAttribute(\"backgroundColor\", color).run()`\n */\nexport const TableCell = TipTapTableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: {\n default: null,\n renderHTML: (attributes: { backgroundColor?: string }) => {\n if (!attributes.backgroundColor) {\n return {};\n }\n\n return {\n style: `background-color: ${attributes.backgroundColor}`,\n };\n },\n parseHTML: (element: { style?: { backgroundColor: string } }) => {\n return element.style?.backgroundColor?.replace(/['\"]+/g, '');\n },\n },\n };\n },\n});\n"],"names":["TipTapTableCell","_a"],"mappings":"iJAMa,UAAYA,mBAAAA,UAAgB,OAAO,CAC9C,eAAgB,QACd,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,gBAAiB,CACf,QAAS,KACT,WAAa,YACN,WAAW,gBAIT,CACL,MAAO,qBAAqB,WAAW,eAAe,EAAA,EAJ/C,CAAA,EAOX,UAAY,SAAqD,YAC/D,OAAO,IAAAC,IAAA,QAAQ,QAAR,YAAAA,IAAe,kBAAf,eAAgC,QAAQ,SAAU,GAC3D,CAAA,CACF,CAEJ,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-cell.js","sources":["../../src/table-cell/table-cell.ts"],"sourcesContent":["import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';\n\n/**\n * This custom extension allows setting a background-color to table cells.\n * Apply with ̀`editor.chain().focus().setCellAttribute(\"backgroundColor\", color).run()`\n */\nexport const TableCell = TipTapTableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: {\n default: null,\n renderHTML: (attributes: { backgroundColor?: string }) => {\n if (!attributes.backgroundColor) {\n return {};\n }\n\n return {\n style: `background-color: ${attributes.backgroundColor}`,\n };\n },\n parseHTML: (element: { style?: { backgroundColor: string } }) => {\n return element.style?.backgroundColor?.replace(/['\"]+/g, '');\n },\n },\n };\n },\n});\n"],"names":["TipTapTableCell","_a"],"mappings":";AAMO,MAAM,YAAYA,YAAgB,OAAO;AAAA,EAC9C,gBAAgB;;AACd,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,iBAAiB;AAAA,QACf,SAAS;AAAA,QACT,YAAY,CAAC,eACN,WAAW,kBAIT;AAAA,UACL,OAAO,qBAAqB,WAAW,eAAe;AAAA,QAAA,IAJ/C,CAAA;AAAA,QAOX,WAAW,CAAC,YAAqD;;AAC/D,kBAAO,MAAAC,MAAA,QAAQ,UAAR,gBAAAA,IAAe,oBAAf,mBAAgC,QAAQ,UAAU;AAAA,
|
|
1
|
+
{"version":3,"file":"table-cell.js","sources":["../../src/table-cell/table-cell.ts"],"sourcesContent":["import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';\n\n/**\n * This custom extension allows setting a background-color to table cells.\n * Apply with ̀`editor.chain().focus().setCellAttribute(\"backgroundColor\", color).run()`\n */\nexport const TableCell = TipTapTableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: {\n default: null,\n renderHTML: (attributes: { backgroundColor?: string }) => {\n if (!attributes.backgroundColor) {\n return {};\n }\n\n return {\n style: `background-color: ${attributes.backgroundColor}`,\n };\n },\n parseHTML: (element: { style?: { backgroundColor: string } }) => {\n return element.style?.backgroundColor?.replace(/['\"]+/g, '');\n },\n },\n };\n },\n});\n"],"names":["TipTapTableCell","_a"],"mappings":";AAMO,MAAM,YAAYA,YAAgB,OAAO;AAAA,EAC9C,gBAAgB;;AACd,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,iBAAiB;AAAA,QACf,SAAS;AAAA,QACT,YAAY,CAAC,eACN,WAAW,kBAIT;AAAA,UACL,OAAO,qBAAqB,WAAW,eAAe;AAAA,QAAA,IAJ/C,CAAA;AAAA,QAOX,WAAW,CAAC,YAAqD;;AAC/D,kBAAO,MAAAC,MAAA,QAAQ,UAAR,gBAAAA,IAAe,oBAAf,mBAAgC,QAAQ,UAAU;AAAA,QAC3D;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AACF,CAAC;"}
|
package/dist/video/video.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.cjs","sources":["../../src/video/video.ts"],"sourcesContent":["import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';\n\nexport interface VideoOptions {\n url: string;\n width: number;\n height: number;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n video: {\n /**\n * Set a video node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setVideo: (\n id: string,\n src: string,\n isCaptation: boolean,\n width?: number,\n height?: number,\n controls?: boolean,\n controlslist?: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n /**\n * Toggle a video\n */\n toggleVideo: (src: string) => ReturnType;\n };\n }\n}\n\nconst VIDEO_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\n\nexport const Video = Node.create({\n name: 'video',\n group: 'block',\n draggable: true,\n selectable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n controls: {\n default: true,\n parseHTML: (el: any) => {\n if ((el as HTMLSpanElement).getAttribute('controls')) {\n return (el as HTMLSpanElement).getAttribute('controls');\n } else if ((el as HTMLSpanElement).hasAttribute('controls')) {\n return true;\n } else {\n return false;\n }\n },\n renderHTML: (attrs: any) => ({ controls: attrs.controls }),\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 isCaptation: {\n default: false,\n renderHTML: (attributes: any) => {\n return { 'data-document-is-captation': attributes.isCaptation };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-document-is-captation'),\n },\n videoResolution: {\n default: '404x720',\n renderHTML: (attributes: any) => {\n return { 'data-video-resolution': attributes.videoResolution };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-video-resolution'),\n },\n width: {\n renderHTML: (attributes: any) => {\n return {\n width: parseInt(attributes.width),\n };\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes: any) => {\n return {\n height: parseInt(attributes.height),\n };\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.video-wrapper>video,video',\n getAttrs: (el: any) => ({\n src: (el as HTMLVideoElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'video-wrapper' },\n ['video', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setVideo:\n (\n id: string,\n src: string,\n isCaptation: boolean,\n width = 350,\n height = 197,\n controls = true,\n controlslist = 'nodownload',\n options,\n ) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<video \n controls=\"${controls}\" \n controlslist=\"${controlslist}\"\n src=\"${src}\" \n width=\"${width}\"\n height=\"${height}\"\n data-document-id=\"${id}\" \n data-document-is-captation=\"${isCaptation}\"\n data-video-resolution=\"${width}x${height}\" />`,\n options,\n );\n },\n\n toggleVideo:\n () =>\n ({ commands }) =>\n commands.toggleNode(this.name, 'paragraph'),\n };\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: VIDEO_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , src] = match;\n\n return { src };\n },\n }),\n ];\n },\n});\n"],"names":["Node","mergeAttributes","nodeInputRule"],"mappings":"mHAkCM,kBAAoB,gDAEb,MAAQA,KAAAA,KAAK,OAAO,CAC/B,KAAM,QACN,MAAO,QACP,UAAW,GACX,WAAY,GAEZ,eAAgB,CACd,MAAO,CACL,IAAK,CACH,QAAS,KACT,UAAY,IAAa,GAAuB,aAAa,KAAK,EAClE,WAAa,QAAgB,CAAE,IAAK,MAAM,GAAA,EAAI,EAEhD,SAAU,CACR,QAAS,GACT,UAAY,IACL,GAAuB,aAAa,UAAU,EACzC,GAAuB,aAAa,UAAU,EAC5C,KAAuB,aAAa,UAAU,EAM5D,WAAa,QAAgB,CAAE,SAAU,MAAM,QAAA,EAAS,EAE1D,WAAY,CACV,QAAS,GACT,WAAa,aACJ,CAAE,mBAAoB,WAAW,UAAA,GAE1C,UAAY,SAAiB,QAAQ,aAAa,kBAAkB,CAAA,EAEtE,YAAa,CACX,QAAS,GACT,WAAa,aACJ,CAAE,6BAA8B,WAAW,WAAA,GAEpD,UAAY,SACV,QAAQ,aAAa,4BAA4B,CAAA,EAErD,gBAAiB,CACf,QAAS,UACT,WAAa,aACJ,CAAE,wBAAyB,WAAW,eAAA,GAE/C,UAAY,SACV,QAAQ,aAAa,uBAAuB,CAAA,EAEhD,MAAO,CACL,WAAa,aACJ,CACL,MAAO,SAAS,WAAW,KAAK,CAAA,GAGpC,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,EAEtD,OAAQ,CACN,WAAa,aACJ,CACL,OAAQ,SAAS,WAAW,MAAM,CAAA,GAGtC,UAAY,SAAY,QAAQ,aAAa,QAAQ,CAAA,CACvD,
|
|
1
|
+
{"version":3,"file":"video.cjs","sources":["../../src/video/video.ts"],"sourcesContent":["import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';\n\nexport interface VideoOptions {\n url: string;\n width: number;\n height: number;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n video: {\n /**\n * Set a video node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setVideo: (\n id: string,\n src: string,\n isCaptation: boolean,\n width?: number,\n height?: number,\n controls?: boolean,\n controlslist?: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n /**\n * Toggle a video\n */\n toggleVideo: (src: string) => ReturnType;\n };\n }\n}\n\nconst VIDEO_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\n\nexport const Video = Node.create({\n name: 'video',\n group: 'block',\n draggable: true,\n selectable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n controls: {\n default: true,\n parseHTML: (el: any) => {\n if ((el as HTMLSpanElement).getAttribute('controls')) {\n return (el as HTMLSpanElement).getAttribute('controls');\n } else if ((el as HTMLSpanElement).hasAttribute('controls')) {\n return true;\n } else {\n return false;\n }\n },\n renderHTML: (attrs: any) => ({ controls: attrs.controls }),\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 isCaptation: {\n default: false,\n renderHTML: (attributes: any) => {\n return { 'data-document-is-captation': attributes.isCaptation };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-document-is-captation'),\n },\n videoResolution: {\n default: '404x720',\n renderHTML: (attributes: any) => {\n return { 'data-video-resolution': attributes.videoResolution };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-video-resolution'),\n },\n width: {\n renderHTML: (attributes: any) => {\n return {\n width: parseInt(attributes.width),\n };\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes: any) => {\n return {\n height: parseInt(attributes.height),\n };\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.video-wrapper>video,video',\n getAttrs: (el: any) => ({\n src: (el as HTMLVideoElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'video-wrapper' },\n ['video', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setVideo:\n (\n id: string,\n src: string,\n isCaptation: boolean,\n width = 350,\n height = 197,\n controls = true,\n controlslist = 'nodownload',\n options,\n ) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<video \n controls=\"${controls}\" \n controlslist=\"${controlslist}\"\n src=\"${src}\" \n width=\"${width}\"\n height=\"${height}\"\n data-document-id=\"${id}\" \n data-document-is-captation=\"${isCaptation}\"\n data-video-resolution=\"${width}x${height}\" />`,\n options,\n );\n },\n\n toggleVideo:\n () =>\n ({ commands }) =>\n commands.toggleNode(this.name, 'paragraph'),\n };\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: VIDEO_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , src] = match;\n\n return { src };\n },\n }),\n ];\n },\n});\n"],"names":["Node","mergeAttributes","nodeInputRule"],"mappings":"mHAkCM,kBAAoB,gDAEb,MAAQA,KAAAA,KAAK,OAAO,CAC/B,KAAM,QACN,MAAO,QACP,UAAW,GACX,WAAY,GAEZ,eAAgB,CACd,MAAO,CACL,IAAK,CACH,QAAS,KACT,UAAY,IAAa,GAAuB,aAAa,KAAK,EAClE,WAAa,QAAgB,CAAE,IAAK,MAAM,GAAA,EAAI,EAEhD,SAAU,CACR,QAAS,GACT,UAAY,IACL,GAAuB,aAAa,UAAU,EACzC,GAAuB,aAAa,UAAU,EAC5C,KAAuB,aAAa,UAAU,EAM5D,WAAa,QAAgB,CAAE,SAAU,MAAM,QAAA,EAAS,EAE1D,WAAY,CACV,QAAS,GACT,WAAa,aACJ,CAAE,mBAAoB,WAAW,UAAA,GAE1C,UAAY,SAAiB,QAAQ,aAAa,kBAAkB,CAAA,EAEtE,YAAa,CACX,QAAS,GACT,WAAa,aACJ,CAAE,6BAA8B,WAAW,WAAA,GAEpD,UAAY,SACV,QAAQ,aAAa,4BAA4B,CAAA,EAErD,gBAAiB,CACf,QAAS,UACT,WAAa,aACJ,CAAE,wBAAyB,WAAW,eAAA,GAE/C,UAAY,SACV,QAAQ,aAAa,uBAAuB,CAAA,EAEhD,MAAO,CACL,WAAa,aACJ,CACL,MAAO,SAAS,WAAW,KAAK,CAAA,GAGpC,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,EAEtD,OAAQ,CACN,WAAa,aACJ,CACL,OAAQ,SAAS,WAAW,MAAM,CAAA,GAGtC,UAAY,SAAY,QAAQ,aAAa,QAAQ,CAAA,CACvD,CAEJ,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,gCACL,SAAW,KAAa,CACtB,IAAM,GAAwB,aAAa,KAAK,CAAA,EAClD,CACF,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACA,CAAE,MAAO,eAAA,EACT,CAAC,QAASC,KAAAA,gBAAgB,cAAc,CAAC,CAAA,CAE7C,EAEA,aAAc,CACZ,MAAO,CACL,SACE,CACE,GACA,IACA,YACA,MAAQ,IACR,OAAS,IACT,SAAW,GACX,aAAe,aACf,UAEF,CAAC,CAAE,SAAU,SACJ,SAAS,gBACd,MAAM,UACN;AAAA,0BACc,QAAQ;AAAA,8BACJ,YAAY;AAAA,qBACrB,GAAG;AAAA,uBACD,KAAK;AAAA,wBACJ,MAAM;AAAA,kCACI,EAAE;AAAA,4CACQ,WAAW;AAAA,uCAChB,KAAK,IAAI,MAAM,OAC1C,OAAA,EAIN,YACE,IACA,CAAC,CAAE,QAAA,IACD,SAAS,WAAW,KAAK,KAAM,WAAW,CAAA,CAElD,EAEA,eAAgB,CACd,MAAO,CACLC,mBAAc,CACZ,KAAM,kBACN,KAAM,KAAK,KACX,cAAgB,OAAU,CACxB,KAAM,CAAA,CAAA,CAAK,GAAG,EAAI,MAElB,MAAO,CAAE,GAAA,CACX,CAAA,CACD,CAAA,CAEL,CACF,CAAC"}
|
package/dist/video/video.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.js","sources":["../../src/video/video.ts"],"sourcesContent":["import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';\n\nexport interface VideoOptions {\n url: string;\n width: number;\n height: number;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n video: {\n /**\n * Set a video node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setVideo: (\n id: string,\n src: string,\n isCaptation: boolean,\n width?: number,\n height?: number,\n controls?: boolean,\n controlslist?: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n /**\n * Toggle a video\n */\n toggleVideo: (src: string) => ReturnType;\n };\n }\n}\n\nconst VIDEO_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\n\nexport const Video = Node.create({\n name: 'video',\n group: 'block',\n draggable: true,\n selectable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n controls: {\n default: true,\n parseHTML: (el: any) => {\n if ((el as HTMLSpanElement).getAttribute('controls')) {\n return (el as HTMLSpanElement).getAttribute('controls');\n } else if ((el as HTMLSpanElement).hasAttribute('controls')) {\n return true;\n } else {\n return false;\n }\n },\n renderHTML: (attrs: any) => ({ controls: attrs.controls }),\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 isCaptation: {\n default: false,\n renderHTML: (attributes: any) => {\n return { 'data-document-is-captation': attributes.isCaptation };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-document-is-captation'),\n },\n videoResolution: {\n default: '404x720',\n renderHTML: (attributes: any) => {\n return { 'data-video-resolution': attributes.videoResolution };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-video-resolution'),\n },\n width: {\n renderHTML: (attributes: any) => {\n return {\n width: parseInt(attributes.width),\n };\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes: any) => {\n return {\n height: parseInt(attributes.height),\n };\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.video-wrapper>video,video',\n getAttrs: (el: any) => ({\n src: (el as HTMLVideoElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'video-wrapper' },\n ['video', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setVideo:\n (\n id: string,\n src: string,\n isCaptation: boolean,\n width = 350,\n height = 197,\n controls = true,\n controlslist = 'nodownload',\n options,\n ) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<video \n controls=\"${controls}\" \n controlslist=\"${controlslist}\"\n src=\"${src}\" \n width=\"${width}\"\n height=\"${height}\"\n data-document-id=\"${id}\" \n data-document-is-captation=\"${isCaptation}\"\n data-video-resolution=\"${width}x${height}\" />`,\n options,\n );\n },\n\n toggleVideo:\n () =>\n ({ commands }) =>\n commands.toggleNode(this.name, 'paragraph'),\n };\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: VIDEO_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , src] = match;\n\n return { src };\n },\n }),\n ];\n },\n});\n"],"names":[],"mappings":";AAkCA,MAAM,oBAAoB,iDAEb,QAAQ,KAAK,OAAO;AAAA,EAC/B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA,EAEZ,gBAAgB;AACd,WAAO;AAAA,MACL,KAAK;AAAA,QACH,SAAS;AAAA,QACT,WAAW,CAAC,OAAa,GAAuB,aAAa,KAAK;AAAA,QAClE,YAAY,CAAC,WAAgB,EAAE,KAAK,MAAM,IAAA;AAAA,MAAI;AAAA,MAEhD,UAAU;AAAA,QACR,SAAS;AAAA,QACT,WAAW,CAAC,OACL,GAAuB,aAAa,UAAU,IACzC,GAAuB,aAAa,UAAU,IAC5C,KAAuB,aAAa,UAAU;AAAA,QAM5D,YAAY,CAAC,WAAgB,EAAE,UAAU,MAAM,SAAA;AAAA,MAAS;AAAA,MAE1D,YAAY;AAAA,QACV,SAAS;AAAA,QACT,YAAY,CAAC,gBACJ,EAAE,oBAAoB,WAAW,WAAA;AAAA,QAE1C,WAAW,CAAC,YAAiB,QAAQ,aAAa,kBAAkB;AAAA,MAAA;AAAA,MAEtE,aAAa;AAAA,QACX,SAAS;AAAA,QACT,YAAY,CAAC,gBACJ,EAAE,8BAA8B,WAAW,YAAA;AAAA,QAEpD,WAAW,CAAC,YACV,QAAQ,aAAa,4BAA4B;AAAA,MAAA;AAAA,MAErD,iBAAiB;AAAA,QACf,SAAS;AAAA,QACT,YAAY,CAAC,gBACJ,EAAE,yBAAyB,WAAW,gBAAA;AAAA,QAE/C,WAAW,CAAC,YACV,QAAQ,aAAa,uBAAuB;AAAA,MAAA;AAAA,MAEhD,OAAO;AAAA,QACL,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,SAAS,WAAW,KAAK;AAAA,QAAA;AAAA,QAGpC,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MAAA;AAAA,MAEtD,QAAQ;AAAA,QACN,YAAY,CAAC,gBACJ;AAAA,UACL,QAAQ,SAAS,WAAW,MAAM;AAAA,QAAA;AAAA,QAGtC,WAAW,CAAC,YAAY,QAAQ,aAAa,QAAQ;AAAA,MAAA;AAAA,IACvD;AAAA,
|
|
1
|
+
{"version":3,"file":"video.js","sources":["../../src/video/video.ts"],"sourcesContent":["import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';\n\nexport interface VideoOptions {\n url: string;\n width: number;\n height: number;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n video: {\n /**\n * Set a video node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setVideo: (\n id: string,\n src: string,\n isCaptation: boolean,\n width?: number,\n height?: number,\n controls?: boolean,\n controlslist?: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n /**\n * Toggle a video\n */\n toggleVideo: (src: string) => ReturnType;\n };\n }\n}\n\nconst VIDEO_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\n\nexport const Video = Node.create({\n name: 'video',\n group: 'block',\n draggable: true,\n selectable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n controls: {\n default: true,\n parseHTML: (el: any) => {\n if ((el as HTMLSpanElement).getAttribute('controls')) {\n return (el as HTMLSpanElement).getAttribute('controls');\n } else if ((el as HTMLSpanElement).hasAttribute('controls')) {\n return true;\n } else {\n return false;\n }\n },\n renderHTML: (attrs: any) => ({ controls: attrs.controls }),\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 isCaptation: {\n default: false,\n renderHTML: (attributes: any) => {\n return { 'data-document-is-captation': attributes.isCaptation };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-document-is-captation'),\n },\n videoResolution: {\n default: '404x720',\n renderHTML: (attributes: any) => {\n return { 'data-video-resolution': attributes.videoResolution };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-video-resolution'),\n },\n width: {\n renderHTML: (attributes: any) => {\n return {\n width: parseInt(attributes.width),\n };\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes: any) => {\n return {\n height: parseInt(attributes.height),\n };\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.video-wrapper>video,video',\n getAttrs: (el: any) => ({\n src: (el as HTMLVideoElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'video-wrapper' },\n ['video', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setVideo:\n (\n id: string,\n src: string,\n isCaptation: boolean,\n width = 350,\n height = 197,\n controls = true,\n controlslist = 'nodownload',\n options,\n ) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<video \n controls=\"${controls}\" \n controlslist=\"${controlslist}\"\n src=\"${src}\" \n width=\"${width}\"\n height=\"${height}\"\n data-document-id=\"${id}\" \n data-document-is-captation=\"${isCaptation}\"\n data-video-resolution=\"${width}x${height}\" />`,\n options,\n );\n },\n\n toggleVideo:\n () =>\n ({ commands }) =>\n commands.toggleNode(this.name, 'paragraph'),\n };\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: VIDEO_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , src] = match;\n\n return { src };\n },\n }),\n ];\n },\n});\n"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/tiptap-extensions",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.12",
|
|
4
4
|
"description": "Edifice Rich Text Editor Extensions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"edifice",
|
|
@@ -154,11 +154,11 @@
|
|
|
154
154
|
"prosemirror-view": "^1.27.0",
|
|
155
155
|
"vite": "^5.4.11",
|
|
156
156
|
"vite-plugin-dts": "^4.1.0",
|
|
157
|
-
"@edifice.io/utilities": "2.2.
|
|
157
|
+
"@edifice.io/utilities": "2.2.12"
|
|
158
158
|
},
|
|
159
159
|
"devDependencies": {
|
|
160
160
|
"@types/dom-speech-recognition": "^0.0.1",
|
|
161
|
-
"@edifice.io/client": "2.2.
|
|
161
|
+
"@edifice.io/client": "2.2.12"
|
|
162
162
|
},
|
|
163
163
|
"publishConfig": {
|
|
164
164
|
"access": "public"
|