@edifice.io/tiptap-extensions 2.6.8-develop-enabling.20261007103744 → 2.6.8-develop-enabling.20261012145010
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/abbr/abbr.cjs +2 -2
- package/dist/abbr/abbr.cjs.map +1 -1
- package/dist/abbr/abbr.js +2 -33
- package/dist/abbr/abbr.js.map +1 -1
- package/dist/alert/alert.cjs +2 -2
- package/dist/alert/alert.cjs.map +1 -1
- package/dist/alert/alert.js +2 -45
- package/dist/alert/alert.js.map +1 -1
- package/dist/attachment/attachment-transformer.cjs +2 -2
- package/dist/attachment/attachment-transformer.cjs.map +1 -1
- package/dist/attachment/attachment-transformer.js +2 -76
- package/dist/attachment/attachment-transformer.js.map +1 -1
- package/dist/attachment/attachment.cjs +2 -2
- package/dist/attachment/attachment.cjs.map +1 -1
- package/dist/attachment/attachment.js +2 -98
- package/dist/attachment/attachment.js.map +1 -1
- package/dist/audio/audio.cjs +2 -2
- package/dist/audio/audio.cjs.map +1 -1
- package/dist/audio/audio.js +3 -52
- package/dist/audio/audio.js.map +1 -1
- package/dist/conversation-history/conversation-history.cjs +2 -2
- package/dist/conversation-history/conversation-history.cjs.map +1 -1
- package/dist/conversation-history/conversation-history.js +2 -63
- package/dist/conversation-history/conversation-history.js.map +1 -1
- package/dist/conversation-history-body/conversation-history-body.cjs +2 -2
- package/dist/conversation-history-body/conversation-history-body.cjs.map +1 -1
- package/dist/conversation-history-body/conversation-history-body.js +2 -24
- package/dist/conversation-history-body/conversation-history-body.js.map +1 -1
- package/dist/font-size/font-size.cjs +2 -2
- package/dist/font-size/font-size.cjs.map +1 -1
- package/dist/font-size/font-size.js +2 -39
- package/dist/font-size/font-size.js.map +1 -1
- package/dist/heading/heading.cjs +2 -2
- package/dist/heading/heading.cjs.map +1 -1
- package/dist/heading/heading.js +2 -46
- package/dist/heading/heading.js.map +1 -1
- package/dist/highlight/highlight.cjs +2 -2
- package/dist/highlight/highlight.cjs.map +1 -1
- package/dist/highlight/highlight.js +2 -28
- package/dist/highlight/highlight.js.map +1 -1
- package/dist/hyperlink/hyperlink.cjs +2 -2
- package/dist/hyperlink/hyperlink.cjs.map +1 -1
- package/dist/hyperlink/hyperlink.js +2 -53
- package/dist/hyperlink/hyperlink.js.map +1 -1
- package/dist/iframe/iframe.cjs +2 -2
- package/dist/iframe/iframe.cjs.map +1 -1
- package/dist/iframe/iframe.js +2 -70
- package/dist/iframe/iframe.js.map +1 -1
- package/dist/iframe/transformers/index.cjs +2 -2
- package/dist/iframe/transformers/index.cjs.map +1 -1
- package/dist/iframe/transformers/index.js +2 -22
- package/dist/iframe/transformers/index.js.map +1 -1
- package/dist/iframe/transformers/pad-transformer.cjs +2 -2
- package/dist/iframe/transformers/pad-transformer.cjs.map +1 -1
- package/dist/iframe/transformers/pad-transformer.js +2 -24
- package/dist/iframe/transformers/pad-transformer.js.map +1 -1
- package/dist/image/image.cjs +2 -2
- package/dist/image/image.cjs.map +1 -1
- package/dist/image/image.js +2 -175
- package/dist/image/image.js.map +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.js +1 -52
- package/dist/information-pane/information-pane.cjs +2 -2
- package/dist/information-pane/information-pane.cjs.map +1 -1
- package/dist/information-pane/information-pane.js +2 -57
- package/dist/information-pane/information-pane.js.map +1 -1
- package/dist/line-height/line-height.cjs +2 -2
- package/dist/line-height/line-height.cjs.map +1 -1
- package/dist/line-height/line-height.js +2 -33
- package/dist/line-height/line-height.js.map +1 -1
- package/dist/linker/linker.cjs +2 -2
- package/dist/linker/linker.cjs.map +1 -1
- package/dist/linker/linker.js +2 -96
- package/dist/linker/linker.js.map +1 -1
- package/dist/mathjax/mathjax.cjs +2 -2
- package/dist/mathjax/mathjax.cjs.map +1 -1
- package/dist/mathjax/mathjax.js +2 -40
- package/dist/mathjax/mathjax.js.map +1 -1
- package/dist/paragraph/paragraph.cjs +2 -2
- package/dist/paragraph/paragraph.cjs.map +1 -1
- package/dist/paragraph/paragraph.js +2 -16
- package/dist/paragraph/paragraph.js.map +1 -1
- package/dist/speech-recognition/speech-recognition.cjs +2 -2
- package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
- package/dist/speech-recognition/speech-recognition.js +2 -56
- package/dist/speech-recognition/speech-recognition.js.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.cjs +2 -2
- package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.js +2 -25
- package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
- package/dist/table-cell/table-cell.cjs +2 -2
- package/dist/table-cell/table-cell.cjs.map +1 -1
- package/dist/table-cell/table-cell.js +2 -23
- package/dist/table-cell/table-cell.js.map +1 -1
- package/dist/transform/html-to-json/html-to-json.cjs +2 -2
- package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
- package/dist/transform/html-to-json/html-to-json.js +2 -6
- package/dist/transform/html-to-json/html-to-json.js.map +1 -1
- package/dist/transform/json-to-html/json-to-html.cjs +2 -2
- package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
- package/dist/transform/json-to-html/json-to-html.js +2 -6
- package/dist/transform/json-to-html/json-to-html.js.map +1 -1
- package/dist/video/video.cjs +3 -3
- package/dist/video/video.cjs.map +1 -1
- package/dist/video/video.js +3 -92
- package/dist/video/video.js.map +1 -1
- package/package.json +5 -5
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"
|
|
1
|
+
{"version":3,"file":"iframe.cjs","names":[],"sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"mappings":"wDAqBA,IAAa,6BAAS,EAAA,KAAK,OAAsB,CAC/C,KAAM,SACN,MAAO,QACP,KAAM,GACN,UAAW,GAEX,YAAa,CACX,MAAO,CACL,gBAAiB,GACjB,eAAgB,CACd,MAAO,gBACT,CACF,CACF,EAEA,eAAgB,CACd,MAAO,CACL,IAAK,CACH,QAAS,IACX,EACA,YAAa,CACX,QAAS,CACX,EACA,gBAAiB,CACf,QAAS,KAAK,QAAQ,gBACtB,cAAiB,KAAK,QAAQ,eAChC,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MACE,WAAW,QAAU,OACjB,OACA,SAAS,WAAW,KAAK,CACjC,EACA,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAa,YACJ,WAAW,OACd,CACE,OAAQ,SAAS,WAAW,MAAM,CACpC,EACA,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,QAAQ,CACvD,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MAAO,WAAW,KACpB,EACA,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,CACF,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,QACP,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAG7B,OADA,cAAA,kBAAkB,aAAa,CAAE,cAAe,CAAC,EAC1C,CAAC,MAAO,KAAK,QAAQ,eAAgB,CAAC,SAAU,cAAc,CAAC,CACxE,EAEA,aAAc,CACZ,MAAO,CACL,UACG,UACA,CAAE,GAAI,YAAe,CACpB,GAAM,CAAE,WAAc,GAChB,KAAO,KAAK,KAAK,OAAO,OAAO,EAMrC,OAJI,UACF,GAAG,iBAAiB,UAAU,KAAM,UAAU,GAAI,IAAI,EAGjD,EACT,CACJ,CACF,CACF,CAAC"}
|
package/dist/iframe/iframe.js
CHANGED
|
@@ -1,70 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const Iframe = Node.create({
|
|
4
|
-
name: "iframe",
|
|
5
|
-
group: "block",
|
|
6
|
-
atom: !0,
|
|
7
|
-
draggable: !0,
|
|
8
|
-
addOptions() {
|
|
9
|
-
return {
|
|
10
|
-
allowFullscreen: !0,
|
|
11
|
-
HTMLAttributes: {
|
|
12
|
-
class: "iframe-wrapper"
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
addAttributes() {
|
|
17
|
-
return {
|
|
18
|
-
src: {
|
|
19
|
-
default: null
|
|
20
|
-
},
|
|
21
|
-
frameborder: {
|
|
22
|
-
default: 0
|
|
23
|
-
},
|
|
24
|
-
allowfullscreen: {
|
|
25
|
-
default: this.options.allowFullscreen,
|
|
26
|
-
parseHTML: () => this.options.allowFullscreen
|
|
27
|
-
},
|
|
28
|
-
width: {
|
|
29
|
-
renderHTML: (attributes) => attributes.width ? {
|
|
30
|
-
width: attributes.width === "100%" ? "100%" : parseInt(attributes.width)
|
|
31
|
-
} : {},
|
|
32
|
-
parseHTML: (element) => element.getAttribute("width")
|
|
33
|
-
},
|
|
34
|
-
height: {
|
|
35
|
-
renderHTML: (attributes) => attributes.height ? {
|
|
36
|
-
height: parseInt(attributes.height)
|
|
37
|
-
} : {},
|
|
38
|
-
parseHTML: (element) => element.getAttribute("height")
|
|
39
|
-
},
|
|
40
|
-
style: {
|
|
41
|
-
renderHTML: (attributes) => attributes.style ? {
|
|
42
|
-
style: attributes.style
|
|
43
|
-
} : {},
|
|
44
|
-
parseHTML: (element) => element.getAttribute("style")
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
parseHTML() {
|
|
49
|
-
return [
|
|
50
|
-
{
|
|
51
|
-
tag: "iframe"
|
|
52
|
-
}
|
|
53
|
-
];
|
|
54
|
-
},
|
|
55
|
-
renderHTML({ HTMLAttributes }) {
|
|
56
|
-
return iframeTransformer.onRenderHTML({ HTMLAttributes }), ["div", this.options.HTMLAttributes, ["iframe", HTMLAttributes]];
|
|
57
|
-
},
|
|
58
|
-
addCommands() {
|
|
59
|
-
return {
|
|
60
|
-
setIframe: (options) => ({ tr, dispatch }) => {
|
|
61
|
-
const { selection } = tr, node = this.type.create(options);
|
|
62
|
-
return dispatch && tr.replaceRangeWith(selection.from, selection.to, node), !0;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
export {
|
|
68
|
-
Iframe
|
|
69
|
-
};
|
|
70
|
-
//# sourceMappingURL=iframe.js.map
|
|
1
|
+
import{iframeTransformer}from"./transformers/index.js";import{Node}from"@tiptap/core";var Iframe=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 iframeTransformer.onRenderHTML({HTMLAttributes}),[`div`,this.options.HTMLAttributes,[`iframe`,HTMLAttributes]]},addCommands(){return{setIframe:options=>({tr,dispatch})=>{let{selection}=tr,node=this.type.create(options);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0}}}});export{Iframe};
|
|
2
|
+
//# sourceMappingURL=iframe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.js","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"
|
|
1
|
+
{"version":3,"file":"iframe.js","names":[],"sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"mappings":"sFAqBA,IAAa,OAAS,KAAK,OAAsB,CAC/C,KAAM,SACN,MAAO,QACP,KAAM,GACN,UAAW,GAEX,YAAa,CACX,MAAO,CACL,gBAAiB,GACjB,eAAgB,CACd,MAAO,gBACT,CACF,CACF,EAEA,eAAgB,CACd,MAAO,CACL,IAAK,CACH,QAAS,IACX,EACA,YAAa,CACX,QAAS,CACX,EACA,gBAAiB,CACf,QAAS,KAAK,QAAQ,gBACtB,cAAiB,KAAK,QAAQ,eAChC,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MACE,WAAW,QAAU,OACjB,OACA,SAAS,WAAW,KAAK,CACjC,EACA,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAa,YACJ,WAAW,OACd,CACE,OAAQ,SAAS,WAAW,MAAM,CACpC,EACA,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,QAAQ,CACvD,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MAAO,WAAW,KACpB,EACA,CAAC,EAEP,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,CACF,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,QACP,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAG7B,OADA,kBAAkB,aAAa,CAAE,cAAe,CAAC,EAC1C,CAAC,MAAO,KAAK,QAAQ,eAAgB,CAAC,SAAU,cAAc,CAAC,CACxE,EAEA,aAAc,CACZ,MAAO,CACL,UACG,UACA,CAAE,GAAI,YAAe,CACpB,GAAM,CAAE,WAAc,GAChB,KAAO,KAAK,KAAK,OAAO,OAAO,EAMrC,OAJI,UACF,GAAG,iBAAiB,UAAU,KAAM,UAAU,GAAI,IAAI,EAGjD,EACT,CACJ,CACF,CACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
const require_pad_transformer=require("./pad-transformer.cjs");var iframeTransformer=new class{#transformers=[new require_pad_transformer.PadIframeTransformer];onRenderHTML({HTMLAttributes}){for(let transformer of this.#transformers)transformer.onRenderHTML({HTMLAttributes})}};exports.iframeTransformer=iframeTransformer;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["#transformers"],"sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"mappings":"+DAeA,IAAa,kBACX,IAAI,KAVsD,CAC1D,cAAgB,CAAC,IAAI,wBAAA,oBAAsB,EAC3C,aAAa,CAAE,gBAAkB,CAC/B,IAAK,IAAM,eAAe,KAAKA,cAC7B,YAAY,aAAa,CAAE,cAAe,CAAC,CAE/C,CACF"}
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
6
|
-
import { PadIframeTransformer } from "./pad-transformer.js";
|
|
7
|
-
var _transformers;
|
|
8
|
-
class DefaultIframeTransformer {
|
|
9
|
-
constructor() {
|
|
10
|
-
__privateAdd(this, _transformers, [new PadIframeTransformer()]);
|
|
11
|
-
}
|
|
12
|
-
onRenderHTML({ HTMLAttributes }) {
|
|
13
|
-
for (const transformer of __privateGet(this, _transformers))
|
|
14
|
-
transformer.onRenderHTML({ HTMLAttributes });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
_transformers = new WeakMap();
|
|
18
|
-
const iframeTransformer = new DefaultIframeTransformer();
|
|
19
|
-
export {
|
|
20
|
-
iframeTransformer
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{PadIframeTransformer}from"./pad-transformer.js";var iframeTransformer=new class{#transformers=[new PadIframeTransformer];onRenderHTML({HTMLAttributes}){for(let transformer of this.#transformers)transformer.onRenderHTML({HTMLAttributes})}};export{iframeTransformer};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["#transformers"],"sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"mappings":"uDAeA,IAAa,kBACX,IAAI,KAVsD,CAC1D,cAAgB,CAAC,IAAI,oBAAsB,EAC3C,aAAa,CAAE,gBAAkB,CAC/B,IAAK,IAAM,eAAe,KAAKA,cAC7B,YAAY,aAAa,CAAE,cAAe,CAAC,CAE/C,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=pad-transformer.cjs.map
|
|
1
|
+
var PadIframeTransformer=class{constructor(){this.padPath=`/pad/`,this.embedPath=`/collaborativeeditor/embed/`}onRenderHTML({HTMLAttributes}){try{let currentUrl=window.location.href.split(`?`)[0],baseUrl=new URL(currentUrl).origin,srcUrl=new URL(HTMLAttributes.src),pathMatch=srcUrl.pathname.match(RegExp(`^${this.padPath}(.+)$`));if(srcUrl.origin===baseUrl&&pathMatch&&pathMatch[1]){let padId=pathMatch[1].replace(/^p\//i,``),newUrl=new URL(`${baseUrl}${this.embedPath}${padId}`);srcUrl.searchParams.forEach((value,key)=>{newUrl.searchParams.set(key,value)}),HTMLAttributes.src=newUrl.toString()}}catch(e){console.error(`Error transforming pad URL:`,e)}}};exports.PadIframeTransformer=PadIframeTransformer;
|
|
2
|
+
//# sourceMappingURL=pad-transformer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pad-transformer.cjs","sources":["../../../src/iframe/transformers/pad-transformer.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\n\n/**\n * This transformer is used to transform the pad URL to the embed URL inside the iframe\n * The embed URL is used to create a session for the pad before redirecting to the pad url\n */\nexport class PadIframeTransformer implements IframeTransformer {\n // Define the pad path\n private padPath = '/pad/';\n // Define the embed path\n private embedPath = '/collaborativeeditor/embed/';\n onRenderHTML({ HTMLAttributes }) {\n try {\n // Get host URL from the current window\n const currentUrl = window.location.href.split('?')[0];\n const baseUrl = new URL(currentUrl).origin;\n // Get Iframe src URL\n const srcUrl = new URL(HTMLAttributes.src);\n const pathMatch = srcUrl.pathname.match(\n new RegExp(`^${this.padPath}(.+)$`),\n );\n // Check if the src URL is from the same origin and matches the pad path\n if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {\n // Extract pad ID from the URL\n const padId = pathMatch[1].replace(/^p\\//i, '');\n // Create a new URL with the embed path\n const newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);\n // Copy search params from the src URL to the new URL\n srcUrl.searchParams.forEach((value, key) => {\n newUrl.searchParams.set(key, value);\n });\n // Set the new URL\n HTMLAttributes.src = newUrl.toString();\n }\n } catch (e) {\n console.error('Error transforming pad URL:', e);\n }\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"pad-transformer.cjs","names":[],"sources":["../../../src/iframe/transformers/pad-transformer.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\n\n/**\n * This transformer is used to transform the pad URL to the embed URL inside the iframe\n * The embed URL is used to create a session for the pad before redirecting to the pad url\n */\nexport class PadIframeTransformer implements IframeTransformer {\n // Define the pad path\n private padPath = '/pad/';\n // Define the embed path\n private embedPath = '/collaborativeeditor/embed/';\n onRenderHTML({ HTMLAttributes }) {\n try {\n // Get host URL from the current window\n const currentUrl = window.location.href.split('?')[0];\n const baseUrl = new URL(currentUrl).origin;\n // Get Iframe src URL\n const srcUrl = new URL(HTMLAttributes.src);\n const pathMatch = srcUrl.pathname.match(\n new RegExp(`^${this.padPath}(.+)$`),\n );\n // Check if the src URL is from the same origin and matches the pad path\n if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {\n // Extract pad ID from the URL\n const padId = pathMatch[1].replace(/^p\\//i, '');\n // Create a new URL with the embed path\n const newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);\n // Copy search params from the src URL to the new URL\n srcUrl.searchParams.forEach((value, key) => {\n newUrl.searchParams.set(key, value);\n });\n // Set the new URL\n HTMLAttributes.src = newUrl.toString();\n }\n } catch (e) {\n console.error('Error transforming pad URL:', e);\n }\n }\n}\n"],"mappings":"AAMA,IAAa,qBAAb,KAA+D,4BAE3C,uBAEE,8BACpB,aAAa,CAAE,gBAAkB,CAC/B,GAAI,CAEF,IAAM,WAAa,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,GAC7C,QAAU,IAAI,IAAI,UAAU,EAAE,OAE9B,OAAS,IAAI,IAAI,eAAe,GAAG,EACnC,UAAY,OAAO,SAAS,MAC5B,OAAO,IAAI,KAAK,QAAQ,MAAM,CACpC,EAEA,GAAI,OAAO,SAAW,SAAW,WAAa,UAAU,GAAI,CAE1D,IAAM,MAAQ,UAAU,GAAG,QAAQ,QAAS,EAAE,EAExC,OAAS,IAAI,IAAI,GAAG,UAAU,KAAK,YAAY,OAAO,EAE5D,OAAO,aAAa,SAAS,MAAO,MAAQ,CAC1C,OAAO,aAAa,IAAI,IAAK,KAAK,CACpC,CAAC,EAED,eAAe,IAAM,OAAO,SAAS,CACvC,CACF,OAAS,EAAG,CACV,QAAQ,MAAM,8BAA+B,CAAC,CAChD,CACF,CACF"}
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
this.padPath = "/pad/", this.embedPath = "/collaborativeeditor/embed/";
|
|
4
|
-
}
|
|
5
|
-
onRenderHTML({ HTMLAttributes }) {
|
|
6
|
-
try {
|
|
7
|
-
const currentUrl = window.location.href.split("?")[0], baseUrl = new URL(currentUrl).origin, srcUrl = new URL(HTMLAttributes.src), pathMatch = srcUrl.pathname.match(
|
|
8
|
-
new RegExp(`^${this.padPath}(.+)$`)
|
|
9
|
-
);
|
|
10
|
-
if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {
|
|
11
|
-
const padId = pathMatch[1].replace(/^p\//i, ""), newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);
|
|
12
|
-
srcUrl.searchParams.forEach((value, key) => {
|
|
13
|
-
newUrl.searchParams.set(key, value);
|
|
14
|
-
}), HTMLAttributes.src = newUrl.toString();
|
|
15
|
-
}
|
|
16
|
-
} catch (e) {
|
|
17
|
-
console.error("Error transforming pad URL:", e);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
PadIframeTransformer
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=pad-transformer.js.map
|
|
1
|
+
var PadIframeTransformer=class{constructor(){this.padPath=`/pad/`,this.embedPath=`/collaborativeeditor/embed/`}onRenderHTML({HTMLAttributes}){try{let currentUrl=window.location.href.split(`?`)[0],baseUrl=new URL(currentUrl).origin,srcUrl=new URL(HTMLAttributes.src),pathMatch=srcUrl.pathname.match(RegExp(`^${this.padPath}(.+)$`));if(srcUrl.origin===baseUrl&&pathMatch&&pathMatch[1]){let padId=pathMatch[1].replace(/^p\//i,``),newUrl=new URL(`${baseUrl}${this.embedPath}${padId}`);srcUrl.searchParams.forEach((value,key)=>{newUrl.searchParams.set(key,value)}),HTMLAttributes.src=newUrl.toString()}}catch(e){console.error(`Error transforming pad URL:`,e)}}};export{PadIframeTransformer};
|
|
2
|
+
//# sourceMappingURL=pad-transformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pad-transformer.js","sources":["../../../src/iframe/transformers/pad-transformer.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\n\n/**\n * This transformer is used to transform the pad URL to the embed URL inside the iframe\n * The embed URL is used to create a session for the pad before redirecting to the pad url\n */\nexport class PadIframeTransformer implements IframeTransformer {\n // Define the pad path\n private padPath = '/pad/';\n // Define the embed path\n private embedPath = '/collaborativeeditor/embed/';\n onRenderHTML({ HTMLAttributes }) {\n try {\n // Get host URL from the current window\n const currentUrl = window.location.href.split('?')[0];\n const baseUrl = new URL(currentUrl).origin;\n // Get Iframe src URL\n const srcUrl = new URL(HTMLAttributes.src);\n const pathMatch = srcUrl.pathname.match(\n new RegExp(`^${this.padPath}(.+)$`),\n );\n // Check if the src URL is from the same origin and matches the pad path\n if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {\n // Extract pad ID from the URL\n const padId = pathMatch[1].replace(/^p\\//i, '');\n // Create a new URL with the embed path\n const newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);\n // Copy search params from the src URL to the new URL\n srcUrl.searchParams.forEach((value, key) => {\n newUrl.searchParams.set(key, value);\n });\n // Set the new URL\n HTMLAttributes.src = newUrl.toString();\n }\n } catch (e) {\n console.error('Error transforming pad URL:', e);\n }\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"pad-transformer.js","names":[],"sources":["../../../src/iframe/transformers/pad-transformer.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\n\n/**\n * This transformer is used to transform the pad URL to the embed URL inside the iframe\n * The embed URL is used to create a session for the pad before redirecting to the pad url\n */\nexport class PadIframeTransformer implements IframeTransformer {\n // Define the pad path\n private padPath = '/pad/';\n // Define the embed path\n private embedPath = '/collaborativeeditor/embed/';\n onRenderHTML({ HTMLAttributes }) {\n try {\n // Get host URL from the current window\n const currentUrl = window.location.href.split('?')[0];\n const baseUrl = new URL(currentUrl).origin;\n // Get Iframe src URL\n const srcUrl = new URL(HTMLAttributes.src);\n const pathMatch = srcUrl.pathname.match(\n new RegExp(`^${this.padPath}(.+)$`),\n );\n // Check if the src URL is from the same origin and matches the pad path\n if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {\n // Extract pad ID from the URL\n const padId = pathMatch[1].replace(/^p\\//i, '');\n // Create a new URL with the embed path\n const newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);\n // Copy search params from the src URL to the new URL\n srcUrl.searchParams.forEach((value, key) => {\n newUrl.searchParams.set(key, value);\n });\n // Set the new URL\n HTMLAttributes.src = newUrl.toString();\n }\n } catch (e) {\n console.error('Error transforming pad URL:', e);\n }\n }\n}\n"],"mappings":"AAMA,IAAa,qBAAb,KAA+D,4BAE3C,uBAEE,8BACpB,aAAa,CAAE,gBAAkB,CAC/B,GAAI,CAEF,IAAM,WAAa,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,GAC7C,QAAU,IAAI,IAAI,UAAU,EAAE,OAE9B,OAAS,IAAI,IAAI,eAAe,GAAG,EACnC,UAAY,OAAO,SAAS,MAC5B,OAAO,IAAI,KAAK,QAAQ,MAAM,CACpC,EAEA,GAAI,OAAO,SAAW,SAAW,WAAa,UAAU,GAAI,CAE1D,IAAM,MAAQ,UAAU,GAAG,QAAQ,QAAS,EAAE,EAExC,OAAS,IAAI,IAAI,GAAG,UAAU,KAAK,YAAY,OAAO,EAE5D,OAAO,aAAa,SAAS,MAAO,MAAQ,CAC1C,OAAO,aAAa,IAAI,IAAK,KAAK,CACpC,CAAC,EAED,eAAe,IAAM,OAAO,SAAS,CACvC,CACF,OAAS,EAAG,CACV,QAAQ,MAAM,8BAA+B,CAAC,CAChD,CACF,CACF"}
|
package/dist/image/image.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=image.cjs.map
|
|
1
|
+
const require_runtime=require("../_virtual/_rolldown/runtime.cjs");let _tiptap_core=require("@tiptap/core"),prosemirror_state=require("prosemirror-state"),_edifice_io_utilities=require("@edifice.io/utilities"),_tiptap_extension_image=require("@tiptap/extension-image");_tiptap_extension_image=require_runtime.__toESM(_tiptap_extension_image,1);var IMAGE_INPUT_REGEX=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Image=_tiptap_extension_image.default.extend({name:`custom-image`,draggable:!0,selectable:!0,addOptions(){return{...this.parent?.(),inline:!0,content:`inline*`,sizes:[`small`,`medium`,`large`],HTMLAttributes:{class:`custom-image`},uploadFile:()=>Promise.resolve(null)}},addAttributes(){return{...this.parent?.(),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:()=>null}}},parseHTML(){return[{tag:`img[src]:not([src^="data:"])`,getAttrs:el=>{let attr={src:el.getAttribute(`src`)};return el.parentElement?.className.includes(`image-container`)&&el.parentElement.style?.width&&(attr.width=el.parentElement.style.width),el.style?.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:`16px`},attr.width=`null`,attr.height=`null`),attr}}]},renderHTML({HTMLAttributes}){return[`img`,(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes)]},addInputRules(){return[(0,_tiptap_core.nodeInputRule)({find:IMAGE_INPUT_REGEX,type:this.type,getAttributes:match=>{let[,,alt,src,title]=match;return{src,alt,title}}})]},addCommands(){return{setNewImage:attrs=>({tr,dispatch})=>{let{selection}=tr,node=this.type.create(attrs);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0},setAttributes:attributes=>({tr,dispatch})=>{let{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(){let uploadNode=async file=>{let resizedImage=await _edifice_io_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)=>{let node=await uploadNode(file);if(!node)return;let transaction=position===void 0?editor.state.tr.replaceSelectionWith(node):editor.state.tr.insert(position,node);editor.dispatch(transaction)};return[new prosemirror_state.Plugin({props:{handlePaste:(editor,e)=>{let files=getFilteredFiles(e.clipboardData?.files);if(files.length===0)return!1;for(let file of files)handleImageInsert(editor,file);return!0},handleDrop:(editor,e,_s,moved)=>{if(moved)return!1;let files=getFilteredFiles(e.dataTransfer.files);if(files.length===0)return!1;let{pos:position}=editor.posAtCoords({left:e.clientX,top:e.clientY});for(let file of files)handleImageInsert(editor,file,position);return!0}}})]}});exports.IMAGE_INPUT_REGEX=IMAGE_INPUT_REGEX,exports.Image=Image;
|
|
2
|
+
//# sourceMappingURL=image.cjs.map
|
package/dist/image/image.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.cjs","sources":["../../src/image/image.ts"],"sourcesContent":["import { WorkspaceElement } from '@edifice.io/client';\nimport { ImageResizer } from '@edifice.io/utilities';\nimport { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport TiptapImage from '@tiptap/extension-image';\nimport { Plugin } from 'prosemirror-state';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\n uploadFile?: (file: File) => Promise<WorkspaceElement | null>;\n}\n\ninterface AttributesProps {\n width: number | string;\n height: number | string;\n size: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customImage: {\n setAttributes: (options: AttributesProps) => ReturnType;\n setNewImage: (options: {\n src: string;\n alt?: string;\n title?: string;\n }) => ReturnType;\n };\n }\n}\n\nexport const Image = TiptapImage.extend<CustomImageOptions>({\n name: 'custom-image',\n draggable: true,\n selectable: true,\n\n addOptions() {\n return {\n ...this.parent?.(),\n inline: true,\n content: 'inline*',\n sizes: ['small', 'medium', 'large'],\n HTMLAttributes: {\n class: 'custom-image',\n },\n uploadFile: () => {\n return Promise.resolve(null);\n },\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n size: {\n default: 'medium',\n rendered: false,\n },\n alt: {\n renderHTML: (attributes) => {\n return {\n alt: attributes.alt,\n };\n },\n parseHTML: (element) => element.getAttribute('alt'),\n },\n title: {\n renderHTML: (attributes) => {\n return {\n title: attributes.title,\n };\n },\n parseHTML: (element) => element.getAttribute('title'),\n },\n width: {\n default: '350',\n renderHTML: (attributes) => {\n if (\n attributes.width !== null &&\n attributes.width !== undefined &&\n !Number.isNaN(attributes.width)\n ) {\n return {\n width: parseInt(attributes.width),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n if (\n attributes.height !== null &&\n attributes.height !== undefined &&\n !Number.isNaN(attributes.height)\n ) {\n return {\n height: parseInt(attributes.height),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: () => {\n return null;\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]:not([src^=\"data:\"])',\n getAttrs: (el: HTMLImageElement) => {\n const attr = { src: el.getAttribute('src') };\n // Check old content format and get the width from the parent element\n if (el.parentElement?.className.includes('image-container')) {\n if (el.parentElement.style?.width) {\n attr['width'] = el.parentElement.style.width;\n }\n }\n if (el.style?.width) {\n attr['width'] = el.style.width;\n }\n\n // Check old content smiley\n const oldSmileyList = [\n 'happy',\n 'proud',\n 'dreamy',\n 'love',\n 'tired',\n 'angry',\n 'worried',\n 'sick',\n 'joker',\n 'sad',\n ];\n if (\n oldSmileyList.filter((smiley) => attr.src.includes(smiley + '.png'))\n .length > 0\n ) {\n attr['style'] = {\n width: '1.5em',\n height: '1.5em',\n fontSize: '16px',\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\n }\n\n return attr;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'img',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: IMAGE_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , alt, src, title] = match;\n\n return {\n src,\n alt,\n title,\n };\n },\n }),\n ];\n },\n\n addCommands() {\n return {\n setNewImage:\n (attrs) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(attrs);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n setAttributes:\n (attributes) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n\n const nodeAttrs = tr.doc.nodeAt(tr.selection.from);\n const options = {\n ...nodeAttrs.attrs,\n ...attributes,\n };\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n\n addProseMirrorPlugins() {\n const uploadNode = async (file: File) => {\n /**\n * Resize the image\n */\n const resizedImage = await ImageResizer.resizeImageFile(file);\n\n /**\n * Upload the image\n */\n const image = await this.options.uploadFile(resizedImage);\n\n /**\n * Get the image url\n */\n const imageUrl = `/workspace/${image.public ? 'pub/' : ''}document/${\n image._id\n }?timestamp=${new Date().getTime()}`;\n\n /**\n * Create the image node\n */\n\n const node = this.type.create({\n src: imageUrl,\n alt: image.alt,\n title: image.title,\n });\n\n return node;\n };\n\n const getFilteredFiles = (files: FileList) => {\n return Array.from(files).filter((file) =>\n /image\\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type),\n );\n };\n\n const handleImageInsert = async (\n editor: any,\n file: File,\n position?: number,\n ) => {\n const node = await uploadNode(file);\n if (!node) return;\n\n const transaction =\n position !== undefined\n ? editor.state.tr.insert(position, node)\n : editor.state.tr.replaceSelectionWith(node);\n\n editor.dispatch(transaction);\n };\n\n return [\n new Plugin({\n props: {\n handlePaste: (editor, e) => {\n const files = getFilteredFiles(e.clipboardData?.files);\n if (files.length === 0) return false;\n\n for (const file of files) {\n handleImageInsert(editor, file);\n }\n\n return true;\n },\n handleDrop: (editor, e, _s, moved) => {\n if (moved) return false;\n\n const files = getFilteredFiles(e.dataTransfer.files);\n if (files.length === 0) return false;\n\n const { pos: position } = editor.posAtCoords({\n left: e.clientX,\n top: e.clientY,\n });\n\n for (const file of files) {\n handleImageInsert(editor, file, position);\n }\n return true;\n },\n },\n }),\n ];\n },\n});\n"],"names":["mergeAttributes","nodeInputRule","ImageResizer","Plugin"],"mappings":"2PAMa,kBACX,2DA2BW,MAAQ,YAAY,OAA2B,CAC1D,KAAM,eACN,UAAW,GACX,WAAY,GAEZ,YAAa,QACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,OAAQ,GACR,QAAS,UACT,MAAO,CAAC,QAAS,SAAU,OAAO,EAClC,eAAgB,CACd,MAAO,cAAA,EAET,WAAY,IACH,QAAQ,QAAQ,IAAI,CAC7B,CAEJ,EAEA,eAAgB,QACd,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,KAAM,CACJ,QAAS,SACT,SAAU,EAAA,EAEZ,IAAK,CACH,WAAa,aACJ,CACL,IAAK,WAAW,GAAA,GAGpB,UAAY,SAAY,QAAQ,aAAa,KAAK,CAAA,EAEpD,MAAO,CACL,WAAa,aACJ,CACL,MAAO,WAAW,KAAA,GAGtB,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,EAEtD,MAAO,CACL,QAAS,MACT,WAAa,YAET,WAAW,QAAU,MACrB,WAAW,QAAU,QACrB,CAAC,OAAO,MAAM,WAAW,KAAK,EAEvB,CACL,MAAO,SAAS,WAAW,KAAK,CAAA,EAG7B,CAAA,EAET,UAAY,SAAY,QAAQ,aAAa,OAAO,CAAA,EAEtD,OAAQ,CACN,WAAa,YAET,WAAW,SAAW,MACtB,WAAW,SAAW,QACtB,CAAC,OAAO,MAAM,WAAW,MAAM,EAExB,CACL,OAAQ,SAAS,WAAW,MAAM,CAAA,EAG/B,CAAA,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W,EAAG,MAAO,GAE/B,KAAM,CAAE,IAAK,UAAa,OAAO,YAAY,CAC3C,KAAM,EAAE,QACR,IAAK,EAAE,OAAA,CACR,EAED,UAAW,QAAQ,MACjB,kBAAkB,OAAQ,KAAM,QAAQ,EAE1C,MAAO,EACT,CAAA,CACF,CACD,CAAA,CAEL,CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"image.cjs","names":[],"sources":["../../src/image/image.ts"],"sourcesContent":["import { WorkspaceElement } from '@edifice.io/client';\nimport { ImageResizer } from '@edifice.io/utilities';\nimport { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport TiptapImage from '@tiptap/extension-image';\nimport { Plugin } from 'prosemirror-state';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\n uploadFile?: (file: File) => Promise<WorkspaceElement | null>;\n}\n\ninterface AttributesProps {\n width: number | string;\n height: number | string;\n size: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customImage: {\n setAttributes: (options: AttributesProps) => ReturnType;\n setNewImage: (options: {\n src: string;\n alt?: string;\n title?: string;\n }) => ReturnType;\n };\n }\n}\n\nexport const Image = TiptapImage.extend<CustomImageOptions>({\n name: 'custom-image',\n draggable: true,\n selectable: true,\n\n addOptions() {\n return {\n ...this.parent?.(),\n inline: true,\n content: 'inline*',\n sizes: ['small', 'medium', 'large'],\n HTMLAttributes: {\n class: 'custom-image',\n },\n uploadFile: () => {\n return Promise.resolve(null);\n },\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n size: {\n default: 'medium',\n rendered: false,\n },\n alt: {\n renderHTML: (attributes) => {\n return {\n alt: attributes.alt,\n };\n },\n parseHTML: (element) => element.getAttribute('alt'),\n },\n title: {\n renderHTML: (attributes) => {\n return {\n title: attributes.title,\n };\n },\n parseHTML: (element) => element.getAttribute('title'),\n },\n width: {\n default: '350',\n renderHTML: (attributes) => {\n if (\n attributes.width !== null &&\n attributes.width !== undefined &&\n !Number.isNaN(attributes.width)\n ) {\n return {\n width: parseInt(attributes.width),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n if (\n attributes.height !== null &&\n attributes.height !== undefined &&\n !Number.isNaN(attributes.height)\n ) {\n return {\n height: parseInt(attributes.height),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: () => {\n return null;\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]:not([src^=\"data:\"])',\n getAttrs: (el: HTMLImageElement) => {\n const attr = { src: el.getAttribute('src') };\n // Check old content format and get the width from the parent element\n if (el.parentElement?.className.includes('image-container')) {\n if (el.parentElement.style?.width) {\n attr['width'] = el.parentElement.style.width;\n }\n }\n if (el.style?.width) {\n attr['width'] = el.style.width;\n }\n\n // Check old content smiley\n const oldSmileyList = [\n 'happy',\n 'proud',\n 'dreamy',\n 'love',\n 'tired',\n 'angry',\n 'worried',\n 'sick',\n 'joker',\n 'sad',\n ];\n if (\n oldSmileyList.filter((smiley) => attr.src.includes(smiley + '.png'))\n .length > 0\n ) {\n attr['style'] = {\n width: '1.5em',\n height: '1.5em',\n fontSize: '16px',\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\n }\n\n return attr;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'img',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: IMAGE_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , alt, src, title] = match;\n\n return {\n src,\n alt,\n title,\n };\n },\n }),\n ];\n },\n\n addCommands() {\n return {\n setNewImage:\n (attrs) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(attrs);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n setAttributes:\n (attributes) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n\n const nodeAttrs = tr.doc.nodeAt(tr.selection.from);\n const options = {\n ...nodeAttrs.attrs,\n ...attributes,\n };\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n\n addProseMirrorPlugins() {\n const uploadNode = async (file: File) => {\n /**\n * Resize the image\n */\n const resizedImage = await ImageResizer.resizeImageFile(file);\n\n /**\n * Upload the image\n */\n const image = await this.options.uploadFile(resizedImage);\n\n /**\n * Get the image url\n */\n const imageUrl = `/workspace/${image.public ? 'pub/' : ''}document/${\n image._id\n }?timestamp=${new Date().getTime()}`;\n\n /**\n * Create the image node\n */\n\n const node = this.type.create({\n src: imageUrl,\n alt: image.alt,\n title: image.title,\n });\n\n return node;\n };\n\n const getFilteredFiles = (files: FileList) => {\n return Array.from(files).filter((file) =>\n /image\\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type),\n );\n };\n\n const handleImageInsert = async (\n editor: any,\n file: File,\n position?: number,\n ) => {\n const node = await uploadNode(file);\n if (!node) return;\n\n const transaction =\n position !== undefined\n ? editor.state.tr.insert(position, node)\n : editor.state.tr.replaceSelectionWith(node);\n\n editor.dispatch(transaction);\n };\n\n return [\n new Plugin({\n props: {\n handlePaste: (editor, e) => {\n const files = getFilteredFiles(e.clipboardData?.files);\n if (files.length === 0) return false;\n\n for (const file of files) {\n handleImageInsert(editor, file);\n }\n\n return true;\n },\n handleDrop: (editor, e, _s, moved) => {\n if (moved) return false;\n\n const files = getFilteredFiles(e.dataTransfer.files);\n if (files.length === 0) return false;\n\n const { pos: position } = editor.posAtCoords({\n left: e.clientX,\n top: e.clientY,\n });\n\n for (const file of files) {\n handleImageInsert(editor, file, position);\n }\n return true;\n },\n },\n }),\n ];\n },\n});\n"],"mappings":"wVAMA,IAAa,kBACX,2DA2BW,MAAQ,wBAAA,QAAY,OAA2B,CAC1D,KAAM,eACN,UAAW,GACX,WAAY,GAEZ,YAAa,CACX,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,OAAQ,GACR,QAAS,UACT,MAAO,CAAC,QAAS,SAAU,OAAO,EAClC,eAAgB,CACd,MAAO,cACT,EACA,eACS,QAAQ,QAAQ,IAAI,CAE/B,CACF,EAEA,eAAgB,CACd,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,KAAM,CACJ,QAAS,SACT,SAAU,EACZ,EACA,IAAK,CACH,WAAa,aACJ,CACL,IAAK,WAAW,GAClB,GAEF,UAAY,SAAY,QAAQ,aAAa,KAAK,CACpD,EACA,MAAO,CACL,WAAa,aACJ,CACL,MAAO,WAAW,KACpB,GAEF,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,MAAO,CACL,QAAS,MACT,WAAa,YAET,WAAW,QAAU,MACrB,WAAW,QAAU,IAAA,IACrB,CAAC,OAAO,MAAM,WAAW,KAAK,EAEvB,CACL,MAAO,SAAS,WAAW,KAAK,CAClC,EAEK,CAAC,EAEV,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAa,YAET,WAAW,SAAW,MACtB,WAAW,SAAW,IAAA,IACtB,CAAC,OAAO,MAAM,WAAW,MAAM,EAExB,CACL,OAAQ,SAAS,WAAW,MAAM,CACpC,EAEK,CAAC,EAEV,UAAY,SAAY,QAAQ,aAAa,QAAQ,CACvD,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MAAO,WAAW,KACpB,EACA,CAAC,EAEP,cACS,IAEX,CACF,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,+BACL,SAAW,IAAyB,CAClC,IAAM,KAAO,CAAE,IAAK,GAAG,aAAa,KAAK,CAAE,EAqC3C,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
import TiptapImage from "@tiptap/extension-image";
|
|
4
|
-
import { Plugin } from "prosemirror-state";
|
|
5
|
-
const IMAGE_INPUT_REGEX = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Image = TiptapImage.extend({
|
|
6
|
-
name: "custom-image",
|
|
7
|
-
draggable: !0,
|
|
8
|
-
selectable: !0,
|
|
9
|
-
addOptions() {
|
|
10
|
-
var _a;
|
|
11
|
-
return {
|
|
12
|
-
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
13
|
-
inline: !0,
|
|
14
|
-
content: "inline*",
|
|
15
|
-
sizes: ["small", "medium", "large"],
|
|
16
|
-
HTMLAttributes: {
|
|
17
|
-
class: "custom-image"
|
|
18
|
-
},
|
|
19
|
-
uploadFile: () => Promise.resolve(null)
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
addAttributes() {
|
|
23
|
-
var _a;
|
|
24
|
-
return {
|
|
25
|
-
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
26
|
-
size: {
|
|
27
|
-
default: "medium",
|
|
28
|
-
rendered: !1
|
|
29
|
-
},
|
|
30
|
-
alt: {
|
|
31
|
-
renderHTML: (attributes) => ({
|
|
32
|
-
alt: attributes.alt
|
|
33
|
-
}),
|
|
34
|
-
parseHTML: (element) => element.getAttribute("alt")
|
|
35
|
-
},
|
|
36
|
-
title: {
|
|
37
|
-
renderHTML: (attributes) => ({
|
|
38
|
-
title: attributes.title
|
|
39
|
-
}),
|
|
40
|
-
parseHTML: (element) => element.getAttribute("title")
|
|
41
|
-
},
|
|
42
|
-
width: {
|
|
43
|
-
default: "350",
|
|
44
|
-
renderHTML: (attributes) => attributes.width !== null && attributes.width !== void 0 && !Number.isNaN(attributes.width) ? {
|
|
45
|
-
width: parseInt(attributes.width)
|
|
46
|
-
} : {},
|
|
47
|
-
parseHTML: (element) => element.getAttribute("width")
|
|
48
|
-
},
|
|
49
|
-
height: {
|
|
50
|
-
renderHTML: (attributes) => attributes.height !== null && attributes.height !== void 0 && !Number.isNaN(attributes.height) ? {
|
|
51
|
-
height: parseInt(attributes.height)
|
|
52
|
-
} : {},
|
|
53
|
-
parseHTML: (element) => element.getAttribute("height")
|
|
54
|
-
},
|
|
55
|
-
style: {
|
|
56
|
-
renderHTML: (attributes) => attributes.style ? {
|
|
57
|
-
style: attributes.style
|
|
58
|
-
} : {},
|
|
59
|
-
parseHTML: () => null
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
parseHTML() {
|
|
64
|
-
return [
|
|
65
|
-
{
|
|
66
|
-
tag: 'img[src]:not([src^="data:"])',
|
|
67
|
-
getAttrs: (el) => {
|
|
68
|
-
var _a, _b, _c;
|
|
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), [
|
|
71
|
-
"happy",
|
|
72
|
-
"proud",
|
|
73
|
-
"dreamy",
|
|
74
|
-
"love",
|
|
75
|
-
"tired",
|
|
76
|
-
"angry",
|
|
77
|
-
"worried",
|
|
78
|
-
"sick",
|
|
79
|
-
"joker",
|
|
80
|
-
"sad"
|
|
81
|
-
].filter((smiley) => attr.src.includes(smiley + ".png")).length > 0 && (attr.style = {
|
|
82
|
-
width: "1.5em",
|
|
83
|
-
height: "1.5em",
|
|
84
|
-
fontSize: "16px"
|
|
85
|
-
}, attr.width = "null", attr.height = "null"), attr;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
];
|
|
89
|
-
},
|
|
90
|
-
renderHTML({ HTMLAttributes }) {
|
|
91
|
-
return [
|
|
92
|
-
"img",
|
|
93
|
-
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)
|
|
94
|
-
];
|
|
95
|
-
},
|
|
96
|
-
addInputRules() {
|
|
97
|
-
return [
|
|
98
|
-
nodeInputRule({
|
|
99
|
-
find: IMAGE_INPUT_REGEX,
|
|
100
|
-
type: this.type,
|
|
101
|
-
getAttributes: (match) => {
|
|
102
|
-
const [, , alt, src, title] = match;
|
|
103
|
-
return {
|
|
104
|
-
src,
|
|
105
|
-
alt,
|
|
106
|
-
title
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
];
|
|
111
|
-
},
|
|
112
|
-
addCommands() {
|
|
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;
|
|
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;
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
},
|
|
127
|
-
addProseMirrorPlugins() {
|
|
128
|
-
const uploadNode = async (file) => {
|
|
129
|
-
const resizedImage = await ImageResizer.resizeImageFile(file), image = await this.options.uploadFile(resizedImage), imageUrl = `/workspace/${image.public ? "pub/" : ""}document/${image._id}?timestamp=${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
130
|
-
return this.type.create({
|
|
131
|
-
src: imageUrl,
|
|
132
|
-
alt: image.alt,
|
|
133
|
-
title: image.title
|
|
134
|
-
});
|
|
135
|
-
}, getFilteredFiles = (files) => Array.from(files).filter(
|
|
136
|
-
(file) => /image\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type)
|
|
137
|
-
), handleImageInsert = async (editor, file, position) => {
|
|
138
|
-
const node = await uploadNode(file);
|
|
139
|
-
if (!node) return;
|
|
140
|
-
const transaction = position !== void 0 ? editor.state.tr.insert(position, node) : editor.state.tr.replaceSelectionWith(node);
|
|
141
|
-
editor.dispatch(transaction);
|
|
142
|
-
};
|
|
143
|
-
return [
|
|
144
|
-
new Plugin({
|
|
145
|
-
props: {
|
|
146
|
-
handlePaste: (editor, e) => {
|
|
147
|
-
var _a;
|
|
148
|
-
const files = getFilteredFiles((_a = e.clipboardData) == null ? void 0 : _a.files);
|
|
149
|
-
if (files.length === 0) return !1;
|
|
150
|
-
for (const file of files)
|
|
151
|
-
handleImageInsert(editor, file);
|
|
152
|
-
return !0;
|
|
153
|
-
},
|
|
154
|
-
handleDrop: (editor, e, _s, moved) => {
|
|
155
|
-
if (moved) return !1;
|
|
156
|
-
const files = getFilteredFiles(e.dataTransfer.files);
|
|
157
|
-
if (files.length === 0) return !1;
|
|
158
|
-
const { pos: position } = editor.posAtCoords({
|
|
159
|
-
left: e.clientX,
|
|
160
|
-
top: e.clientY
|
|
161
|
-
});
|
|
162
|
-
for (const file of files)
|
|
163
|
-
handleImageInsert(editor, file, position);
|
|
164
|
-
return !0;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
})
|
|
168
|
-
];
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
export {
|
|
172
|
-
IMAGE_INPUT_REGEX,
|
|
173
|
-
Image
|
|
174
|
-
};
|
|
175
|
-
//# sourceMappingURL=image.js.map
|
|
1
|
+
import{mergeAttributes,nodeInputRule}from"@tiptap/core";import{Plugin}from"prosemirror-state";import{ImageResizer}from"@edifice.io/utilities";import TiptapImage from"@tiptap/extension-image";var IMAGE_INPUT_REGEX=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Image=TiptapImage.extend({name:`custom-image`,draggable:!0,selectable:!0,addOptions(){return{...this.parent?.(),inline:!0,content:`inline*`,sizes:[`small`,`medium`,`large`],HTMLAttributes:{class:`custom-image`},uploadFile:()=>Promise.resolve(null)}},addAttributes(){return{...this.parent?.(),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:()=>null}}},parseHTML(){return[{tag:`img[src]:not([src^="data:"])`,getAttrs:el=>{let attr={src:el.getAttribute(`src`)};return el.parentElement?.className.includes(`image-container`)&&el.parentElement.style?.width&&(attr.width=el.parentElement.style.width),el.style?.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:`16px`},attr.width=`null`,attr.height=`null`),attr}}]},renderHTML({HTMLAttributes}){return[`img`,mergeAttributes(this.options.HTMLAttributes,HTMLAttributes)]},addInputRules(){return[nodeInputRule({find:IMAGE_INPUT_REGEX,type:this.type,getAttributes:match=>{let[,,alt,src,title]=match;return{src,alt,title}}})]},addCommands(){return{setNewImage:attrs=>({tr,dispatch})=>{let{selection}=tr,node=this.type.create(attrs);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0},setAttributes:attributes=>({tr,dispatch})=>{let{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(){let uploadNode=async file=>{let resizedImage=await 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)=>{let node=await uploadNode(file);if(!node)return;let transaction=position===void 0?editor.state.tr.replaceSelectionWith(node):editor.state.tr.insert(position,node);editor.dispatch(transaction)};return[new Plugin({props:{handlePaste:(editor,e)=>{let files=getFilteredFiles(e.clipboardData?.files);if(files.length===0)return!1;for(let file of files)handleImageInsert(editor,file);return!0},handleDrop:(editor,e,_s,moved)=>{if(moved)return!1;let files=getFilteredFiles(e.dataTransfer.files);if(files.length===0)return!1;let{pos:position}=editor.posAtCoords({left:e.clientX,top:e.clientY});for(let file of files)handleImageInsert(editor,file,position);return!0}}})]}});export{IMAGE_INPUT_REGEX,Image};
|
|
2
|
+
//# sourceMappingURL=image.js.map
|
package/dist/image/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sources":["../../src/image/image.ts"],"sourcesContent":["import { WorkspaceElement } from '@edifice.io/client';\nimport { ImageResizer } from '@edifice.io/utilities';\nimport { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport TiptapImage from '@tiptap/extension-image';\nimport { Plugin } from 'prosemirror-state';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\n uploadFile?: (file: File) => Promise<WorkspaceElement | null>;\n}\n\ninterface AttributesProps {\n width: number | string;\n height: number | string;\n size: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customImage: {\n setAttributes: (options: AttributesProps) => ReturnType;\n setNewImage: (options: {\n src: string;\n alt?: string;\n title?: string;\n }) => ReturnType;\n };\n }\n}\n\nexport const Image = TiptapImage.extend<CustomImageOptions>({\n name: 'custom-image',\n draggable: true,\n selectable: true,\n\n addOptions() {\n return {\n ...this.parent?.(),\n inline: true,\n content: 'inline*',\n sizes: ['small', 'medium', 'large'],\n HTMLAttributes: {\n class: 'custom-image',\n },\n uploadFile: () => {\n return Promise.resolve(null);\n },\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n size: {\n default: 'medium',\n rendered: false,\n },\n alt: {\n renderHTML: (attributes) => {\n return {\n alt: attributes.alt,\n };\n },\n parseHTML: (element) => element.getAttribute('alt'),\n },\n title: {\n renderHTML: (attributes) => {\n return {\n title: attributes.title,\n };\n },\n parseHTML: (element) => element.getAttribute('title'),\n },\n width: {\n default: '350',\n renderHTML: (attributes) => {\n if (\n attributes.width !== null &&\n attributes.width !== undefined &&\n !Number.isNaN(attributes.width)\n ) {\n return {\n width: parseInt(attributes.width),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n if (\n attributes.height !== null &&\n attributes.height !== undefined &&\n !Number.isNaN(attributes.height)\n ) {\n return {\n height: parseInt(attributes.height),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: () => {\n return null;\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]:not([src^=\"data:\"])',\n getAttrs: (el: HTMLImageElement) => {\n const attr = { src: el.getAttribute('src') };\n // Check old content format and get the width from the parent element\n if (el.parentElement?.className.includes('image-container')) {\n if (el.parentElement.style?.width) {\n attr['width'] = el.parentElement.style.width;\n }\n }\n if (el.style?.width) {\n attr['width'] = el.style.width;\n }\n\n // Check old content smiley\n const oldSmileyList = [\n 'happy',\n 'proud',\n 'dreamy',\n 'love',\n 'tired',\n 'angry',\n 'worried',\n 'sick',\n 'joker',\n 'sad',\n ];\n if (\n oldSmileyList.filter((smiley) => attr.src.includes(smiley + '.png'))\n .length > 0\n ) {\n attr['style'] = {\n width: '1.5em',\n height: '1.5em',\n fontSize: '16px',\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\n }\n\n return attr;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'img',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: IMAGE_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , alt, src, title] = match;\n\n return {\n src,\n alt,\n title,\n };\n },\n }),\n ];\n },\n\n addCommands() {\n return {\n setNewImage:\n (attrs) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(attrs);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n setAttributes:\n (attributes) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n\n const nodeAttrs = tr.doc.nodeAt(tr.selection.from);\n const options = {\n ...nodeAttrs.attrs,\n ...attributes,\n };\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n\n addProseMirrorPlugins() {\n const uploadNode = async (file: File) => {\n /**\n * Resize the image\n */\n const resizedImage = await ImageResizer.resizeImageFile(file);\n\n /**\n * Upload the image\n */\n const image = await this.options.uploadFile(resizedImage);\n\n /**\n * Get the image url\n */\n const imageUrl = `/workspace/${image.public ? 'pub/' : ''}document/${\n image._id\n }?timestamp=${new Date().getTime()}`;\n\n /**\n * Create the image node\n */\n\n const node = this.type.create({\n src: imageUrl,\n alt: image.alt,\n title: image.title,\n });\n\n return node;\n };\n\n const getFilteredFiles = (files: FileList) => {\n return Array.from(files).filter((file) =>\n /image\\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type),\n );\n };\n\n const handleImageInsert = async (\n editor: any,\n file: File,\n position?: number,\n ) => {\n const node = await uploadNode(file);\n if (!node) return;\n\n const transaction =\n position !== undefined\n ? editor.state.tr.insert(position, node)\n : editor.state.tr.replaceSelectionWith(node);\n\n editor.dispatch(transaction);\n };\n\n return [\n new Plugin({\n props: {\n handlePaste: (editor, e) => {\n const files = getFilteredFiles(e.clipboardData?.files);\n if (files.length === 0) return false;\n\n for (const file of files) {\n handleImageInsert(editor, file);\n }\n\n return true;\n },\n handleDrop: (editor, e, _s, moved) => {\n if (moved) return false;\n\n const files = getFilteredFiles(e.dataTransfer.files);\n if (files.length === 0) return false;\n\n const { pos: position } = editor.posAtCoords({\n left: e.clientX,\n top: e.clientY,\n });\n\n for (const file of files) {\n handleImageInsert(editor, file, position);\n }\n return true;\n },\n },\n }),\n ];\n },\n});\n"],"names":[],"mappings":";;;;AAMO,MAAM,oBACX,4DA2BW,QAAQ,YAAY,OAA2B;AAAA,EAC1D,MAAM;AAAA,EACN,WAAW;AAAA,EACX,YAAY;AAAA,EAEZ,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,CAAC,SAAS,UAAU,OAAO;AAAA,MAClC,gBAAgB;AAAA,QACd,OAAO;AAAA,MAAA;AAAA,MAET,YAAY,MACH,QAAQ,QAAQ,IAAI;AAAA,IAC7B;AAAA,EAEJ;AAAA,EAEA,gBAAgB;;AACd,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,UAAU;AAAA,MAAA;AAAA,MAEZ,KAAK;AAAA,QACH,YAAY,CAAC,gBACJ;AAAA,UACL,KAAK,WAAW;AAAA,QAAA;AAAA,QAGpB,WAAW,CAAC,YAAY,QAAQ,aAAa,KAAK;AAAA,MAAA;AAAA,MAEpD,OAAO;AAAA,QACL,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,WAAW;AAAA,QAAA;AAAA,QAGtB,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAA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
{"version":3,"file":"image.js","names":[],"sources":["../../src/image/image.ts"],"sourcesContent":["import { WorkspaceElement } from '@edifice.io/client';\nimport { ImageResizer } from '@edifice.io/utilities';\nimport { mergeAttributes, nodeInputRule } from '@tiptap/core';\nimport TiptapImage from '@tiptap/extension-image';\nimport { Plugin } from 'prosemirror-state';\n\nexport const IMAGE_INPUT_REGEX =\n /(?:^|\\s)(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))$/;\n\nexport interface CustomImageOptions {\n HTMLAttributes: Record<string, string>;\n sizes: string[];\n uploadFile?: (file: File) => Promise<WorkspaceElement | null>;\n}\n\ninterface AttributesProps {\n width: number | string;\n height: number | string;\n size: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customImage: {\n setAttributes: (options: AttributesProps) => ReturnType;\n setNewImage: (options: {\n src: string;\n alt?: string;\n title?: string;\n }) => ReturnType;\n };\n }\n}\n\nexport const Image = TiptapImage.extend<CustomImageOptions>({\n name: 'custom-image',\n draggable: true,\n selectable: true,\n\n addOptions() {\n return {\n ...this.parent?.(),\n inline: true,\n content: 'inline*',\n sizes: ['small', 'medium', 'large'],\n HTMLAttributes: {\n class: 'custom-image',\n },\n uploadFile: () => {\n return Promise.resolve(null);\n },\n };\n },\n\n addAttributes() {\n return {\n ...this.parent?.(),\n size: {\n default: 'medium',\n rendered: false,\n },\n alt: {\n renderHTML: (attributes) => {\n return {\n alt: attributes.alt,\n };\n },\n parseHTML: (element) => element.getAttribute('alt'),\n },\n title: {\n renderHTML: (attributes) => {\n return {\n title: attributes.title,\n };\n },\n parseHTML: (element) => element.getAttribute('title'),\n },\n width: {\n default: '350',\n renderHTML: (attributes) => {\n if (\n attributes.width !== null &&\n attributes.width !== undefined &&\n !Number.isNaN(attributes.width)\n ) {\n return {\n width: parseInt(attributes.width),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n if (\n attributes.height !== null &&\n attributes.height !== undefined &&\n !Number.isNaN(attributes.height)\n ) {\n return {\n height: parseInt(attributes.height),\n };\n }\n return {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: () => {\n return null;\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]:not([src^=\"data:\"])',\n getAttrs: (el: HTMLImageElement) => {\n const attr = { src: el.getAttribute('src') };\n // Check old content format and get the width from the parent element\n if (el.parentElement?.className.includes('image-container')) {\n if (el.parentElement.style?.width) {\n attr['width'] = el.parentElement.style.width;\n }\n }\n if (el.style?.width) {\n attr['width'] = el.style.width;\n }\n\n // Check old content smiley\n const oldSmileyList = [\n 'happy',\n 'proud',\n 'dreamy',\n 'love',\n 'tired',\n 'angry',\n 'worried',\n 'sick',\n 'joker',\n 'sad',\n ];\n if (\n oldSmileyList.filter((smiley) => attr.src.includes(smiley + '.png'))\n .length > 0\n ) {\n attr['style'] = {\n width: '1.5em',\n height: '1.5em',\n fontSize: '16px',\n };\n attr['width'] = 'null';\n attr['height'] = 'null';\n }\n\n return attr;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'img',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n ];\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: IMAGE_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , alt, src, title] = match;\n\n return {\n src,\n alt,\n title,\n };\n },\n }),\n ];\n },\n\n addCommands() {\n return {\n setNewImage:\n (attrs) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(attrs);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n setAttributes:\n (attributes) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n\n const nodeAttrs = tr.doc.nodeAt(tr.selection.from);\n const options = {\n ...nodeAttrs.attrs,\n ...attributes,\n };\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n\n addProseMirrorPlugins() {\n const uploadNode = async (file: File) => {\n /**\n * Resize the image\n */\n const resizedImage = await ImageResizer.resizeImageFile(file);\n\n /**\n * Upload the image\n */\n const image = await this.options.uploadFile(resizedImage);\n\n /**\n * Get the image url\n */\n const imageUrl = `/workspace/${image.public ? 'pub/' : ''}document/${\n image._id\n }?timestamp=${new Date().getTime()}`;\n\n /**\n * Create the image node\n */\n\n const node = this.type.create({\n src: imageUrl,\n alt: image.alt,\n title: image.title,\n });\n\n return node;\n };\n\n const getFilteredFiles = (files: FileList) => {\n return Array.from(files).filter((file) =>\n /image\\/(png|jpeg|jpg|gif|webp|heic|avif)/.test(file.type),\n );\n };\n\n const handleImageInsert = async (\n editor: any,\n file: File,\n position?: number,\n ) => {\n const node = await uploadNode(file);\n if (!node) return;\n\n const transaction =\n position !== undefined\n ? editor.state.tr.insert(position, node)\n : editor.state.tr.replaceSelectionWith(node);\n\n editor.dispatch(transaction);\n };\n\n return [\n new Plugin({\n props: {\n handlePaste: (editor, e) => {\n const files = getFilteredFiles(e.clipboardData?.files);\n if (files.length === 0) return false;\n\n for (const file of files) {\n handleImageInsert(editor, file);\n }\n\n return true;\n },\n handleDrop: (editor, e, _s, moved) => {\n if (moved) return false;\n\n const files = getFilteredFiles(e.dataTransfer.files);\n if (files.length === 0) return false;\n\n const { pos: position } = editor.posAtCoords({\n left: e.clientX,\n top: e.clientY,\n });\n\n for (const file of files) {\n handleImageInsert(editor, file, position);\n }\n return true;\n },\n },\n }),\n ];\n },\n});\n"],"mappings":"+LAMA,IAAa,kBACX,2DA2BW,MAAQ,YAAY,OAA2B,CAC1D,KAAM,eACN,UAAW,GACX,WAAY,GAEZ,YAAa,CACX,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,OAAQ,GACR,QAAS,UACT,MAAO,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AM,KAAK,KAAK,EAAE,OAAQ,MAC/B,2CAA2C,KAAK,KAAK,IAAI,CAC3D,EAGI,kBAAoB,MACxB,OACA,KACA,WACG,CACH,IAAM,KAAO,MAAM,WAAW,IAAI,EAClC,GAAI,CAAC,KAAM,OAEX,IAAM,YACJ,WAAa,IAAA,GAET,OAAO,MAAM,GAAG,qBAAqB,IAAI,EADzC,OAAO,MAAM,GAAG,OAAO,SAAU,IAAI,EAG3C,OAAO,SAAS,WAAW,CAC7B,EAEA,MAAO,CACL,IAAI,OAAO,CACT,MAAO,CACL,aAAc,OAAQ,IAAM,CAC1B,IAAM,MAAQ,iBAAiB,EAAE,eAAe,KAAK,EACrD,GAAI,MAAM,SAAW,EAAG,MAAO,GAE/B,IAAK,IAAM,QAAQ,MACjB,kBAAkB,OAAQ,IAAI,EAGhC,MAAO,EACT,EACA,YAAa,OAAQ,EAAG,GAAI,QAAU,CACpC,GAAI,MAAO,MAAO,GAElB,IAAM,MAAQ,iBAAiB,EAAE,aAAa,KAAK,EACnD,GAAI,MAAM,SAAW,EAAG,MAAO,GAE/B,GAAM,CAAE,IAAK,UAAa,OAAO,YAAY,CAC3C,KAAM,EAAE,QACR,IAAK,EAAE,OACT,CAAC,EAED,IAAK,IAAM,QAAQ,MACjB,kBAAkB,OAAQ,KAAM,QAAQ,EAE1C,MAAO,EACT,CACF,CACF,CAAC,CACH,CACF,CACF,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_abbr=require("./abbr/abbr.cjs"),require_alert=require("./alert/alert.cjs"),require_attachment=require("./attachment/attachment.cjs"),require_attachment_transformer=require("./attachment/attachment-transformer.cjs"),require_audio=require("./audio/audio.cjs"),require_conversation_history=require("./conversation-history/conversation-history.cjs"),require_conversation_history_body=require("./conversation-history-body/conversation-history-body.cjs"),require_font_size=require("./font-size/font-size.cjs"),require_heading=require("./heading/heading.cjs"),require_highlight=require("./highlight/highlight.cjs"),require_hyperlink=require("./hyperlink/hyperlink.cjs"),require_iframe=require("./iframe/iframe.cjs"),require_image=require("./image/image.cjs"),require_information_pane=require("./information-pane/information-pane.cjs"),require_line_height=require("./line-height/line-height.cjs"),require_linker=require("./linker/linker.cjs"),require_mathjax=require("./mathjax/mathjax.cjs"),require_paragraph=require("./paragraph/paragraph.cjs"),require_speech_recognition=require("./speech-recognition/speech-recognition.cjs"),require_speech_synthesis=require("./speech-synthesis/speech-synthesis.cjs"),require_table_cell=require("./table-cell/table-cell.cjs"),require_html_to_json=require("./transform/html-to-json/html-to-json.cjs"),require_json_to_html=require("./transform/json-to-html/json-to-html.cjs"),require_video=require("./video/video.cjs");exports.Abbr=require_abbr.Abbr,exports.Alert=require_alert.Alert,exports.Attachment=require_attachment.Attachment,exports.AttachmentTransformer=require_attachment_transformer.AttachmentTransformer,exports.Audio=require_audio.Audio,exports.ConversationHistory=require_conversation_history.ConversationHistory,exports.ConversationHistoryBody=require_conversation_history_body.ConversationHistoryBody,exports.CustomHeading=require_heading.CustomHeading,exports.CustomHighlight=require_highlight.CustomHighlight,exports.FontSize=require_font_size.FontSize,exports.Hyperlink=require_hyperlink.Hyperlink,exports.IMAGE_INPUT_REGEX=require_image.IMAGE_INPUT_REGEX,exports.Iframe=require_iframe.Iframe,exports.Image=require_image.Image,exports.InformationPane=require_information_pane.InformationPane,exports.LineHeight=require_line_height.LineHeight,exports.Linker=require_linker.Linker,exports.MathJax=require_mathjax.MathJax,exports.Paragraph=require_paragraph.Paragraph,exports.SpeechRecognition=require_speech_recognition.SpeechRecognition,exports.SpeechSynthesis=require_speech_synthesis.SpeechSynthesis,exports.TableCell=require_table_cell.TableCell,exports.Video=require_video.Video,exports.htmlToJson=require_html_to_json,exports.jsonToHtml=require_json_to_html;
|