pleroma/priv/static/packs/modals/embed_modal-c776fd6a0ea581675783.js.map
2017-11-12 14:23:05 +01:00

1 line
13 KiB
Plaintext

{"version":3,"sources":["webpack:///modals/embed_modal-c776fd6a0ea581675783.js","webpack:///./app/javascript/mastodon/features/ui/components/embed_modal.js"],"names":["webpackJsonp","774","module","__webpack_exports__","__webpack_require__","Object","defineProperty","value","d","EmbedModal","_class","_class2","_temp2","__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx__","__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default","n","__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__","__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default","__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__","__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default","__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__","__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default","__WEBPACK_IMPORTED_MODULE_4_react__","__WEBPACK_IMPORTED_MODULE_4_react___default","__WEBPACK_IMPORTED_MODULE_5_prop_types__","__WEBPACK_IMPORTED_MODULE_5_prop_types___default","__WEBPACK_IMPORTED_MODULE_6_react_immutable_pure_component__","__WEBPACK_IMPORTED_MODULE_6_react_immutable_pure_component___default","__WEBPACK_IMPORTED_MODULE_7_react_intl__","__WEBPACK_IMPORTED_MODULE_8_axios__","__WEBPACK_IMPORTED_MODULE_8_axios___default","_ImmutablePureCompone","_temp","_this","_ret","this","_len","arguments","length","args","Array","_key","call","apply","concat","state","loading","oembed","setIframeRef","c","iframe","handleTextareaClick","e","target","select","prototype","componentDidMount","_this2","url","props","setState","a","post","then","res","data","iframeDocument","contentWindow","document","open","write","html","close","body","style","margin","width","scrollWidth","height","scrollHeight","render","className","id","defaultMessage","type","readOnly","onClick","createElement","frameBorder","ref","title","propTypes","string","isRequired","onClose","func","int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kC,KAAKF,WACxBG,KAAMvE,EAAAoC,EAAUoC,OAAOJ,YD0B6DnF,EAqFrFE,KAAYF","file":"modals/embed_modal-c776fd6a0ea581675783.js","sourcesContent":["webpackJsonp([25],{\n\n/***/ 774:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return EmbedModal; });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx__ = __webpack_require__(2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__ = __webpack_require__(4);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_react__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types__ = __webpack_require__(5);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_prop_types__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_react_immutable_pure_component__ = __webpack_require__(11);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_react_immutable_pure_component___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_react_immutable_pure_component__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_react_intl__ = __webpack_require__(6);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_axios__ = __webpack_require__(72);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_axios__);\n\n\n\n\n\nvar _class, _class2, _temp2;\n\n\n\n\n\n\n\nvar EmbedModal = Object(__WEBPACK_IMPORTED_MODULE_7_react_intl__[\"g\" /* injectIntl */])(_class = (_temp2 = _class2 = function (_ImmutablePureCompone) {\n __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_inherits___default()(EmbedModal, _ImmutablePureCompone);\n\n function EmbedModal() {\n var _temp, _this, _ret;\n\n __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default()(this, EmbedModal);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return _ret = (_temp = (_this = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default()(this, _ImmutablePureCompone.call.apply(_ImmutablePureCompone, [this].concat(args))), _this), _this.state = {\n loading: false,\n oembed: null\n }, _this.setIframeRef = function (c) {\n _this.iframe = c;\n }, _this.handleTextareaClick = function (e) {\n e.target.select();\n }, _temp), __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_possibleConstructorReturn___default()(_this, _ret);\n }\n\n EmbedModal.prototype.componentDidMount = function componentDidMount() {\n var _this2 = this;\n\n var url = this.props.url;\n\n\n this.setState({ loading: true });\n\n __WEBPACK_IMPORTED_MODULE_8_axios___default.a.post('/api/web/embed', { url: url }).then(function (res) {\n _this2.setState({ loading: false, oembed: res.data });\n\n var iframeDocument = _this2.iframe.contentWindow.document;\n\n iframeDocument.open();\n iframeDocument.write(res.data.html);\n iframeDocument.close();\n\n iframeDocument.body.style.margin = 0;\n _this2.iframe.width = iframeDocument.body.scrollWidth;\n _this2.iframe.height = iframeDocument.body.scrollHeight;\n });\n };\n\n EmbedModal.prototype.render = function render() {\n var oembed = this.state.oembed;\n\n\n return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()('div', {\n className: 'modal-root__modal embed-modal'\n }, void 0, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()('h4', {}, void 0, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()(__WEBPACK_IMPORTED_MODULE_7_react_intl__[\"b\" /* FormattedMessage */], {\n id: 'status.embed',\n defaultMessage: 'Embed'\n })), __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()('div', {\n className: 'embed-modal__container'\n }, void 0, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()('p', {\n className: 'hint'\n }, void 0, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()(__WEBPACK_IMPORTED_MODULE_7_react_intl__[\"b\" /* FormattedMessage */], {\n id: 'embed.instructions',\n defaultMessage: 'Embed this status on your website by copying the code below.'\n })), __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()('input', {\n type: 'text',\n className: 'embed-modal__html',\n readOnly: true,\n value: oembed && oembed.html || '',\n onClick: this.handleTextareaClick\n }), __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()('p', {\n className: 'hint'\n }, void 0, __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_jsx___default()(__WEBPACK_IMPORTED_MODULE_7_react_intl__[\"b\" /* FormattedMessage */], {\n id: 'embed.preview',\n defaultMessage: 'Here is what it will look like:'\n })), __WEBPACK_IMPORTED_MODULE_4_react___default.a.createElement('iframe', {\n className: 'embed-modal__iframe',\n frameBorder: '0',\n ref: this.setIframeRef,\n title: 'preview'\n })));\n };\n\n return EmbedModal;\n}(__WEBPACK_IMPORTED_MODULE_6_react_immutable_pure_component___default.a), _class2.propTypes = {\n url: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.string.isRequired,\n onClose: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.func.isRequired,\n intl: __WEBPACK_IMPORTED_MODULE_5_prop_types___default.a.object.isRequired\n}, _temp2)) || _class;\n\n\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// modals/embed_modal-c776fd6a0ea581675783.js","import React from 'react';\nimport PropTypes from 'prop-types';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { FormattedMessage, injectIntl } from 'react-intl';\nimport axios from 'axios';\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 axios.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 title='preview'\n />\n </div>\n </div>\n );\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./app/javascript/mastodon/features/ui/components/embed_modal.js"],"sourceRoot":""}