@edifice.io/tiptap-extensions 1.5.16-develop-rc.3 → 1.7.4-develop-pedago.20241211162226

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 (109) hide show
  1. package/README.md +8 -5
  2. package/dist/abbr/abbr.cjs +1 -32
  3. package/dist/abbr/abbr.cjs.map +1 -1
  4. package/dist/abbr/abbr.d.ts +12 -12
  5. package/dist/abbr/abbr.js +13 -17
  6. package/dist/abbr/abbr.js.map +1 -1
  7. package/dist/alert/alert.cjs +1 -32
  8. package/dist/alert/alert.cjs.map +1 -1
  9. package/dist/alert/alert.js +22 -20
  10. package/dist/alert/alert.js.map +1 -1
  11. package/dist/attachment/attachment-transformer.cjs +2 -0
  12. package/dist/attachment/attachment-transformer.cjs.map +1 -0
  13. package/dist/attachment/attachment-transformer.d.ts +12 -0
  14. package/dist/attachment/attachment-transformer.js +76 -0
  15. package/dist/attachment/attachment-transformer.js.map +1 -0
  16. package/dist/attachment/attachment.cjs +1 -73
  17. package/dist/attachment/attachment.cjs.map +1 -1
  18. package/dist/attachment/attachment.d.ts +6 -6
  19. package/dist/attachment/attachment.js +29 -40
  20. package/dist/attachment/attachment.js.map +1 -1
  21. package/dist/attachment/index.d.ts +1 -0
  22. package/dist/audio/audio.cjs +2 -52
  23. package/dist/audio/audio.cjs.map +1 -1
  24. package/dist/audio/audio.d.ts +13 -17
  25. package/dist/audio/audio.js +25 -28
  26. package/dist/audio/audio.js.map +1 -1
  27. package/dist/font-size/font-size.cjs +1 -48
  28. package/dist/font-size/font-size.cjs.map +1 -1
  29. package/dist/font-size/font-size.d.ts +13 -13
  30. package/dist/font-size/font-size.js +17 -29
  31. package/dist/font-size/font-size.js.map +1 -1
  32. package/dist/heading/heading.cjs +1 -61
  33. package/dist/heading/heading.cjs.map +1 -1
  34. package/dist/heading/heading.d.ts +12 -10
  35. package/dist/heading/heading.js +25 -39
  36. package/dist/heading/heading.js.map +1 -1
  37. package/dist/highlight/highlight.cjs +1 -25
  38. package/dist/highlight/highlight.cjs.map +1 -1
  39. package/dist/highlight/highlight.d.ts +1 -4
  40. package/dist/highlight/highlight.js +13 -11
  41. package/dist/highlight/highlight.js.map +1 -1
  42. package/dist/hyperlink/hyperlink.cjs +1 -47
  43. package/dist/hyperlink/hyperlink.cjs.map +1 -1
  44. package/dist/hyperlink/hyperlink.d.ts +24 -27
  45. package/dist/hyperlink/hyperlink.js +19 -21
  46. package/dist/hyperlink/hyperlink.js.map +1 -1
  47. package/dist/iframe/iframe.cjs +1 -69
  48. package/dist/iframe/iframe.cjs.map +1 -1
  49. package/dist/iframe/iframe.d.ts +14 -12
  50. package/dist/iframe/iframe.js +32 -48
  51. package/dist/iframe/iframe.js.map +1 -1
  52. package/dist/image/image.cjs +2 -0
  53. package/dist/image/image.cjs.map +1 -0
  54. package/dist/image/image.d.ts +26 -0
  55. package/dist/image/image.js +178 -0
  56. package/dist/image/image.js.map +1 -0
  57. package/dist/image/index.d.ts +3 -3
  58. package/dist/index.cjs +1 -43
  59. package/dist/index.js +24 -22
  60. package/dist/index.js.map +1 -1
  61. package/dist/line-height/line-height.cjs +1 -33
  62. package/dist/line-height/line-height.cjs.map +1 -1
  63. package/dist/line-height/line-height.js +15 -18
  64. package/dist/line-height/line-height.js.map +1 -1
  65. package/dist/linker/linker.cjs +1 -95
  66. package/dist/linker/linker.cjs.map +1 -1
  67. package/dist/linker/linker.d.ts +17 -17
  68. package/dist/linker/linker.js +49 -57
  69. package/dist/linker/linker.js.map +1 -1
  70. package/dist/mathjax/mathjax.cjs +1 -47
  71. package/dist/mathjax/mathjax.cjs.map +1 -1
  72. package/dist/mathjax/mathjax.js +20 -30
  73. package/dist/mathjax/mathjax.js.map +1 -1
  74. package/dist/paragraph/paragraph.cjs +1 -13
  75. package/dist/paragraph/paragraph.cjs.map +1 -1
  76. package/dist/paragraph/paragraph.d.ts +1 -4
  77. package/dist/paragraph/paragraph.js +8 -6
  78. package/dist/paragraph/paragraph.js.map +1 -1
  79. package/dist/speech-recognition/speech-recognition.cjs +1 -76
  80. package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
  81. package/dist/speech-recognition/speech-recognition.d.ts +12 -12
  82. package/dist/speech-recognition/speech-recognition.js +36 -57
  83. package/dist/speech-recognition/speech-recognition.js.map +1 -1
  84. package/dist/speech-synthesis/speech-synthesis.cjs +1 -32
  85. package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
  86. package/dist/speech-synthesis/speech-synthesis.d.ts +9 -9
  87. package/dist/speech-synthesis/speech-synthesis.js +10 -19
  88. package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
  89. package/dist/table-cell/table-cell.cjs +1 -27
  90. package/dist/table-cell/table-cell.cjs.map +1 -1
  91. package/dist/table-cell/table-cell.d.ts +1 -4
  92. package/dist/table-cell/table-cell.js +12 -17
  93. package/dist/table-cell/table-cell.js.map +1 -1
  94. package/dist/transform/html-to-json/html-to-json.cjs +1 -4
  95. package/dist/transform/html-to-json/html-to-json.d.ts +1 -4
  96. package/dist/transform/html-to-json/html-to-json.js +4 -2
  97. package/dist/transform/json-to-html/json-to-html.cjs +1 -4
  98. package/dist/transform/json-to-html/json-to-html.js +4 -2
  99. package/dist/video/video.cjs +2 -111
  100. package/dist/video/video.cjs.map +1 -1
  101. package/dist/video/video.d.ts +19 -28
  102. package/dist/video/video.js +90 -114
  103. package/dist/video/video.js.map +1 -1
  104. package/package.json +24 -16
  105. package/dist/image/custom-image.cjs +0 -163
  106. package/dist/image/custom-image.cjs.map +0 -1
  107. package/dist/image/custom-image.d.ts +0 -27
  108. package/dist/image/custom-image.js +0 -181
  109. package/dist/image/custom-image.js.map +0 -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":[],"mappings":";;;AAsBa,MAAA,gBAAgB,QAAQ,OAAgB;AAAA,EACnD,MAAM;AAAA,EAEN,aAAa;;AACJ,WAAA;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,gBAAgB,CAAA;AAAA,IAClB;AAAA,EACF;AAAA,EAEA,YAAY;AACV,WAAO,KAAK,QAAQ,OAAO,IAAI,CAAC,WAAkB;AAAA,MAChD,KAAK,IAAI,KAAK;AAAA,MACd,OAAO,EAAE,MAAM;AAAA,IAAA,EACf;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,IACF;AAAA,EACF;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,cAAc,IAChB,EAAE,MAAM,GAAA,IAAO;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,MAAA;AAAA,IAE5D;AAAA,EAAA;AAEJ,CAAC;"}
