spc-pleroma/priv/static/packs/flavours/glitch/async/embed_modal.js.map

1 line
4.5 KiB
Plaintext

{"version":3,"sources":["webpack:///app/javascript/seagate/sources/git/hacktivis.me/git/mastofe/app/javascript/flavours/glitch/features/ui/components/embed_modal.js"],"names":["EmbedModal","injectIntl","loading","oembed","c","_this","iframe","e","target","select","componentDidMount","_this2","this","url","props","setState","api","post","then","res","data","iframeDocument","contentWindow","document","open","write","html","close","body","style","margin","width","scrollWidth","height","scrollHeight","render","state","Object","_babel_runtime_helpers_esm_jsx__WEBPACK_IMPORTED_MODULE_0__","className","react_intl__WEBPACK_IMPORTED_MODULE_7__","id","defaultMessage","type","readOnly","value","onClick","handleTextareaClick","react__WEBPACK_IMPORTED_MODULE_4___default","a","createElement","frameBorder","ref","setIframeRef","sandbox","title","ImmutablePureComponent","PropTypes","string","isRequired","onClose","func","intl","object"],"mappings":"qOAOqBA,EADpBC,oNASS,CACNC,SAAS,EACTC,OAAQ,8DAuBK,SAAAC,GACbC,EAAKC,OAASF,kEAGM,SAACG,GACrBA,EAAEC,OAAOC,yDAzBXC,kBAAA,WAAqB,IAAAC,EAAAC,KACXC,EAAQD,KAAKE,MAAbD,IAERD,KAAKG,SAAS,CAAEb,SAAS,IAEzBc,cAAMC,KAAK,iBAAkB,CAAEJ,QAAOK,KAAK,SAAAC,GACzCR,EAAKI,SAAS,CAAEb,SAAS,EAAOC,OAAQgB,EAAIC,OAE5C,IAAMC,EAAiBV,EAAKL,OAAOgB,cAAcC,SAEjDF,EAAeG,OACfH,EAAeI,MAAMN,EAAIC,KAAKM,MAC9BL,EAAeM,QAEfN,EAAeO,KAAKC,MAAMC,OAAS,EACnCnB,EAAKL,OAAOyB,MAASV,EAAeO,KAAKI,YACzCrB,EAAKL,OAAO2B,OAASZ,EAAeO,KAAKM,kBAY7CC,OAAA,WAAU,IACAhC,EAAWS,KAAKwB,MAAhBjC,OAER,OACEkC,OAAAC,EAAA,EAAAD,CAAA,OAAKE,UAAU,sCAAf,EACEF,OAAAC,EAAA,EAAAD,CAAA,eAAIA,OAAAC,EAAA,EAAAD,CAACG,EAAA,EAAD,CAAkBC,GAAG,eAAeC,eAAe,WAEvDL,OAAAC,EAAA,EAAAD,CAAA,OAAKE,UAAU,+BAAf,EACEF,OAAAC,EAAA,EAAAD,CAAA,KAAGE,UAAU,aAAb,EACEF,OAAAC,EAAA,EAAAD,CAACG,EAAA,EAAD,CAAkBC,GAAG,qBAAqBC,eAAe,kEAG3DL,OAAAC,EAAA,EAAAD,CAAA,SACEM,KAAK,OACLJ,UAAU,oBACVK,UAAQ,EACRC,MAAO1C,GAAUA,EAAOuB,MAAQ,GAChCoB,QAASlC,KAAKmC,sBAGhBV,OAAAC,EAAA,EAAAD,CAAA,KAAGE,UAAU,aAAb,EACEF,OAAAC,EAAA,EAAAD,CAACG,EAAA,EAAD,CAAkBC,GAAG,gBAAgBC,eAAe,qCAGtDM,EAAAC,EAAAC,cAAA,UACEX,UAAU,sBACVY,YAAY,IACZC,IAAKxC,KAAKyC,aACVC,QAAQ,oBACRC,MAAM,kBAtEsBC,+BAEnB,CACjB3C,IAAK4C,IAAUC,OAAOC,WACtBC,QAASH,IAAUI,KAAKF,WACxBG,KAAML,IAAUM,OAAOJ","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\n@injectIntl\nexport default class EmbedModal extends ImmutablePureComponent {\n\n static propTypes = {\n url: PropTypes.string.isRequired,\n onClose: 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 });\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 <iframe\n className='embed-modal__iframe'\n frameBorder='0'\n ref={this.setIframeRef}\n sandbox='allow-same-origin'\n title='preview'\n />\n </div>\n </div>\n );\n }\n\n}\n"],"sourceRoot":""}