@pie-lib/editable-html 10.0.0-beta.7 → 10.0.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.
Files changed (118) hide show
  1. package/CHANGELOG.json +1 -1
  2. package/CHANGELOG.md +81 -0
  3. package/LICENSE.md +5 -0
  4. package/lib/editor.js +410 -543
  5. package/lib/editor.js.map +1 -1
  6. package/lib/index.js +200 -101
  7. package/lib/index.js.map +1 -1
  8. package/lib/parse-html.js +5 -6
  9. package/lib/parse-html.js.map +1 -1
  10. package/lib/plugins/characters/custom-popper.js +12 -2
  11. package/lib/plugins/characters/custom-popper.js.map +1 -1
  12. package/lib/plugins/characters/index.js +71 -19
  13. package/lib/plugins/characters/index.js.map +1 -1
  14. package/lib/plugins/characters/utils.js.map +1 -1
  15. package/lib/plugins/html/icons/index.js +38 -0
  16. package/lib/plugins/html/icons/index.js.map +1 -0
  17. package/lib/plugins/html/index.js +75 -0
  18. package/lib/plugins/html/index.js.map +1 -0
  19. package/lib/plugins/image/alt-dialog.js +26 -0
  20. package/lib/plugins/image/alt-dialog.js.map +1 -1
  21. package/lib/plugins/image/component.js +124 -90
  22. package/lib/plugins/image/component.js.map +1 -1
  23. package/lib/plugins/image/image-toolbar.js +45 -7
  24. package/lib/plugins/image/image-toolbar.js.map +1 -1
  25. package/lib/plugins/image/index.js +91 -113
  26. package/lib/plugins/image/index.js.map +1 -1
  27. package/lib/plugins/image/insert-image-handler.js +54 -72
  28. package/lib/plugins/image/insert-image-handler.js.map +1 -1
  29. package/lib/plugins/index.js +71 -31
  30. package/lib/plugins/index.js.map +1 -1
  31. package/lib/plugins/list/index.js +129 -58
  32. package/lib/plugins/list/index.js.map +1 -1
  33. package/lib/plugins/math/index.js +152 -118
  34. package/lib/plugins/math/index.js.map +1 -1
  35. package/lib/plugins/media/index.js +185 -168
  36. package/lib/plugins/media/index.js.map +1 -1
  37. package/lib/plugins/media/media-dialog.js +197 -110
  38. package/lib/plugins/media/media-dialog.js.map +1 -1
  39. package/lib/plugins/media/media-toolbar.js +24 -4
  40. package/lib/plugins/media/media-toolbar.js.map +1 -1
  41. package/lib/plugins/media/media-wrapper.js +65 -23
  42. package/lib/plugins/media/media-wrapper.js.map +1 -1
  43. package/lib/plugins/respArea/drag-in-the-blank/choice.js +50 -10
  44. package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -1
  45. package/lib/plugins/respArea/drag-in-the-blank/index.js +22 -9
  46. package/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -1
  47. package/lib/plugins/respArea/explicit-constructed-response/index.js +9 -4
  48. package/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -1
  49. package/lib/plugins/respArea/icons/index.js +18 -1
  50. package/lib/plugins/respArea/icons/index.js.map +1 -1
  51. package/lib/plugins/respArea/index.js +133 -122
  52. package/lib/plugins/respArea/index.js.map +1 -1
  53. package/lib/plugins/respArea/inline-dropdown/index.js +10 -4
  54. package/lib/plugins/respArea/inline-dropdown/index.js.map +1 -1
  55. package/lib/plugins/respArea/utils.js +33 -15
  56. package/lib/plugins/respArea/utils.js.map +1 -1
  57. package/lib/plugins/table/icons/index.js +7 -0
  58. package/lib/plugins/table/icons/index.js.map +1 -1
  59. package/lib/plugins/table/index.js +279 -390
  60. package/lib/plugins/table/index.js.map +1 -1
  61. package/lib/plugins/table/table-toolbar.js +47 -14
  62. package/lib/plugins/table/table-toolbar.js.map +1 -1
  63. package/lib/plugins/toolbar/default-toolbar.js +63 -51
  64. package/lib/plugins/toolbar/default-toolbar.js.map +1 -1
  65. package/lib/plugins/toolbar/done-button.js +9 -1
  66. package/lib/plugins/toolbar/done-button.js.map +1 -1
  67. package/lib/plugins/toolbar/editor-and-toolbar.js +140 -83
  68. package/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -1
  69. package/lib/plugins/toolbar/index.js +5 -0
  70. package/lib/plugins/toolbar/index.js.map +1 -1
  71. package/lib/plugins/toolbar/toolbar-buttons.js +39 -8
  72. package/lib/plugins/toolbar/toolbar-buttons.js.map +1 -1
  73. package/lib/plugins/toolbar/toolbar.js +261 -225
  74. package/lib/plugins/toolbar/toolbar.js.map +1 -1
  75. package/lib/plugins/utils.js +16 -19
  76. package/lib/plugins/utils.js.map +1 -1
  77. package/lib/serialization.js +70 -11
  78. package/lib/serialization.js.map +1 -1
  79. package/lib/theme.js.map +1 -1
  80. package/package.json +18 -17
  81. package/src/editor.jsx +139 -434
  82. package/src/index.jsx +96 -62
  83. package/src/plugins/characters/index.jsx +17 -12
  84. package/src/plugins/html/icons/index.jsx +19 -0
  85. package/src/plugins/html/index.jsx +68 -0
  86. package/src/plugins/image/component.jsx +38 -60
  87. package/src/plugins/image/index.jsx +42 -95
  88. package/src/plugins/image/insert-image-handler.js +27 -62
  89. package/src/plugins/index.jsx +39 -21
  90. package/src/plugins/list/index.jsx +90 -62
  91. package/src/plugins/math/index.jsx +70 -93
  92. package/src/plugins/media/index.jsx +117 -146
  93. package/src/plugins/media/media-dialog.js +9 -10
  94. package/src/plugins/media/media-wrapper.jsx +27 -29
  95. package/src/plugins/respArea/drag-in-the-blank/index.jsx +4 -5
  96. package/src/plugins/respArea/explicit-constructed-response/index.jsx +1 -2
  97. package/src/plugins/respArea/index.jsx +84 -114
  98. package/src/plugins/respArea/inline-dropdown/index.jsx +2 -3
  99. package/src/plugins/respArea/utils.jsx +28 -23
  100. package/src/plugins/table/index.jsx +214 -334
  101. package/src/plugins/table/table-toolbar.jsx +4 -3
  102. package/src/plugins/toolbar/default-toolbar.jsx +30 -48
  103. package/src/plugins/toolbar/editor-and-toolbar.jsx +114 -114
  104. package/src/plugins/toolbar/toolbar.jsx +224 -254
  105. package/src/plugins/utils.js +0 -16
  106. package/src/serialization.jsx +1 -1
  107. package/lib/components.js +0 -92
  108. package/lib/components.js.map +0 -1
  109. package/lib/new-serialization.js +0 -280
  110. package/lib/new-serialization.js.map +0 -1
  111. package/lib/plugins/hotKeys/index.js +0 -60
  112. package/lib/plugins/hotKeys/index.js.map +0 -1
  113. package/lib/test-serializer.js +0 -138
  114. package/lib/test-serializer.js.map +0 -1
  115. package/src/components.js +0 -135
  116. package/src/new-serialization.jsx +0 -310
  117. package/src/plugins/hotKeys/index.js +0 -54
  118. package/src/test-serializer.js +0 -132