@@ -1,26 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const Highlight = require('@tiptap/extension-highlight'),
4
- CustomHighlight = Highlight.extend({
5
- name: 'customHighlight',
6
- addOptions() {
7
- var _a;
8
- return {
9
- ...((_a = this.parent) == null ? void 0 : _a.call(this)),
10
- multicolor: !0,
11
- HTMLAttributes: {},
12
- };
13
- },
14
- parseHTML() {
15
- var _a;
16
- return [
17
- {
18
- ...((_a = this.parent) == null ? void 0 : _a.call(this)),
19
- style: 'background-color',
20
- getAttrs: (style) => ({ color: style }),
21
- },
22
- ];
23
- },
24
- });
25
- exports.CustomHighlight = CustomHighlight;
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;
26
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":[],"mappings":"uIAEa,gBAAkB,UAAU,OAAO,CAC9C,KAAM,kBAEN,YAAa,QACJ,MAAA,CACL,IAAG,QAAK,SAAL,0BACH,WAAY,GACZ,eAAgB,CAAA,CAClB,CACF,EAEA,WAAY,QACH,MAAA,CACL,CACE,IAAG,QAAK,SAAL,0BACH,MAAO,mBACP,SAAW,QACF,CACL,MAAO,KACT,EACF,CAEJ,CAAA,CAEJ,CAAC"}
@@ -1,4 +1 @@
1
- export declare const CustomHighlight: import('@tiptap/core').Mark<
2
- import('@tiptap/extension-highlight').HighlightOptions,
3
- any
4
- >;
1
+ export declare const CustomHighlight: import('@tiptap/core').Mark<import('@tiptap/extension-highlight').HighlightOptions, any>;
@@ -1,26 +1,28 @@
1
- import Highlight from '@tiptap/extension-highlight';
1
+ import Highlight from "@tiptap/extension-highlight";
2
2
  const CustomHighlight = Highlight.extend({
3
- name: 'customHighlight',
3
+ name: "customHighlight",
4
4
  addOptions() {
5
5
  var _a;
6
6
  return {
7
- ...((_a = this.parent) == null ? void 0 : _a.call(this)),
7
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
8
8
  multicolor: !0,
9
- HTMLAttributes: {},
9
+ HTMLAttributes: {}
10
10
  };
11
11
  },
12
12
  parseHTML() {
13
13
  var _a;
14
14
  return [
15
15
  {
16
- ...((_a = this.parent) == null ? void 0 : _a.call(this)),
17
- style: 'background-color',
16
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
17
+ style: "background-color",
18
18
  getAttrs: (style) => ({
19
- color: style,
20
- }),
21
- },
19
+ color: style
20
+ })
21
+ }
22
22
  ];
