@edifice.io/tiptap-extensions 2.2.2 → 2.2.3

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Iframe=core.Node.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},width:{renderHTML:attributes=>attributes.width?{width:attributes.width==="100%"?"100%":parseInt(attributes.width)}:{},parseHTML:element=>element.getAttribute("width")},height:{renderHTML:attributes=>attributes.height?{height:parseInt(attributes.height)}:{},parseHTML:element=>element.getAttribute("height")},style:{renderHTML:attributes=>attributes.style?{style:attributes.style}:{},parseHTML:element=>element.getAttribute("style")}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes}){return["div",this.options.HTMLAttributes,["iframe",HTMLAttributes]]},addCommands(){return{setIframe:options=>({tr,dispatch})=>{const{selection}=tr,node=this.type.create(options);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0}}}});exports.Iframe=Iframe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),index=require("./transformers/index.cjs"),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 index.iframeTransformer.onRenderHTML({HTMLAttributes}),["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;
2
2
  //# sourceMappingURL=iframe.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAoBa,OAASA,UAAK,OAAsB,CAC/C,KAAM,SACN,MAAO,QACP,KAAM,GACN,UAAW,GAEX,YAAa,CACJ,MAAA,CACL,gBAAiB,GACjB,eAAgB,CACd,MAAO,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
+ {"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":["Node","iframeTransformer"],"mappings":"6JAqBa,OAASA,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,CAEXC,+BAAA,aAAa,CAAE,eAAgB,EAC1C,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,4 +1,5 @@
1
1
  import { Node } from "@tiptap/core";
2
+ import { iframeTransformer } from "./transformers/index.js";
2
3
  const Iframe = Node.create({
3
4
  name: "iframe",
4
5
  group: "block",
@@ -52,7 +53,7 @@ const Iframe = Node.create({
52
53
  ];
53
54
  },
54
55
  renderHTML({ HTMLAttributes }) {
55
- return ["div", this.options.HTMLAttributes, ["iframe", HTMLAttributes]];
56
+ return iframeTransformer.onRenderHTML({ HTMLAttributes }), ["div", this.options.HTMLAttributes, ["iframe", HTMLAttributes]];
56
57
  },
57
58
  addCommands() {
58
59
  return {
@@ -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,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;"}
1
+ {"version":3,"file":"iframe.js","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\nimport { iframeTransformer } from './transformers';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n // Call the onRenderHTML method from the iframeTransformer before rendering the iframe\n iframeTransformer.onRenderHTML({ HTMLAttributes });\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":[],"mappings":";;AAqBa,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;AAEX,6BAAA,aAAa,EAAE,gBAAgB,GAC1C,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";var __typeError=msg=>{throw TypeError(msg)};var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const padTransformer=require("./pad-transformer.cjs");var _transformers;class DefaultIframeTransformer{constructor(){__privateAdd(this,_transformers,[new padTransformer.PadIframeTransformer])}onRenderHTML({HTMLAttributes}){for(const transformer of __privateGet(this,_transformers))transformer.onRenderHTML({HTMLAttributes})}}_transformers=new WeakMap;const iframeTransformer=new DefaultIframeTransformer;exports.iframeTransformer=iframeTransformer;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"names":["PadIframeTransformer"],"mappings":"0kBAMA,MAAM,wBAAsD,CAA5D,cACE,gCAAgB,CAAC,IAAIA,eAAAA,oBAAsB,GAC3C,aAAa,CAAE,gBAAkB,CACpB,UAAA,eAAe,kBAAK,eACjB,YAAA,aAAa,CAAE,eAAgB,CAC7C,CAEJ,CANE,0BAQW,MAAA,kBACX,IAAI"}
@@ -0,0 +1,2 @@
1
+ import { IframeTransformer } from './interface';
2
+ export declare const iframeTransformer: IframeTransformer;
@@ -0,0 +1,22 @@
1
+ var __typeError = (msg) => {
2
+ throw TypeError(msg);
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/iframe/transformers/index.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\nimport { PadIframeTransformer } from './pad-transformer';\n/**\n * Default iframe transformer\n * This transformer is used to call all the transformers\n */\nclass DefaultIframeTransformer implements IframeTransformer {\n #transformers = [new PadIframeTransformer()];\n onRenderHTML({ HTMLAttributes }) {\n for (const transformer of this.#transformers) {\n transformer.onRenderHTML({ HTMLAttributes });\n }\n }\n}\n\nexport const iframeTransformer: IframeTransformer =\n new DefaultIframeTransformer();\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,yBAAsD;AAAA,EAA5D;AACE,sCAAgB,CAAC,IAAI,sBAAsB;AAAA;AAAA,EAC3C,aAAa,EAAE,kBAAkB;AACpB,eAAA,eAAe,mBAAK;AACjB,kBAAA,aAAa,EAAE,gBAAgB;AAAA,EAC7C;AAEJ;AANE;AAQW,MAAA,oBACX,IAAI,yBAAyB;"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Interface for the iframe transformer.
3
+ * Iframe transformers are used to transform the iframe attributes before rendering it.
4
+ */
5
+ export interface IframeTransformer {
6
+ onRenderHTML({ HTMLAttributes }: {
7
+ HTMLAttributes: any;
8
+ }): void;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class PadIframeTransformer{constructor(){this.padPath="/pad/",this.embedPath="/collaborativeeditor/embed/"}onRenderHTML({HTMLAttributes}){try{const currentUrl=window.location.href.split("?")[0],baseUrl=new URL(currentUrl).origin,srcUrl=new URL(HTMLAttributes.src),pathMatch=srcUrl.pathname.match(new RegExp(`^${this.padPath}(.+)$`));if(srcUrl.origin===baseUrl&&pathMatch&&pathMatch[1]){const 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pad-transformer.cjs","sources":["../../../src/iframe/transformers/pad-transformer.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\n\n/**\n * This transformer is used to transform the pad URL to the embed URL inside the iframe\n * The embed URL is used to create a session for the pad before redirecting to the pad url\n */\nexport class PadIframeTransformer implements IframeTransformer {\n // Define the pad path\n private padPath = '/pad/';\n // Define the embed path\n private embedPath = '/collaborativeeditor/embed/';\n onRenderHTML({ HTMLAttributes }) {\n try {\n // Get host URL from the current window\n const currentUrl = window.location.href.split('?')[0];\n const baseUrl = new URL(currentUrl).origin;\n // Get Iframe src URL\n const srcUrl = new URL(HTMLAttributes.src);\n const pathMatch = srcUrl.pathname.match(\n new RegExp(`^${this.padPath}(.+)$`),\n );\n // Check if the src URL is from the same origin and matches the pad path\n if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {\n // Extract pad ID from the URL\n const padId = pathMatch[1].replace(/^p\\//i, '');\n // Create a new URL with the embed path\n const newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);\n // Copy search params from the src URL to the new URL\n srcUrl.searchParams.forEach((value, key) => {\n newUrl.searchParams.set(key, value);\n });\n // Set the new URL\n HTMLAttributes.src = newUrl.toString();\n }\n } catch (e) {\n console.error('Error transforming pad URL:', e);\n }\n }\n}\n"],"names":[],"mappings":"gFAMO,MAAM,oBAAkD,CAAxD,aAAA,CAEL,KAAQ,QAAU,QAElB,KAAQ,UAAY,6BAAA,CACpB,aAAa,CAAE,gBAAkB,CAC3B,GAAA,CAEF,MAAM,WAAa,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,CAAC,EAC9C,QAAU,IAAI,IAAI,UAAU,EAAE,OAE9B,OAAS,IAAI,IAAI,eAAe,GAAG,EACnC,UAAY,OAAO,SAAS,MAChC,IAAI,OAAO,IAAI,KAAK,OAAO,OAAO,CACpC,EAEA,GAAI,OAAO,SAAW,SAAW,WAAa,UAAU,CAAC,EAAG,CAE1D,MAAM,MAAQ,UAAU,CAAC,EAAE,QAAQ,QAAS,EAAE,EAExC,OAAS,IAAI,IAAI,GAAG,OAAO,GAAG,KAAK,SAAS,GAAG,KAAK,EAAE,EAE5D,OAAO,aAAa,QAAQ,CAAC,MAAO,MAAQ,CACnC,OAAA,aAAa,IAAI,IAAK,KAAK,CAAA,CACnC,EAEc,eAAA,IAAM,OAAO,SAAS,CAAA,QAEhC,EAAG,CACF,QAAA,MAAM,8BAA+B,CAAC,CAAA,CAChD,CAEJ"}
@@ -0,0 +1,12 @@
1
+ import { IframeTransformer } from './interface';
2
+ /**
3
+ * This transformer is used to transform the pad URL to the embed URL inside the iframe
4
+ * The embed URL is used to create a session for the pad before redirecting to the pad url
5
+ */
6
+ export declare class PadIframeTransformer implements IframeTransformer {
7
+ private padPath;
8
+ private embedPath;
9
+ onRenderHTML({ HTMLAttributes }: {
10
+ HTMLAttributes: any;
11
+ }): void;
12
+ }
@@ -0,0 +1,24 @@
1
+ class PadIframeTransformer {
2
+ constructor() {
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pad-transformer.js","sources":["../../../src/iframe/transformers/pad-transformer.ts"],"sourcesContent":["import { IframeTransformer } from './interface';\n\n/**\n * This transformer is used to transform the pad URL to the embed URL inside the iframe\n * The embed URL is used to create a session for the pad before redirecting to the pad url\n */\nexport class PadIframeTransformer implements IframeTransformer {\n // Define the pad path\n private padPath = '/pad/';\n // Define the embed path\n private embedPath = '/collaborativeeditor/embed/';\n onRenderHTML({ HTMLAttributes }) {\n try {\n // Get host URL from the current window\n const currentUrl = window.location.href.split('?')[0];\n const baseUrl = new URL(currentUrl).origin;\n // Get Iframe src URL\n const srcUrl = new URL(HTMLAttributes.src);\n const pathMatch = srcUrl.pathname.match(\n new RegExp(`^${this.padPath}(.+)$`),\n );\n // Check if the src URL is from the same origin and matches the pad path\n if (srcUrl.origin === baseUrl && pathMatch && pathMatch[1]) {\n // Extract pad ID from the URL\n const padId = pathMatch[1].replace(/^p\\//i, '');\n // Create a new URL with the embed path\n const newUrl = new URL(`${baseUrl}${this.embedPath}${padId}`);\n // Copy search params from the src URL to the new URL\n srcUrl.searchParams.forEach((value, key) => {\n newUrl.searchParams.set(key, value);\n });\n // Set the new URL\n HTMLAttributes.src = newUrl.toString();\n }\n } catch (e) {\n console.error('Error transforming pad URL:', e);\n }\n }\n}\n"],"names":[],"mappings":"AAMO,MAAM,qBAAkD;AAAA,EAAxD,cAAA;AAEL,SAAQ,UAAU,SAElB,KAAQ,YAAY;AAAA,EAAA;AAAA,EACpB,aAAa,EAAE,kBAAkB;AAC3B,QAAA;AAEF,YAAM,aAAa,OAAO,SAAS,KAAK,MAAM,GAAG,EAAE,CAAC,GAC9C,UAAU,IAAI,IAAI,UAAU,EAAE,QAE9B,SAAS,IAAI,IAAI,eAAe,GAAG,GACnC,YAAY,OAAO,SAAS;AAAA,QAChC,IAAI,OAAO,IAAI,KAAK,OAAO,OAAO;AAAA,MACpC;AAEA,UAAI,OAAO,WAAW,WAAW,aAAa,UAAU,CAAC,GAAG;AAE1D,cAAM,QAAQ,UAAU,CAAC,EAAE,QAAQ,SAAS,EAAE,GAExC,SAAS,IAAI,IAAI,GAAG,OAAO,GAAG,KAAK,SAAS,GAAG,KAAK,EAAE;AAE5D,eAAO,aAAa,QAAQ,CAAC,OAAO,QAAQ;AACnC,iBAAA,aAAa,IAAI,KAAK,KAAK;AAAA,QAAA,CACnC,GAEc,eAAA,MAAM,OAAO,SAAS;AAAA,MAAA;AAAA,aAEhC,GAAG;AACF,cAAA,MAAM,+BAA+B,CAAC;AAAA,IAAA;AAAA,EAChD;AAEJ;"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const abbr=require("./abbr/abbr.cjs"),alert=require("./alert/alert.cjs"),attachmentTransformer=require("./attachment/attachment-transformer.cjs"),attachment=require("./attachment/attachment.cjs"),audio=require("./audio/audio.cjs"),fontSize=require("./font-size/font-size.cjs"),heading=require("./heading/heading.cjs"),highlight=require("./highlight/highlight.cjs"),hyperlink=require("./hyperlink/hyperlink.cjs"),iframe=require("./iframe/iframe.cjs"),image=require("./image/image.cjs"),lineHeight=require("./line-height/line-height.cjs"),linker=require("./linker/linker.cjs"),mathjax=require("./mathjax/mathjax.cjs"),paragraph=require("./paragraph/paragraph.cjs"),speechRecognition=require("./speech-recognition/speech-recognition.cjs"),speechSynthesis=require("./speech-synthesis/speech-synthesis.cjs"),tableCell=require("./table-cell/table-cell.cjs"),htmlToJson=require("./transform/html-to-json/html-to-json.cjs"),jsonToHtml=require("./transform/json-to-html/json-to-html.cjs"),video=require("./video/video.cjs");exports.Abbr=abbr.Abbr;exports.Alert=alert.Alert;exports.AttachmentTransformer=attachmentTransformer.AttachmentTransformer;exports.Attachment=attachment.Attachment;exports.Audio=audio.Audio;exports.FontSize=fontSize.FontSize;exports.CustomHeading=heading.CustomHeading;exports.CustomHighlight=highlight.CustomHighlight;exports.Hyperlink=hyperlink.Hyperlink;exports.Iframe=iframe.Iframe;exports.IMAGE_INPUT_REGEX=image.IMAGE_INPUT_REGEX;exports.Image=image.Image;exports.LineHeight=lineHeight.LineHeight;exports.Linker=linker.Linker;exports.MathJax=mathjax.MathJax;exports.Paragraph=paragraph.Paragraph;exports.SpeechRecognition=speechRecognition.SpeechRecognition;exports.SpeechSynthesis=speechSynthesis.SpeechSynthesis;exports.TableCell=tableCell.TableCell;exports.htmlToJson=htmlToJson;exports.jsonToHtml=jsonToHtml;exports.Video=video.Video;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const abbr=require("./abbr/abbr.cjs"),alert=require("./alert/alert.cjs"),attachmentTransformer=require("./attachment/attachment-transformer.cjs"),attachment=require("./attachment/attachment.cjs"),audio=require("./audio/audio.cjs"),informationPane=require("./information-pane/information-pane.cjs"),fontSize=require("./font-size/font-size.cjs"),heading=require("./heading/heading.cjs"),highlight=require("./highlight/highlight.cjs"),hyperlink=require("./hyperlink/hyperlink.cjs"),iframe=require("./iframe/iframe.cjs"),image=require("./image/image.cjs"),lineHeight=require("./line-height/line-height.cjs"),linker=require("./linker/linker.cjs"),mathjax=require("./mathjax/mathjax.cjs"),paragraph=require("./paragraph/paragraph.cjs"),speechRecognition=require("./speech-recognition/speech-recognition.cjs"),speechSynthesis=require("./speech-synthesis/speech-synthesis.cjs"),tableCell=require("./table-cell/table-cell.cjs"),htmlToJson=require("./transform/html-to-json/html-to-json.cjs"),jsonToHtml=require("./transform/json-to-html/json-to-html.cjs"),video=require("./video/video.cjs");exports.Abbr=abbr.Abbr;exports.Alert=alert.Alert;exports.AttachmentTransformer=attachmentTransformer.AttachmentTransformer;exports.Attachment=attachment.Attachment;exports.Audio=audio.Audio;exports.InformationPane=informationPane.InformationPane;exports.FontSize=fontSize.FontSize;exports.CustomHeading=heading.CustomHeading;exports.CustomHighlight=highlight.CustomHighlight;exports.Hyperlink=hyperlink.Hyperlink;exports.Iframe=iframe.Iframe;exports.IMAGE_INPUT_REGEX=image.IMAGE_INPUT_REGEX;exports.Image=image.Image;exports.LineHeight=lineHeight.LineHeight;exports.Linker=linker.Linker;exports.MathJax=mathjax.MathJax;exports.Paragraph=paragraph.Paragraph;exports.SpeechRecognition=speechRecognition.SpeechRecognition;exports.SpeechSynthesis=speechSynthesis.SpeechSynthesis;exports.TableCell=tableCell.TableCell;exports.htmlToJson=htmlToJson;exports.jsonToHtml=jsonToHtml;exports.Video=video.Video;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './abbr';
2
2
  export * from './alert';
3
3
  export * from './attachment';
4
4
  export * from './audio';
5
+ export * from './information-pane';
5
6
  export * from './font-size';
6
7
  export * from './heading';
7
8
  export * from './highlight';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import { Alert } from "./alert/alert.js";
3
3
  import { AttachmentTransformer } from "./attachment/attachment-transformer.js";
4
4
  import { Attachment } from "./attachment/attachment.js";
5
5
  import { Audio } from "./audio/audio.js";
6
+ import { InformationPane } from "./information-pane/information-pane.js";
6
7
  import { FontSize } from "./font-size/font-size.js";
7
8
  import { CustomHeading } from "./heading/heading.js";
8
9
  import { CustomHighlight } from "./highlight/highlight.js";
@@ -32,6 +33,7 @@ export {
32
33
  IMAGE_INPUT_REGEX,
33
34
  Iframe,
34
35
  Image,
36
+ InformationPane,
35
37
  LineHeight,
36
38
  Linker,
37
39
  MathJax,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ import { InformationPane } from './information-pane';
2
+ export * from './information-pane';
3
+ export default InformationPane;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),InformationPane=core.Node.create({name:"information-pane",group:"block",content:"block+",defining:!0,marks:"",addAttributes(){return{type:{default:"info",parseHTML:element=>element.getAttribute("data-type")||"info",renderHTML:attributes=>({"data-type":attributes.type})}}},parseHTML(){return[{tag:"div[data-information-pane]"}]},renderHTML({node,HTMLAttributes}){const type=node.attrs.type;return["div",core.mergeAttributes(HTMLAttributes,{"data-information-pane":"",class:`information-pane information-pane-${type}`}),0]},addCommands(){return{setInformationPane:(type="info")=>({commands})=>commands.insertContent([{type:this.name,attrs:{type},content:[{type:"paragraph"}]}])}}});exports.InformationPane=InformationPane;
2
+ //# sourceMappingURL=information-pane.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"information-pane.cjs","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n informationPane: {\n /**\n * Set a informationPane node\n * @param type The type of the informationPane\n */\n setInformationPane: (type?: string) => ReturnType;\n };\n }\n}\n\nexport const InformationPane = Node.create({\n name: 'information-pane',\n\n group: 'block',\n content: 'block+',\n defining: true,\n marks: '',\n\n addAttributes() {\n return {\n type: {\n default: 'info', // type par défaut\n parseHTML: (element) => element.getAttribute('data-type') || 'info',\n renderHTML: (attributes) => {\n return {\n 'data-type': attributes.type,\n };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-information-pane]',\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const type = node.attrs.type;\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-information-pane': '',\n 'class': `information-pane information-pane-${type}`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setInformationPane:\n (type = 'info') =>\n ({ commands }) => {\n return commands.insertContent([\n {\n type: this.name,\n attrs: { type },\n content: [\n {\n type: 'paragraph',\n },\n ],\n },\n ]);\n },\n };\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAca,gBAAkBA,UAAK,OAAO,CACzC,KAAM,mBAEN,MAAO,QACP,QAAS,SACT,SAAU,GACV,MAAO,GAEP,eAAgB,CACP,MAAA,CACL,KAAM,CACJ,QAAS,OACT,UAAY,SAAY,QAAQ,aAAa,WAAW,GAAK,OAC7D,WAAa,aACJ,CACL,YAAa,WAAW,IAC1B,EACF,CAEJ,CACF,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,4BAAA,CAET,CACF,EAEA,WAAW,CAAE,KAAM,gBAAkB,CAC7B,MAAA,KAAO,KAAK,MAAM,KACjB,MAAA,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAC9B,wBAAyB,GACzB,MAAS,qCAAqC,IAAI,EAAA,CACnD,EACD,CACF,CACF,EAEA,aAAc,CACL,MAAA,CACL,mBACE,CAAC,KAAO,SACR,CAAC,CAAE,YACM,SAAS,cAAc,CAC5B,CACE,KAAM,KAAK,KACX,MAAO,CAAE,IAAK,EACd,QAAS,CACP,CACE,KAAM,WAAA,CACR,CACF,CACF,CACD,CAEP,CAAA,CAEJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Node } from '@tiptap/core';
2
+ declare module '@tiptap/core' {
3
+ interface Commands<ReturnType> {
4
+ informationPane: {
5
+ /**
6
+ * Set a informationPane node
7
+ * @param type The type of the informationPane
8
+ */
9
+ setInformationPane: (type?: string) => ReturnType;
10
+ };
11
+ }
12
+ }
13
+ export declare const InformationPane: Node<any, any>;
@@ -0,0 +1,57 @@
1
+ import { Node, mergeAttributes } from "@tiptap/core";
2
+ const InformationPane = Node.create({
3
+ name: "information-pane",
4
+ group: "block",
5
+ content: "block+",
6
+ defining: !0,
7
+ marks: "",
8
+ addAttributes() {
9
+ return {
10
+ type: {
11
+ default: "info",
12
+ // type par défaut
13
+ parseHTML: (element) => element.getAttribute("data-type") || "info",
14
+ renderHTML: (attributes) => ({
15
+ "data-type": attributes.type
16
+ })
17
+ }
18
+ };
19
+ },
20
+ parseHTML() {
21
+ return [
22
+ {
23
+ tag: "div[data-information-pane]"
24
+ }
25
+ ];
26
+ },
27
+ renderHTML({ node, HTMLAttributes }) {
28
+ const type = node.attrs.type;
29
+ return [
30
+ "div",
31
+ mergeAttributes(HTMLAttributes, {
32
+ "data-information-pane": "",
33
+ class: `information-pane information-pane-${type}`
34
+ }),
35
+ 0
36
+ ];
37
+ },
38
+ addCommands() {
39
+ return {
40
+ setInformationPane: (type = "info") => ({ commands }) => commands.insertContent([
41
+ {
42
+ type: this.name,
43
+ attrs: { type },
44
+ content: [
45
+ {
46
+ type: "paragraph"
47
+ }
48
+ ]
49
+ }
50
+ ])
51
+ };
52
+ }
53
+ });
54
+ export {
55
+ InformationPane
56
+ };
57
+ //# sourceMappingURL=information-pane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"information-pane.js","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n informationPane: {\n /**\n * Set a informationPane node\n * @param type The type of the informationPane\n */\n setInformationPane: (type?: string) => ReturnType;\n };\n }\n}\n\nexport const InformationPane = Node.create({\n name: 'information-pane',\n\n group: 'block',\n content: 'block+',\n defining: true,\n marks: '',\n\n addAttributes() {\n return {\n type: {\n default: 'info', // type par défaut\n parseHTML: (element) => element.getAttribute('data-type') || 'info',\n renderHTML: (attributes) => {\n return {\n 'data-type': attributes.type,\n };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-information-pane]',\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const type = node.attrs.type;\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-information-pane': '',\n 'class': `information-pane information-pane-${type}`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setInformationPane:\n (type = 'info') =>\n ({ commands }) => {\n return commands.insertContent([\n {\n type: this.name,\n attrs: { type },\n content: [\n {\n type: 'paragraph',\n },\n ],\n },\n ]);\n },\n };\n },\n});\n"],"names":[],"mappings":";AAca,MAAA,kBAAkB,KAAK,OAAO;AAAA,EACzC,MAAM;AAAA,EAEN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EAEP,gBAAgB;AACP,WAAA;AAAA,MACL,MAAM;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,WAAW,CAAC,YAAY,QAAQ,aAAa,WAAW,KAAK;AAAA,QAC7D,YAAY,CAAC,gBACJ;AAAA,UACL,aAAa,WAAW;AAAA,QAC1B;AAAA,MACF;AAAA,IAEJ;AAAA,EACF;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IAET;AAAA,EACF;AAAA,EAEA,WAAW,EAAE,MAAM,kBAAkB;AAC7B,UAAA,OAAO,KAAK,MAAM;AACjB,WAAA;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB;AAAA,QAC9B,yBAAyB;AAAA,QACzB,OAAS,qCAAqC,IAAI;AAAA,MAAA,CACnD;AAAA,MACD;AAAA,IACF;AAAA,EACF;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,oBACE,CAAC,OAAO,WACR,CAAC,EAAE,eACM,SAAS,cAAc;AAAA,QAC5B;AAAA,UACE,MAAM,KAAK;AAAA,UACX,OAAO,EAAE,KAAK;AAAA,UACd,SAAS;AAAA,YACP;AAAA,cACE,MAAM;AAAA,YAAA;AAAA,UACR;AAAA,QACF;AAAA,MACF,CACD;AAAA,IAEP;AAAA,EAAA;AAEJ,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/tiptap-extensions",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Edifice Rich Text Editor Extensions",
5
5
  "keywords": [
6
6
  "edifice",
@@ -101,6 +101,10 @@
101
101
  "./video": {
102
102
  "import": "./dist/video/video.js",
103
103
  "require": "./dist/video/video.cjs"
104
+ },
105
+ "./information-pane": {
106
+ "import": "./dist/information-pane/information-pane.js",
107
+ "require": "./dist/information-pane/information-pane.cjs"
104
108
  }
105
109
  },
106
110
  "main": "dist/index.cjs",
@@ -130,11 +134,11 @@
130
134
  "prosemirror-view": "^1.27.0",
131
135
  "vite": "^5.4.11",
132
136
  "vite-plugin-dts": "^4.1.0",
133
- "@edifice.io/utilities": "2.2.2"
137
+ "@edifice.io/utilities": "2.2.3"
134
138
  },
135
139
  "devDependencies": {
136
140
  "@types/dom-speech-recognition": "^0.0.1",
137
- "@edifice.io/client": "2.2.2"
141
+ "@edifice.io/client": "2.2.3"
138
142
  },
139
143
  "publishConfig": {
140
144
  "access": "public"