@edifice.io/tiptap-extensions
Version:
Edifice Rich Text Editor Extensions
3 lines (2 loc) • 1.35 kB
JavaScript
;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;
//# sourceMappingURL=iframe.cjs.map