23
- },
23
+ }
24
24
  });
25
- export { CustomHighlight };
25
+ export {
26
+ CustomHighlight
27
+ };
26
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":[],"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,CAAA;AAAA,IAClB;AAAA,EACF;AAAA,EAEA,YAAY;;AACH,WAAA;AAAA,MACL;AAAA,QACE,IAAG,UAAK,WAAL;AAAA,QACH,OAAO;AAAA,QACP,UAAU,CAAC,WACF;AAAA,UACL,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IAEJ;AAAA,EAAA;AAEJ,CAAC;"}
@@ -1,48 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const extensionLink = require('@tiptap/extension-link'),
4
- Hyperlink = extensionLink.Link.extend({
5
- name: 'hyperlink',
6
- parseHTML() {
7
- return [
8
- {
9
- tag: 'a[href]:not([href *= "javascript:" i])',
10
- getAttrs: (node) => {
11
- if (
12
- node.getAttribute('data-id') &&
13
- node.getAttribute('data-app-prefix')
14
- )
15
- return !1;
16
- },
17
- },
18
- ];
19
- },
20
- addOptions() {
21
- var _a, _b;
22
- return {
23
- ...((_a = this.parent) == null ? void 0 : _a.call(this)),
24
- openOnClick: !1,
25
- HTMLAttributes: {
26
- ...((_b = this.parent) == null
27
- ? void 0
28
- : _b.call(this).HTMLAttributes),
29
- target: null,
30
- },
31
- };
32
- },
33
- addAttributes() {
34
- var _a;
35
- return {
36
- ...((_a = this.parent) == null ? void 0 : _a.call(this)),
37
- target: {
38
- default: this.options.HTMLAttributes.target,
39
- parseHTML: (element) =>
40
- element.getAttribute('target') !== '_blank' ? null : '_blank',
41
- renderHTML: (attributes) => ({ target: attributes.target }),
42
- },
43
- title: { default: this.options.HTMLAttributes.title },
44
- };
45
- },
46
- });
47
- exports.Hyperlink = Hyperlink;
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;
48
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":["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,EAAA,CACX,CAEJ,CACF,EAEA,YAAa,WACJ,MAAA,CACL,IAAG,QAAK,SAAL,0BACH,YAAa,GACb,eAAgB,CACd,IAAG,QAAK,SAAL,0BAAgB,eACnB,OAAQ,IAAA,CAEZ,CACF,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,MACrB,EACF,EACA,MAAO,CACL,QAAS,KAAK,QAAQ,eAAe,KAAA,CAEzC,CAAA,CAEJ,CAAC"}
@@ -1,30 +1,30 @@
1
1
  /** Our own model of an hyperlink in a rich document. */
