@edifice.io/tiptap-extensions 2.0.0-develop-rc.7 → 2.0.0-develop-rc.10

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 (83) hide show
  1. package/dist/abbr/abbr.cjs +1 -1
  2. package/dist/abbr/abbr.cjs.map +1 -1
  3. package/dist/abbr/abbr.js +7 -7
  4. package/dist/abbr/abbr.js.map +1 -1
  5. package/dist/alert/alert.cjs +1 -1
  6. package/dist/alert/alert.cjs.map +1 -1
  7. package/dist/alert/alert.js +6 -6
  8. package/dist/alert/alert.js.map +1 -1
  9. package/dist/attachment/attachment.cjs +1 -1
  10. package/dist/attachment/attachment.cjs.map +1 -1
  11. package/dist/attachment/attachment.js +29 -29
  12. package/dist/attachment/attachment.js.map +1 -1
  13. package/dist/audio/audio.cjs +3 -3
  14. package/dist/audio/audio.cjs.map +1 -1
  15. package/dist/audio/audio.js +16 -16
  16. package/dist/audio/audio.js.map +1 -1
  17. package/dist/font-size/font-size.cjs +1 -1
  18. package/dist/font-size/font-size.cjs.map +1 -1
  19. package/dist/font-size/font-size.js +10 -10
  20. package/dist/font-size/font-size.js.map +1 -1
  21. package/dist/heading/heading.cjs +1 -1
  22. package/dist/heading/heading.cjs.map +1 -1
  23. package/dist/heading/heading.js +20 -20
  24. package/dist/heading/heading.js.map +1 -1
  25. package/dist/highlight/highlight.cjs +1 -1
  26. package/dist/highlight/highlight.cjs.map +1 -1
  27. package/dist/highlight/highlight.js +9 -9
  28. package/dist/highlight/highlight.js.map +1 -1
  29. package/dist/hyperlink/hyperlink.cjs +1 -1
  30. package/dist/hyperlink/hyperlink.cjs.map +1 -1
  31. package/dist/hyperlink/hyperlink.js +13 -13
  32. package/dist/hyperlink/hyperlink.js.map +1 -1
  33. package/dist/iframe/iframe.cjs +1 -1
  34. package/dist/iframe/iframe.cjs.map +1 -1
  35. package/dist/iframe/iframe.js +17 -17
  36. package/dist/iframe/iframe.js.map +1 -1
  37. package/dist/image/custom-image.cjs +1 -1
  38. package/dist/image/custom-image.cjs.map +1 -1
  39. package/dist/image/custom-image.js +51 -51
  40. package/dist/image/custom-image.js.map +1 -1
  41. package/dist/index.cjs +1 -1
  42. package/dist/index.js +41 -41
  43. package/dist/line-height/line-height.cjs +1 -1
  44. package/dist/line-height/line-height.cjs.map +1 -1
  45. package/dist/line-height/line-height.js +8 -8
  46. package/dist/line-height/line-height.js.map +1 -1
  47. package/dist/linker/linker.cjs +1 -1
  48. package/dist/linker/linker.cjs.map +1 -1
  49. package/dist/linker/linker.js +16 -16
  50. package/dist/linker/linker.js.map +1 -1
  51. package/dist/mathjax/mathjax.cjs +1 -1
  52. package/dist/mathjax/mathjax.cjs.map +1 -1
  53. package/dist/mathjax/mathjax.js +9 -9
  54. package/dist/mathjax/mathjax.js.map +1 -1
  55. package/dist/paragraph/paragraph.cjs +1 -1
  56. package/dist/paragraph/paragraph.cjs.map +1 -1
  57. package/dist/paragraph/paragraph.js +5 -5
  58. package/dist/paragraph/paragraph.js.map +1 -1
  59. package/dist/speech-recognition/speech-recognition.cjs +1 -1
  60. package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
  61. package/dist/speech-recognition/speech-recognition.js +29 -29
  62. package/dist/speech-recognition/speech-recognition.js.map +1 -1
  63. package/dist/speech-synthesis/speech-synthesis.cjs +1 -1
  64. package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
  65. package/dist/speech-synthesis/speech-synthesis.js +8 -8
  66. package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
  67. package/dist/table-cell/table-cell.cjs +1 -1
  68. package/dist/table-cell/table-cell.cjs.map +1 -1
  69. package/dist/table-cell/table-cell.js +10 -10
  70. package/dist/table-cell/table-cell.js.map +1 -1
  71. package/dist/transform/html-to-json/html-to-json.cjs +1 -1
  72. package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
  73. package/dist/transform/html-to-json/html-to-json.js +3 -3
  74. package/dist/transform/html-to-json/html-to-json.js.map +1 -1
  75. package/dist/transform/json-to-html/json-to-html.cjs +1 -1
  76. package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
  77. package/dist/transform/json-to-html/json-to-html.js +3 -3
  78. package/dist/transform/json-to-html/json-to-html.js.map +1 -1
  79. package/dist/video/video.cjs +9 -9
  80. package/dist/video/video.cjs.map +1 -1
  81. package/dist/video/video.js +40 -40
  82. package/dist/video/video.js.map +1 -1
  83. package/package.json +1 -1
