akkoma/priv/static/packs/modals/embed_modal.js.map

1 line
4.5 KiB
Plaintext
Raw Normal View History

2018-09-20 16:10:13 +00:00
{"version":3,"sources":["webpack:///./app/javascript/mastodon/features/ui/components/embed_modal.js"],"names":["EmbedModal","Object","react_intl__WEBPACK_IMPORTED_MODULE_7__","state","loading","oembed","setIframeRef","c","_this","iframe","handleTextareaClick","e","target","select","componentDidMount","_this2","this","url","props","setState","_api__WEBPACK_IMPORTED_MODULE_8__","post","then","res","data","iframeDocument","contentWindow","document","open","write","html","close","body","style","margin","width","scrollWidth","height","scrollHeight","catch","error","onError","render","babel_runtime_helpers_jsx__WEBPACK_IMPORTED_MODULE_0___default","className","id","defaultMessage","type","readOnly","value","onClick","react__WEBPACK_IMPORTED_MODULE_4___default","a","createElement","frameBorder","ref","title","react_immutable_pure_component__WEBPACK_IMPORTED_MODULE_6__","propTypes","prop_types__WEBPACK_IMPORTED_MODULE_5___default","string","isRequired","onClose","func","intl","object"],"mappings":"uQAOqBA,EADpBC,OAAAC,EAAA,EAAAD,iLAUCE,OACEC,SAAS,EACTC,OAAQ,QAyBVC,aAAe,SAAAC,GACbC,EAAKC,OAASF,KAGhBG,oBAAsB,SAACC,GACrBA,EAAEC,OAAOC,mDA3BXC,6BAAqB,IAAAC,EAAAC,KACXC,EAAQD,KAAKE,MAAbD,IAERD,KAAKG,UAAWf,SAAS,IAEzBH,OAAAmB,EAAA,EAAAnB,GAAMoB,KAAK,kBAAoBJ,QAAOK,KAAK,SAAAC,GACzCR,EAAKI,UAAWf,SAAS,EAAOC,OAAQkB,EAAIC,OAE5C,IAAMC,EAAiBV,EAAKN,OAAOiB,cAAcC,SAEjDF,EAAeG,OACfH,EAAeI,MAAMN,EAAIC,KAAKM,MAC9BL,EAAeM,QAEfN,EAAeO,KAAKC,MAAMC,OAAS,EACnCnB,EAAKN,OAAO0B,MAASV,EAAeO,KAAKI,YACzCrB,EAAKN,OAAO4B,OAASZ,EAAeO,KAAKM,eACxCC,MAAM,SAAAC,GACPzB,EAAKG,MAAMuB,QAAQD,kBAYvBE,kBAAU,IACArC,EAAWW,KAAKb,MAAhBE,OAER,OAAAsC,IAAA,OAAAC,UACiB,sCADjB,EAAAD,IAAA,eAAAA,IAESzC,EAAA,GAFT2C,GAE6B,eAF7BC,eAE2D,WAF3DH,IAAA,OAAAC,UAImB,+BAJnB,EAAAD,IAAA,KAAAC,UAKmB,aALnB,EAAAD,IAMSzC,EAAA,GANT2C,GAM6B,qBAN7BC,eAMiE,kEANjEH,IAAA,SAAAI,KAUa,OAVbH,UAWkB,oBAXlBI,UAAA,EAAAC,MAae5C,GAAUA,EAAOyB,MAAQ,GAbxCoB,QAciBlC,KAAKN,sBAdtBiC,IAAA,KAAAC,UAiBmB,aAjBnB,EAAAD,IAkBSzC,EAAA,GAlBT2C,GAkB6B,gBAlB7BC,eAkB4D,qCAGtDK,EAAAC,EAAAC,cAAA,UACET,UAAU,sBACVU,YAAY,IACZC,IAAKvC,KAAKV,aACVkD,MAAM,kBAxEsBC,EAAA,KAE/BC,WACLzC,IAAK0C,EAAAP,EAAUQ,OAAOC,WACtBC,QAASH,EAAAP,EAAUW,KAAKF,WACxBpB,QAASkB,EAAAP,EAAUW,KAAKF,WACxBG,KAAML,EAAAP,EAAUa,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\n@injectIntl\nexport default class 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='