2
2
  export type HyperlinkAttributes = {
3
- href: string | null;
4
- target: '_blank' | null;
5
- title: string | null;
6
- text: string | null;
3
+ href: string | null;
4
+ target: '_blank' | null;
5
+ title: string | null;
6
+ text: string | null;
7
7
  };
8
8
  declare module '@tiptap/core' {
9
- interface Commands<ReturnType> {
10
- hyperlink: {
11
- /**
12
- * Set an hyperlink mark
13
- */
14
- setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;
15
- /**
16
- * Toggle an hyperlink mark
17
- */
18
- toggleLink: (attributes: {
19
- href: string;
20
- target?: string | null;
21
- }) => ReturnType;
22
- /**
23
- * Unset an hyperlink mark
24
- */
25
- unsetLink: () => ReturnType;
26
- };
27
- }
9
+ interface Commands<ReturnType> {
10
+ hyperlink: {
11
+ /**
12
+ * Set an hyperlink mark
13
+ */
14
+ setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;
15
+ /**
16
+ * Toggle an hyperlink mark
17
+ */
18
+ toggleLink: (attributes: {
19
+ href: string;
20
+ target?: string | null;
21
+ }) => ReturnType;
22
+ /**
23
+ * Unset an hyperlink mark
24
+ */
25
+ unsetLink: () => ReturnType;
26
+ };
27
+ }
28
28
  }
29
29
  /**
30
30
  * Hyperlink (external links), extends `Link` extension from TipTap.
@@ -32,7 +32,4 @@ declare module '@tiptap/core' {
32
32
  * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.
33
33
  * The `target` attribute has to be sanitized, so it is overriden.
34
34
  */