@@ -1,61 +1,101 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = exports.MediaDialog = void 0;
9
+
8
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
9
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
10
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
11
16
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
12
18
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
+
13
20
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
+
14
22
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
+
15
24
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+
16
26
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+
17
28
  var _react = _interopRequireDefault(require("react"));
29
+
18
30
  var _propTypes = _interopRequireDefault(require("prop-types"));
31
+
19
32
  var _debug = _interopRequireDefault(require("debug"));
33
+
20
34
  var _renderUi = require("@pie-lib/render-ui");
35
+
21
36
  var _styles = require("@material-ui/core/styles");
37
+
22
38
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
39
+
23
40
  var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
41
+
24
42
  var _Tabs = _interopRequireDefault(require("@material-ui/core/Tabs"));
43
+
25
44
  var _Tab = _interopRequireDefault(require("@material-ui/core/Tab"));
45
+
26
46
  var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
47
+
27
48
  var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogContent"));
49
+
28
50
  var _DialogContentText = _interopRequireDefault(require("@material-ui/core/DialogContentText"));
51
+
29
52
  var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
53
+
30
54
  var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
55
+
31
56
  var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
57
+
32
58
  var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
59
+
33
60
  var _Delete = _interopRequireDefault(require("@material-ui/icons/Delete"));
