@pie-lib/editable-html 9.3.1-next.53 → 9.4.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 +17 -0
- package/lib/editor.js +244 -114
- package/lib/editor.js.map +1 -1
- package/lib/index.js +51 -5
- package/lib/index.js.map +1 -1
- package/lib/parse-html.js +5 -6
- package/lib/parse-html.js.map +1 -1
- package/lib/plugins/characters/custom-popper.js +12 -2
- package/lib/plugins/characters/custom-popper.js.map +1 -1
- package/lib/plugins/characters/index.js +50 -3
- package/lib/plugins/characters/index.js.map +1 -1
- package/lib/plugins/characters/utils.js.map +1 -1
- package/lib/plugins/image/alt-dialog.js +26 -0
- package/lib/plugins/image/alt-dialog.js.map +1 -1
- package/lib/plugins/image/component.js +82 -29
- package/lib/plugins/image/component.js.map +1 -1
- package/lib/plugins/image/image-toolbar.js +45 -7
- package/lib/plugins/image/image-toolbar.js.map +1 -1
- package/lib/plugins/image/index.js +41 -2
- package/lib/plugins/image/index.js.map +1 -1
- package/lib/plugins/image/insert-image-handler.js +22 -2
- package/lib/plugins/image/insert-image-handler.js.map +1 -1
- package/lib/plugins/index.js +34 -13
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/list/index.js +42 -13
- package/lib/plugins/list/index.js.map +1 -1
- package/lib/plugins/math/index.js +75 -30
- package/lib/plugins/math/index.js.map +1 -1
- package/lib/plugins/media/index.js +75 -18
- package/lib/plugins/media/index.js.map +1 -1
- package/lib/plugins/media/media-dialog.js +188 -100
- package/lib/plugins/media/media-dialog.js.map +1 -1
- package/lib/plugins/media/media-toolbar.js +24 -4
- package/lib/plugins/media/media-toolbar.js.map +1 -1
- package/lib/plugins/media/media-wrapper.js +29 -5
- package/lib/plugins/media/media-wrapper.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/choice.js +50 -10
- package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -1
- package/lib/plugins/respArea/drag-in-the-blank/index.js +18 -4
- package/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -1
- package/lib/plugins/respArea/explicit-constructed-response/index.js +8 -2
- package/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -1
- package/lib/plugins/respArea/icons/index.js +18 -1
- package/lib/plugins/respArea/icons/index.js.map +1 -1
- package/lib/plugins/respArea/index.js +47 -1
- package/lib/plugins/respArea/index.js.map +1 -1
- package/lib/plugins/respArea/inline-dropdown/index.js +8 -1
- package/lib/plugins/respArea/inline-dropdown/index.js.map +1 -1
- package/lib/plugins/respArea/utils.js +22 -0
- package/lib/plugins/respArea/utils.js.map +1 -1
- package/lib/plugins/table/icons/index.js +7 -0
- package/lib/plugins/table/icons/index.js.map +1 -1
- package/lib/plugins/table/index.js +94 -15
- package/lib/plugins/table/index.js.map +1 -1
- package/lib/plugins/table/table-toolbar.js +43 -11
- package/lib/plugins/table/table-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/default-toolbar.js +30 -8
- package/lib/plugins/toolbar/default-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/done-button.js +9 -1
- package/lib/plugins/toolbar/done-button.js.map +1 -1
- package/lib/plugins/toolbar/editor-and-toolbar.js +48 -18
- package/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -1
- package/lib/plugins/toolbar/index.js +5 -0
- package/lib/plugins/toolbar/index.js.map +1 -1
- package/lib/plugins/toolbar/toolbar-buttons.js +39 -8
- package/lib/plugins/toolbar/toolbar-buttons.js.map +1 -1
- package/lib/plugins/toolbar/toolbar.js +67 -19
- package/lib/plugins/toolbar/toolbar.js.map +1 -1
- package/lib/plugins/utils.js +15 -0
- package/lib/plugins/utils.js.map +1 -1
- package/lib/serialization.js +69 -8
- package/lib/serialization.js.map +1 -1
- package/lib/theme.js.map +1 -1
- package/package.json +4 -4
- package/src/plugins/media/index.jsx +1 -0
|
@@ -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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
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,8 +190,10 @@ 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
|
-
|
|
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) {
|
|
@@ -156,26 +212,34 @@ 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
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
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
244
|
urlToUse: null,
|
|
181
245
|
url: null,
|
|
@@ -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
|
-
|
|
194
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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,95 +294,111 @@ 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)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
-
|
|
304
|
+
error: null,
|
|
305
|
+
loading: true
|
|
247
306
|
})
|
|
248
307
|
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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)
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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
404
|
url: _url,
|
|
@@ -335,6 +417,7 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
335
417
|
};
|
|
336
418
|
return _this;
|
|
337
419
|
}
|
|
420
|
+
|
|
338
421
|
(0, _createClass2["default"])(MediaDialog, [{
|
|
339
422
|
key: "componentDidMount",
|
|
340
423
|
value: function componentDidMount() {
|
|
@@ -350,24 +433,25 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
350
433
|
key: "render",
|
|
351
434
|
value: function render() {
|
|
352
435
|
var _this2 = this;
|
|
436
|
+
|
|
353
437
|
var _this$props = this.props,
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
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;
|
|
360
444
|
var _this$state4 = this.state,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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;
|
|
371
455
|
var isYoutube = matchYoutubeUrl(url);
|
|
372
456
|
var isInsertURL = tabValue === 0;
|
|
373
457
|
var isUploadMedia = tabValue === 1;
|
|
@@ -500,6 +584,7 @@ var MediaDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
500
584
|
}]);
|
|
501
585
|
return MediaDialog;
|
|
502
586
|
}(_react["default"].Component);
|
|
587
|
+
|
|
503
588
|
exports.MediaDialog = MediaDialog;
|
|
504
589
|
(0, _defineProperty2["default"])(MediaDialog, "propTypes", {
|
|
505
590
|
classes: _propTypes["default"].object.isRequired,
|
|
@@ -520,6 +605,7 @@ exports.MediaDialog = MediaDialog;
|
|
|
520
605
|
height: _propTypes["default"].number,
|
|
521
606
|
width: _propTypes["default"].number
|
|
522
607
|
});
|
|
608
|
+
|
|
523
609
|
var styles = function styles() {
|
|
524
610
|
return {
|
|
525
611
|
paper: {
|
|
@@ -552,6 +638,8 @@ var styles = function styles() {
|
|
|
552
638
|
}
|
|
553
639
|
};
|
|
554
640
|
};
|
|
641
|
+
|
|
555
642
|
var _default = (0, _styles.withStyles)(styles)(MediaDialog);
|
|
643
|
+
|
|
556
644
|
exports["default"] = _default;
|
|
557
645
|
//# sourceMappingURL=media-dialog.js.map
|