35
- export declare const Hyperlink: import('@tiptap/core').Mark<
36
- import('@tiptap/extension-link').LinkOptions,
37
- any
38
- >;
35
+ export declare const Hyperlink: import('@tiptap/core').Mark<import('@tiptap/extension-link').LinkOptions, any>;
@@ -1,6 +1,6 @@
1
- import { Link } from '@tiptap/extension-link';
1
+ import { Link } from "@tiptap/extension-link";
2
2
  const Hyperlink = Link.extend({
3
- name: 'hyperlink',
3
+ name: "hyperlink",
4
4
  parseHTML() {
5
5
  return [
6
6
  {
@@ -8,24 +8,21 @@ const Hyperlink = Link.extend({
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
10
  getAttrs: (node) => {
11
- if (
12
- node.getAttribute('data-id') &&
13
- node.getAttribute('data-app-prefix')
14
- )
11
+ if (node.getAttribute("data-id") && node.getAttribute("data-app-prefix"))
15
12
  return !1;
16
- },
17
- },
13
+ }
14
+ }
18
15
  ];
19
16
  },
20
17
  addOptions() {
21
18
  var _a, _b;
22
19
  return {
23
- ...((_a = this.parent) == null ? void 0 : _a.call(this)),
20
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
24
21
  openOnClick: !1,
25
22
  HTMLAttributes: {
26
- ...((_b = this.parent) == null ? void 0 : _b.call(this).HTMLAttributes),
27
- target: null,
28
- },
23
+ ...(_b = this.parent) == null ? void 0 : _b.call(this).HTMLAttributes,
24
+ target: null
25
+ }
29
26
  };
30
27
  },
31
28
  /* Manage `title` and `target` attributes. */
@@ -33,23 +30,24 @@ const Hyperlink = Link.extend({
33
30
  var _a;
34
31
  return {
35
32
  // Preserve attributes of parent extension...
36
- ...((_a = this.parent) == null ? void 0 : _a.call(this)),
33
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
37
34
  // ...then add or override the following :
38
35
  //------------------
39
36
  target: {
40
37
  default: this.options.HTMLAttributes.target,
41
38
  // Sanitize target value
42
- parseHTML: (element) =>
43
- element.getAttribute('target') !== '_blank' ? null : '_blank',
39
+ parseHTML: (element) => element.getAttribute("target") !== "_blank" ? null : "_blank",
44
40
  renderHTML: (attributes) => ({
45
- target: attributes.target,
46
- }),
41
+ target: attributes.target
42
+ })
47
43
  },
48
44
  title: {
49
- default: this.options.HTMLAttributes.title,
50
- },
45
+ default: this.options.HTMLAttributes.title
46
+ }
51
47
  };
52
- },
48
+ }
53
49
  });
54
- export { Hyperlink };
50
+ export {
51
+ Hyperlink
52
+ };
55
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":[],"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,QAAA;AAAA,MACX;AAAA,IAEJ;AAAA,EACF;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,MAAA;AAAA,IAEZ;AAAA,EACF;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,QACrB;AAAA,MACF;AAAA,MACA,OAAO;AAAA,QACL,SAAS,KAAK,QAAQ,eAAe;AAAA,MAAA;AAAA,IAEzC;AAAA,EAAA;AAEJ,CAAC;"}
@@ -1,70 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const core = require('@tiptap/core'),
4
- Iframe = core.Node.create({
5
- name: 'iframe',
6
- group: 'block',
7
- atom: !0,
8
- draggable: !0,
9
- addOptions() {
10
- return {
11
- allowFullscreen: !0,
12
- HTMLAttributes: { class: 'iframe-wrapper' },
13
- };
14
- },
15
- addAttributes() {
16
- return {
17
- src: { default: null },
18
- frameborder: { default: 0 },
19
- allowfullscreen: {
20
- default: this.options.allowFullscreen,
21
- parseHTML: () => this.options.allowFullscreen,
22
- },
23
- width: {
24
- renderHTML: (attributes) =>
25
- attributes.width
26
- ? {
27
- width:
28
- attributes.width === '100%'
29
- ? '100%'
30
- : parseInt(attributes.width),
31
- }
32
- : {},
33
- parseHTML: (element) => element.getAttribute('width'),
34
- },
35
- height: {
36
- renderHTML: (attributes) =>
37
- attributes.height ? { height: parseInt(attributes.height) } : {},
38
- parseHTML: (element) => element.getAttribute('height'),
39
- },
40
- style: {
41
- renderHTML: (attributes) =>
42
- attributes.style ? { style: attributes.style } : {},
43
- parseHTML: (element) => element.getAttribute('style'),
44
- },
45
- };
46
- },
47
- parseHTML() {
48
- return [{ tag: 'iframe' }];
49
- },
50
- renderHTML({ HTMLAttributes }) {
51
- return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];
52
- },
53
- addCommands() {
54
- return {
55
- setIframe:
56
- (options) =>
57
- ({ tr, dispatch }) => {
58
- const { selection } = tr,
59
- node = this.type.create(options);
60
- return (
61
- dispatch &&
62
- tr.replaceRangeWith(selection.from, selection.to, node),
63
- !0
64
- );
65
- },
66
- };
67
- },
68
- });
69
- exports.Iframe = Iframe;
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;
70
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":["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,gBAAA,CAEX,CACF,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,CAAA,EAEjC,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAa,YACJ,WAAW,OACd,CACE,OAAQ,SAAS,WAAW,MAAM,CAAA,EAEpC,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,QAAQ,CACvD,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MAAO,WAAW,KAAA,EAEpB,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,CAExD,CACF,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,QAAA,CAET,CACF,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,WAAc,GAChB,KAAO,KAAK,KAAK,OAAO,OAAO,EAErC,OAAI,UACF,GAAG,iBAAiB,UAAU,KAAM,UAAU,GAAI,IAAI,EAGjD,EAAA,CAEb,CAAA,CAEJ,CAAC"}
@@ -1,18 +1,20 @@
1
1
  import { Node } from '@tiptap/core';
