mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-14 11:34:15 +00:00
2 lines
2 KiB
JavaScript
2 lines
2 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[194],{736:function(e,t,a){"use strict";a.r(t),a.d(t,"default",function(){return j});var i,o,n,r=a(0),s=a(2),c=a(7),d=a(1),l=a(3),b=a.n(l),m=a(5),u=a.n(m),f=a(19),h=a(6),p=a(9),j=Object(h.g)((n=o=function(e){function t(){for(var t,a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return t=e.call.apply(e,[this].concat(i))||this,Object(d.a)(Object(s.a)(t),"state",{loading:!1,oembed:null}),Object(d.a)(Object(s.a)(t),"setIframeRef",function(e){t.iframe=e}),Object(d.a)(Object(s.a)(t),"handleTextareaClick",function(e){e.target.select()}),t}Object(c.a)(t,e);var a=t.prototype;return a.componentDidMount=function(){var e=this,t=this.props.url;this.setState({loading:!0}),Object(p.a)().post("/api/web/embed",{url:t}).then(function(t){e.setState({loading:!1,oembed:t.data});var a=e.iframe.contentWindow.document;a.open(),a.write(t.data.html),a.close(),a.body.style.margin=0,e.iframe.width=a.body.scrollWidth,e.iframe.height=a.body.scrollHeight}).catch(function(t){e.props.onError(t)})},a.render=function(){var e=this.state.oembed;return Object(r.a)("div",{className:"modal-root__modal embed-modal"},void 0,Object(r.a)("h4",{},void 0,Object(r.a)(h.b,{id:"status.embed",defaultMessage:"Embed"})),Object(r.a)("div",{className:"embed-modal__container"},void 0,Object(r.a)("p",{className:"hint"},void 0,Object(r.a)(h.b,{id:"embed.instructions",defaultMessage:"Embed this status on your website by copying the code below."})),Object(r.a)("input",{type:"text",className:"embed-modal__html",readOnly:!0,value:e&&e.html||"",onClick:this.handleTextareaClick}),Object(r.a)("p",{className:"hint"},void 0,Object(r.a)(h.b,{id:"embed.preview",defaultMessage:"Here is what it will look like:"})),b.a.createElement("iframe",{className:"embed-modal__iframe",frameBorder:"0",ref:this.setIframeRef,sandbox:"allow-same-origin",title:"preview"})))},t}(f.a),Object(d.a)(o,"propTypes",{url:u.a.string.isRequired,onClose:u.a.func.isRequired,onError:u.a.func.isRequired,intl:u.a.object.isRequired}),i=n))||i}}]);
|
|
//# sourceMappingURL=embed_modal.js.map
|