@pie-lib/editable-html 7.18.0 → 7.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/lib/editor.js +27 -20
- package/lib/editor.js.map +1 -1
- package/lib/index.js +27 -21
- package/lib/index.js.map +1 -1
- package/lib/plugins/image/component.js +20 -18
- package/lib/plugins/image/component.js.map +1 -1
- package/lib/plugins/image/image-toolbar.js +21 -19
- package/lib/plugins/image/image-toolbar.js.map +1 -1
- package/lib/plugins/image/index.js +7 -7
- package/lib/plugins/image/index.js.map +1 -1
- package/lib/plugins/image/insert-image-handler.js +2 -4
- package/lib/plugins/image/insert-image-handler.js.map +1 -1
- package/lib/plugins/index.js +7 -7
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/list/index.js +7 -7
- package/lib/plugins/list/index.js.map +1 -1
- package/lib/plugins/math/index.js +13 -12
- package/lib/plugins/math/index.js.map +1 -1
- package/lib/plugins/media/index.js +16 -13
- package/lib/plugins/media/index.js.map +1 -1
- package/lib/plugins/media/media-dialog.js +27 -23
- package/lib/plugins/media/media-dialog.js.map +1 -1
- package/lib/plugins/media/media-toolbar.js +19 -15
- package/lib/plugins/media/media-toolbar.js.map +1 -1
- package/lib/plugins/media/media-wrapper.js +20 -14
- package/lib/plugins/media/media-wrapper.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/choice.js +25 -19
- package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/index.js +6 -6
- package/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -1
- package/lib/plugins/respArea/explicit-constructed-response/index.js +3 -3
- package/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -1
- package/lib/plugins/respArea/icons/index.js +7 -7
- package/lib/plugins/respArea/icons/index.js.map +1 -1
- package/lib/plugins/respArea/index.js +36 -9
- package/lib/plugins/respArea/index.js.map +1 -1
- package/lib/plugins/respArea/inline-dropdown/index.js +4 -4
- package/lib/plugins/respArea/inline-dropdown/index.js.map +1 -1
- package/lib/plugins/respArea/utils.js +3 -3
- package/lib/plugins/respArea/utils.js.map +1 -1
- package/lib/plugins/table/icons/index.js +8 -8
- package/lib/plugins/table/icons/index.js.map +1 -1
- package/lib/plugins/table/index.js +19 -19
- package/lib/plugins/table/index.js.map +1 -1
- package/lib/plugins/table/table-toolbar.js +26 -24
- package/lib/plugins/table/table-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/default-toolbar.js +7 -7
- package/lib/plugins/toolbar/default-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/done-button.js +3 -3
- package/lib/plugins/toolbar/done-button.js.map +1 -1
- package/lib/plugins/toolbar/editor-and-toolbar.js +23 -19
- package/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/index.js +1 -1
- package/lib/plugins/toolbar/index.js.map +1 -1
- package/lib/plugins/toolbar/toolbar-buttons.js +22 -18
- package/lib/plugins/toolbar/toolbar-buttons.js.map +1 -1
- package/lib/plugins/toolbar/toolbar.js +25 -21
- package/lib/plugins/toolbar/toolbar.js.map +1 -1
- package/lib/plugins/utils.js +1 -1
- package/lib/serialization.js +4 -4
- package/lib/serialization.js.map +1 -1
- package/package.json +2 -2
- package/src/editor.jsx +4 -2
- package/src/plugins/respArea/explicit-constructed-response/index.jsx +1 -1
- package/src/plugins/respArea/index.jsx +28 -2
- package/src/plugins/toolbar/toolbar.jsx +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -29,23 +31,25 @@ var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
|
29
31
|
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
33
|
|
|
32
|
-
function _typeof(obj) { 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); }
|
|
33
|
-
|
|
34
34
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
35
|
|
|
36
36
|
function _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); } }
|
|
37
37
|
|
|
38
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
39
39
|
|
|
40
|
-
function
|
|
40
|
+
function _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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
|
+
|
|
44
|
+
function _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); }; }
|
|
45
|
+
|
|
46
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
43
47
|
|
|
44
48
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
49
|
|
|
46
|
-
function
|
|
50
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
51
|
|
|
48
|
-
function
|
|
52
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
53
|
|
|
50
54
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
51
55
|
|
|
@@ -103,17 +107,17 @@ var typeMap = {
|
|
|
103
107
|
audio: 'Audio'
|
|
104
108
|
};
|
|
105
109
|
|
|
106
|
-
var MediaDialog =
|
|
107
|
-
/*#__PURE__*/
|
|
108
|
-
function (_React$Component) {
|
|
110
|
+
var MediaDialog = /*#__PURE__*/function (_React$Component) {
|
|
109
111
|
_inherits(MediaDialog, _React$Component);
|
|
110
112
|
|
|
113
|
+
var _super = _createSuper(MediaDialog);
|
|
114
|
+
|
|
111
115
|
function MediaDialog(props) {
|
|
112
116
|
var _this;
|
|
113
117
|
|
|
114
118
|
_classCallCheck(this, MediaDialog);
|
|
115
119
|
|
|
116
|
-
_this =
|
|
120
|
+
_this = _super.call(this, props);
|
|
117
121
|
|
|
118
122
|
_defineProperty(_assertThisInitialized(_this), "formatUrl", function () {
|
|
119
123
|
var _this$state = _this.state,
|
|
@@ -317,7 +321,7 @@ function (_React$Component) {
|
|
|
317
321
|
formattedUrl = _this$state3.formattedUrl,
|
|
318
322
|
updating = _this$state3.updating;
|
|
319
323
|
var isYoutube = matchYoutubeUrl(url);
|
|
320
|
-
return _react["default"].createElement(_Dialog["default"], {
|
|
324
|
+
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
321
325
|
classes: {
|
|
322
326
|
paper: classes.paper
|
|
323
327
|
},
|
|
@@ -327,9 +331,9 @@ function (_React$Component) {
|
|
|
327
331
|
return _this2.handleDone(false);
|
|
328
332
|
},
|
|
329
333
|
"aria-labelledby": "form-dialog-title"
|
|
330
|
-
}, _react["default"].createElement(_DialogTitle["default"], {
|
|
334
|
+
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
|
|
331
335
|
id: "form-dialog-title"
|
|
332
|
-
}, "Insert ", typeMap[type]), _react["default"].createElement(_DialogContent["default"], null, _react["default"].createElement(_DialogContentText["default"], null, type === 'video' ? 'Insert YouTube or Vimeo URL' : 'Insert SoundCloud URL'), _react["default"].createElement(_TextField["default"], {
|
|
336
|
+
}, "Insert ", typeMap[type]), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], null, type === 'video' ? 'Insert YouTube or Vimeo URL' : 'Insert SoundCloud URL'), /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
333
337
|
autoFocus: true,
|
|
334
338
|
error: invalid,
|
|
335
339
|
helperText: invalid ? 'Invalid URL' : '',
|
|
@@ -341,11 +345,11 @@ function (_React$Component) {
|
|
|
341
345
|
onChange: this.urlChange,
|
|
342
346
|
value: url,
|
|
343
347
|
fullWidth: true
|
|
344
|
-
}), type === 'video' && _react["default"].createElement(_DialogContent["default"], {
|
|
348
|
+
}), type === 'video' && /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], {
|
|
345
349
|
classes: {
|
|
346
350
|
root: classes.properties
|
|
347
351
|
}
|
|
348
|
-
}, _react["default"].createElement(_DialogContentText["default"], null, "Video Properties"), _react["default"].createElement(_TextField["default"], {
|
|
352
|
+
}, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], null, "Video Properties"), /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
349
353
|
autoFocus: true,
|
|
350
354
|
margin: "dense",
|
|
351
355
|
id: "width",
|
|
@@ -354,7 +358,7 @@ function (_React$Component) {
|
|
|
354
358
|
placeholder: "Width",
|
|
355
359
|
value: width,
|
|
356
360
|
onChange: this.changeHandler('width')
|
|
357
|
-
}), _react["default"].createElement(_TextField["default"], {
|
|
361
|
+
}), /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
358
362
|
autoFocus: true,
|
|
359
363
|
margin: "dense",
|
|
360
364
|
id: "height",
|
|
@@ -363,18 +367,18 @@ function (_React$Component) {
|
|
|
363
367
|
placeholder: "Height",
|
|
364
368
|
value: height,
|
|
365
369
|
onChange: this.changeHandler('height')
|
|
366
|
-
})), formattedUrl && _react["default"].createElement("iframe", {
|
|
370
|
+
})), formattedUrl && /*#__PURE__*/_react["default"].createElement("iframe", {
|
|
367
371
|
width: width,
|
|
368
372
|
height: height,
|
|
369
373
|
src: formattedUrl,
|
|
370
374
|
frameBorder: "0",
|
|
371
375
|
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
372
376
|
allowFullScreen: true
|
|
373
|
-
}), type === 'video' && (formattedUrl || updating) && !invalid && _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_DialogContent["default"], {
|
|
377
|
+
}), type === 'video' && (formattedUrl || updating) && !invalid && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], {
|
|
374
378
|
classes: {
|
|
375
379
|
root: classes.properties
|
|
376
380
|
}
|
|
377
|
-
}, _react["default"].createElement(_TextField["default"], {
|
|
381
|
+
}, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
378
382
|
autoFocus: true,
|
|
379
383
|
margin: "dense",
|
|
380
384
|
id: "starts",
|
|
@@ -383,7 +387,7 @@ function (_React$Component) {
|
|
|
383
387
|
placeholder: "Starts",
|
|
384
388
|
value: starts,
|
|
385
389
|
onChange: this.changeHandler('starts')
|
|
386
|
-
}), isYoutube && _react["default"].createElement(_TextField["default"], {
|
|
390
|
+
}), isYoutube && /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
387
391
|
autoFocus: true,
|
|
388
392
|
margin: "dense",
|
|
389
393
|
id: "ends",
|
|
@@ -392,12 +396,12 @@ function (_React$Component) {
|
|
|
392
396
|
placeholder: "Ends",
|
|
393
397
|
value: ends,
|
|
394
398
|
onChange: this.changeHandler('ends')
|
|
395
|
-
})))), _react["default"].createElement(_DialogActions["default"], null, _react["default"].createElement(_Button["default"], {
|
|
399
|
+
})))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
396
400
|
onClick: function onClick() {
|
|
397
401
|
return _this2.handleDone(false);
|
|
398
402
|
},
|
|
399
403
|
color: "primary"
|
|
400
|
-
}, "Cancel"), _react["default"].createElement(_Button["default"], {
|
|
404
|
+
}, "Cancel"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
401
405
|
disabled: invalid || url === null || url === undefined,
|
|
402
406
|
onClick: function onClick() {
|
|
403
407
|
return _this2.handleDone(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/media/media-dialog.js"],"names":["log","matchYoutubeUrl","url","p","match","matchVimeoUrl","test","matchSoundCloudUrl","regexp","makeApiRequest","Promise","resolve","fetch","then","response","json","d","document","createElement","innerHTML","html","iframe","querySelector","src","err","typeMap","video","audio","MediaDialog","props","state","urlToUse","starts","ends","isYoutube","isVimeo","formattedUrl","params","paramName","paramStart","push","length","join","callback","setState","updating","newState","formatUrl","e","target","value","type","handleStateChange","invalid","regExp","id","replace","val","handleClose","height","width","urlChange","classes","open","disablePortal","edit","paper","handleDone","root","properties","changeHandler","undefined","React","Component","PropTypes","object","isRequired","bool","func","string","number","styles","minWidth","padding"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6CAAN,CAAZ;;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAAAC,GAAG,EAAI;AAC7B,MAAI,CAACA,GAAL,EAAU;AACR,WAAO,KAAP;AACD;;AAED,MAAMC,CAAC,GAAG,0HAAV;;AACA,MAAID,GAAG,CAACE,KAAJ,CAAUD,CAAV,CAAJ,EAAkB;AAChB,WAAOD,GAAG,CAACE,KAAJ,CAAUD,CAAV,EAAa,CAAb,CAAP;AACD;;AACD,SAAO,KAAP;AACD,CAVD;;AAYA,IAAME,aAAa,GAAG,SAAhBA,aAAgB,CAAAH,GAAG;AAAA,SACvBA,GAAG,IACH,8HAA8HI,IAA9H,CACEJ,GADF,CAFuB;AAAA,CAAzB;;AAMA,IAAMK,kBAAkB,GAAG,SAArBA,kBAAqB,CAAAL,GAAG,EAAI;AAChC,MAAI,CAACA,GAAL,EAAU;AACR,WAAO,KAAP;AACD;;AAED,MAAMM,MAAM,GAAG,8CAAf;AACA,SAAON,GAAG,CAACE,KAAJ,CAAUI,MAAV,KAAqBN,GAAG,CAACE,KAAJ,CA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AAAA,GAAG,EAAEwE,sBAAUK,MARE;AASjBhD,EAAAA,QAAQ,EAAE2C,sBAAUK,MATH;AAUjB/C,EAAAA,MAAM,EAAE0C,sBAAUM,MAVD;AAWjB/C,EAAAA,IAAI,EAAEyC,sBAAUM,MAXC;AAYjBrB,EAAAA,MAAM,EAAEe,sBAAUM,MAZD;AAajBpB,EAAAA,KAAK,EAAEc,sBAAUM;AAbA,C;;AAmSrB,IAAMC,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBf,IAAAA,KAAK,EAAE;AACLgB,MAAAA,QAAQ,EAAE;AADL,KADa;AAIpBb,IAAAA,UAAU,EAAE;AACVc,MAAAA,OAAO,EAAE;AADC;AAJQ,GAAP;AAAA,CAAf;;eASe,wBAAWF,MAAX,EAAmBrD,WAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport Button from '@material-ui/core/Button';\nimport TextField from '@material-ui/core/TextField';\n\nconst log = debug('@pie-lib:editable-html:plugins:media:dialog');\n\nconst matchYoutubeUrl = url => {\n if (!url) {\n return false;\n }\n\n const p = /^(?:https?:\\/\\/)?(?:m\\.|www\\.)?(?:youtu\\.be\\/|youtube\\.com\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&v=))((\\w|-){11})(?:\\S+)?$/;\n if (url.match(p)) {\n return url.match(p)[1];\n }\n return false;\n};\n\nconst matchVimeoUrl = url =>\n url &&\n /(http|https)?:\\/\\/(www\\.)?(player\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^/]*)\\/videos\\/|)(video\\/)?(\\d+)(?:|\\/\\?)/.test(\n url\n );\n\nconst matchSoundCloudUrl = url => {\n if (!url) {\n return false;\n }\n\n const regexp = /^https?:\\/\\/(soundcloud\\.com|snd\\.sc)\\/(.*)$/;\n return url.match(regexp) && url.match(regexp)[2];\n};\n\nconst makeApiRequest = url => {\n return new Promise(resolve => {\n try {\n fetch(`https://soundcloud.com/oembed?format=json&url=${url}`)\n .then(response => response.json())\n .then(json => {\n const d = document.createElement('div');\n\n d.innerHTML = json.html;\n\n const iframe = d.querySelector('iframe');\n\n resolve(iframe.src);\n })\n .catch(err => {\n resolve('');\n log(err);\n });\n } catch (err) {\n resolve('');\n }\n });\n};\n\nconst typeMap = {\n video: 'Video',\n audio: 'Audio'\n};\n\nexport class MediaDialog extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n open: PropTypes.bool,\n edit: PropTypes.bool,\n disablePortal: PropTypes.bool,\n handleClose: PropTypes.func,\n type: PropTypes.string,\n src: PropTypes.string,\n url: PropTypes.string,\n urlToUse: PropTypes.string,\n starts: PropTypes.number,\n ends: PropTypes.number,\n height: PropTypes.number,\n width: PropTypes.number\n };\n\n constructor(props) {\n super(props);\n\n const { src, starts, ends, height, url, urlToUse, width } = props;\n\n this.state = {\n ends: ends || 0,\n url: url,\n urlToUse: urlToUse,\n formattedUrl: src,\n height: height || 315,\n invalid: false,\n starts: starts || 0,\n width: width || 560\n };\n }\n\n componentDidMount() {\n if (this.props.url) {\n this.urlChange({\n target: {\n value: this.props.url\n }\n });\n }\n }\n\n formatUrl = () => {\n const { url, urlToUse, starts, ends } = this.state;\n const isYoutube = matchYoutubeUrl(url);\n const isVimeo = matchVimeoUrl(url);\n let formattedUrl = urlToUse;\n\n if ((isYoutube || isVimeo) && urlToUse) {\n const params = [];\n\n let paramName;\n let paramStart;\n\n switch (true) {\n case isVimeo:\n paramName = 't';\n paramStart = '#';\n break;\n case isYoutube:\n paramName = 'start';\n paramStart = '?';\n break;\n default:\n paramName = 'start';\n paramStart = '?';\n }\n\n if (starts) {\n params.push(`${paramName}=${starts}`);\n }\n\n if (ends) {\n params.push(`end=${ends}`);\n }\n\n formattedUrl = `${urlToUse}${params.length ? paramStart : ''}${params.join('&')}`;\n }\n\n const callback = () => this.setState({ formattedUrl, updating: false });\n\n this.setState({ formattedUrl: null, updating: true }, callback);\n };\n\n handleStateChange = newState => this.setState(newState, this.formatUrl);\n\n urlChange = e => {\n const { value } = e.target || {};\n const { type } = this.props;\n\n if (type && type === 'audio') {\n if (matchSoundCloudUrl(value)) {\n makeApiRequest(value)\n .then(urlToUse => {\n this.handleStateChange({\n urlToUse,\n invalid: !urlToUse,\n url: value\n });\n })\n .catch(log);\n\n return;\n }\n } else if (type && type === 'video') {\n if (matchYoutubeUrl(value)) {\n const regExp = /^.*(youtu\\.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|&v=)([^#&?]*).*/;\n const match = value.match(regExp);\n const id = match[2];\n const urlToUse = `https://youtube.com/embed/${id}`;\n\n log('is youtube');\n\n this.handleStateChange({\n urlToUse,\n url: value,\n invalid: false\n });\n\n return;\n }\n\n if (matchVimeoUrl(value)) {\n const id = value.replace(/.*vimeo.com\\/(.*)/g, '$1');\n const urlToUse = `https://player.vimeo.com/video/${id}`;\n\n log('is vimeo');\n\n this.handleStateChange({\n urlToUse,\n url: value,\n ends: null,\n invalid: false\n });\n\n return;\n }\n }\n\n this.handleStateChange({\n urlToUse: null,\n url: null,\n invalid: true\n });\n };\n\n changeHandler = type => e => this.handleStateChange({ [type]: e.target.value });\n\n handleDone = val => {\n const { handleClose } = this.props;\n\n if (!val) {\n handleClose(val);\n } else {\n const { ends, height, url, urlToUse, formattedUrl, starts, width } = this.state;\n\n handleClose(val, {\n ends,\n height,\n starts,\n width,\n url,\n urlToUse,\n src: formattedUrl\n });\n }\n };\n\n render() {\n const { classes, open, disablePortal, type, edit } = this.props;\n const { ends, height, invalid, starts, width, url, formattedUrl, updating } = this.state;\n const isYoutube = matchYoutubeUrl(url);\n\n return (\n <Dialog\n classes={{\n paper: classes.paper\n }}\n disablePortal={disablePortal}\n open={open}\n onClose={() => this.handleDone(false)}\n aria-labelledby=\"form-dialog-title\"\n >\n <DialogTitle id=\"form-dialog-title\">Insert {typeMap[type]}</DialogTitle>\n <DialogContent>\n <DialogContentText>\n {type === 'video' ? 'Insert YouTube or Vimeo URL' : 'Insert SoundCloud URL'}\n </DialogContentText>\n <TextField\n autoFocus\n error={invalid}\n helperText={invalid ? 'Invalid URL' : ''}\n margin=\"dense\"\n id=\"name\"\n label=\"URL\"\n placeholder={`Paste URL of ${type}...`}\n type=\"text\"\n onChange={this.urlChange}\n value={url}\n fullWidth\n />\n {type === 'video' && (\n <DialogContent\n classes={{\n root: classes.properties\n }}\n >\n <DialogContentText>Video Properties</DialogContentText>\n <TextField\n autoFocus\n margin=\"dense\"\n id=\"width\"\n label=\"Width\"\n type=\"number\"\n placeholder=\"Width\"\n value={width}\n onChange={this.changeHandler('width')}\n />\n <TextField\n autoFocus\n margin=\"dense\"\n id=\"height\"\n label=\"Height\"\n type=\"number\"\n placeholder=\"Height\"\n value={height}\n onChange={this.changeHandler('height')}\n />\n </DialogContent>\n )}\n {formattedUrl && (\n <iframe\n width={width}\n height={height}\n src={formattedUrl}\n frameBorder=\"0\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n />\n )}\n {type === 'video' && (formattedUrl || updating) && !invalid && (\n <React.Fragment>\n <DialogContent\n classes={{\n root: classes.properties\n }}\n >\n <TextField\n autoFocus\n margin=\"dense\"\n id=\"starts\"\n label=\"Starts\"\n type=\"number\"\n placeholder=\"Starts\"\n value={starts}\n onChange={this.changeHandler('starts')}\n />\n {isYoutube && (\n <TextField\n autoFocus\n margin=\"dense\"\n id=\"ends\"\n label=\"Ends\"\n type=\"number\"\n placeholder=\"Ends\"\n value={ends}\n onChange={this.changeHandler('ends')}\n />\n )}\n </DialogContent>\n </React.Fragment>\n )}\n </DialogContent>\n <DialogActions>\n <Button onClick={() => this.handleDone(false)} color=\"primary\">\n Cancel\n </Button>\n <Button\n disabled={invalid || url === null || url === undefined}\n onClick={() => this.handleDone(true)}\n color=\"primary\"\n >\n {edit ? 'Update' : 'Insert'}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n\nconst styles = () => ({\n paper: {\n minWidth: '500px'\n },\n properties: {\n padding: 0\n }\n});\n\nexport default withStyles(styles)(MediaDialog);\n"],"file":"media-dialog.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/plugins/media/media-dialog.js"],"names":["log","matchYoutubeUrl","url","p","match","matchVimeoUrl","test","matchSoundCloudUrl","regexp","makeApiRequest","Promise","resolve","fetch","then","response","json","d","document","createElement","innerHTML","html","iframe","querySelector","src","err","typeMap","video","audio","MediaDialog","props","state","urlToUse","starts","ends","isYoutube","isVimeo","formattedUrl","params","paramName","paramStart","push","length","join","callback","setState","updating","newState","formatUrl","e","target","value","type","handleStateChange","invalid","regExp","id","replace","val","handleClose","height","width","urlChange","classes","open","disablePortal","edit","paper","handleDone","root","properties","changeHandler","undefined","React","Component","PropTypes","object","isRequired","bool","func","string","number","styles","minWidth","padding"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6CAAN,CAAZ;;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAAAC,GAAG,EAAI;AAC7B,MAAI,CAACA,GAAL,EAAU;AACR,WAAO,KAAP;AACD;;AAED,MAAMC,CAAC,GAAG,0HAAV;;AACA,MAAID,GAAG,CAACE,KAAJ,CAAUD,CAAV,CAAJ,EAAkB;AAChB,WAAOD,GAAG,CAACE,KAAJ,CAAUD,CAAV,EAAa,CAAb,CAAP;AACD;;AACD,SAAO,KAAP;AACD,CAVD;;AAYA,IAAME,aAAa,GAAG,SAAhBA,aAAgB,CAAAH,GAAG;AAAA,SACvBA,GAAG,IACH,8HAA8HI,IAA9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AkHD;;;;EAjS8BO,kBAAMC,S;;;;gBAA1B7C,W,eACQ;AACjBkC,EAAAA,OAAO,EAAEY,sBAAUC,MAAV,CAAiBC,UADT;AAEjBb,EAAAA,IAAI,EAAEW,sBAAUG,IAFC;AAGjBZ,EAAAA,IAAI,EAAES,sBAAUG,IAHC;AAIjBb,EAAAA,aAAa,EAAEU,sBAAUG,IAJR;AAKjBnB,EAAAA,WAAW,EAAEgB,sBAAUI,IALN;AAMjB3B,EAAAA,IAAI,EAAEuB,sBAAUK,MANC;AAOjBxD,EAAAA,GAAG,EAAEmD,sBAAUK,MAPE;AAQjB7E,EAAAA,GAAG,EAAEwE,sBAAUK,MARE;AASjBhD,EAAAA,QAAQ,EAAE2C,sBAAUK,MATH;AAUjB/C,EAAAA,MAAM,EAAE0C,sBAAUM,MAVD;AAWjB/C,EAAAA,IAAI,EAAEyC,sBAAUM,MAXC;AAYjBrB,EAAAA,MAAM,EAAEe,sBAAUM,MAZD;AAajBpB,EAAAA,KAAK,EAAEc,sBAAUM;AAbA,C;;AAmSrB,IAAMC,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBf,IAAAA,KAAK,EAAE;AACLgB,MAAAA,QAAQ,EAAE;AADL,KADa;AAIpBb,IAAAA,UAAU,EAAE;AACVc,MAAAA,OAAO,EAAE;AADC;AAJQ,GAAP;AAAA,CAAf;;eASe,wBAAWF,MAAX,EAAmBrD,WAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport Button from '@material-ui/core/Button';\nimport TextField from '@material-ui/core/TextField';\n\nconst log = debug('@pie-lib:editable-html:plugins:media:dialog');\n\nconst matchYoutubeUrl = url => {\n if (!url) {\n return false;\n }\n\n const p = /^(?:https?:\\/\\/)?(?:m\\.|www\\.)?(?:youtu\\.be\\/|youtube\\.com\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&v=))((\\w|-){11})(?:\\S+)?$/;\n if (url.match(p)) {\n return url.match(p)[1];\n }\n return false;\n};\n\nconst matchVimeoUrl = url =>\n url &&\n /(http|https)?:\\/\\/(www\\.)?(player\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^/]*)\\/videos\\/|)(video\\/)?(\\d+)(?:|\\/\\?)/.test(\n url\n );\n\nconst matchSoundCloudUrl = url => {\n if (!url) {\n return false;\n }\n\n const regexp = /^https?:\\/\\/(soundcloud\\.com|snd\\.sc)\\/(.*)$/;\n return url.match(regexp) && url.match(regexp)[2];\n};\n\nconst makeApiRequest = url => {\n return new Promise(resolve => {\n try {\n fetch(`https://soundcloud.com/oembed?format=json&url=${url}`)\n .then(response => response.json())\n .then(json => {\n const d = document.createElement('div');\n\n d.innerHTML = json.html;\n\n const iframe = d.querySelector('iframe');\n\n resolve(iframe.src);\n })\n .catch(err => {\n resolve('');\n log(err);\n });\n } catch (err) {\n resolve('');\n }\n });\n};\n\nconst typeMap = {\n video: 'Video',\n audio: 'Audio'\n};\n\nexport class MediaDialog extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n open: PropTypes.bool,\n edit: PropTypes.bool,\n disablePortal: PropTypes.bool,\n handleClose: PropTypes.func,\n type: PropTypes.string,\n src: PropTypes.string,\n url: PropTypes.string,\n urlToUse: PropTypes.string,\n starts: PropTypes.number,\n ends: PropTypes.number,\n height: PropTypes.number,\n width: PropTypes.number\n };\n\n constructor(props) {\n super(props);\n\n const { src, starts, ends, height, url, urlToUse, width } = props;\n\n this.state = {\n ends: ends || 0,\n url: url,\n urlToUse: urlToUse,\n formattedUrl: src,\n height: height || 315,\n invalid: false,\n starts: starts || 0,\n width: width || 560\n };\n }\n\n componentDidMount() {\n if (this.props.url) {\n this.urlChange({\n target: {\n value: this.props.url\n }\n });\n }\n }\n\n formatUrl = () => {\n const { url, urlToUse, starts, ends } = this.state;\n const isYoutube = matchYoutubeUrl(url);\n const isVimeo = matchVimeoUrl(url);\n let formattedUrl = urlToUse;\n\n if ((isYoutube || isVimeo) && urlToUse) {\n const params = [];\n\n let paramName;\n let paramStart;\n\n switch (true) {\n case isVimeo:\n paramName = 't';\n paramStart = '#';\n break;\n case isYoutube:\n paramName = 'start';\n paramStart = '?';\n break;\n default:\n paramName = 'start';\n paramStart = '?';\n }\n\n if (starts) {\n params.push(`${paramName}=${starts}`);\n }\n\n if (ends) {\n params.push(`end=${ends}`);\n }\n\n formattedUrl = `${urlToUse}${params.length ? paramStart : ''}${params.join('&')}`;\n }\n\n const callback = () => this.setState({ formattedUrl, updating: false });\n\n this.setState({ formattedUrl: null, updating: true }, callback);\n };\n\n handleStateChange = newState => this.setState(newState, this.formatUrl);\n\n urlChange = e => {\n const { value } = e.target || {};\n const { type } = this.props;\n\n if (type && type === 'audio') {\n if (matchSoundCloudUrl(value)) {\n makeApiRequest(value)\n .then(urlToUse => {\n this.handleStateChange({\n urlToUse,\n invalid: !urlToUse,\n url: value\n });\n })\n .catch(log);\n\n return;\n }\n } else if (type && type === 'video') {\n if (matchYoutubeUrl(value)) {\n const regExp = /^.*(youtu\\.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|&v=)([^#&?]*).*/;\n const match = value.match(regExp);\n const id = match[2];\n const urlToUse = `https://youtube.com/embed/${id}`;\n\n log('is youtube');\n\n this.handleStateChange({\n urlToUse,\n url: value,\n invalid: false\n });\n\n return;\n }\n\n if (matchVimeoUrl(value)) {\n const id = value.replace(/.*vimeo.com\\/(.*)/g, '$1');\n const urlToUse = `https://player.vimeo.com/video/${id}`;\n\n log('is vimeo');\n\n this.handleStateChange({\n urlToUse,\n url: value,\n ends: null,\n invalid: false\n });\n\n return;\n }\n }\n\n this.handleStateChange({\n urlToUse: null,\n url: null,\n invalid: true\n });\n };\n\n changeHandler = type => e => this.handleStateChange({ [type]: e.target.value });\n\n handleDone = val => {\n const { handleClose } = this.props;\n\n if (!val) {\n handleClose(val);\n } else {\n const { ends, height, url, urlToUse, formattedUrl, starts, width } = this.state;\n\n handleClose(val, {\n ends,\n height,\n starts,\n width,\n url,\n urlToUse,\n src: formattedUrl\n });\n }\n };\n\n render() {\n const { classes, open, disablePortal, type, edit } = this.props;\n const { ends, height, invalid, starts, width, url, formattedUrl, updating } = this.state;\n const isYoutube = matchYoutubeUrl(url);\n\n return (\n <Dialog\n classes={{\n paper: classes.paper\n }}\n disablePortal={disablePortal}\n open={open}\n onClose={() => this.handleDone(false)}\n aria-labelledby=\"form-dialog-title\"\n >\n <DialogTitle id=\"form-dialog-title\">Insert {typeMap[type]}</DialogTitle>\n <DialogContent>\n <DialogContentText>\n {type === 'video' ? 'Insert YouTube or Vimeo URL' : 'Insert SoundCloud URL'}\n </DialogContentText>\n <TextField\n autoFocus\n error={invalid}\n helperText={invalid ? 'Invalid URL' : ''}\n margin=\"dense\"\n id=\"name\"\n label=\"URL\"\n placeholder={`Paste URL of ${type}...`}\n type=\"text\"\n onChange={this.urlChange}\n value={url}\n fullWidth\n />\n {type === 'video' && (\n <DialogContent\n classes={{\n root: classes.properties\n }}\n >\n <DialogContentText>Video Properties</DialogContentText>\n <TextField\n autoFocus\n margin=\"dense\"\n id=\"width\"\n label=\"Width\"\n type=\"number\"\n placeholder=\"Width\"\n value={width}\n onChange={this.changeHandler('width')}\n />\n <TextField\n autoFocus\n margin=\"dense\"\n id=\"height\"\n label=\"Height\"\n type=\"number\"\n placeholder=\"Height\"\n value={height}\n onChange={this.changeHandler('height')}\n />\n </DialogContent>\n )}\n {formattedUrl && (\n <iframe\n width={width}\n height={height}\n src={formattedUrl}\n frameBorder=\"0\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n />\n )}\n {type === 'video' && (formattedUrl || updating) && !invalid && (\n <React.Fragment>\n <DialogContent\n classes={{\n root: classes.properties\n }}\n >\n <TextField\n autoFocus\n margin=\"dense\"\n id=\"starts\"\n label=\"Starts\"\n type=\"number\"\n placeholder=\"Starts\"\n value={starts}\n onChange={this.changeHandler('starts')}\n />\n {isYoutube && (\n <TextField\n autoFocus\n margin=\"dense\"\n id=\"ends\"\n label=\"Ends\"\n type=\"number\"\n placeholder=\"Ends\"\n value={ends}\n onChange={this.changeHandler('ends')}\n />\n )}\n </DialogContent>\n </React.Fragment>\n )}\n </DialogContent>\n <DialogActions>\n <Button onClick={() => this.handleDone(false)} color=\"primary\">\n Cancel\n </Button>\n <Button\n disabled={invalid || url === null || url === undefined}\n onClick={() => this.handleDone(true)}\n color=\"primary\"\n >\n {edit ? 'Update' : 'Insert'}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n\nconst styles = () => ({\n paper: {\n minWidth: '500px'\n },\n properties: {\n padding: 0\n }\n});\n\nexport default withStyles(styles)(MediaDialog);\n"],"file":"media-dialog.js"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -13,23 +15,25 @@ var _styles = require("@material-ui/core/styles");
|
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
17
|
|
|
16
|
-
function _typeof(obj) { 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); }
|
|
17
|
-
|
|
18
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
19
|
|
|
20
20
|
function _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); } }
|
|
21
21
|
|
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
function _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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
27
|
|
|
28
|
-
function
|
|
28
|
+
function _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); }; }
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
31
31
|
|
|
32
|
-
function
|
|
32
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
+
|
|
34
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
|
+
|
|
36
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
37
|
|
|
34
38
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
39
|
|
|
@@ -60,15 +64,15 @@ var useStyles = (0, _styles.withStyles)(function (theme) {
|
|
|
60
64
|
};
|
|
61
65
|
});
|
|
62
66
|
|
|
63
|
-
var MediaToolbar =
|
|
64
|
-
/*#__PURE__*/
|
|
65
|
-
function (_React$Component) {
|
|
67
|
+
var MediaToolbar = /*#__PURE__*/function (_React$Component) {
|
|
66
68
|
_inherits(MediaToolbar, _React$Component);
|
|
67
69
|
|
|
70
|
+
var _super = _createSuper(MediaToolbar);
|
|
71
|
+
|
|
68
72
|
function MediaToolbar() {
|
|
69
73
|
_classCallCheck(this, MediaToolbar);
|
|
70
74
|
|
|
71
|
-
return
|
|
75
|
+
return _super.apply(this, arguments);
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
_createClass(MediaToolbar, [{
|
|
@@ -78,12 +82,12 @@ function (_React$Component) {
|
|
|
78
82
|
classes = _this$props.classes,
|
|
79
83
|
onEdit = _this$props.onEdit,
|
|
80
84
|
onRemove = _this$props.onRemove;
|
|
81
|
-
return _react["default"].createElement("span", {
|
|
85
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
82
86
|
className: classes.root
|
|
83
|
-
}, _react["default"].createElement("span", {
|
|
87
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
84
88
|
className: classes.editContainer,
|
|
85
89
|
onClick: onEdit
|
|
86
|
-
}, "Edit Settings"), _react["default"].createElement("span", {
|
|
90
|
+
}, "Edit Settings"), /*#__PURE__*/_react["default"].createElement("span", {
|
|
87
91
|
className: classes.removeContainer,
|
|
88
92
|
onClick: onRemove
|
|
89
93
|
}, "Remove"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/media/media-toolbar.jsx"],"names":["useStyles","theme","root","position","bottom","left","width","background","display","padding","boxShadow","editContainer","cursor","flex","border","textAlign","borderWidth","marginRight","paddingRight","removeContainer","MediaToolbar","props","classes","onEdit","onRemove","React","Component","PropTypes","object","func"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/plugins/media/media-toolbar.jsx"],"names":["useStyles","theme","root","position","bottom","left","width","background","display","padding","boxShadow","editContainer","cursor","flex","border","textAlign","borderWidth","marginRight","paddingRight","removeContainer","MediaToolbar","props","classes","onEdit","onRemove","React","Component","PropTypes","object","func"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,SAAS,GAAG,wBAAW,UAAAC,KAAK;AAAA,SAAK;AACrCC,IAAAA,IAAI,EAAE;AACJC,MAAAA,QAAQ,EAAE,UADN;AAEJC,MAAAA,MAAM,EAAE,KAFJ;AAGJC,MAAAA,IAAI,EAAE,CAHF;AAIJC,MAAAA,KAAK,EAAE,MAJH;AAKJC,MAAAA,UAAU,EAAE,OALR;AAMJC,MAAAA,OAAO,EAAE,aANL;AAOJC,MAAAA,OAAO,EAAE,KAPL;AAQJC,MAAAA,SAAS,EAAE;AARP,KAD+B;AAWrCC,IAAAA,aAAa,EAAE;AACbC,MAAAA,MAAM,EAAE,SADK;AAEbC,MAAAA,IAAI,EAAE,CAFO;AAGbC,MAAAA,MAAM,EAAE,aAHK;AAIbC,MAAAA,SAAS,EAAE,OAJE;AAKbC,MAAAA,WAAW,EAAE,WALA;AAMbC,MAAAA,WAAW,EAAE,KANA;AAObC,MAAAA,YAAY,EAAE;AAPD,KAXsB;AAoBrCC,IAAAA,eAAe,EAAE;AACfP,MAAAA,MAAM,EAAE;AADO;AApBoB,GAAL;AAAA,CAAhB,CAAlB;;IAyBMQ,Y;;;;;;;;;;;;;WAOJ,kBAAS;AACP,wBAAsC,KAAKC,KAA3C;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,MAAjB,eAAiBA,MAAjB;AAAA,UAAyBC,QAAzB,eAAyBA,QAAzB;AAEA,0BACE;AAAM,QAAA,SAAS,EAAEF,OAAO,CAACpB;AAAzB,sBACE;AAAM,QAAA,SAAS,EAAEoB,OAAO,CAACX,aAAzB;AAAwC,QAAA,OAAO,EAAEY;AAAjD,yBADF,eAIE;AAAM,QAAA,SAAS,EAAED,OAAO,CAACH,eAAzB;AAA0C,QAAA,OAAO,EAAEK;AAAnD,kBAJF,CADF;AAUD;;;;EApBwBC,kBAAMC,S;;gBAA3BN,Y,eACe;AACjBE,EAAAA,OAAO,EAAEK,sBAAUC,MADF;AAEjBL,EAAAA,MAAM,EAAEI,sBAAUE,IAFD;AAGjBL,EAAAA,QAAQ,EAAEG,sBAAUE;AAHH,C;;eAsBN7B,SAAS,CAACoB,YAAD,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\n\nconst useStyles = withStyles(theme => ({\n root: {\n position: 'relative',\n bottom: '5px',\n left: 0,\n width: '100%',\n background: 'white',\n display: 'inline-flex',\n padding: '5px',\n boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)'\n },\n editContainer: {\n cursor: 'pointer',\n flex: 3,\n border: 'solid black',\n textAlign: 'right',\n borderWidth: '0 2px 0 0',\n marginRight: '5px',\n paddingRight: '5px'\n },\n removeContainer: {\n cursor: 'pointer'\n }\n}));\n\nclass MediaToolbar extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n onEdit: PropTypes.func,\n onRemove: PropTypes.func\n };\n\n render() {\n const { classes, onEdit, onRemove } = this.props;\n\n return (\n <span className={classes.root}>\n <span className={classes.editContainer} onClick={onEdit}>\n Edit Settings\n </span>\n <span className={classes.removeContainer} onClick={onRemove}>\n Remove\n </span>\n </span>\n );\n }\n}\n\nexport default useStyles(MediaToolbar);\n"],"file":"media-toolbar.js"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -13,9 +15,9 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
15
|
|
|
14
16
|
var _styles = require("@material-ui/core/styles");
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
var _excluded = ["editor", "classes", "children", "width"];
|
|
17
19
|
|
|
18
|
-
function
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
21
|
|
|
20
22
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
23
|
|
|
@@ -27,17 +29,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
27
29
|
|
|
28
30
|
function _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); } }
|
|
29
31
|
|
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
32
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
33
|
|
|
32
|
-
function
|
|
34
|
+
function _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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
35
|
|
|
34
|
-
function
|
|
36
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
37
|
|
|
36
|
-
function
|
|
38
|
+
function _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); }; }
|
|
37
39
|
|
|
38
|
-
function
|
|
40
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
39
41
|
|
|
40
|
-
function
|
|
42
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
|
+
|
|
44
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
|
+
|
|
46
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
47
|
|
|
42
48
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
43
49
|
|
|
@@ -53,15 +59,15 @@ var useStyles = (0, _styles.withStyles)(function () {
|
|
|
53
59
|
};
|
|
54
60
|
});
|
|
55
61
|
|
|
56
|
-
var MediaWrapper =
|
|
57
|
-
/*#__PURE__*/
|
|
58
|
-
function (_React$Component) {
|
|
62
|
+
var MediaWrapper = /*#__PURE__*/function (_React$Component) {
|
|
59
63
|
_inherits(MediaWrapper, _React$Component);
|
|
60
64
|
|
|
65
|
+
var _super = _createSuper(MediaWrapper);
|
|
66
|
+
|
|
61
67
|
function MediaWrapper() {
|
|
62
68
|
_classCallCheck(this, MediaWrapper);
|
|
63
69
|
|
|
64
|
-
return
|
|
70
|
+
return _super.apply(this, arguments);
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
_createClass(MediaWrapper, [{
|
|
@@ -72,9 +78,9 @@ function (_React$Component) {
|
|
|
72
78
|
classes = _this$props.classes,
|
|
73
79
|
children = _this$props.children,
|
|
74
80
|
width = _this$props.width,
|
|
75
|
-
rest = _objectWithoutProperties(_this$props,
|
|
81
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
76
82
|
|
|
77
|
-
return _react["default"].createElement("span", _extends({
|
|
83
|
+
return /*#__PURE__*/_react["default"].createElement("span", _extends({
|
|
78
84
|
className: (0, _classnames["default"])(classes.root, _defineProperty({}, classes.editor, editor))
|
|
79
85
|
}, rest, {
|
|
80
86
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/plugins/media/media-wrapper.jsx"],"names":["useStyles","root","position","editor","display","overflow","MediaWrapper","props","classes","children","width","rest","React","Component","PropTypes","object","array","bool","oneOfType","number","string"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/plugins/media/media-wrapper.jsx"],"names":["useStyles","root","position","editor","display","overflow","MediaWrapper","props","classes","children","width","rest","React","Component","PropTypes","object","array","bool","oneOfType","number","string"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,SAAS,GAAG,wBAAW;AAAA,SAAO;AAClCC,IAAAA,IAAI,EAAE;AACJC,MAAAA,QAAQ,EAAE;AADN,KAD4B;AAIlCC,IAAAA,MAAM,EAAE;AACNC,MAAAA,OAAO,EAAE,cADH;AAENC,MAAAA,QAAQ,EAAE;AAFJ;AAJ0B,GAAP;AAAA,CAAX,CAAlB;;IAUMC,Y;;;;;;;;;;;;;WAQJ,kBAAS;AACP,wBAAsD,KAAKC,KAA3D;AAAA,UAAQJ,MAAR,eAAQA,MAAR;AAAA,UAAgBK,OAAhB,eAAgBA,OAAhB;AAAA,UAAyBC,QAAzB,eAAyBA,QAAzB;AAAA,UAAmCC,KAAnC,eAAmCA,KAAnC;AAAA,UAA6CC,IAA7C;;AAEA,0BACE;AACE,QAAA,SAAS,EAAE,4BAAWH,OAAO,CAACP,IAAnB,sBACRO,OAAO,CAACL,MADA,EACSA,MADT;AADb,SAIMQ,IAJN;AAKE,QAAA,KAAK,EAAE;AACLD,UAAAA,KAAK,EAAEA,KAAK,IAAI;AADX;AALT,UASGD,QATH,CADF;AAaD;;;;EAxBwBG,kBAAMC,S;;gBAA3BP,Y,eACe;AACjBE,EAAAA,OAAO,EAAEM,sBAAUC,MADF;AAEjBN,EAAAA,QAAQ,EAAEK,sBAAUE,KAFH;AAGjBb,EAAAA,MAAM,EAAEW,sBAAUG,IAHD;AAIjBP,EAAAA,KAAK,EAAEI,sBAAUI,SAAV,CAAoB,CAACJ,sBAAUK,MAAX,EAAmBL,sBAAUM,MAA7B,CAApB;AAJU,C;;eA0BNpB,SAAS,CAACM,YAAD,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\n\nconst useStyles = withStyles(() => ({\n root: {\n position: 'relative'\n },\n editor: {\n display: 'inline-block',\n overflow: 'hidden'\n }\n}));\n\nclass MediaWrapper extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n children: PropTypes.array,\n editor: PropTypes.bool,\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n };\n\n render() {\n const { editor, classes, children, width, ...rest } = this.props;\n\n return (\n <span\n className={classNames(classes.root, {\n [classes.editor]: editor\n })}\n {...rest}\n style={{\n width: width || 300\n }}\n >\n {children}\n </span>\n );\n }\n}\n\nexport default useStyles(MediaWrapper);\n"],"file":"media-wrapper.js"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports
|
|
8
|
+
exports.tileTarget = exports.tileSource = exports["default"] = exports.BlankContent = void 0;
|
|
7
9
|
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
@@ -23,9 +25,9 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
23
25
|
|
|
24
26
|
var _icons = require("../icons");
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
var _excluded = ["connectDropTarget", "connectDragSource"];
|
|
27
29
|
|
|
28
|
-
function
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
31
|
|
|
30
32
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
31
33
|
|
|
@@ -35,17 +37,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
35
37
|
|
|
36
38
|
function _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); } }
|
|
37
39
|
|
|
38
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
40
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
39
41
|
|
|
40
|
-
function
|
|
42
|
+
function _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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
41
43
|
|
|
42
|
-
function
|
|
44
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
+
|
|
46
|
+
function _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); }; }
|
|
47
|
+
|
|
48
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
43
49
|
|
|
44
50
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
51
|
|
|
46
|
-
function
|
|
52
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
53
|
|
|
48
|
-
function
|
|
54
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
55
|
|
|
50
56
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
51
57
|
|
|
@@ -69,17 +75,17 @@ var useStyles = (0, _styles.withStyles)(function (theme) {
|
|
|
69
75
|
};
|
|
70
76
|
});
|
|
71
77
|
|
|
72
|
-
var BlankContent =
|
|
73
|
-
/*#__PURE__*/
|
|
74
|
-
function (_React$Component) {
|
|
78
|
+
var BlankContent = /*#__PURE__*/function (_React$Component) {
|
|
75
79
|
_inherits(BlankContent, _React$Component);
|
|
76
80
|
|
|
81
|
+
var _super = _createSuper(BlankContent);
|
|
82
|
+
|
|
77
83
|
function BlankContent(props) {
|
|
78
84
|
var _this;
|
|
79
85
|
|
|
80
86
|
_classCallCheck(this, BlankContent);
|
|
81
87
|
|
|
82
|
-
_this =
|
|
88
|
+
_this = _super.call(this, props);
|
|
83
89
|
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_this));
|
|
84
90
|
return _this;
|
|
85
91
|
}
|
|
@@ -125,7 +131,7 @@ function (_React$Component) {
|
|
|
125
131
|
var label = dragItem && isOver ? dragItem.value.value : value.value || "\xA0";
|
|
126
132
|
var finalLabel = isDragging ? "\xA0" : label;
|
|
127
133
|
var hasGrip = finalLabel !== "\xA0";
|
|
128
|
-
return _react["default"].createElement("div", {
|
|
134
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
129
135
|
ref: function ref(_ref) {
|
|
130
136
|
return _this2.elementRef = _ref;
|
|
131
137
|
},
|
|
@@ -143,7 +149,7 @@ function (_React$Component) {
|
|
|
143
149
|
},
|
|
144
150
|
"data-key": n.key,
|
|
145
151
|
contentEditable: false
|
|
146
|
-
}, hasGrip && _react["default"].createElement(_icons.GripIcon, {
|
|
152
|
+
}, hasGrip && /*#__PURE__*/_react["default"].createElement(_icons.GripIcon, {
|
|
147
153
|
style: {
|
|
148
154
|
position: 'absolute',
|
|
149
155
|
top: '6px',
|
|
@@ -151,7 +157,7 @@ function (_React$Component) {
|
|
|
151
157
|
color: '#9B9B9B'
|
|
152
158
|
},
|
|
153
159
|
contentEditable: false
|
|
154
|
-
}), _react["default"].createElement("span", {
|
|
160
|
+
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
155
161
|
dangerouslySetInnerHTML: {
|
|
156
162
|
__html: finalLabel
|
|
157
163
|
}
|
|
@@ -178,17 +184,17 @@ var StyledBlankContent = useStyles(BlankContent);
|
|
|
178
184
|
var connectedBlankContent = useStyles(function (_ref2) {
|
|
179
185
|
var connectDropTarget = _ref2.connectDropTarget,
|
|
180
186
|
connectDragSource = _ref2.connectDragSource,
|
|
181
|
-
props = _objectWithoutProperties(_ref2,
|
|
187
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
182
188
|
|
|
183
189
|
var classes = props.classes,
|
|
184
190
|
isOver = props.isOver,
|
|
185
191
|
value = props.value;
|
|
186
192
|
|
|
187
|
-
var dragContent = _react["default"].createElement(StyledBlankContent, props);
|
|
193
|
+
var dragContent = /*#__PURE__*/_react["default"].createElement(StyledBlankContent, props);
|
|
188
194
|
|
|
189
|
-
var dragEl = !value ? dragContent : connectDragSource(_react["default"].createElement("span", null, dragContent));
|
|
195
|
+
var dragEl = !value ? dragContent : connectDragSource( /*#__PURE__*/_react["default"].createElement("span", null, dragContent));
|
|
190
196
|
|
|
191
|
-
var content = _react["default"].createElement("span", {
|
|
197
|
+
var content = /*#__PURE__*/_react["default"].createElement("span", {
|
|
192
198
|
className: (0, _classnames["default"])(classes.content, isOver && classes.over)
|
|
193
199
|
}, dragEl);
|
|
194
200
|
|