2
2
  export interface IframeOptions {
3
- allowFullscreen: boolean;
4
- HTMLAttributes: {
5
- [key: string]: any;
6
- };
3
+ allowFullscreen: boolean;
4
+ HTMLAttributes: {
5
+ [key: string]: any;
6
+ };
7
7
  }
8
8
  declare module '@tiptap/core' {
9
- interface Commands<ReturnType> {
10
- iframe: {
11
- /**
12
- * Add an iframe
13
- */
14
- setIframe: (options: { src: string }) => ReturnType;
15
- };
16
- }
9
+ interface Commands<ReturnType> {
10
+ iframe: {
11
+ /**
12
+ * Add an iframe
13
+ */
14
+ setIframe: (options: {
15
+ src: string;
16
+ }) => ReturnType;
17
+ };
18
+ }
17
19
  }
18
20
  export declare const Iframe: Node<IframeOptions, any>;
@@ -1,85 +1,69 @@
1
- import { Node } from '@tiptap/core';
1
+ import { Node } from "@tiptap/core";
2
2
  const Iframe = Node.create({
3
- name: 'iframe',
4
- group: 'block',
3
+ name: "iframe",
4
+ group: "block",
5
5
  atom: !0,
6
6
  draggable: !0,
7
7
  addOptions() {
8
8
  return {
9
9
  allowFullscreen: !0,
10
10
  HTMLAttributes: {
11
- class: 'iframe-wrapper',
12
- },
11
+ class: "iframe-wrapper"
12
+ }
13
13
  };
14
14
  },
15
15
  addAttributes() {
16
16
  return {
17
17
  src: {
18
- default: null,
18
+ default: null
19
19
  },
20
20
  frameborder: {
21
- default: 0,
21
+ default: 0
22
22
  },
23
23
  allowfullscreen: {
24
24
  default: this.options.allowFullscreen,
25
- parseHTML: () => this.options.allowFullscreen,
25
+ parseHTML: () => this.options.allowFullscreen
26
26
  },
27
27
  width: {
28
- renderHTML: (attributes) =>
29
- attributes.width
30
- ? {
31
- width:
32
- attributes.width === '100%'
33
- ? '100%'
34
- : parseInt(attributes.width),
35
- }
36
- : {},
37
- parseHTML: (element) => element.getAttribute('width'),
28
+ renderHTML: (attributes) => attributes.width ? {
29
+ width: attributes.width === "100%" ? "100%" : parseInt(attributes.width)
30
+ } : {},
31
+ parseHTML: (element) => element.getAttribute("width")
38
32
  },
39
33
  height: {
40
- renderHTML: (attributes) =>
41
- attributes.height
42
- ? {
43
- height: parseInt(attributes.height),
44
- }
45
- : {},
46
- parseHTML: (element) => element.getAttribute('height'),
34
+ renderHTML: (attributes) => attributes.height ? {
35
+ height: parseInt(attributes.height)
36
+ } : {},
37
+ parseHTML: (element) => element.getAttribute("height")
47
38
  },
48
39
  style: {
49
- renderHTML: (attributes) =>
50
- attributes.style
51
- ? {
52
- style: attributes.style,
53
- }
54
- : {},
55
- parseHTML: (element) => element.getAttribute('style'),
56
- },
40
+ renderHTML: (attributes) => attributes.style ? {
41
+ style: attributes.style
42
+ } : {},
43
+ parseHTML: (element) => element.getAttribute("style")
44
+ }
57
45
  };
58
46
  },
