app/assets/javascripts/locomotive/editor.js in locomotivecms-4.1.0.rc1 vs app/assets/javascripts/locomotive/editor.js in locomotivecms-4.1.0
- old
+ new
@@ -1075,10 +1075,10 @@
\*******************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../i18n */ \"./app/javascript/src/locomotive/editor/i18n.js\");\n/* harmony import */ var client_compress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! client-compress */ \"./node_modules/client-compress/dist/index.js\");\n/* harmony import */ var client_compress__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(client_compress__WEBPACK_IMPORTED_MODULE_3__);\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\nvar Uploader = /*#__PURE__*/function (_Component) {\n _inherits(Uploader, _Component);\n\n var _super = _createSuper(Uploader);\n\n function Uploader(props) {\n var _this;\n\n _classCallCheck(this, Uploader);\n\n _this = _super.call(this, props);\n _this.state = {\n uploading: false\n };\n Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"bindAll\"])(_assertThisInitialized(_this), 'openDialog', 'handleUpload');\n return _this;\n }\n\n _createClass(Uploader, [{\n key: \"openDialog\",\n value: function openDialog() {\n this.input.click();\n }\n }, {\n key: \"_handleUpload\",\n value: function _handleUpload(files) {\n var _this2 = this;\n\n this.props.uploadAssets(files).then(function (assets) {\n _this2.setState({\n uploading: false\n }, function () {\n _this2.props.handleUpload(assets[0]);\n });\n })[\"catch\"](function (error) {\n alert('error!', error);\n });\n }\n }, {\n key: \"handleUpload\",\n value: function handleUpload(event) {\n var _this3 = this;\n\n var files = Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"compact\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(event.target.files, function (file) {\n return file.size > window.Locomotive.maximum_uploaded_file_size ? null : file;\n }));\n if (files.length != event.target.files.length) alert(_i18n__WEBPACK_IMPORTED_MODULE_2__[\"default\"].t('views.pickers.images.too_big'));\n if (files.length > 0) this.setState({\n uploading: true\n }, function () {\n // do we have to compress the images on the browser before sending them to server?\n // https://www.npmjs.com/package/client-compress\n if (_this3.props.compress !== undefined) {\n var compress = new client_compress__WEBPACK_IMPORTED_MODULE_3___default.a(_this3.props.compress);\n compress.compress(files).then(function (conversions) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(conversions, function (conversion) {\n return {\n blob: conversion.photo.data,\n filename: conversion.photo.name\n };\n });\n }).then(function (_files) {\n return _this3._handleUpload(_files);\n });\n } else _this3._handleUpload(files);\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this4 = this;\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"editor-image-uploader\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", {\n type: \"file\",\n ref: function ref(el) {\n return _this4.input = el;\n },\n onChange: this.handleUpload\n }), !this.state.uploading && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"a\", {\n className: \"editor-image-uploader--button\",\n onClick: this.openDialog\n }, _i18n__WEBPACK_IMPORTED_MODULE_2__[\"default\"].t('views.pickers.images.add')), this.state.uploading && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"editor-image-uploader--uploading\"\n }, _i18n__WEBPACK_IMPORTED_MODULE_2__[\"default\"].t('views.pickers.images.upload_in_progress')));\n }\n }]);\n\n return Uploader;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Uploader);\n\n//# sourceURL=webpack:///./app/javascript/src/locomotive/editor/views/pickers/images/uploader.js?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../i18n */ \"./app/javascript/src/locomotive/editor/i18n.js\");\n/* harmony import */ var client_compress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! client-compress */ \"./node_modules/client-compress/dist/index.js\");\n/* harmony import */ var client_compress__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(client_compress__WEBPACK_IMPORTED_MODULE_3__);\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\nvar Uploader = /*#__PURE__*/function (_Component) {\n _inherits(Uploader, _Component);\n\n var _super = _createSuper(Uploader);\n\n function Uploader(props) {\n var _this;\n\n _classCallCheck(this, Uploader);\n\n _this = _super.call(this, props);\n _this.state = {\n uploading: false\n };\n Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"bindAll\"])(_assertThisInitialized(_this), 'openDialog', 'handleUpload');\n return _this;\n }\n\n _createClass(Uploader, [{\n key: \"openDialog\",\n value: function openDialog() {\n this.input.click();\n }\n }, {\n key: \"_handleUpload\",\n value: function _handleUpload(files) {\n var _this2 = this;\n\n this.props.uploadAssets(files).then(function (assets) {\n _this2.setState({\n uploading: false\n }, function () {\n _this2.props.handleUpload(assets[0]);\n });\n })[\"catch\"](function (error) {\n alert('error!', error);\n });\n }\n }, {\n key: \"handleUpload\",\n value: function handleUpload(event) {\n var _this3 = this;\n\n var files = Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"compact\"])(Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(event.target.files, function (file) {\n return file.size > window.Locomotive.maximum_uploaded_file_size ? null : file;\n }));\n if (files.length != event.target.files.length) alert(_i18n__WEBPACK_IMPORTED_MODULE_2__[\"default\"].t('views.pickers.images.too_big'));\n if (files.length > 0) this.setState({\n uploading: true\n }, function () {\n // do we have to compress the images on the browser before sending them to server?\n // https://www.npmjs.com/package/client-compress \n if (_this3.props.compress !== undefined) {\n var options = Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"mapKeys\"])(_this3.props.compress, function (_, k) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"camelCase\"])(k);\n });\n var compress = new client_compress__WEBPACK_IMPORTED_MODULE_3___default.a(options);\n compress.compress(files).then(function (conversions) {\n return Object(lodash__WEBPACK_IMPORTED_MODULE_1__[\"map\"])(conversions, function (conversion) {\n return {\n blob: conversion.photo.data,\n filename: conversion.photo.name\n };\n });\n }).then(function (_files) {\n return _this3._handleUpload(_files);\n });\n } else _this3._handleUpload(files);\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this4 = this;\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"editor-image-uploader\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", {\n type: \"file\",\n ref: function ref(el) {\n return _this4.input = el;\n },\n onChange: this.handleUpload\n }), !this.state.uploading && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"a\", {\n className: \"editor-image-uploader--button\",\n onClick: this.openDialog\n }, _i18n__WEBPACK_IMPORTED_MODULE_2__[\"default\"].t('views.pickers.images.add')), this.state.uploading && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"editor-image-uploader--uploading\"\n }, _i18n__WEBPACK_IMPORTED_MODULE_2__[\"default\"].t('views.pickers.images.upload_in_progress')));\n }\n }]);\n\n return Uploader;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Uploader);\n\n//# sourceURL=webpack:///./app/javascript/src/locomotive/editor/views/pickers/images/uploader.js?");
/***/ }),
/***/ "./app/javascript/src/locomotive/editor/views/pickers/urls/index.js":
/*!**************************************************************************!*\
\ No newline at end of file