@@ -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":";;;AAsBa,MAAA,gBAAgB,QAAQ,OAAgB;AAAA,EACnD,MAAM;AAAA,EAEN,aAAa;;AACJ,WAAA;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,gBAAgB,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EAEA,YAAY;AACV,WAAO,KAAK,QAAQ,OAAO,IAAI,CAAC,WAAkB;AAAA,MAChD,KAAK,IAAI,KAAK;AAAA,MACd,OAAO,EAAE,MAAM;AAAA,IACf,EAAA;AAAA,EACJ;AAAA,EAEA,WAAW,EAAE,MAAM,kBAAkB;AAI5B,WAAA;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;AACL,WAAA;AAAA,MACL,kBACE,CAAC,eACD,CAAC,EAAE,IAAI,UAAU,eAAe;AAC9B,YAAI,CAAC,KAAK,QAAQ,OAAO,SAAS,WAAW,KAAK;AACzC,iBAAA;AAGH,cAAA,EAAE,UAAc,IAAA,IAChB,EAAE,MAAM,GAAO,IAAA;AAErB,kBAAG,IAAI,aAAa,MAAM,IAAI,CAAC,MAAM,QAAQ;AAC3C,UAAI,KAAK,WAAW,QAAQ,OAAO,MAAM,MAAM,KAAK,YAE7C,KAAA,QAAQ,QAAQ,CAAC,YAAY;AAExB,oBAAA,MAAM,QAAQ,CAAC,SAAS;AAE9B,cACE,KAAK,KAAK,SAAS,eACnB,KAAK,MAAM,YACX,KAAK,MAAM,aAAgB,SAG3B,KAAK,GAAG,WAAW,KAAK,MAAM,KAAK,UAAU,KAAK,IAAI;AAAA,YACxD,CACD;AAAA,UAAA,CACF;AAAA,QACH,CACD,GAEG,YACF,SAAS,EAAE,GAEN,SAAS,WAAW,EAAE,OAAO,WAAW,OAAO;AAAA,MACxD;AAAA,IAAA;AAAA,EAEN;AACF,CAAC;"}
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":["CustomHeading","Heading","_a","level","node","HTMLAttributes","mergeAttributes","attributes","tr","dispatch","commands","selection","from","to","pos","content","mark"],"mappings":";;;AAsBa,MAAAA,IAAgBC,EAAQ,OAAgB;AAAA,EACnD,MAAM;AAAA,EAEN,aAAa;;AACJ,WAAA;AAAA,MACL,IAAGC,IAAA,KAAK,WAAL,gBAAAA,EAAA;AAAA,MACH,gBAAgB,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EAEA,YAAY;AACV,WAAO,KAAK,QAAQ,OAAO,IAAI,CAACC,OAAkB;AAAA,MAChD,KAAK,IAAIA,CAAK;AAAA,MACd,OAAO,EAAE,OAAAA,EAAM;AAAA,IACf,EAAA;AAAA,EACJ;AAAA,EAEA,WAAW,EAAE,MAAAC,GAAM,gBAAAC,KAAkB;AAI5B,WAAA;AAAA,MACL,IAJe,KAAK,QAAQ,OAAO,SAASD,EAAK,MAAM,KAAK,IACrCA,EAAK,MAAM,QAAQ,KAAK,QAAQ,OAAO,CAAC,CAGtD;AAAA,MACTE,EAAgB,KAAK,QAAQ,gBAAgBD,CAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,kBACE,CAACE,MACD,CAAC,EAAE,IAAAC,GAAI,UAAAC,GAAU,UAAAC,QAAe;AAC9B,YAAI,CAAC,KAAK,QAAQ,OAAO,SAASH,EAAW,KAAK;AACzC,iBAAA;AAGH,cAAA,EAAE,WAAAI,EAAc,IAAAH,GAChB,EAAE,MAAAI,GAAM,IAAAC,EAAO,IAAAF;AAErB,eAAAH,EAAG,IAAI,aAAaI,GAAMC,GAAI,CAACT,GAAMU,MAAQ;AAC3C,UAAIV,EAAK,WAAWQ,KAAQE,KAAOD,KAAMC,IAAMV,EAAK,YAE7CA,EAAA,QAAQ,QAAQ,CAACW,MAAY;AAExB,YAAAA,EAAA,MAAM,QAAQ,CAACC,MAAS;AAE9B,cACEA,EAAK,KAAK,SAAS,eACnBA,EAAK,MAAM,YACXA,EAAK,MAAM,aAAgB,SAG3BR,IAAKA,EAAG,WAAWM,GAAKA,IAAMV,EAAK,UAAUY,EAAK,IAAI;AAAA,YACxD,CACD;AAAA,UAAA,CACF;AAAA,QACH,CACD,GAEGP,KACFA,EAASD,CAAE,GAENE,EAAS,WAAW,EAAE,OAAOH,EAAW,OAAO;AAAA,MACxD;AAAA,IAAA;AAAA,EAEN;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Highlight=require("@tiptap/extension-highlight"),CustomHighlight=Highlight.extend({name:"customHighlight",addOptions(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),multicolor:!0,HTMLAttributes:{}}},parseHTML(){var _a;return[{...(_a=this.parent)==null?void 0:_a.call(this),style:"background-color",getAttrs:style=>({color:style})}]}});exports.CustomHighlight=CustomHighlight;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@tiptap/extension-highlight"),i=r.extend({name:"customHighlight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,HTMLAttributes:{}}},parseHTML(){var t;return[{...(t=this.parent)==null?void 0:t.call(this),style:"background-color",getAttrs:e=>({color:e})}]}});exports.CustomHighlight=i;
2
2
  //# sourceMappingURL=highlight.cjs.map
