forked from AkkomaGang/akkoma
1 line
No EOL
13 KiB
Text
1 line
No EOL
13 KiB
Text
{"version":3,"sources":["webpack:///modals/embed_modal.js","webpack:///./app/javascript/mastodon/features/ui/components/embed_modal.js"],"names":["webpackJsonp","852","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__api__","_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","post","then","res","data","iframeDocument","contentWindow","document","open","write","html","close","body","style","margin","width","scrollWidth","height","scrollHeight","catch","error","onError","render","className","id","defaultMessage","type","readOnly","onClick","a","createElement","frameBorder","ref","title","propTypes","string","isRequired","onClose","func","intl","object"],"mappings":"AAAAA,cAAc,KAERC,IACA,SAAUC,EAAQC,EAAqBC,GAE7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ACxBG,KAAMzE,EAAA+D,EAAUW,OAAOJ,YDwB6DrF,EAwFrFE,KAAYF","file":"modals/embed_modal.js","sourcesContent":["webpackJsonp([32],{\n\n/***/ 852:\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__(12);\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__(7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__api__ = __webpack_require__(11);\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 Object(__WEBPACK_IMPORTED_MODULE_8__api__[\"a\" /* default */])().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 }).catch(function (error) {\n _this2.props.onError(error);\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 onError: __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.js","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='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":""} |