mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-23 17:54:22 +00:00
1 line
5 KiB
Plaintext
1 line
5 KiB
Plaintext
{"version":3,"sources":["webpack:///app/javascript/tank/sources/git/git.pleroma.social/pleroma/mastofe/app/javascript/mastodon/features/ui/components/embed_modal.js"],"names":["messages","defineMessages","close","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","body","style","margin","width","scrollWidth","height","scrollHeight","catch","error","onError","render","intl","onClose","state","className","title","formatMessage","icon","onClick","size","id","defaultMessage","display","type","readOnly","value","handleTextareaClick","frameBorder","ref","setIframeRef","sandbox","ImmutablePureComponent","PropTypes","string","isRequired","func","object"],"mappings":"4PAOA,IAAMA,EAAWC,YAAe,CAC9BC,MAAM,CAAD,8CAIDC,EADUC,a,qNAUN,CACNC,SAAS,EACTC,OAAQ,O,2CAyBK,SAAAC,GACb,EAAKC,OAASD,K,kDAGM,SAACE,GACrBA,EAAEC,OAAOC,Y,6BA3BXC,kBAAA,WAAsB,IAAD,OACXC,EAAQC,KAAKC,MAAbF,IAERC,KAAKE,SAAS,CAAEX,SAAS,IAEzBY,cAAMC,KAAK,iBAAkB,CAAEL,QAAOM,MAAK,SAAAC,GACzC,EAAKJ,SAAS,CAAEX,SAAS,EAAOC,OAAQc,EAAIC,OAE5C,IAAMC,EAAiB,EAAKd,OAAOe,cAAcC,SAEjDF,EAAeG,OACfH,EAAeI,MAAMN,EAAIC,KAAKM,MAC9BL,EAAepB,QAEfoB,EAAeM,KAAKC,MAAMC,OAAS,EACnC,EAAKtB,OAAOuB,MAAST,EAAeM,KAAKI,YACzC,EAAKxB,OAAOyB,OAASX,EAAeM,KAAKM,gBACxCC,OAAM,SAAAC,GACP,EAAKrB,MAAMsB,QAAQD,O,EAYvBE,OAAA,WAAW,IAAD,EACkBxB,KAAKC,MAAvBwB,EADA,EACAA,KAAMC,EADN,EACMA,QACNlC,EAAWQ,KAAK2B,MAAhBnC,OAER,OACE,mBAAKoC,UAAU,mDAAf,EACE,mBAAKA,UAAU,6BAAf,EACE,YAAC,IAAD,CAAYA,UAAU,qBAAqBC,MAAOJ,EAAKK,cAAc5C,EAASE,OAAQ2C,KAAK,QAAQC,QAASN,EAASO,KAAM,KAC3H,YAAC,IAAD,CAAkBC,GAAG,eAAeC,eAAe,WAGrD,mBAAKP,UAAU,iDAAiDb,MAAO,CAAEqB,QAAS,eAAlF,EACE,iBAAGR,UAAU,aAAb,EACE,YAAC,IAAD,CAAkBM,GAAG,qBAAqBC,eAAe,kEAG3D,qBACEE,KAAK,OACLT,UAAU,oBACVU,UAAQ,EACRC,MAAO/C,GAAUA,EAAOqB,MAAQ,GAChCmB,QAAShC,KAAKwC,sBAGhB,iBAAGZ,UAAU,aAAb,EACE,YAAC,IAAD,CAAkBM,GAAG,gBAAgBC,eAAe,qCAGtD,4BACEP,UAAU,sBACVa,YAAY,IACZC,IAAK1C,KAAK2C,aACVC,QAAQ,oBACRf,MAAM,e,GA7EOgB,K,0BAEJ,CACjB9C,IAAK+C,IAAUC,OAAOC,WACtBtB,QAASoB,IAAUG,KAAKD,WACxBzB,QAASuB,IAAUG,KAAKD,WACxBvB,KAAMqB,IAAUI,OAAOF,a","file":"modals/embed_modal.js","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { defineMessages, FormattedMessage, injectIntl } from 'react-intl';\nimport api from 'mastodon/api';\nimport IconButton from 'mastodon/components/icon_button';\n\nconst messages = defineMessages({\n close: { id: 'lightbox.close', defaultMessage: 'Close' },\n});\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 { intl, onClose } = this.props;\n const { oembed } = this.state;\n\n return (\n <div className='modal-root__modal report-modal embed-modal'>\n <div className='report-modal__target'>\n <IconButton className='media-modal__close' title={intl.formatMessage(messages.close)} icon='times' onClick={onClose} size={16} />\n <FormattedMessage id='status.embed' defaultMessage='Embed' />\n </div>\n\n <div className='report-modal__container embed-modal__container' style={{ display: 'block' }}>\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":""} |