distraction.party/priv/static/packs/modals/embed_modal.js.map

1 line
4.6 KiB
Text
Raw Normal View History

2018-09-16 21:17:34 +00:00
{"version":3,"sources":["webpack:///app/javascript/seagate/sources/git/hacktivis.me/git/mastofe/app/javascript/mastodon/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","catch","error","onError","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":"qOAOMA,EADUC,oNAUN,CACNC,SAAS,EACTC,OAAQ,8DAyBK,SAAAC,GACbC,EAAKC,OAASF,kEAGM,SAACG,GACrBA,EAAEC,OAAOC,yDA3BXC,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,eACxCC,MAAM,SAAAC,GACPzB,EAAKG,MAAMuB,QAAQD,QAYvBE,OAAA,WAAU,IACAnC,EAAWS,KAAK2B,MAAhBpC,OAER,OACEqC,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,MAAO7C,GAAUA,EAAOuB,MAAQ,GAChCuB,QAASrC,KAAKsC,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,IAAK3C,KAAK4C,aACVC,QAAQ,oBACRC,MAAM,kBAzEOC,+BAEJ,CACjB9C,IAAK+C,IAAUC,OAAOC,WACtBC,QAASH,IAAUI,KAAKF,WACxBzB,QAASuB,IAAUI,KAAKF,WACxBG,KAAML,IAAUM,OAAOJ","file":"modals/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 '../../../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 <