@edifice.io/tiptap-extensions 2.0.0-develop-rc.8 → 2.0.0-develop-rc.14

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.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/dist/abbr/abbr.cjs +32 -1
  3. package/dist/abbr/abbr.cjs.map +1 -1
  4. package/dist/abbr/abbr.d.ts +12 -12
  5. package/dist/abbr/abbr.js +20 -16
  6. package/dist/abbr/abbr.js.map +1 -1
  7. package/dist/alert/alert.cjs +32 -1
  8. package/dist/alert/alert.cjs.map +1 -1
  9. package/dist/alert/alert.js +22 -24
  10. package/dist/alert/alert.js.map +1 -1
  11. package/dist/attachment/attachment.cjs +73 -1
  12. package/dist/attachment/attachment.cjs.map +1 -1
  13. package/dist/attachment/attachment.d.ts +6 -6
  14. package/dist/attachment/attachment.js +58 -47
  15. package/dist/attachment/attachment.js.map +1 -1
  16. package/dist/audio/audio.cjs +53 -3
  17. package/dist/audio/audio.cjs.map +1 -1
  18. package/dist/audio/audio.d.ts +17 -13
  19. package/dist/audio/audio.js +33 -30
  20. package/dist/audio/audio.js.map +1 -1
  21. package/dist/font-size/font-size.cjs +48 -1
  22. package/dist/font-size/font-size.cjs.map +1 -1
  23. package/dist/font-size/font-size.d.ts +13 -13
  24. package/dist/font-size/font-size.js +32 -20
  25. package/dist/font-size/font-size.js.map +1 -1
  26. package/dist/heading/heading.cjs +61 -1
  27. package/dist/heading/heading.cjs.map +1 -1
  28. package/dist/heading/heading.d.ts +10 -12
  29. package/dist/heading/heading.js +45 -31
  30. package/dist/heading/heading.js.map +1 -1
  31. package/dist/highlight/highlight.cjs +25 -1
  32. package/dist/highlight/highlight.cjs.map +1 -1
  33. package/dist/highlight/highlight.d.ts +4 -1
  34. package/dist/highlight/highlight.js +15 -17
  35. package/dist/highlight/highlight.js.map +1 -1
  36. package/dist/hyperlink/hyperlink.cjs +47 -1
  37. package/dist/hyperlink/hyperlink.cjs.map +1 -1
  38. package/dist/hyperlink/hyperlink.d.ts +27 -24
  39. package/dist/hyperlink/hyperlink.js +26 -24
  40. package/dist/hyperlink/hyperlink.js.map +1 -1
  41. package/dist/iframe/iframe.cjs +69 -1
  42. package/dist/iframe/iframe.cjs.map +1 -1
  43. package/dist/iframe/iframe.d.ts +12 -14
  44. package/dist/iframe/iframe.js +50 -34
  45. package/dist/iframe/iframe.js.map +1 -1
  46. package/dist/image/custom-image.cjs +162 -1
  47. package/dist/image/custom-image.cjs.map +1 -1
  48. package/dist/image/custom-image.d.ts +19 -16
  49. package/dist/image/custom-image.js +179 -130
  50. package/dist/image/custom-image.js.map +1 -1
  51. package/dist/index.cjs +43 -1
  52. package/dist/index.js +41 -41
  53. package/dist/line-height/line-height.cjs +33 -1
  54. package/dist/line-height/line-height.cjs.map +1 -1
  55. package/dist/line-height/line-height.js +21 -18
  56. package/dist/line-height/line-height.js.map +1 -1
  57. package/dist/linker/linker.cjs +95 -1
  58. package/dist/linker/linker.cjs.map +1 -1
  59. package/dist/linker/linker.d.ts +17 -17
  60. package/dist/linker/linker.js +60 -52
  61. package/dist/linker/linker.js.map +1 -1
  62. package/dist/mathjax/mathjax.cjs +47 -1
  63. package/dist/mathjax/mathjax.cjs.map +1 -1
  64. package/dist/mathjax/mathjax.js +33 -23
  65. package/dist/mathjax/mathjax.js.map +1 -1
  66. package/dist/paragraph/paragraph.cjs +13 -1
  67. package/dist/paragraph/paragraph.cjs.map +1 -1
  68. package/dist/paragraph/paragraph.d.ts +4 -1
  69. package/dist/paragraph/paragraph.js +8 -10
  70. package/dist/paragraph/paragraph.js.map +1 -1
  71. package/dist/speech-recognition/speech-recognition.cjs +76 -1
  72. package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
  73. package/dist/speech-recognition/speech-recognition.d.ts +12 -12
  74. package/dist/speech-recognition/speech-recognition.js +61 -45
  75. package/dist/speech-recognition/speech-recognition.js.map +1 -1
  76. package/dist/speech-synthesis/speech-synthesis.cjs +32 -1
  77. package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
  78. package/dist/speech-synthesis/speech-synthesis.d.ts +9 -9
  79. package/dist/speech-synthesis/speech-synthesis.js +23 -14
  80. package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
  81. package/dist/table-cell/table-cell.cjs +27 -1
  82. package/dist/table-cell/table-cell.cjs.map +1 -1
  83. package/dist/table-cell/table-cell.d.ts +4 -1
  84. package/dist/table-cell/table-cell.js +21 -16
  85. package/dist/table-cell/table-cell.js.map +1 -1
  86. package/dist/transform/html-to-json/html-to-json.cjs +4 -1
  87. package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
  88. package/dist/transform/html-to-json/html-to-json.d.ts +4 -1
  89. package/dist/transform/html-to-json/html-to-json.js +3 -5
  90. package/dist/transform/html-to-json/html-to-json.js.map +1 -1
  91. package/dist/transform/json-to-html/json-to-html.cjs +4 -1
  92. package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
  93. package/dist/transform/json-to-html/json-to-html.js +3 -5
  94. package/dist/transform/json-to-html/json-to-html.js.map +1 -1
  95. package/dist/video/video.cjs +118 -9
  96. package/dist/video/video.cjs.map +1 -1
  97. package/dist/video/video.d.ts +28 -19
  98. package/dist/video/video.js +121 -97
  99. package/dist/video/video.js.map +1 -1
  100. package/package.json +39 -50
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ![npm](https://img.shields.io/npm/v/@edifice.io/tiptap-extensions?style=flat-square)
4
4
  ![bundlephobia](https://img.shields.io/bundlephobia/min/@edifice.io/tiptap-extensions?style=flat-square)
5
5
 
6
- TypeScript Extensions based on Tiptap Editor
6
+ Extensions based on Tiptap Editor
7
7
 
8
8
  ## Getting Started
9
9
 
@@ -1,2 +1,33 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@tiptap/core"),e=t.Mark.create({name:"abbr",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"abbr"}]},renderHTML({HTMLAttributes:r}){return["abbr",t.mergeAttributes(this.options.HTMLAttributes,r),0]},addCommands(){return{setAbbr:()=>({commands:r})=>r.setMark(this.name),toggleAbbr:()=>({commands:r})=>r.toggleMark(this.name)}}});exports.Abbr=e;
1
+ 'use strict';
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
+ const core = require('@tiptap/core'),
4
+ Abbr = core.Mark.create({
5
+ name: 'abbr',
6
+ addOptions() {
7
+ return { HTMLAttributes: {} };
8
+ },
9
+ parseHTML() {
10
+ return [{ tag: 'abbr' }];
11
+ },
12
+ renderHTML({ HTMLAttributes }) {
13
+ return [
14
+ 'abbr',
15
+ core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
16
+ 0,
17
+ ];
18
+ },
19
+ addCommands() {
20
+ return {
21
+ setAbbr:
22
+ () =>
23
+ ({ commands }) =>
24
+ commands.setMark(this.name),
25
+ toggleAbbr:
26
+ () =>
27
+ ({ commands }) =>
28
+ commands.toggleMark(this.name),
29
+ };
30
+ },
31
+ });
32
+ exports.Abbr = Abbr;
2
33
  //# sourceMappingURL=abbr.cjs.map
@@ -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":["Abbr","Mark","HTMLAttributes","mergeAttributes","commands"],"mappings":"gHAiBaA,EAAOC,OAAK,OAAO,CAC9B,KAAM,OAEN,YAAa,CACJ,MAAA,CACL,eAAgB,CAAC,CAAA,CAErB,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,MACP,CAAA,CAEJ,EAEA,WAAW,CAAE,eAAAC,GAAkB,CACtB,MAAA,CACL,OACAC,EAAAA,gBAAgB,KAAK,QAAQ,eAAgBD,CAAc,EAC3D,CAAA,CAEJ,EAEA,aAAc,CACL,MAAA,CACL,QACE,IACA,CAAC,CAAE,SAAAE,KACMA,EAAS,QAAQ,KAAK,IAAI,EAErC,WACE,IACA,CAAC,CAAE,SAAAA,KACMA,EAAS,WAAW,KAAK,IAAI,CACtC,CAEN,CACF,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,UAAK,OAAO,CAC9B,KAAM,OAEN,YAAa,CACJ,MAAA,CACL,eAAgB,CAAC,CAAA,CAErB,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,MACP,CAAA,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CACL,OACAC,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CAAA,CAEJ,EAEA,aAAc,CACL,MAAA,CACL,QACE,IACA,CAAC,CAAE,YACM,SAAS,QAAQ,KAAK,IAAI,EAErC,WACE,IACA,CAAC,CAAE,YACM,SAAS,WAAW,KAAK,IAAI,CACtC,CAEN,CACF,CAAC"}
@@ -1,16 +1,16 @@
1
1
  import { Mark } from '@tiptap/core';
2
2
  declare module '@tiptap/core' {
3
- interface Commands<ReturnType> {
4
- abbr: {
5
- /**
6
- * Set an abbr mark
7
- */
8
- setAbbr: (src: string) => ReturnType;
9
- /**
10
- * Toggle an abbr mark
11
- */
12
- toggleAbbr: (src: string) => ReturnType;
13
- };
14
- }
3
+ interface Commands<ReturnType> {
4
+ abbr: {
5
+ /**
6
+ * Set an abbr mark
7
+ */
8
+ setAbbr: (src: string) => ReturnType;
9
+ /**
10
+ * Toggle an abbr mark
11
+ */
12
+ toggleAbbr: (src: string) => ReturnType;
13
+ };
14
+ }
15
15
  }
16
16
  export declare const Abbr: Mark<any, any>;
package/dist/abbr/abbr.js CHANGED
@@ -1,33 +1,37 @@
1
- import { Mark as t, mergeAttributes as e } from "@tiptap/core";
2
- const b = t.create({
3
- name: "abbr",
1
+ import { Mark, mergeAttributes } from '@tiptap/core';
2
+ const Abbr = Mark.create({
3
+ name: 'abbr',
4
4
  addOptions() {
5
5
  return {
6
- HTMLAttributes: {}
6
+ HTMLAttributes: {},
7
7
  };
8
8
  },
9
9
  parseHTML() {
10
10
  return [
11
11
  {
12
- tag: "abbr"
13
- }
12
+ tag: 'abbr',
13
+ },
14
14
  ];
15
15
  },
16
- renderHTML({ HTMLAttributes: r }) {
16
+ renderHTML({ HTMLAttributes }) {
17
17
  return [
18
- "abbr",
19
- e(this.options.HTMLAttributes, r),
20
- 0
18
+ 'abbr',
19
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
20
+ 0,
21
21
  ];
22
22
  },
23
23
  addCommands() {
24
24
  return {
25
- setAbbr: () => ({ commands: r }) => r.setMark(this.name),
26
- toggleAbbr: () => ({ commands: r }) => r.toggleMark(this.name)
25
+ setAbbr:
26
+ () =>
27
+ ({ commands }) =>
28
+ commands.setMark(this.name),
29
+ toggleAbbr:
30
+ () =>
31
+ ({ commands }) =>
32
+ commands.toggleMark(this.name),
27
33
  };
28
- }
34
+ },
29
35
  });
30
- export {
31
- b as Abbr
32
- };
36
+ export { Abbr };
33
37
  //# sourceMappingURL=abbr.js.map
@@ -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":["Abbr","Mark","HTMLAttributes","mergeAttributes","commands"],"mappings":";AAiBa,MAAAA,IAAOC,EAAK,OAAO;AAAA,EAC9B,MAAM;AAAA,EAEN,aAAa;AACJ,WAAA;AAAA,MACL,gBAAgB,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,gBAAAC,KAAkB;AACtB,WAAA;AAAA,MACL;AAAA,MACAC,EAAgB,KAAK,QAAQ,gBAAgBD,CAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,SACE,MACA,CAAC,EAAE,UAAAE,QACMA,EAAS,QAAQ,KAAK,IAAI;AAAA,MAErC,YACE,MACA,CAAC,EAAE,UAAAA,QACMA,EAAS,WAAW,KAAK,IAAI;AAAA,IACtC;AAAA,EAEN;AACF,CAAC;"}
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":";AAiBa,MAAA,OAAO,KAAK,OAAO;AAAA,EAC9B,MAAM;AAAA,EAEN,aAAa;AACJ,WAAA;AAAA,MACL,gBAAgB,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AACtB,WAAA;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACL,WAAA;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;"}
@@ -1,2 +1,33 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@tiptap/core"),t=e.Node.create({name:"alert",content:"inline+",marks:"",group:"block",inline:!1,selectable:!0,draggable:!0,parseHTML(){return[{tag:"p.info",priority:60},{tag:"p.warning",priority:60},{tag:"div.info",priority:60},{tag:"div.warning",priority:60}]},addAttributes(){return{class:{default:"info",parseHTML:r=>r.getAttribute("class")}}},renderHTML({HTMLAttributes:r}){return["div",r,0]}});exports.Alert=t;
1
+ 'use strict';
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
+ const core = require('@tiptap/core'),
4
+ Alert = core.Node.create({
5
+ name: 'alert',
6
+ content: 'inline+',
7
+ marks: '',
8
+ group: 'block',
9
+ inline: !1,
10
+ selectable: !0,
11
+ draggable: !0,
12
+ parseHTML() {
13
+ return [
14
+ { tag: 'p.info', priority: 60 },
15
+ { tag: 'p.warning', priority: 60 },
16
+ { tag: 'div.info', priority: 60 },
17
+ { tag: 'div.warning', priority: 60 },
18
+ ];
19
+ },
20
+ addAttributes() {
21
+ return {
22
+ class: {
23
+ default: 'info',
24
+ parseHTML: (element) => element.getAttribute('class'),
25
+ },
26
+ };
27
+ },
28
+ renderHTML({ HTMLAttributes }) {
29
+ return ['div', HTMLAttributes, 0];
30
+ },
31
+ });
32
+ exports.Alert = Alert;
2
33
  //# sourceMappingURL=alert.cjs.map
@@ -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":["Alert","Node","element","HTMLAttributes"],"mappings":"gHAEaA,EAAQC,OAAK,OAAO,CAC/B,KAAM,QACN,QAAS,UACT,MAAO,GACP,MAAO,QAEP,OAAQ,GACR,WAAY,GACZ,UAAW,GAEX,WAAY,CACH,MAAA,CACL,CACE,IAAK,SACL,SAAU,EACZ,EACA,CACE,IAAK,YACL,SAAU,EACZ,EACA,CACE,IAAK,WACL,SAAU,EACZ,EACA,CACE,IAAK,cACL,SAAU,EACZ,CAAA,CAEJ,EACA,eAAgB,CACP,MAAA,CACL,MAAO,CACL,QAAS,OACT,UAAYC,GACHA,EAAQ,aAAa,OAAO,CAEvC,CAAA,CAEJ,EACA,WAAW,CAAE,eAAAC,GAAkB,CACtB,MAAA,CAAC,MAAOA,EAAgB,CAAC,CAClC,CACF,CAAC"}
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,UAAK,OAAO,CAC/B,KAAM,QACN,QAAS,UACT,MAAO,GACP,MAAO,QAEP,OAAQ,GACR,WAAY,GACZ,UAAW,GAEX,WAAY,CACH,MAAA,CACL,CACE,IAAK,SACL,SAAU,EACZ,EACA,CACE,IAAK,YACL,SAAU,EACZ,EACA,CACE,IAAK,WACL,SAAU,EACZ,EACA,CACE,IAAK,cACL,SAAU,EACZ,CAAA,CAEJ,EACA,eAAgB,CACP,MAAA,CACL,MAAO,CACL,QAAS,OACT,UAAY,SACH,QAAQ,aAAa,OAAO,CAEvC,CAAA,CAEJ,EACA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CAAC,MAAO,eAAgB,CAAC,CAClC,CACF,CAAC"}
@@ -1,45 +1,43 @@
1
- import { Node as t } from "@tiptap/core";
2
- const i = t.create({
3
- name: "alert",
4
- content: "inline+",
5
- marks: "",
6
- group: "block",
1
+ import { Node } from '@tiptap/core';
2
+ const Alert = Node.create({
3
+ name: 'alert',
4
+ content: 'inline+',
5
+ marks: '',
6
+ group: 'block',
7
7
  inline: !1,
8
8
  selectable: !0,
9
9
  draggable: !0,
10
10
  parseHTML() {
11
11
  return [
12
12
  {
13
- tag: "p.info",
14
- priority: 60
13
+ tag: 'p.info',
14
+ priority: 60,
15
15
  },
16
16
  {
17
- tag: "p.warning",
18
- priority: 60
17
+ tag: 'p.warning',
18
+ priority: 60,
19
19
  },
20
20
  {
21
- tag: "div.info",
22
- priority: 60
21
+ tag: 'div.info',
22
+ priority: 60,
23
23
  },
24
24
  {
25
- tag: "div.warning",
26
- priority: 60
27
- }
25
+ tag: 'div.warning',
26
+ priority: 60,
27
+ },
28
28
  ];
29
29
  },
30
30
  addAttributes() {
31
31
  return {
32
32
  class: {
33
- default: "info",
34
- parseHTML: (r) => r.getAttribute("class")
35
- }
33
+ default: 'info',
34
+ parseHTML: (element) => element.getAttribute('class'),
35
+ },
36
36
  };
37
37
  },
38
- renderHTML({ HTMLAttributes: r }) {
39
- return ["div", r, 0];
40
- }
38
+ renderHTML({ HTMLAttributes }) {
39
+ return ['div', HTMLAttributes, 0];
40
+ },
41
41
  });
42
- export {
43
- i as Alert
44
- };
42
+ export { Alert };
45
43
  //# sourceMappingURL=alert.js.map
@@ -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":["Alert","Node","element","HTMLAttributes"],"mappings":";AAEa,MAAAA,IAAQC,EAAK,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;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,IAAA;AAAA,EAEJ;AAAA,EACA,gBAAgB;AACP,WAAA;AAAA,MACL,OAAO;AAAA,QACL,SAAS;AAAA,QACT,WAAW,CAACC,MACHA,EAAQ,aAAa,OAAO;AAAA,MAEvC;AAAA,IAAA;AAAA,EAEJ;AAAA,EACA,WAAW,EAAE,gBAAAC,KAAkB;AACtB,WAAA,CAAC,OAAOA,GAAgB,CAAC;AAAA,EAClC;AACF,CAAC;"}
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":";AAEa,MAAA,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;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,IAAA;AAAA,EAEJ;AAAA,EACA,gBAAgB;AACP,WAAA;AAAA,MACL,OAAO;AAAA,QACL,SAAS;AAAA,QACT,WAAW,CAAC,YACH,QAAQ,aAAa,OAAO;AAAA,MAEvC;AAAA,IAAA;AAAA,EAEJ;AAAA,EACA,WAAW,EAAE,kBAAkB;AACtB,WAAA,CAAC,OAAO,gBAAgB,CAAC;AAAA,EAClC;AACF,CAAC;"}
@@ -1,2 +1,74 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("@tiptap/core"),i=m.Node.create({name:"attachments",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:"attachments"}}},parseHTML(){return[{tag:"div[class=attachments]"}]},renderHTML({HTMLAttributes:n}){const a=n.links.map(e=>["a",{name:e.name,href:e.href,documentId:e.documentId,dataContentType:e.dataContentType},e.name]);return["div",this.options.HTMLAttributes,...a]},addAttributes(){return{links:{default:[],parseHTML:n=>{const t=n.getElementsByTagName("a"),a=[];for(let e=0;e<t.length;e++){const r=t[e],s=r.getAttribute("href"),d=r.textContent,o=s.match(/([^/]+$)/),c=r.getAttribute("data-document-id")||o&&o[0],u=r.getAttribute("data-content-type");a.push({href:s,name:d,documentId:c,dataContentType:u})}return a},renderHTML:n=>({links:n.links.map(t=>({href:t.href,name:t.name,documentId:t.documentId,dataContentType:t.dataContentType}))})}}},addCommands(){return{setAttachment:(n={dataContentType:"",name:"",documentId:"",href:""})=>({chain:t})=>t().insertContent({type:this.name,attrs:n}).run()}}});exports.Attachment=i;
1
+ 'use strict';
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
+ const core = require('@tiptap/core'),
4
+ Attachment = core.Node.create({
5
+ name: 'attachments',
6
+ content: '',
7
+ marks: '',
8
+ group: 'block',
9
+ selectable: !0,
10
+ atom: !0,
11
+ draggable: !0,
12
+ addOptions() {
13
+ return { HTMLAttributes: { class: 'attachments' } };
14
+ },
15
+ parseHTML() {
16
+ return [{ tag: 'div[class=attachments]' }];
17
+ },
18
+ renderHTML({ HTMLAttributes }) {
19
+ const renderedLinks = HTMLAttributes.links.map((el) => [
20
+ 'a',
21
+ {
22
+ name: el.name,
23
+ href: el.href,
24
+ documentId: el.documentId,
25
+ dataContentType: el.dataContentType,
26
+ },
27
+ el.name,
28
+ ]);
29
+ return ['div', this.options.HTMLAttributes, ...renderedLinks];
30
+ },
31
+ addAttributes() {
32
+ return {
33
+ links: {
34
+ default: [],
35
+ parseHTML: (element) => {
36
+ const links = element.getElementsByTagName('a'),
37
+ parsedLinks = [];
38
+ for (let i = 0; i < links.length; i++) {
39
+ const link = links[i],
40
+ href = link.getAttribute('href'),
41
+ name = link.textContent,
42
+ regexResult = href.match(/([^/]+$)/),
43
+ documentId =
44
+ link.getAttribute('data-document-id') ||
45
+ (regexResult && regexResult[0]),
46
+ dataContentType = link.getAttribute('data-content-type');
47
+ parsedLinks.push({ href, name, documentId, dataContentType });
48
+ }
49
+ return parsedLinks;
50
+ },
51
+ renderHTML: (attributes) => ({
52
+ links: attributes.links.map((link) => ({
53
+ href: link.href,
54
+ name: link.name,
55
+ documentId: link.documentId,
56
+ dataContentType: link.dataContentType,
57
+ })),
58
+ }),
59
+ },
60
+ };
61
+ },
62
+ addCommands() {
63
+ return {
64
+ setAttachment:
65
+ (
66
+ attrs = { dataContentType: '', name: '', documentId: '', href: '' },
67
+ ) =>
68
+ ({ chain }) =>
69
+ chain().insertContent({ type: this.name, attrs }).run(),
70
+ };
71
+ },
72
+ });
73
+ exports.Attachment = Attachment;
2
74
  //# sourceMappingURL=attachment.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachment.cjs","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":["Attachment","Node","HTMLAttributes","renderedLinks","el","element","links","parsedLinks","i","link","href","name","regexResult","documentId","dataContentType","attributes","attrs","chain"],"mappings":"gHAcaA,EAAaC,OAAK,OAA0B,CACvD,KAAM,cACN,QAAS,GACT,MAAO,GACP,MAAO,QACP,WAAY,GACZ,KAAM,GACN,UAAW,GAEX,YAAa,CACJ,MAAA,CACL,eAAgB,CACd,MAAO,aACT,CAAA,CAEJ,EAEA,WAAY,CACV,MAAO,CAAC,CAAE,IAAK,wBAAA,CAA0B,CAC3C,EAEA,WAAW,CAAE,eAAAC,GAAkB,CAG7B,MAAMC,EAFQD,EAAe,MAED,IAAKE,GACxB,CACL,IACA,CACE,KAAMA,EAAG,KACT,KAAMA,EAAG,KACT,WAAYA,EAAG,WACf,gBAAiBA,EAAG,eACtB,EACAA,EAAG,IAAA,CAEN,EAED,MAAO,CAAC,MAAO,KAAK,QAAQ,eAAgB,GAAGD,CAAa,CAC9D,EAEA,eAAgB,CACP,MAAA,CACL,MAAO,CACL,QAAS,CAAC,EACV,UAAYE,GAAY,CAChB,MAAAC,EAAQD,EAAQ,qBAAqB,GAAG,EACxCE,EAAc,CAAA,EAEpB,QAASC,EAAI,EAAGA,EAAIF,EAAM,OAAQE,IAAK,CAC/B,MAAAC,EAAOH,EAAME,CAAC,EACdE,EAAOD,EAAK,aAAa,MAAM,EAC/BE,EAAOF,EAAK,YACZG,EAAcF,EAAK,MAAM,UAAU,EACnCG,EACJJ,EAAK,aAAa,kBAAkB,GACnCG,GAAeA,EAAY,CAAC,EACzBE,EAAkBL,EAAK,aAAa,mBAAmB,EAE7DF,EAAY,KAAK,CACf,KAAAG,EACA,KAAAC,EACA,WAAAE,EACA,gBAAAC,CAAA,CACD,CACH,CAEO,OAAAP,CACT,EACA,WAAaQ,IACJ,CACL,MAAOA,EAAW,MAAM,IAAKN,IAAU,CACrC,KAAMA,EAAK,KACX,KAAMA,EAAK,KACX,WAAYA,EAAK,WACjB,gBAAiBA,EAAK,eAAA,EACtB,CAAA,EAGR,CAAA,CAEJ,EAEA,aAAc,CACL,MAAA,CACL,cACE,CACEO,EAAQ,CACN,gBAAiB,GACjB,KAAM,GACN,WAAY,GACZ,KAAM,EAAA,IAGV,CAAC,CAAE,MAAAC,KACMA,EAAA,EAAQ,cAAc,CAAE,KAAM,KAAK,KAAM,MAAAD,CAAA,CAAO,EAAE,KAC3D,CAEN,CACF,CAAC"}
