akkoma/priv/static/packs/flavours/glitch/async/embed_modal.js.map

1 line
4.3 KiB
Plaintext
Raw Normal View History

2020-01-22 15:00:23 +00:00
{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/flavours/glitch/features/ui/components/embed_modal.js"],"names":["EmbedModal","injectIntl","loading","oembed","c","iframe","e","target","select","componentDidMount","url","this","props","setState","api","post","then","res","data","iframeDocument","contentWindow","document","open","write","html","close","body","style","margin","width","scrollWidth","height","scrollHeight","catch","error","onError","render","state","className","id","defaultMessage","type","readOnly","value","onClick","handleTextareaClick","frameBorder","ref","setIframeRef","sandbox","title","ImmutablePureComponent","PropTypes","string","isRequired","onClose","func","intl","object"],"mappings":"oOAOMA,EADUC,a,0LAUN,CACNC,SAAS,EACTC,OAAQ,O,0CAyBK,SAAAC,GACb,EAAKC,OAASD,I,iDAGM,SAACE,GACrBA,EAAEC,OAAOC,W,8CA3BXC,kBAAA,WAAsB,IAAD,OACXC,EAAQC,KAAKC,MAAbF,IAERC,KAAKE,SAAS,CAAEX,SAAS,IAEzBY,cAAMC,KAAK,iBAAkB,CAAEL,QAAOM,KAAK,SAAAC,GACzC,EAAKJ,SAAS,CAAEX,SAAS,EAAOC,OAAQc,EAAIC,OAE5C,IAAMC,EAAiB,EAAKd,OAAOe,cAAcC,SAEjDF,EAAeG,OACfH,EAAeI,MAAMN,EAAIC,KAAKM,MAC9BL,EAAeM,QAEfN,EAAeO,KAAKC,MAAMC,OAAS,EACnC,EAAKvB,OAAOwB,MAASV,EAAeO,KAAKI,YACzC,EAAKzB,OAAO0B,OAASZ,EAAeO,KAAKM,eACxCC,MAAM,SAAAC,GACP,EAAKtB,MAAMuB,QAAQD,M,EAYvBE,OAAA,WAAW,IACDjC,EAAWQ,KAAK0B,MAAhBlC,OAER,OACE,mBAAKmC,UAAU,sCAAf,EACE,2BAAI,YAAC,IAAD,CAAkBC,GAAG,eAAeC,eAAe,WAEvD,mBAAKF,UAAU,+BAAf,EACE,iBAAGA,UAAU,aAAb,EACE,YAAC,IAAD,CAAkBC,GAAG,qBAAqBC,eAAe,kEAG3D,qBACEC,KAAK,OACLH,UAAU,oBACVI,UAAQ,EACRC,MAAOxC,GAAUA,EAAOqB,MAAQ,GAChCoB,QAASjC,KAAKkC,sBAGhB,iBAAGP,UAAU,aAAb,EACE,YAAC,IAAD,CAAkBC,GAAG,gBAAgBC,eAAe,qCAGtD,4BACEF,UAAU,sBACVQ,YAAY,IACZC,IAAKpC,KAAKqC,aACVC,QAAQ,oBACRC,MAAM,e,GAzEOC,K,0BAEJ,CACjBzC,IAAK0C,IAAUC,OAAOC,WACtBC,QAASH,IAAUI,KAAKF,WACxBnB,QAASiB,IAAUI,KAAKF,WACxBG,KAAML,IAAUM,OAAOJ,a","file":"flavours/glitch/async/embed_modal.js","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { FormattedMessage, injectIntl } from 'react-intl';\nimport api from 'flavours/glitch/util/api';\n\nexport default @injectIntl\nclass EmbedModal extends ImmutablePureComponent {\n\n static propTypes = {\n url: PropTypes.string.isRequired,\n onClose: PropTypes.func.isRequired,\n onError: PropTypes.func.isRequired,\n intl: PropTypes.object.isRequired,\n }\n\n state = {\n loading: false,\n oembed: null,\n };\n\n componentDidMount () {\n const { url } = this.props;\n\n this.setState({ loading: true });\n\n api().post('/api/web/embed', { url }).then(res => {\n this.setState({ loading: false, oembed: res.data });\n\n const iframeDocument = this.iframe.contentWindow.document;\n\n iframeDocument.open();\n iframeDocument.write(res.data.html);\n iframeDocument.close();\n\n iframeDocument.body.style.margin = 0;\n this.iframe.width = iframeDocument.body.scrollWidth;\n this.iframe.height = iframeDocument.body.scrollHeight;\n }).catch(error => {\n this.props.onError(error);\n });\n }\n\n setIframeRef = c => {\n this.iframe = c;\n }\n\n handleTextareaClick = (e) => {\n e.target.select();\n }\n\n render () {\n const { oembed } = this.state;\n\n return (\n <div className='modal-root__modal embed-modal'>\n <h4><FormattedMessage id='status.embed' defaultMessage='Embed' /></h4>\n\n <div className='embed-modal__container'>\n <p className='hint'>\n <FormattedMessage id='embed.instructions' defaultMessage='Embed this status on your website by copying the code below.' />\n </p>\n\n <input\n type='text'\n className='embed-modal__html'\n readOnly\n value={oembed && oembed.html || ''}\n onClick={this.handleTextareaClick}\n />\n\n <p className='hint'>\n <FormattedMessage id='embed.preview' defaultMessage='Here is what it will look like:' />\n </p>\n\n <if