61
+
34
62
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
63
+
35
64
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
65
+
36
66
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
67
+
37
68
  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; } }
69
+
38
70
  var log = (0, _debug["default"])('@pie-lib:editable-html:plugins:media:dialog');
71
+
39
72
  var matchYoutubeUrl = function matchYoutubeUrl(url) {
40
73
  if (!url) {
41
74
  return false;
42
75
  }
76
+
43
77
  var p = /^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
78
+
44
79
  if (url.match(p)) {
45
80
  return url.match(p)[1];
46
81
  }
82
+
47
83
  return false;
48
84
  };
85
+
49
86
  var matchVimeoUrl = function matchVimeoUrl(url) {
50
87
  return url && /(http|https)?:\/\/(www\.)?(player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(video\/)?(\d+)(?:|\/\?)/.test(url);
51
88
  };
89
+
52
90
  var matchSoundCloudUrl = function matchSoundCloudUrl(url) {
53
91
  if (!url) {
54
92
  return false;
55
93
  }
94
+
56
95
  var regexp = /^https?:\/\/(soundcloud\.com|snd\.sc)\/(.*)$/;
57
96
  return url.match(regexp) && url.match(regexp)[2];
58
97
  };
98
+
59
99
  var makeApiRequest = function makeApiRequest(url) {
60
100
  return new Promise(function (resolve) {
61
101
  try {
@@ -75,57 +115,71 @@ var makeApiRequest = function makeApiRequest(url) {
75
115
  }
76
116
  });
77
117
  };
118
+
78
119
  var typeMap = {
79
120
  video: 'Video',
80
121
  audio: 'Audio'
81
122
  };
123
+
82
124
  var MediaDialog = /*#__PURE__*/function (_React$Component) {
83
125
  (0, _inherits2["default"])(MediaDialog, _React$Component);
126
+
84
127
  var _super = _createSuper(MediaDialog);
128
+
85
129
  function MediaDialog(props) {
86
130
  var _this;
131
+
87
132
  (0, _classCallCheck2["default"])(this, MediaDialog);
88
133
  _this = _super.call(this, props);
89
134
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "formatUrl", function () {
90
135
  var _this$state = _this.state,
91
- url = _this$state.url,
92
- urlToUse = _this$state.urlToUse,
93
- starts = _this$state.starts,
94
- ends = _this$state.ends;
136
+ url = _this$state.url,
137
+ urlToUse = _this$state.urlToUse,
138
+ starts = _this$state.starts,
139
+ ends = _this$state.ends;
95
140
  var isYoutube = matchYoutubeUrl(url);
96
141
  var isVimeo = matchVimeoUrl(url);
97
- var formattedUrl = urlToUse || '';
142
+ var formattedUrl = urlToUse;
143
+
98
144
  if ((isYoutube || isVimeo) && urlToUse) {
99
145
  var params = [];
100
146
  var paramName;
101
147
  var paramStart;
148
+
102
149
  switch (true) {
103
150
  case isVimeo:
104
151
  paramName = 't';
105
152
  paramStart = '#';
106
153
  break;
154
+
107
155
  case isYoutube:
108
156
  paramName = 'start';
109
157
  paramStart = '?';
110
158
  break;
159
+
111
160
  default:
112
161
  paramName = 'start';
113
162
  paramStart = '?';
114
163
  }
164
+
115
165
  if (starts) {
116
166
  params.push("".concat(paramName, "=").concat(starts));
117
167
  }
168
+
118
169
  if (ends) {
119
170
  params.push("end=".concat(ends));
120
171
  }
172
+
121
173
  formattedUrl = "".concat(urlToUse).concat(params.length ? paramStart : '').concat(params.join('&'));
122
174
  }
175
+
123
176
  var callback = function callback() {
124
177
  return _this.setState({
125
178
  formattedUrl: formattedUrl,
126
179
  updating: false
127
180
  });
128
181
  };
182
+
129
183
  _this.setState({
130
184
  formattedUrl: null,
131
185
  updating: true
@@ -136,15 +190,17 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
136
190
  });
137
191
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "urlChange", function (e) {
138
192
  var _ref = e.target || {},
139
- value = _ref.value;
193
+ value = _ref.value;
194
+
140
195
  var type = _this.props.type;
196
+
141
197
  if (type && type === 'audio') {
142
198
  if (matchSoundCloudUrl(value)) {
143
199
  makeApiRequest(value).then(function (urlToUse) {
144
200
  _this.handleStateChange({
145
201
  urlToUse: urlToUse,
146
202
  invalid: !urlToUse,
147
- url: value || ''
203
+ url: value
148
204
  });
149
205
  })["catch"](log);
150
206
  return;
@@ -156,29 +212,37 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
156
212
  var id = match[2];
157
213
  var urlToUse = "https://youtube.com/embed/".concat(id);
158
214
  log('is youtube');
215
+
159
216
  _this.handleStateChange({
160
217
  urlToUse: urlToUse,
161
- url: value || '',
218
+ url: value,
162
219
  invalid: false
163
220
  });
221
+
164
222
  return;
165
223
  }
224
+
166
225
  if (matchVimeoUrl(value)) {
167
226
  var _id = value.replace(/.*vimeo.com\/(.*)/g, '$1');
227
+
168
228
  var _urlToUse2 = "https://player.vimeo.com/video/".concat(_id);
229
+
169
230
  log('is vimeo');
231
+
170
232
  _this.handleStateChange({
171
233
  urlToUse: _urlToUse2,
172
- url: value || '',
234
+ url: value,
173
235
  ends: null,
174
236
  invalid: false
175
237
  });
238
+
176
239
  return;
177
240
  }
178
241
  }
242
+
179
243
  _this.handleStateChange({
180
- urlToUse: '',
181
- url: '',
244
+ urlToUse: null,
245
+ url: null,
182
246
  invalid: true
183
247
  });
184
248
  });
@@ -190,23 +254,25 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
190
254
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDone", function (val) {
191
255
  var handleClose = _this.props.handleClose;
192
256
  var _this$state2 = _this.state,
193
- tabValue = _this$state2.tabValue,
194
- fileUpload = _this$state2.fileUpload;
257
+ tabValue = _this$state2.tabValue,
258
+ fileUpload = _this$state2.fileUpload;
195
259
  var isInsertURL = tabValue === 0;
260
+
196
261
  if (!val) {
197
262
  if (fileUpload.url) {
198
263
  _this.handleRemoveFile();
199
264
  }
265
+
200
266
  handleClose(val);
201
267
  } else if (isInsertURL) {
202
268
  var _this$state3 = _this.state,
203
- ends = _this$state3.ends,
204
- height = _this$state3.height,
205
- url = _this$state3.url,
206
- urlToUse = _this$state3.urlToUse,
207
- formattedUrl = _this$state3.formattedUrl,
208
- starts = _this$state3.starts,
209
- width = _this$state3.width;
269
+ ends = _this$state3.ends,
270
+ height = _this$state3.height,
271
+ url = _this$state3.url,
272
+ urlToUse = _this$state3.urlToUse,
273
+ formattedUrl = _this$state3.formattedUrl,
274
+ starts = _this$state3.starts,
275
+ width = _this$state3.width;
210
276
  handleClose(val, {
211
277
  tag: 'iframe',
212
278
  ends: ends,
@@ -228,106 +294,121 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
228
294
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(e) {
229
295
  var fileChosen, reader;
230
296
  return _regenerator["default"].wrap(function _callee$(_context) {
231
- while (1) switch (_context.prev = _context.next) {
232
- case 0:
233
- e.preventDefault();
234
- _this.setState({
235
- fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
236
- error: null,
237
- loading: true
238
- })
239
- });
240
- fileChosen = e.target.files[0];
241
- reader = new FileReader();
242
- reader.onload = function () {
243
- var dataURL = reader.result;
297
+ while (1) {
298
+ switch (_context.prev = _context.next) {
299
+ case 0:
300
+ e.preventDefault();
301
+
244
302
  _this.setState({
245
303
  fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
246
- url: dataURL
304
+ error: null,
305
+ loading: true
247
306
  })
248
307
  });
249
- };
250
- reader.readAsDataURL(fileChosen);
251
- _this.props.uploadSoundSupport.add({
252
- fileChosen: fileChosen,
253
- done: function done(err, src) {
254
- log('done: err:', err);
255
- if (err) {
256
- //eslint-disable-next-line
257
- console.log(err);
258
- _this.setState({
259
- fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
260
- loading: false,
261
- error: err
262
- })
263
- });
264
- } else {
265
- _this.setState({
266
- fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
267
- loading: false,
268
- url: src
269
- })
270
- });
308
+
309
+ fileChosen = e.target.files[0];
310
+ reader = new FileReader();
311
+
312
+ reader.onload = function () {
313
+ var dataURL = reader.result;
314
+
315
+ _this.setState({
316
+ fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
317
+ url: dataURL
318
+ })
319
+ });
320
+ };
321
+
322
+ reader.readAsDataURL(fileChosen);
323
+
324
+ _this.props.uploadSoundSupport.add({
325
+ fileChosen: fileChosen,
326
+ done: function done(err, src) {
327
+ log('done: err:', err);
328
+
329
+ if (err) {
330
+ //eslint-disable-next-line
331
+ console.log(err);
332
+
333
+ _this.setState({
334
+ fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
335
+ loading: false,
336
+ error: err
337
+ })
338
+ });
339
+ } else {
340
+ _this.setState({
341
+ fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
342
+ loading: false,
343
+ url: src
344
+ })
345
+ });
346
+ }
271
347
  }
272
- }
273
- });
274
- case 7:
275
- case "end":
276
- return _context.stop();
348
+ });
349
+
350
+ case 7:
351
+ case "end":
352
+ return _context.stop();
353
+ }
277
354
  }
