{"version":3,"file":"EmbedExtension.cjs","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/EmbedExtension.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\n\ndeclare module \"@tiptap/core\" {\n  interface Commands<ReturnType> {\n    embed: {\n      setEmbed: (options: { src: string; type?: string }) => ReturnType;\n    };\n  }\n}\n\nconst EmbedExtension = Node.create({\n  name: \"embed\",\n  group: \"block\",\n  atom: true,\n\n  addAttributes() {\n    return {\n      src: { default: null },\n      type: { default: \"generic\" },\n    };\n  },\n\n  parseHTML() {\n    return [\n      {\n        tag: 'div[data-type=\"embed\"]',\n      },\n    ];\n  },\n\n  renderHTML({ HTMLAttributes }: any) {\n    const src = HTMLAttributes.src || \"\";\n    return [\n      \"div\",\n      mergeAttributes(HTMLAttributes, {\n        \"data-type\": \"embed\",\n        class: \"ihub-te-embed-wrapper\",\n      }),\n      [\n        \"iframe\",\n        {\n          src,\n          frameborder: \"0\",\n          allowfullscreen: \"true\",\n          class: \"ihub-te-embed-iframe\",\n        },\n      ],\n    ];\n  },\n\n  addCommands() {\n    return {\n      setEmbed:\n        (options: any) =>\n        ({ commands }: any) => {\n          return commands.insertContent({\n            type: this.name,\n            attrs: options,\n          });\n        },\n    };\n  },\n});\n\nexport default EmbedExtension;\n"],"names":["EmbedExtension","Node","create","name","group","atom","addAttributes","src","default","type","parseHTML","tag","renderHTML","_ref","HTMLAttributes","mergeAttributes","class","frameborder","allowfullscreen","addCommands","_this","this","setEmbed","options","_ref2","commands","insertContent","attrs"],"mappings":"yMAUMA,EAAiBC,EAAIA,KAACC,OAAO,CACjCC,KAAM,QACNC,MAAO,QACPC,MAAM,EAENC,cAAa,WACX,MAAO,CACLC,IAAK,CAAEC,QAAS,MAChBC,KAAM,CAAED,QAAS,WAEpB,EAEDE,UAAS,WACP,MAAO,CACL,CACEC,IAAK,0BAGV,EAEDC,WAAAA,SAAUC,GAAwB,IAArBC,EAAcD,EAAdC,eACLP,EAAMO,EAAeP,KAAO,GAClC,MAAO,CACL,MACAQ,EAAeA,gBAACD,EAAgB,CAC9B,YAAa,QACbE,MAAO,0BAET,CACE,SACA,CACET,IAAAA,EACAU,YAAa,IACbC,gBAAiB,OACjBF,MAAO,yBAId,EAEDG,YAAW,WAAA,IAAAC,EAAAC,KACT,MAAO,CACLC,SACE,SAACC,GAAY,OACb,SAAAC,GACE,OADSA,EAARC,SACeC,cAAc,CAC5BjB,KAAMW,EAAKjB,KACXwB,MAAOJ,IAEV,EAEP"}