@@ -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,QACJ,MAAA,CACL,IAAG,QAAK,SAAL,0BACH,WAAY,GACZ,eAAgB,CAAC,CAAA,CAErB,EAEA,WAAY,QACH,MAAA,CACL,CACE,IAAG,QAAK,SAAL,0BACH,MAAO,mBACP,SAAW,QACF,CACL,MAAO,KAAA,EAGb,CAAA,CAEJ,CACF,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":["CustomHighlight","Highlight","_a","style"],"mappings":"+HAEaA,EAAkBC,EAAU,OAAO,CAC9C,KAAM,kBAEN,YAAa,OACJ,MAAA,CACL,IAAGC,EAAA,KAAK,SAAL,YAAAA,EAAA,WACH,WAAY,GACZ,eAAgB,CAAC,CAAA,CAErB,EAEA,WAAY,OACH,MAAA,CACL,CACE,IAAGA,EAAA,KAAK,SAAL,YAAAA,EAAA,WACH,MAAO,mBACP,SAAWC,IACF,CACL,MAAOA,CAAA,EAGb,CAAA,CAEJ,CACF,CAAC"}
@@ -1,28 +1,28 @@
1
- import Highlight from "@tiptap/extension-highlight";
2
- const CustomHighlight = Highlight.extend({
1
+ import e from "@tiptap/extension-highlight";
2
+ const i = e.extend({
3
3
  name: "customHighlight",
4
4
  addOptions() {
5
- var _a;
5
+ var t;
6
6
  return {
7
- ...(_a = this.parent) == null ? void 0 : _a.call(this),
7
+ ...(t = this.parent) == null ? void 0 : t.call(this),
8
8
  multicolor: !0,
9
9
  HTMLAttributes: {}
10
10
  };
11
11
  },
12
12
  parseHTML() {
13
- var _a;
13
+ var t;
14
14
  return [
15
15
  {
16
- ...(_a = this.parent) == null ? void 0 : _a.call(this),
16
+ ...(t = this.parent) == null ? void 0 : t.call(this),
17
17
  style: "background-color",
18
- getAttrs: (style) => ({
19
- color: style
18
+ getAttrs: (r) => ({
19
+ color: r
20
20
  })
21
21
  }
22
22
  ];
23
23
  }
24
24
  });
25
25
  export {
26
- CustomHighlight
26
+ i as CustomHighlight
27
27
  };
28
28
  //# sourceMappingURL=highlight.js.map
@@ -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":";AAEa,MAAA,kBAAkB,UAAU,OAAO;AAAA,EAC9C,MAAM;AAAA,EAEN,aAAa;;AACJ,WAAA;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,YAAY;AAAA,MACZ,gBAAgB,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EAEA,YAAY;;AACH,WAAA;AAAA,MACL;AAAA,QACE,IAAG,UAAK,WAAL;AAAA,QACH,OAAO;AAAA,QACP,UAAU,CAAC,WACF;AAAA,UACL,OAAO;AAAA,QAAA;AAAA,MAGb;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
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":["CustomHighlight","Highlight","_a","style"],"mappings":";AAEa,MAAAA,IAAkBC,EAAU,OAAO;AAAA,EAC9C,MAAM;AAAA,EAEN,aAAa;;AACJ,WAAA;AAAA,MACL,IAAGC,IAAA,KAAK,WAAL,gBAAAA,EAAA;AAAA,MACH,YAAY;AAAA,MACZ,gBAAgB,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EAEA,YAAY;;AACH,WAAA;AAAA,MACL;AAAA,QACE,IAAGA,IAAA,KAAK,WAAL,gBAAAA,EAAA;AAAA,QACH,OAAO;AAAA,QACP,UAAU,CAACC,OACF;AAAA,UACL,OAAOA;AAAA,QAAA;AAAA,MAGb;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const extensionLink=require("@tiptap/extension-link"),Hyperlink=extensionLink.Link.extend({name:"hyperlink",parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])',getAttrs:node=>{if(node.getAttribute("data-id")&&node.getAttribute("data-app-prefix"))return!1}}]},addOptions(){var _a,_b;return{...(_a=this.parent)==null?void 0:_a.call(this),openOnClick:!1,HTMLAttributes:{...(_b=this.parent)==null?void 0:_b.call(this).HTMLAttributes,target:null}}},addAttributes(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),target:{default:this.options.HTMLAttributes.target,parseHTML:element=>element.getAttribute("target")!=="_blank"?null:"_blank",renderHTML:attributes=>({target:attributes.target})},title:{default:this.options.HTMLAttributes.title}}}});exports.Hyperlink=Hyperlink;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@tiptap/extension-link"),i=r.Link.extend({name:"hyperlink",parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])',getAttrs:t=>{if(t.getAttribute("data-id")&&t.getAttribute("data-app-prefix"))return!1}}]},addOptions(){var t,e;return{...(t=this.parent)==null?void 0:t.call(this),openOnClick:!1,HTMLAttributes:{...(e=this.parent)==null?void 0:e.call(this).HTMLAttributes,target:null}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),target:{default:this.options.HTMLAttributes.target,parseHTML:e=>e.getAttribute("target")!=="_blank"?null:"_blank",renderHTML:e=>({target:e.target})},title:{default:this.options.HTMLAttributes.title}}}});exports.Hyperlink=i;
2
2
  //# sourceMappingURL=hyperlink.cjs.map