278
355
  }, _callee);
279
356
  }));
357
+
280
358
  return function (_x) {
281
359
  return _ref2.apply(this, arguments);
282
360
  };
283
361
  }());
284
362
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleRemoveFile", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
285
363
  return _regenerator["default"].wrap(function _callee2$(_context2) {
286
- while (1) switch (_context2.prev = _context2.next) {
287
- case 0:
288
- _this.props.uploadSoundSupport["delete"](_this.state.fileUpload.url, function (err) {
289
- if (err) {
290
- //eslint-disable-next-line
291
- console.log(err);
292
- _this.setState({
293
- fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
294
- error: err
295
- })
296
- });
297
- }
298
- });
364
+ while (1) {
365
+ switch (_context2.prev = _context2.next) {
366
+ case 0:
367
+ _this.props.uploadSoundSupport["delete"](_this.state.fileUpload.url, function (err) {
368
+ if (err) {
369
+ //eslint-disable-next-line
370
+ console.log(err);
299
371
 
300
- // we should put it inside uploadSoundSupport.delete but we can leave it here for testing purposes
301
- _this.setState({
302
- fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
303
- loading: false,
304
- url: ''
305
- })
306
- });
307
- case 2:
308
- case "end":
309
- return _context2.stop();
372
+ _this.setState({
373
+ fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
374
+ error: err
375
+ })
376
+ });
377
+ }
378
+ }); // we should put it inside uploadSoundSupport.delete but we can leave it here for testing purposes
379
+
380
+
381
+ _this.setState({
382
+ fileUpload: _objectSpread(_objectSpread({}, _this.state.fileUpload), {}, {
383
+ loading: false,
384
+ url: ''
385
+ })
386
+ });
387
+
388
+ case 2:
389
+ case "end":
390
+ return _context2.stop();
391
+ }
310
392
  }
