pleroma/priv/static/packs/containers/media_container.js

2 lines
1.9 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{714:function(e,t,a){"use strict";a.r(t),a.d(t,"default",function(){return A});var n=a(34),i=a.n(n),d=a(53),o=a.n(d),s=a(0),l=a.n(s),c=a(6),r=a.n(c),m=a(3),u=a.n(m),p=a(7),h=a.n(p),f=a(1),b=a.n(f),v=a(28),O=a.n(v),g=a(4),w=a(8),y=a(383),j=a(78),C=a(696),M=a(207),S=a(134),x=a(5),J=Object(w.getLocale)(),L=J.localeData,V=J.messages;Object(g.e)(L);var k={MediaGallery:y.default,Video:j.default,Card:C.a},A=function(e){function t(){var a,n,i;r()(this,t);for(var d=arguments.length,o=Array(d),s=0;s<d;s++)o[s]=arguments[s];return a=n=u()(this,e.call.apply(e,[this].concat(o))),n.state={media:null,index:null,time:null},n.handleOpenMedia=function(e,t){document.body.classList.add("with-modals--active"),n.setState({media:e,index:t})},n.handleOpenVideo=function(e,t){var a=Object(x.List)([e]);document.body.classList.add("with-modals--active"),n.setState({media:a,time:t})},n.handleCloseMedia=function(){document.body.classList.remove("with-modals--active"),n.setState({media:null,index:null,time:null})},i=a,u()(n,i)}return h()(t,e),t.prototype.render=function(){var e=this,t=this.props,a=t.locale,n=t.components;return l()(g.d,{locale:a,messages:V},void 0,l()(f.Fragment,{},void 0,[].map.call(n,function(t,a){var n=t.getAttribute("data-component"),d=k[n],s=JSON.parse(t.getAttribute("data-props")),l=s.media,c=s.card,r=o()(s,["media","card"]);return Object.assign(r,Object.assign({},l?{media:Object(x.fromJS)(l)}:{},c?{card:Object(x.fromJS)(c)}:{},"Video"===n?{onOpenVideo:e.handleOpenVideo}:{onOpenMedia:e.handleOpenMedia})),O.a.createPortal(b.a.createElement(d,i()({},r,{key:"media-"+a})),t)}),l()(M.a,{onClose:this.handleCloseMedia},void 0,this.state.media&&l()(S.a,{media:this.state.media,index:this.state.index||0,time:this.state.time,onClose:this.handleCloseMedia}))))},t}(f.PureComponent)}}]);
//# sourceMappingURL=media_container.js.map