Skip to content

Commit f867b99

Browse files
committed
Catching errors when parse the component.
1 parent c5f5b3d commit f867b99

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

dist/grapesjs-plugin-sproutvideo.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "grapesjs-plugin-sproutvideo",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "GrapesJS Plugin to extend the video funtionality to support Sprout Video",
55
"main": "dist/grapesjs-plugin-sproutvideo.min.js",
66
"scripts": {

src/components.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,26 @@ export default (editor, config = {}) => {
2626
var videoId1 = uri.pathname.split('/').pop();
2727
this.set('videoId', videoId1);
2828
this.set('videoId2', videoId2);
29+
try {
30+
this.set('autoplay', JSON.parse(qr.autoplay) === true);
31+
} catch (e) {
32+
this.set('autoplay', false);
33+
}
34+
35+
try {
36+
this.set('loop', JSON.parse(qr.loop) === true);
37+
38+
} catch (e) {
39+
this.set('loop', false);
40+
}
41+
42+
try {
43+
this.set('controls', JSON.parse(qr.bigPlayButton) === false);
44+
45+
} catch (e) {
46+
this.set('controls', true);
47+
}
2948

30-
this.set('autoplay', JSON.parse(qr.autoplay) === true);
31-
this.set('loop', JSON.parse(qr.loop) === true);
32-
this.set('controls', JSON.parse(qr.bigPlayButton) === false);
3349
break;
3450
default:
3551
}

0 commit comments

Comments
 (0)