311
393
  }, _callee2);
312
394
  })));
313
395
  var _src = props.src,
314
- _starts = props.starts,
315
- _ends = props.ends,
316
- _height = props.height,
317
- _url = props.url,
318
- _urlToUse = props.urlToUse,
319
- _width = props.width;
396
+ _starts = props.starts,
397
+ _ends = props.ends,
398
+ _height = props.height,
399
+ _url = props.url,
400
+ _urlToUse = props.urlToUse,
401
+ _width = props.width;
320
402
  _this.state = {
321
403
  ends: _ends || 0,
322
- url: _url || '',
323
- urlToUse: _urlToUse || '',
324
- formattedUrl: _src || '',
404
+ url: _url,
405
+ urlToUse: _urlToUse,
406
+ formattedUrl: _src,
325
407
  height: _height || 315,
326
408
  invalid: false,
327
409
  starts: _starts || 0,
328
410
  width: _width || 560,
329
411
  tabValue: 0,
330
- updating: false,
331
412
  fileUpload: {
332
413
  loading: false,
333
414
  url: '',
@@ -336,6 +417,7 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
336
417
  };
337
418
  return _this;
338
419
  }
420
+
339
421
  (0, _createClass2["default"])(MediaDialog, [{
340
422
  key: "componentDidMount",
341
423
  value: function componentDidMount() {
@@ -351,24 +433,25 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
351
433
  key: "render",
352
434
  value: function render() {
353
435
  var _this2 = this;
436
+
354
437
  var _this$props = this.props,
355
- classes = _this$props.classes,
356
- open = _this$props.open,
357
- disablePortal = _this$props.disablePortal,
358
- type = _this$props.type,
359
- edit = _this$props.edit,
360
- uploadSoundSupport = _this$props.uploadSoundSupport;
438
+ classes = _this$props.classes,
439
+ open = _this$props.open,
440
+ disablePortal = _this$props.disablePortal,
441
+ type = _this$props.type,
442
+ edit = _this$props.edit,
443
+ uploadSoundSupport = _this$props.uploadSoundSupport;
361
444
  var _this$state4 = this.state,
362
- ends = _this$state4.ends,
363
- height = _this$state4.height,
364
- invalid = _this$state4.invalid,
365
- starts = _this$state4.starts,
366
- width = _this$state4.width,
367
- url = _this$state4.url,
368
- formattedUrl = _this$state4.formattedUrl,
369
- updating = _this$state4.updating,
370
- tabValue = _this$state4.tabValue,
371
- fileUpload = _this$state4.fileUpload;
445
+ ends = _this$state4.ends,
446
+ height = _this$state4.height,
447
+ invalid = _this$state4.invalid,
448
+ starts = _this$state4.starts,
449
+ width = _this$state4.width,
450
+ url = _this$state4.url,
451
+ formattedUrl = _this$state4.formattedUrl,
452
+ updating = _this$state4.updating,
453
+ tabValue = _this$state4.tabValue,
454
+ fileUpload = _this$state4.fileUpload;
372
455
  var isYoutube = matchYoutubeUrl(url);
373
456
  var isInsertURL = tabValue === 0;
374
457
  var isUploadMedia = tabValue === 1;
@@ -501,6 +584,7 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
501
584
  }]);
502
585
  return MediaDialog;
503
586
  }(_react["default"].Component);
587
+
504
588
  exports.MediaDialog = MediaDialog;
505
589
  (0, _defineProperty2["default"])(MediaDialog, "propTypes", {
506
590
  classes: _propTypes["default"].object.isRequired,
@@ -521,6 +605,7 @@ exports.MediaDialog = MediaDialog;
521
605
  height: _propTypes["default"].number,
522
606
  width: _propTypes["default"].number
523
607
  });
608
+
524
609
  var styles = function styles(theme) {
525
610
  return {
526
611
  paper: {
@@ -553,6 +638,8 @@ var styles = function styles(theme) {
553
638
  }
554
639
  };
555
640
  };
641
+
556
642
  var _default = (0, _styles.withStyles)(styles)(MediaDialog);
643
+
557
644
  exports["default"] = _default;
558
645
  //# sourceMappingURL=media-dialog.js.map