@@ -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,mBAAK,OAAO,CACnC,KAAM,YAEN,WAAY,CACH,MAAA,CACL,CACE,IAAK,yCAGL,SAAW,MAA4B,CAErC,GACE,KAAK,aAAa,SAAS,GAC3B,KAAK,aAAa,iBAAiB,EAE5B,MAAA,EACX,CACF,CAAA,CAEJ,EAEA,YAAa,WACJ,MAAA,CACL,IAAG,QAAK,SAAL,0BACH,YAAa,GACb,eAAgB,CACd,IAAG,QAAK,SAAL,0BAAgB,eACnB,OAAQ,IACV,CAAA,CAEJ,EAGA,eAAgB,QACP,MAAA,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,EAE/B,EACA,MAAO,CACL,QAAS,KAAK,QAAQ,eAAe,KACvC,CAAA,CAEJ,CACF,CAAC"}
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":["Hyperlink","Link","node","_a","_b","element","attributes"],"mappings":"0HAsCaA,EAAYC,OAAK,OAAO,CACnC,KAAM,YAEN,WAAY,CACH,MAAA,CACL,CACE,IAAK,yCAGL,SAAWC,GAA4B,CAErC,GACEA,EAAK,aAAa,SAAS,GAC3BA,EAAK,aAAa,iBAAiB,EAE5B,MAAA,EACX,CACF,CAAA,CAEJ,EAEA,YAAa,SACJ,MAAA,CACL,IAAGC,EAAA,KAAK,SAAL,YAAAA,EAAA,WACH,YAAa,GACb,eAAgB,CACd,IAAGC,EAAA,KAAK,SAAL,YAAAA,EAAA,WAAgB,eACnB,OAAQ,IACV,CAAA,CAEJ,EAGA,eAAgB,OACP,MAAA,CAEL,IAAGD,EAAA,KAAK,SAAL,YAAAA,EAAA,WAGH,OAAQ,CACN,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAYE,GACVA,EAAQ,aAAa,QAAQ,IAAM,SAAW,KAAO,SACvD,WAAaC,IAAgB,CAC3B,OAAQA,EAAW,MAAQ,EAE/B,EACA,MAAO,CACL,QAAS,KAAK,QAAQ,eAAe,KACvC,CAAA,CAEJ,CACF,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Link } from "@tiptap/extension-link";
2
- const Hyperlink = Link.extend({
1
+ import { Link as r } from "@tiptap/extension-link";
2
+ const i = r.extend({
3
3
  name: "hyperlink",
4
4
  parseHTML() {
5
5
  return [
@@ -7,38 +7,38 @@ const Hyperlink = Link.extend({
7
7
  tag: 'a[href]:not([href *= "javascript:" i])',
8
8
  // Be sure no data-id and data-app-prefix attribute exists :
9
9
  // it would then be an Linker, not an Hyperlink !
10
- getAttrs: (node) => {
11
- if (node.getAttribute("data-id") && node.getAttribute("data-app-prefix"))
10
+ getAttrs: (t) => {
11
+ if (t.getAttribute("data-id") && t.getAttribute("data-app-prefix"))
12
12
  return !1;
13
13
  }
14
14
  }
15
15
  ];
16
16
  },
17
17
  addOptions() {
18
- var _a, _b;
18
+ var t, e;
19
19
  return {
20
- ...(_a = this.parent) == null ? void 0 : _a.call(this),
20
+ ...(t = this.parent) == null ? void 0 : t.call(this),
21
21
  openOnClick: !1,
22
22
  HTMLAttributes: {
23
- ...(_b = this.parent) == null ? void 0 : _b.call(this).HTMLAttributes,
23
+ ...(e = this.parent) == null ? void 0 : e.call(this).HTMLAttributes,
24
24
  target: null
25
25
  }
26
26
  };
27
27
  },
28
28
  /* Manage `title` and `target` attributes. */
29
29
  addAttributes() {
30
- var _a;
30
+ var t;
31
31
  return {
32
32
  // Preserve attributes of parent extension...
33
- ...(_a = this.parent) == null ? void 0 : _a.call(this),
33
+ ...(t = this.parent) == null ? void 0 : t.call(this),
34
34
  // ...then add or override the following :
35
35
  //------------------
36
36
  target: {
37
37
  default: this.options.HTMLAttributes.target,
38
38
  // Sanitize target value
39
- parseHTML: (element) => element.getAttribute("target") !== "_blank" ? null : "_blank",
40
- renderHTML: (attributes) => ({
41
- target: attributes.target
39
+ parseHTML: (e) => e.getAttribute("target") !== "_blank" ? null : "_blank",
40
+ renderHTML: (e) => ({
41
+ target: e.target
42
42
  })
43
43
  },
44
44
  title: {
@@ -48,6 +48,6 @@ const Hyperlink = Link.extend({
48
48
  }
49
49
  });
50
50
  export {
51
- Hyperlink
51
+ i as Hyperlink
52
52
  };
53
53
  //# sourceMappingURL=hyperlink.js.map
@@ -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":";AAsCa,MAAA,YAAY,KAAK,OAAO;AAAA,EACnC,MAAM;AAAA,EAEN,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA;AAAA;AAAA,QAGL,UAAU,CAAC,SAA4B;AAErC,cACE,KAAK,aAAa,SAAS,KAC3B,KAAK,aAAa,iBAAiB;AAE5B,mBAAA;AAAA,QACX;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,aAAa;;AACJ,WAAA;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,aAAa;AAAA,MACb,gBAAgB;AAAA,QACd,IAAG,UAAK,WAAL,8BAAgB;AAAA,QACnB,QAAQ;AAAA,MACV;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA,EAGA,gBAAgB;;AACP,WAAA;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,MAE/B;AAAA,MACA,OAAO;AAAA,QACL,SAAS,KAAK,QAAQ,eAAe;AAAA,MACvC;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
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":["Hyperlink","Link","node","_a","_b","element","attributes"],"mappings":";AAsCa,MAAAA,IAAYC,EAAK,OAAO;AAAA,EACnC,MAAM;AAAA,EAEN,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA;AAAA;AAAA,QAGL,UAAU,CAACC,MAA4B;AAErC,cACEA,EAAK,aAAa,SAAS,KAC3BA,EAAK,aAAa,iBAAiB;AAE5B,mBAAA;AAAA,QACX;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,aAAa;;AACJ,WAAA;AAAA,MACL,IAAGC,IAAA,KAAK,WAAL,gBAAAA,EAAA;AAAA,MACH,aAAa;AAAA,MACb,gBAAgB;AAAA,QACd,IAAGC,IAAA,KAAK,WAAL,gBAAAA,EAAA,WAAgB;AAAA,QACnB,QAAQ;AAAA,MACV;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA,EAGA,gBAAgB;;AACP,WAAA;AAAA;AAAA,MAEL,IAAGD,IAAA,KAAK,WAAL,gBAAAA,EAAA;AAAA;AAAA;AAAA,MAGH,QAAQ;AAAA,QACN,SAAS,KAAK,QAAQ,eAAe;AAAA;AAAA,QAErC,WAAW,CAACE,MACVA,EAAQ,aAAa,QAAQ,MAAM,WAAW,OAAO;AAAA,QACvD,YAAY,CAACC,OAAgB;AAAA,UAC3B,QAAQA,EAAW;AAAA,QAAQ;AAAA,MAE/B;AAAA,MACA,OAAO;AAAA,QACL,SAAS,KAAK,QAAQ,eAAe;AAAA,MACvC;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Iframe=core.Node.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},width:{renderHTML:attributes=>attributes.width?{width:attributes.width==="100%"?"100%":parseInt(attributes.width)}:{},parseHTML:element=>element.getAttribute("width")},height:{renderHTML:attributes=>attributes.height?{height:parseInt(attributes.height)}:{},parseHTML:element=>element.getAttribute("height")},style:{renderHTML:attributes=>attributes.style?{style:attributes.style}:{},parseHTML:element=>element.getAttribute("style")}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes}){return["div",this.options.HTMLAttributes,["iframe",HTMLAttributes]]},addCommands(){return{setIframe:options=>({tr,dispatch})=>{const{selection}=tr,node=this.type.create(options);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0}}}});exports.Iframe=Iframe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@tiptap/core"),l=s.Node.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},width:{renderHTML:e=>e.width?{width:e.width==="100%"?"100%":parseInt(e.width)}:{},parseHTML:e=>e.getAttribute("width")},height:{renderHTML:e=>e.height?{height:parseInt(e.height)}:{},parseHTML:e=>e.getAttribute("height")},style:{renderHTML:e=>e.style?{style:e.style}:{},parseHTML:e=>e.getAttribute("style")}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["div",this.options.HTMLAttributes,["iframe",e]]},addCommands(){return{setIframe:e=>({tr:t,dispatch:a})=>{const{selection:r}=t,n=this.type.create(e);return a&&t.replaceRangeWith(r.from,r.to,n),!0}}}});exports.Iframe=l;
2
2
  //# sourceMappingURL=iframe.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\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 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"],"mappings":"mHAoBa,OAASA,UAAK,OAAsB,CAC/C,KAAM,SACN,MAAO,QACP,KAAM,GACN,UAAW,GAEX,YAAa,CACJ,MAAA,CACL,gBAAiB,GACjB,eAAgB,CACd,MAAO,gBACT,CAAA,CAEJ,EAEA,eAAgB,CACP,MAAA,CACL,IAAK,CACH,QAAS,IACX,EACA,YAAa,CACX,QAAS,CACX,EACA,gBAAiB,CACf,QAAS,KAAK,QAAQ,gBACtB,UAAW,IAAM,KAAK,QAAQ,eAChC,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MACE,WAAW,QAAU,OACjB,OACA,SAAS,WAAW,KAAK,GAEjC,GAEN,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAa,YACJ,WAAW,OACd,CACE,OAAQ,SAAS,WAAW,MAAM,GAEpC,GAEN,UAAY,SAAY,QAAQ,aAAa,QAAQ,CACvD,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MAAO,WAAW,OAEpB,GAEN,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,CAAA,CAEJ,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,QACP,CAAA,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CAAC,MAAO,KAAK,QAAQ,eAAgB,CAAC,SAAU,cAAc,CAAC,CACxE,EAEA,aAAc,CACL,MAAA,CACL,UACG,SACD,CAAC,CAAE,GAAI,YAAe,CACd,KAAA,CAAE,SAAc,EAAA,GAChB,KAAO,KAAK,KAAK,OAAO,OAAO,EAErC,OAAI,UACF,GAAG,iBAAiB,UAAU,KAAM,UAAU,GAAI,IAAI,EAGjD,EACT,CAAA,CAEN,CACF,CAAC"}
1
+ {"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\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 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":["Iframe","Node","attributes","element","HTMLAttributes","options","tr","dispatch","selection","node"],"mappings":"gHAoBaA,EAASC,OAAK,OAAsB,CAC/C,KAAM,SACN,MAAO,QACP,KAAM,GACN,UAAW,GAEX,YAAa,CACJ,MAAA,CACL,gBAAiB,GACjB,eAAgB,CACd,MAAO,gBACT,CAAA,CAEJ,EAEA,eAAgB,CACP,MAAA,CACL,IAAK,CACH,QAAS,IACX,EACA,YAAa,CACX,QAAS,CACX,EACA,gBAAiB,CACf,QAAS,KAAK,QAAQ,gBACtB,UAAW,IAAM,KAAK,QAAQ,eAChC,EACA,MAAO,CACL,WAAaC,GACJA,EAAW,MACd,CACE,MACEA,EAAW,QAAU,OACjB,OACA,SAASA,EAAW,KAAK,GAEjC,GAEN,UAAYC,GAAYA,EAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAaD,GACJA,EAAW,OACd,CACE,OAAQ,SAASA,EAAW,MAAM,GAEpC,GAEN,UAAYC,GAAYA,EAAQ,aAAa,QAAQ,CACvD,EACA,MAAO,CACL,WAAaD,GACJA,EAAW,MACd,CACE,MAAOA,EAAW,OAEpB,GAEN,UAAYC,GAAYA,EAAQ,aAAa,OAAO,CACtD,CAAA,CAEJ,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,QACP,CAAA,CAEJ,EAEA,WAAW,CAAE,eAAAC,GAAkB,CACtB,MAAA,CAAC,MAAO,KAAK,QAAQ,eAAgB,CAAC,SAAUA,CAAc,CAAC,CACxE,EAEA,aAAc,CACL,MAAA,CACL,UACGC,GACD,CAAC,CAAE,GAAAC,EAAI,SAAAC,KAAe,CACd,KAAA,CAAE,UAAAC,CAAc,EAAAF,EAChBG,EAAO,KAAK,KAAK,OAAOJ,CAAO,EAErC,OAAIE,GACFD,EAAG,iBAAiBE,EAAU,KAAMA,EAAU,GAAIC,CAAI,EAGjD,EACT,CAAA,CAEN,CACF,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Node } from "@tiptap/core";
2
- const Iframe = Node.create({
1
+ import { Node as s } from "@tiptap/core";
2
+ const i = s.create({
3
3
  name: "iframe",
4
4
  group: "block",
5
5
  atom: !0,
@@ -25,22 +25,22 @@ const Iframe = Node.create({
25
25
  parseHTML: () => this.options.allowFullscreen
26
26
  },
27
27
  width: {
28
- renderHTML: (attributes) => attributes.width ? {
29
- width: attributes.width === "100%" ? "100%" : parseInt(attributes.width)
28
+ renderHTML: (e) => e.width ? {
29
+ width: e.width === "100%" ? "100%" : parseInt(e.width)
30
30
  } : {},
31
- parseHTML: (element) => element.getAttribute("width")
31
+ parseHTML: (e) => e.getAttribute("width")
32
32
  },
33
33
  height: {
34
- renderHTML: (attributes) => attributes.height ? {
35
- height: parseInt(attributes.height)
34
+ renderHTML: (e) => e.height ? {
35
+ height: parseInt(e.height)
36
36
  } : {},
37
- parseHTML: (element) => element.getAttribute("height")
37
+ parseHTML: (e) => e.getAttribute("height")
38
38
  },
39
39
  style: {
40
- renderHTML: (attributes) => attributes.style ? {
41
- style: attributes.style
40
+ renderHTML: (e) => e.style ? {
41
+ style: e.style
42
42
  } : {},
43
- parseHTML: (element) => element.getAttribute("style")
43
+ parseHTML: (e) => e.getAttribute("style")
44
44
  }
45
45
  };
46
46
  },
@@ -51,19 +51,19 @@ const Iframe = Node.create({
51
51
  }
52
52
  ];
53
53
  },
54
- renderHTML({ HTMLAttributes }) {
55
- return ["div", this.options.HTMLAttributes, ["iframe", HTMLAttributes]];
54
+ renderHTML({ HTMLAttributes: e }) {
55
+ return ["div", this.options.HTMLAttributes, ["iframe", e]];
56
56
  },
57
57
  addCommands() {
58
58
  return {
59
- setIframe: (options) => ({ tr, dispatch }) => {
60
- const { selection } = tr, node = this.type.create(options);
61
- return dispatch && tr.replaceRangeWith(selection.from, selection.to, node), !0;
59
+ setIframe: (e) => ({ tr: t, dispatch: a }) => {
60
+ const { selection: r } = t, n = this.type.create(e);
61
+ return a && t.replaceRangeWith(r.from, r.to, n), !0;
62
62
  }
63
63
  };
64
64
  }
65
65
  });
66
66
  export {
67
- Iframe
67
+ i as Iframe
68
68
  };
69
69
  //# sourceMappingURL=iframe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"iframe.js","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\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 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":";AAoBa,MAAA,SAAS,KAAK,OAAsB;AAAA,EAC/C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACJ,WAAA;AAAA,MACL,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,QACd,OAAO;AAAA,MACT;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,gBAAgB;AACP,WAAA;AAAA,MACL,KAAK;AAAA,QACH,SAAS;AAAA,MACX;AAAA,MACA,aAAa;AAAA,QACX,SAAS;AAAA,MACX;AAAA,MACA,iBAAiB;AAAA,QACf,SAAS,KAAK,QAAQ;AAAA,QACtB,WAAW,MAAM,KAAK,QAAQ;AAAA,MAChC;AAAA,MACA,OAAO;AAAA,QACL,YAAY,CAAC,eACJ,WAAW,QACd;AAAA,UACE,OACE,WAAW,UAAU,SACjB,SACA,SAAS,WAAW,KAAK;AAAA,YAEjC;QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MACtD;AAAA,MACA,QAAQ;AAAA,QACN,YAAY,CAAC,eACJ,WAAW,SACd;AAAA,UACE,QAAQ,SAAS,WAAW,MAAM;AAAA,YAEpC;QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,QAAQ;AAAA,MACvD;AAAA,MACA,OAAO;AAAA,QACL,YAAY,CAAC,eACJ,WAAW,QACd;AAAA,UACE,OAAO,WAAW;AAAA,YAEpB;QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MACtD;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AACtB,WAAA,CAAC,OAAO,KAAK,QAAQ,gBAAgB,CAAC,UAAU,cAAc,CAAC;AAAA,EACxE;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,WACE,CAAC,YACD,CAAC,EAAE,IAAI,eAAe;AACd,cAAA,EAAE,UAAc,IAAA,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
+ {"version":3,"file":"iframe.js","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\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 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":["Iframe","Node","attributes","element","HTMLAttributes","options","tr","dispatch","selection","node"],"mappings":";AAoBa,MAAAA,IAASC,EAAK,OAAsB;AAAA,EAC/C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACJ,WAAA;AAAA,MACL,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,QACd,OAAO;AAAA,MACT;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,gBAAgB;AACP,WAAA;AAAA,MACL,KAAK;AAAA,QACH,SAAS;AAAA,MACX;AAAA,MACA,aAAa;AAAA,QACX,SAAS;AAAA,MACX;AAAA,MACA,iBAAiB;AAAA,QACf,SAAS,KAAK,QAAQ;AAAA,QACtB,WAAW,MAAM,KAAK,QAAQ;AAAA,MAChC;AAAA,MACA,OAAO;AAAA,QACL,YAAY,CAACC,MACJA,EAAW,QACd;AAAA,UACE,OACEA,EAAW,UAAU,SACjB,SACA,SAASA,EAAW,KAAK;AAAA,YAEjC;QAEN,WAAW,CAACC,MAAYA,EAAQ,aAAa,OAAO;AAAA,MACtD;AAAA,MACA,QAAQ;AAAA,QACN,YAAY,CAACD,MACJA,EAAW,SACd;AAAA,UACE,QAAQ,SAASA,EAAW,MAAM;AAAA,YAEpC;QAEN,WAAW,CAACC,MAAYA,EAAQ,aAAa,QAAQ;AAAA,MACvD;AAAA,MACA,OAAO;AAAA,QACL,YAAY,CAACD,MACJA,EAAW,QACd;AAAA,UACE,OAAOA,EAAW;AAAA,YAEpB;QAEN,WAAW,CAACC,MAAYA,EAAQ,aAAa,OAAO;AAAA,MACtD;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,gBAAAC,KAAkB;AACtB,WAAA,CAAC,OAAO,KAAK,QAAQ,gBAAgB,CAAC,UAAUA,CAAc,CAAC;AAAA,EACxE;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,WACE,CAACC,MACD,CAAC,EAAE,IAAAC,GAAI,UAAAC,QAAe;AACd,cAAA,EAAE,WAAAC,EAAc,IAAAF,GAChBG,IAAO,KAAK,KAAK,OAAOJ,CAAO;AAErC,eAAIE,KACFD,EAAG,iBAAiBE,EAAU,MAAMA,EAAU,IAAIC,CAAI,GAGjD;AAAA,MACT;AAAA,IAAA;AAAA,EAEN;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Image=require("@tiptap/extension-image"),IMAGE_INPUT_REGEX=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,CustomImage=Image.extend({name:"custom-image",draggable:!0,selectable:!0,addOptions(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),inline:!0,content:"inline*",sizes:["small","medium","large"],HTMLAttributes:{class:"custom-image"}}},addAttributes(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),size:{default:"medium",rendered:!1},alt:{renderHTML:attributes=>({alt:attributes.alt}),parseHTML:element=>element.getAttribute("alt")},title:{renderHTML:attributes=>({title:attributes.title}),parseHTML:element=>element.getAttribute("title")},width:{default:"350",renderHTML:attributes=>attributes.width!==null&&attributes.width!==void 0&&!Number.isNaN(attributes.width)?{width:parseInt(attributes.width)}:{},parseHTML:element=>element.getAttribute("width")},height:{renderHTML:attributes=>attributes.height!==null&&attributes.height!==void 0&&!Number.isNaN(attributes.height)?{height:parseInt(attributes.height)}:{},parseHTML:element=>element.getAttribute("height")},style:{renderHTML:attributes=>attributes.style?{style:attributes.style}:{},parseHTML:element=>{const style=element.getAttribute("style");return style&&typeof style=="string"&&style.length>0?{}:null}}}},parseHTML(){return[{tag:'img[src]:not([src^="data:"])',getAttrs:el=>{var _a,_b,_c,_d,_e;const attr={src:el.getAttribute("src")};return(_a=el.parentElement)!=null&&_a.className.includes("image-container")&&(_b=el.parentElement.style)!=null&&_b.width&&(attr.width=el.parentElement.style.width),(_c=el.style)!=null&&_c.width&&(attr.width=el.style.width),["happy","proud","dreamy","love","tired","angry","worried","sick","joker","sad"].filter(smiley=>attr.src.includes(smiley+".png")).length>0&&(attr.style={width:"1.5em",height:"1.5em",fontSize:(_e=(_d=el.parentElement)==null?void 0:_d.style)==null?void 0:_e.fontSize},attr.width="null",attr.height="null"),attr}}]},renderHTML({HTMLAttributes}){return["img",core.mergeAttributes(this.options.HTMLAttributes,HTMLAttributes)]},addInputRules(){return[core.nodeInputRule({find:IMAGE_INPUT_REGEX,type:this.type,getAttributes:match=>{const[,,alt,src,title]=match;return{src,alt,title}}})]},addCommands(){return{setNewImage:attrs=>({tr,dispatch})=>{const{selection}=tr,node=this.type.create(attrs);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0},setAttributes:attributes=>({tr,dispatch})=>{const{selection}=tr,options={...tr.doc.nodeAt(tr.selection.from).attrs,...attributes},node=this.type.create(options);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0}}}});exports.CustomImage=CustomImage;exports.IMAGE_INPUT_REGEX=IMAGE_INPUT_REGEX;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tiptap/core"),h=require("@tiptap/extension-image"),a=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,c=h.extend({name:"custom-image",draggable:!0,selectable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!0,content:"inline*",sizes:["small","medium","large"],HTMLAttributes:{class:"custom-image"}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),size:{default:"medium",rendered:!1},alt:{renderHTML:t=>({alt:t.alt}),parseHTML:t=>t.getAttribute("alt")},title:{renderHTML:t=>({title:t.title}),parseHTML:t=>t.getAttribute("title")},width:{default:"350",renderHTML:t=>t.width!==null&&t.width!==void 0&&!Number.isNaN(t.width)?{width:parseInt(t.width)}:{},parseHTML:t=>t.getAttribute("width")},height:{renderHTML:t=>t.height!==null&&t.height!==void 0&&!Number.isNaN(t.height)?{height:parseInt(t.height)}:{},parseHTML:t=>t.getAttribute("height")},style:{renderHTML:t=>t.style?{style:t.style}:{},parseHTML:t=>{const r=t.getAttribute("style");return r&&typeof r=="string"&&r.length>0?{}:null}}}},parseHTML(){return[{tag:'img[src]:not([src^="data:"])',getAttrs:e=>{var n,i,s,l,d;const t={src:e.getAttribute("src")};return(n=e.parentElement)!=null&&n.className.includes("image-container")&&(i=e.parentElement.style)!=null&&i.width&&(t.width=e.parentElement.style.width),(s=e.style)!=null&&s.width&&(t.width=e.style.width),["happy","proud","dreamy","love","tired","angry","worried","sick","joker","sad"].filter(u=>t.src.includes(u+".png")).length>0&&(t.style={width:"1.5em",height:"1.5em",fontSize:(d=(l=e.parentElement)==null?void 0:l.style)==null?void 0:d.fontSize},t.width="null",t.height="null"),t}}]},renderHTML({HTMLAttributes:e}){return["img",o.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[o.nodeInputRule({find:a,type:this.type,getAttributes:e=>{const[,,t,r,n]=e;return{src:r,alt:t,title:n}}})]},addCommands(){return{setNewImage:e=>({tr:t,dispatch:r})=>{const{selection:n}=t,i=this.type.create(e);return r&&t.replaceRangeWith(n.from,n.to,i),!0},setAttributes:e=>({tr:t,dispatch:r})=>{const{selection:n}=t,s={...t.doc.nodeAt(t.selection.from).attrs,...e},l=this.type.create(s);return r&&t.replaceRangeWith(n.from,n.to,l),!0}}}});exports.CustomImage=c;exports.IMAGE_INPUT_REGEX=a;
2
2
  //# sourceMappingURL=custom-image.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-image.cjs","sources":["../../src/image/custom-image.ts"],"sourcesContent":["import { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport Image from '@tiptap/extension-image';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\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 CustomImage = Image.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 };\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 const style = element.getAttribute('style');\n return style && typeof style === 'string' && style.length > 0\n ? {}\n : 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: el.parentElement?.style?.fontSize,\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\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"],"names":["mergeAttributes","nodeInputRule"],"mappings":"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"}
1
+ {"version":3,"file":"custom-image.cjs","sources":["../../src/image/custom-image.ts"],"sourcesContent":["import { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport Image from '@tiptap/extension-image';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\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 CustomImage = Image.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 };\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 const style = element.getAttribute('style');\n return style && typeof style === 'string' && style.length > 0\n ? {}\n : 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: el.parentElement?.style?.fontSize,\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\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"],"names":["IMAGE_INPUT_REGEX","CustomImage","Image","_a","attributes","element","style","el","attr","_b","_c","smiley","_e","_d","HTMLAttributes","mergeAttributes","nodeInputRule","match","alt","src","title","attrs","tr","dispatch","selection","node","options"],"mappings":"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"}
@@ -1,13 +1,13 @@
1
- import { mergeAttributes, nodeInputRule } from "@tiptap/core";
2
- import Image from "@tiptap/extension-image";
3
- const IMAGE_INPUT_REGEX = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, CustomImage = Image.extend({
1
+ import { mergeAttributes as a, nodeInputRule as u } from "@tiptap/core";
2
+ import h from "@tiptap/extension-image";
3
+ const m = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, p = h.extend({
4
4
  name: "custom-image",
5
5
  draggable: !0,
6
6
  selectable: !0,
7
7
  addOptions() {
8
- var _a;
8
+ var e;
9
9
  return {
10
- ...(_a = this.parent) == null ? void 0 : _a.call(this),
10
+ ...(e = this.parent) == null ? void 0 : e.call(this),
11
11
  inline: !0,
12
12
  content: "inline*",
13
13
  sizes: ["small", "medium", "large"],
@@ -17,45 +17,45 @@ const IMAGE_INPUT_REGEX = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\
17
17
  };
18
18
  },
19
19
  addAttributes() {
20
- var _a;
20
+ var e;
21
21
  return {
22
- ...(_a = this.parent) == null ? void 0 : _a.call(this),
22
+ ...(e = this.parent) == null ? void 0 : e.call(this),
23
23
  size: {
24
24
  default: "medium",
25
25
  rendered: !1
26
26
  },
27
27
  alt: {
28
- renderHTML: (attributes) => ({
29
- alt: attributes.alt
28
+ renderHTML: (t) => ({
29
+ alt: t.alt
30
30
  }),
31
- parseHTML: (element) => element.getAttribute("alt")
31
+ parseHTML: (t) => t.getAttribute("alt")
32
32
  },
33
33
  title: {
34
- renderHTML: (attributes) => ({
35
- title: attributes.title
34
+ renderHTML: (t) => ({
35
+ title: t.title
36
36
  }),
37
- parseHTML: (element) => element.getAttribute("title")
37
+ parseHTML: (t) => t.getAttribute("title")
38
38
  },
39
39
  width: {
40
40
  default: "350",
41
- renderHTML: (attributes) => attributes.width !== null && attributes.width !== void 0 && !Number.isNaN(attributes.width) ? {
42
- width: parseInt(attributes.width)
41
+ renderHTML: (t) => t.width !== null && t.width !== void 0 && !Number.isNaN(t.width) ? {
42
+ width: parseInt(t.width)
43
43
  } : {},
44
- parseHTML: (element) => element.getAttribute("width")
44
+ parseHTML: (t) => t.getAttribute("width")
45
45
  },
46
46
  height: {
47
- renderHTML: (attributes) => attributes.height !== null && attributes.height !== void 0 && !Number.isNaN(attributes.height) ? {
48
- height: parseInt(attributes.height)
47
+ renderHTML: (t) => t.height !== null && t.height !== void 0 && !Number.isNaN(t.height) ? {
48
+ height: parseInt(t.height)
49
49
  } : {},
50
- parseHTML: (element) => element.getAttribute("height")
50
+ parseHTML: (t) => t.getAttribute("height")
51
51
  },
52
52
  style: {
53
- renderHTML: (attributes) => attributes.style ? {
54
- style: attributes.style
53
+ renderHTML: (t) => t.style ? {
54
+ style: t.style
55
55
  } : {},
56
- parseHTML: (element) => {
57
- const style = element.getAttribute("style");
58
- return style && typeof style == "string" && style.length > 0 ? {} : null;
56
+ parseHTML: (t) => {
57
+ const r = t.getAttribute("style");
58
+ return r && typeof r == "string" && r.length > 0 ? {} : null;
59
59
  }
60
60
  }
61
61
  };
@@ -64,10 +64,10 @@ const IMAGE_INPUT_REGEX = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\
64
64
  return [
65
65
  {
66
66
  tag: 'img[src]:not([src^="data:"])',
67
- getAttrs: (el) => {
68
- var _a, _b, _c, _d, _e;
69
- const attr = { src: el.getAttribute("src") };
70
- return (_a = el.parentElement) != null && _a.className.includes("image-container") && (_b = el.parentElement.style) != null && _b.width && (attr.width = el.parentElement.style.width), (_c = el.style) != null && _c.width && (attr.width = el.style.width), [
67
+ getAttrs: (e) => {
68
+ var n, i, s, l, d;
69
+ const t = { src: e.getAttribute("src") };
70
+ return (n = e.parentElement) != null && n.className.includes("image-container") && (i = e.parentElement.style) != null && i.width && (t.width = e.parentElement.style.width), (s = e.style) != null && s.width && (t.width = e.style.width), [
71
71
  "happy",
72
72
  "proud",
73
73
  "dreamy",
@@ -78,32 +78,32 @@ const IMAGE_INPUT_REGEX = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\
78
78
  "sick",
79
79
  "joker",
80
80
  "sad"
81
- ].filter((smiley) => attr.src.includes(smiley + ".png")).length > 0 && (attr.style = {
81
+ ].filter((o) => t.src.includes(o + ".png")).length > 0 && (t.style = {
82
82
  width: "1.5em",
83
83
  height: "1.5em",
84
- fontSize: (_e = (_d = el.parentElement) == null ? void 0 : _d.style) == null ? void 0 : _e.fontSize
85
- }, attr.width = "null", attr.height = "null"), attr;
84
+ fontSize: (d = (l = e.parentElement) == null ? void 0 : l.style) == null ? void 0 : d.fontSize
85
+ }, t.width = "null", t.height = "null"), t;
86
86
  }
87
87
  }
88
88
  ];
89
89
  },
90
- renderHTML({ HTMLAttributes }) {
90
+ renderHTML({ HTMLAttributes: e }) {
91
91
  return [
92
92
  "img",
93
- mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)
93
+ a(this.options.HTMLAttributes, e)
94
94
  ];
95
95
  },
96
96
  addInputRules() {
97
97
  return [
98
- nodeInputRule({
99
- find: IMAGE_INPUT_REGEX,
98
+ u({
99
+ find: m,
100
100
  type: this.type,
101
- getAttributes: (match) => {
102
- const [, , alt, src, title] = match;
101
+ getAttributes: (e) => {
102
+ const [, , t, r, n] = e;
103
103
  return {
104
- src,
105
- alt,
106
- title
104
+ src: r,
105
+ alt: t,
106
+ title: n
107
107
  };
108
108
  }
109
109
  })
@@ -111,22 +111,22 @@ const IMAGE_INPUT_REGEX = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\
111
111
  },
112
112
  addCommands() {
113
113
  return {
114
- setNewImage: (attrs) => ({ tr, dispatch }) => {
115
- const { selection } = tr, node = this.type.create(attrs);
116
- return dispatch && tr.replaceRangeWith(selection.from, selection.to, node), !0;
114
+ setNewImage: (e) => ({ tr: t, dispatch: r }) => {
115
+ const { selection: n } = t, i = this.type.create(e);
116
+ return r && t.replaceRangeWith(n.from, n.to, i), !0;
117
117
  },
118
- setAttributes: (attributes) => ({ tr, dispatch }) => {
119
- const { selection } = tr, options = {
120
- ...tr.doc.nodeAt(tr.selection.from).attrs,
121
- ...attributes
122
- }, node = this.type.create(options);
123
- return dispatch && tr.replaceRangeWith(selection.from, selection.to, node), !0;
118
+ setAttributes: (e) => ({ tr: t, dispatch: r }) => {
119
+ const { selection: n } = t, s = {
120
+ ...t.doc.nodeAt(t.selection.from).attrs,
121
+ ...e
122
+ }, l = this.type.create(s);
123
+ return r && t.replaceRangeWith(n.from, n.to, l), !0;
124
124
  }
125
125
  };
126
126
  }
127
127
  });
128
128
  export {
129
- CustomImage,
130
- IMAGE_INPUT_REGEX
129
+ p as CustomImage,
130
+ m as IMAGE_INPUT_REGEX
131
131
  };
132
132
  //# sourceMappingURL=custom-image.js.map