59
47
  parseHTML() {
60
48
  return [
61
49
  {
62
- tag: 'iframe',
63
- },
50
+ tag: "iframe"
51
+ }
64
52
  ];
65
53
  },
66
54
  renderHTML({ HTMLAttributes }) {
67
- return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];
55
+ return ["div", this.options.HTMLAttributes, ["iframe", HTMLAttributes]];
68
56
  },
69
57
  addCommands() {
70
58
  return {
71
- setIframe:
72
- (options) =>
73
- ({ tr, dispatch }) => {
74
- const { selection } = tr,
75
- node = this.type.create(options);
76
- return (
77
- dispatch && tr.replaceRangeWith(selection.from, selection.to, node),
78
- !0
79
- );
80
- },
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;
62
+ }
81
63
  };
82
- },
64
+ }
83
65
  });
84
- export { Iframe };
66
+ export {
67
+ Iframe
68
+ };
85
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":[],"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,MAAA;AAAA,IAEX;AAAA,EACF;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,QAAA,IAEjC,CAAC;AAAA,QAEP,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,QAAA,IAEpC,CAAC;AAAA,QAEP,WAAW,CAAC,YAAY,QAAQ,aAAa,QAAQ;AAAA,MACvD;AAAA,MACA,OAAO;AAAA,QACL,YAAY,CAAC,eACJ,WAAW,QACd;AAAA,UACE,OAAO,WAAW;AAAA,QAAA,IAEpB,CAAC;AAAA,QAEP,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MAAA;AAAA,IAExD;AAAA,EACF;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IAET;AAAA,EACF;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,cAAc,IAChB,OAAO,KAAK,KAAK,OAAO,OAAO;AAErC,eAAI,YACF,GAAG,iBAAiB,UAAU,MAAM,UAAU,IAAI,IAAI,GAGjD;AAAA,MAAA;AAAA,IAEb;AAAA,EAAA;AAEJ,CAAC;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const utilities=require("@edifice.io/utilities"),core=require("@tiptap/core"),TiptapImage=require("@tiptap/extension-image"),prosemirrorState=require("prosemirror-state"),IMAGE_INPUT_REGEX=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Image=TiptapImage.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"},uploadFile:()=>Promise.resolve(null)}},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}}},addProseMirrorPlugins(){const uploadNode=async file=>{const resizedImage=await utilities.ImageResizer.resizeImageFile(file),image=await this.options.uploadFile(resizedImage),imageUrl=`/workspace/${image.public?"pub/":""}document/${image._id}?timestamp=${new Date().getTime()}`;return this.type.create({src:imageUrl,alt:image.alt,title:image.title})},getFilteredFiles=files=>Array.from(files).filter(file=>/image\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type)),handleImageInsert=async(editor,file,position)=>{const node=await uploadNode(file);if(!node)return;const transaction=position!==void 0?editor.state.tr.insert(position,node):editor.state.tr.replaceSelectionWith(node);editor.dispatch(transaction)};return[new prosemirrorState.Plugin({props:{handlePaste:(editor,e)=>{var _a;const files=getFilteredFiles((_a=e.clipboardData)==null?void 0:_a.files);if(files.length===0)return!1;for(const file of files)handleImageInsert(editor,file);return!0},handleDrop:(editor,e,_s,moved)=>{if(moved)return!1;const files=getFilteredFiles(e.dataTransfer.files);if(files.length===0)return!1;const{pos:position}=editor.posAtCoords({left:e.clientX,top:e.clientY});for(const file of files)handleImageInsert(editor,file,position);return!0}}})]}});exports.IMAGE_INPUT_REGEX=IMAGE_INPUT_REGEX;exports.Image=Image;
2
+ //# sourceMappingURL=image.cjs.map