1
+ {"version":3,"file":"attachment.cjs","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAca,WAAaA,UAAK,OAA0B,CACvD,KAAM,cACN,QAAS,GACT,MAAO,GACP,MAAO,QACP,WAAY,GACZ,KAAM,GACN,UAAW,GAEX,YAAa,CACJ,MAAA,CACL,eAAgB,CACd,MAAO,aACT,CAAA,CAEJ,EAEA,WAAY,CACV,MAAO,CAAC,CAAE,IAAK,wBAAA,CAA0B,CAC3C,EAEA,WAAW,CAAE,gBAAkB,CAG7B,MAAM,cAFQ,eAAe,MAED,IAAK,IACxB,CACL,IACA,CACE,KAAM,GAAG,KACT,KAAM,GAAG,KACT,WAAY,GAAG,WACf,gBAAiB,GAAG,eACtB,EACA,GAAG,IAAA,CAEN,EAED,MAAO,CAAC,MAAO,KAAK,QAAQ,eAAgB,GAAG,aAAa,CAC9D,EAEA,eAAgB,CACP,MAAA,CACL,MAAO,CACL,QAAS,CAAC,EACV,UAAY,SAAY,CAChB,MAAA,MAAQ,QAAQ,qBAAqB,GAAG,EACxC,YAAc,CAAA,EAEpB,QAAS,EAAI,EAAG,EAAI,MAAM,OAAQ,IAAK,CAC/B,MAAA,KAAO,MAAM,CAAC,EACd,KAAO,KAAK,aAAa,MAAM,EAC/B,KAAO,KAAK,YACZ,YAAc,KAAK,MAAM,UAAU,EACnC,WACJ,KAAK,aAAa,kBAAkB,GACnC,aAAe,YAAY,CAAC,EACzB,gBAAkB,KAAK,aAAa,mBAAmB,EAE7D,YAAY,KAAK,CACf,KACA,KACA,WACA,eAAA,CACD,CACH,CAEO,OAAA,WACT,EACA,WAAa,aACJ,CACL,MAAO,WAAW,MAAM,IAAK,OAAU,CACrC,KAAM,KAAK,KACX,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,gBAAiB,KAAK,eAAA,EACtB,CAAA,EAGR,CAAA,CAEJ,EAEA,aAAc,CACL,MAAA,CACL,cACE,CACE,MAAQ,CACN,gBAAiB,GACjB,KAAM,GACN,WAAY,GACZ,KAAM,EAAA,IAGV,CAAC,CAAE,SACM,MAAA,EAAQ,cAAc,CAAE,KAAM,KAAK,KAAM,KAAA,CAAO,EAAE,KAC3D,CAEN,CACF,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { Node } from '@tiptap/core';
2
2
  export interface AttachmentOptions {
3
- HTMLAttributes: Record<string, string>;
3
+ HTMLAttributes: Record<string, string>;
4
4
  }
5
5
  declare module '@tiptap/core' {
6
- interface Commands<ReturnType> {
7
- attachment: {
8
- setAttachment: (attachment: any) => ReturnType;
9
- };
10
- }
6
+ interface Commands<ReturnType> {
7
+ attachment: {
8
+ setAttachment: (attachment: any) => ReturnType;
9
+ };
10
+ }
11
11
  }
12
12
  export declare const Attachment: Node<AttachmentOptions, any>;
@@ -1,75 +1,86 @@
1
- import { Node as u } from "@tiptap/core";
2
- const p = u.create({
3
- name: "attachments",
4
- content: "",
5
- marks: "",
6
- group: "block",
1
+ import { Node } from '@tiptap/core';
2
+ const Attachment = Node.create({
3
+ name: 'attachments',
4
+ content: '',
5
+ marks: '',
6
+ group: 'block',
7
7
  selectable: !0,
8
8
  atom: !0,
9
9
  draggable: !0,
10
10
  addOptions() {
11
11
  return {
12
12
  HTMLAttributes: {
13
- class: "attachments"
14
- }
13
+ class: 'attachments',
14
+ },
15
15
  };
16
16
  },
17
17
  parseHTML() {
18
- return [{ tag: "div[class=attachments]" }];
18
+ return [{ tag: 'div[class=attachments]' }];
19
19
  },
20
- renderHTML({ HTMLAttributes: n }) {
21
- const a = n.links.map((e) => [
22
- "a",
20
+ renderHTML({ HTMLAttributes }) {
21
+ const renderedLinks = HTMLAttributes.links.map((el) => [
22
+ 'a',
23
23
  {
24
- name: e.name,
25
- href: e.href,
26
- documentId: e.documentId,
27
- dataContentType: e.dataContentType
24
+ name: el.name,
25
+ href: el.href,
26
+ documentId: el.documentId,
27
+ dataContentType: el.dataContentType,
28
28
  },
29
- e.name
29
+ el.name,
30
30
  ]);
31
- return ["div", this.options.HTMLAttributes, ...a];
31
+ return ['div', this.options.HTMLAttributes, ...renderedLinks];
32
32
  },
33
33
  addAttributes() {
34
34
  return {
35
35
  links: {
36
36
  default: [],
37
- parseHTML: (n) => {
38
- const t = n.getElementsByTagName("a"), a = [];
39
- for (let e = 0; e < t.length; e++) {
40
- const r = t[e], s = r.getAttribute("href"), d = r.textContent, o = s.match(/([^/]+$)/), m = r.getAttribute("data-document-id") || o && o[0], c = r.getAttribute("data-content-type");
41
- a.push({
42
- href: s,
43
- name: d,
44
- documentId: m,
45
- dataContentType: c
37
+ parseHTML: (element) => {
38
+ const links = element.getElementsByTagName('a'),
39
+ parsedLinks = [];
40
+ for (let i = 0; i < links.length; i++) {
41
+ const link = links[i],
42
+ href = link.getAttribute('href'),
43
+ name = link.textContent,
44
+ regexResult = href.match(/([^/]+$)/),
45
+ documentId =
46
+ link.getAttribute('data-document-id') ||
47
+ (regexResult && regexResult[0]),
48
+ dataContentType = link.getAttribute('data-content-type');
49
+ parsedLinks.push({
50
+ href,
51
+ name,
52
+ documentId,
53
+ dataContentType,
46
54
  });
47
55
  }
48
- return a;
56
+ return parsedLinks;
49
57
  },
50
- renderHTML: (n) => ({
51
- links: n.links.map((t) => ({
52
- href: t.href,
53
- name: t.name,
54
- documentId: t.documentId,
55
- dataContentType: t.dataContentType
56
- }))
57
- })
58
- }
58
+ renderHTML: (attributes) => ({
59
+ links: attributes.links.map((link) => ({
60
+ href: link.href,
61
+ name: link.name,
62
+ documentId: link.documentId,
63
+ dataContentType: link.dataContentType,
64
+ })),
65
+ }),
66
+ },
59
67
  };
60
68
  },
61
69
  addCommands() {
62
70
  return {
63
- setAttachment: (n = {
64
- dataContentType: "",
65
- name: "",
66
- documentId: "",
67
- href: ""
68
- }) => ({ chain: t }) => t().insertContent({ type: this.name, attrs: n }).run()
71
+ setAttachment:
72
+ (
73
+ attrs = {
74
+ dataContentType: '',
75
+ name: '',
76
+ documentId: '',
77
+ href: '',
78
+ },
79
+ ) =>
80
+ ({ chain }) =>
81
+ chain().insertContent({ type: this.name, attrs }).run(),
69
82
  };
70
- }
83
+ },
71
84
  });
72
- export {
73
- p as Attachment
74
- };
85
+ export { Attachment };
75
86
  //# sourceMappingURL=attachment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachment.js","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":["Attachment","Node","HTMLAttributes","renderedLinks","el","element","links","parsedLinks","i","link","href","name","regexResult","documentId","dataContentType","attributes","attrs","chain"],"mappings":";AAca,MAAAA,IAAaC,EAAK,OAA0B;AAAA,EACvD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACJ,WAAA;AAAA,MACL,gBAAgB;AAAA,QACd,OAAO;AAAA,MACT;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,yBAAA,CAA0B;AAAA,EAC3C;AAAA,EAEA,WAAW,EAAE,gBAAAC,KAAkB;AAG7B,UAAMC,IAFQD,EAAe,MAED,IAAI,CAACE,MACxB;AAAA,MACL;AAAA,MACA;AAAA,QACE,MAAMA,EAAG;AAAA,QACT,MAAMA,EAAG;AAAA,QACT,YAAYA,EAAG;AAAA,QACf,iBAAiBA,EAAG;AAAA,MACtB;AAAA,MACAA,EAAG;AAAA,IAAA,CAEN;AAED,WAAO,CAAC,OAAO,KAAK,QAAQ,gBAAgB,GAAGD,CAAa;AAAA,EAC9D;AAAA,EAEA,gBAAgB;AACP,WAAA;AAAA,MACL,OAAO;AAAA,QACL,SAAS,CAAC;AAAA,QACV,WAAW,CAACE,MAAY;AAChB,gBAAAC,IAAQD,EAAQ,qBAAqB,GAAG,GACxCE,IAAc,CAAA;AAEpB,mBAASC,IAAI,GAAGA,IAAIF,EAAM,QAAQE,KAAK;AAC/B,kBAAAC,IAAOH,EAAME,CAAC,GACdE,IAAOD,EAAK,aAAa,MAAM,GAC/BE,IAAOF,EAAK,aACZG,IAAcF,EAAK,MAAM,UAAU,GACnCG,IACJJ,EAAK,aAAa,kBAAkB,KACnCG,KAAeA,EAAY,CAAC,GACzBE,IAAkBL,EAAK,aAAa,mBAAmB;AAE7D,YAAAF,EAAY,KAAK;AAAA,cACf,MAAAG;AAAA,cACA,MAAAC;AAAA,cACA,YAAAE;AAAA,cACA,iBAAAC;AAAA,YAAA,CACD;AAAA,UACH;AAEO,iBAAAP;AAAA,QACT;AAAA,QACA,YAAY,CAACQ,OACJ;AAAA,UACL,OAAOA,EAAW,MAAM,IAAI,CAACN,OAAU;AAAA,YACrC,MAAMA,EAAK;AAAA,YACX,MAAMA,EAAK;AAAA,YACX,YAAYA,EAAK;AAAA,YACjB,iBAAiBA,EAAK;AAAA,UAAA,EACtB;AAAA,QAAA;AAAA,MAGR;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,eACE,CACEO,IAAQ;AAAA,QACN,iBAAiB;AAAA,QACjB,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,MAAM;AAAA,MAAA,MAGV,CAAC,EAAE,OAAAC,QACMA,EAAA,EAAQ,cAAc,EAAE,MAAM,KAAK,MAAM,OAAAD,EAAA,CAAO,EAAE;IAC3D;AAAA,EAEN;AACF,CAAC;"}
1
+ {"version":3,"file":"attachment.js","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":[],"mappings":";AAca,MAAA,aAAa,KAAK,OAA0B;AAAA,EACvD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACJ,WAAA;AAAA,MACL,gBAAgB;AAAA,QACd,OAAO;AAAA,MACT;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,yBAAA,CAA0B;AAAA,EAC3C;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAG7B,UAAM,gBAFQ,eAAe,MAED,IAAI,CAAC,OACxB;AAAA,MACL;AAAA,MACA;AAAA,QACE,MAAM,GAAG;AAAA,QACT,MAAM,GAAG;AAAA,QACT,YAAY,GAAG;AAAA,QACf,iBAAiB,GAAG;AAAA,MACtB;AAAA,MACA,GAAG;AAAA,IAAA,CAEN;AAED,WAAO,CAAC,OAAO,KAAK,QAAQ,gBAAgB,GAAG,aAAa;AAAA,EAC9D;AAAA,EAEA,gBAAgB;AACP,WAAA;AAAA,MACL,OAAO;AAAA,QACL,SAAS,CAAC;AAAA,QACV,WAAW,CAAC,YAAY;AAChB,gBAAA,QAAQ,QAAQ,qBAAqB,GAAG,GACxC,cAAc,CAAA;AAEpB,mBAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AAC/B,kBAAA,OAAO,MAAM,CAAC,GACd,OAAO,KAAK,aAAa,MAAM,GAC/B,OAAO,KAAK,aACZ,cAAc,KAAK,MAAM,UAAU,GACnC,aACJ,KAAK,aAAa,kBAAkB,KACnC,eAAe,YAAY,CAAC,GACzB,kBAAkB,KAAK,aAAa,mBAAmB;AAE7D,wBAAY,KAAK;AAAA,cACf;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YAAA,CACD;AAAA,UACH;AAEO,iBAAA;AAAA,QACT;AAAA,QACA,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,WAAW,MAAM,IAAI,CAAC,UAAU;AAAA,YACrC,MAAM,KAAK;AAAA,YACX,MAAM,KAAK;AAAA,YACX,YAAY,KAAK;AAAA,YACjB,iBAAiB,KAAK;AAAA,UAAA,EACtB;AAAA,QAAA;AAAA,MAGR;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,eACE,CACE,QAAQ;AAAA,QACN,iBAAiB;AAAA,QACjB,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,MAAM;AAAA,MAAA,MAGV,CAAC,EAAE,YACM,MAAA,EAAQ,cAAc,EAAE,MAAM,KAAK,MAAM,MAAA,CAAO,EAAE;IAC3D;AAAA,EAEN;AACF,CAAC;"}
@@ -1,5 +1,55 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@tiptap/core"),a=t.Node.create({name:"audio",group:"block",addAttributes(){return{src:{default:null,parseHTML:e=>e.getAttribute("src"),renderHTML:e=>({src:e.src})},documentId:{default:"",renderHTML:e=>({"data-document-id":e.documentId}),parseHTML:e=>e.getAttribute("data-document-id")}}},parseHTML(){return[{tag:"div.audio-wrapper>audio,audio",getAttrs:e=>({src:e.getAttribute("src")})}]},renderHTML({HTMLAttributes:e}){return["div",{class:"audio-wrapper"},["audio",t.mergeAttributes(e)]]},addCommands(){return{setAudio:(e,r,d)=>({commands:u,state:o})=>u.insertContentAt(o.selection,`<audio
2
- src="${r}"
1
+ 'use strict';
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
+ const core = require('@tiptap/core'),
4
+ Audio = core.Node.create({
5
+ name: 'audio',
6
+ group: 'block',
7
+ addAttributes() {
8
+ return {
9
+ src: {
10
+ default: null,
11
+ parseHTML: (el) => el.getAttribute('src'),
12
+ renderHTML: (attrs) => ({ src: attrs.src }),
13
+ },
14
+ documentId: {
15
+ default: '',
16
+ renderHTML: (attributes) => ({
17
+ 'data-document-id': attributes.documentId,
18
+ }),
19
+ parseHTML: (element) => element.getAttribute('data-document-id'),
20
+ },
21
+ };
22
+ },
23
+ parseHTML() {
24
+ return [
25
+ {
26
+ tag: 'div.audio-wrapper>audio,audio',
27
+ getAttrs: (el) => ({ src: el.getAttribute('src') }),
28
+ },
29
+ ];
30
+ },
31
+ renderHTML({ HTMLAttributes }) {
32
+ return [
33
+ 'div',
34
+ { class: 'audio-wrapper' },
35
+ ['audio', core.mergeAttributes(HTMLAttributes)],
36
+ ];
37
+ },
38
+ addCommands() {
39
+ return {
40
+ setAudio:
41
+ (id, src, options) =>
42
+ ({ commands, state }) =>
43
+ commands.insertContentAt(
44
+ state.selection,
45
+ `<audio
46
+ src="${src}"
3
47
  controls preload="none"
4
- data-document-id="${e}"></audio>`,d)}}});exports.Audio=a;
48
+ data-document-id="${id}"></audio>`,
49
+ options,
50
+ ),
51
+ };
52
+ },
53
+ });
54
+ exports.Audio = Audio;
5
55
  //# sourceMappingURL=audio.cjs.map