fix display of broken videos
This commit is contained in:
@@ -236,8 +236,6 @@ function handleVideoData(el, data, attr) {
|
|||||||
if (data.ref || data.val) {
|
if (data.ref || data.val) {
|
||||||
attr.onClick = this.onVideoPreview;
|
attr.onClick = this.onVideoPreview;
|
||||||
attr.loading = 'lazy';
|
attr.loading = 'lazy';
|
||||||
} else {
|
|
||||||
attr.src = null;
|
|
||||||
}
|
}
|
||||||
el = InlineVideo;
|
el = InlineVideo;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -27,11 +27,12 @@ export default class InlineVideo extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
{React.createElement('img', this.props)}
|
{React.createElement('img', this.props)}
|
||||||
|
<div className="play-control">
|
||||||
{this.props.onClick ?
|
{this.props.onClick ?
|
||||||
<div className="play-control">
|
<i className="material-icons white bigger">play_arrow</i>
|
||||||
<i className="material-icons white bigger">play_arrow</i>
|
:
|
||||||
</div>
|
<img src="img/broken_video.png" width="36" height="36" />}
|
||||||
: null}
|
</div>
|
||||||
{duration ? <div className="duration">{duration}</div> : null}
|
{duration ? <div className="duration">{duration}</div> : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+7
-5
@@ -2828,8 +2828,6 @@ function handleVideoData(el, data, attr) {
|
|||||||
if (data.ref || data.val) {
|
if (data.ref || data.val) {
|
||||||
attr.onClick = this.onVideoPreview;
|
attr.onClick = this.onVideoPreview;
|
||||||
attr.loading = 'lazy';
|
attr.loading = 'lazy';
|
||||||
} else {
|
|
||||||
attr.src = null;
|
|
||||||
}
|
}
|
||||||
el = _widgets_inline_video_jsx__WEBPACK_IMPORTED_MODULE_6__["default"];
|
el = _widgets_inline_video_jsx__WEBPACK_IMPORTED_MODULE_6__["default"];
|
||||||
} else {
|
} else {
|
||||||
@@ -13586,11 +13584,15 @@ class InlineVideo extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
|
|||||||
const className = 'inline-video' + (this.props.onClick ? ' image-clickable' : '');
|
const className = 'inline-video' + (this.props.onClick ? ' image-clickable' : '');
|
||||||
return react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
return react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
className: className
|
className: className
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement('img', this.props), this.props.onClick ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement('img', this.props), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
className: "play-control"
|
className: "play-control"
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", {
|
}, this.props.onClick ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", {
|
||||||
className: "material-icons white bigger"
|
className: "material-icons white bigger"
|
||||||
}, "play_arrow")) : null, duration ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
}, "play_arrow") : react__WEBPACK_IMPORTED_MODULE_0___default().createElement("img", {
|
||||||
|
src: "img/broken_video.png",
|
||||||
|
width: "36",
|
||||||
|
height: "36"
|
||||||
|
})), duration ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
className: "duration"
|
className: "duration"
|
||||||
}, duration) : null);
|
}, duration) : null);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
-3
@@ -1697,19 +1697,20 @@ const DECORATORS = {
|
|||||||
VD: {
|
VD: {
|
||||||
open: data => {
|
open: data => {
|
||||||
const tmpPreviewUrl = base64toDataUrl(data._tempPreview, data.mime);
|
const tmpPreviewUrl = base64toDataUrl(data._tempPreview, data.mime);
|
||||||
const previewUrl = data.ref || base64toObjectUrl(data.preview, data.premime || 'image/json', Drafty.logger);
|
const previewUrl = data.ref || base64toObjectUrl(data.preview, data.premime || 'image/jpeg', Drafty.logger);
|
||||||
return '<img src="' + (tmpPreviewUrl || previewUrl) + '"' + (data.width ? ' width="' + data.width + '"' : '') + (data.height ? ' height="' + data.height + '"' : '') + ' border="0" />';
|
return '<img src="' + (tmpPreviewUrl || previewUrl) + '"' + (data.width ? ' width="' + data.width + '"' : '') + (data.height ? ' height="' + data.height + '"' : '') + ' border="0" />';
|
||||||
},
|
},
|
||||||
close: _ => '',
|
close: _ => '',
|
||||||
props: data => {
|
props: data => {
|
||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
|
const poster = data.preref || base64toObjectUrl(data.preview, data.premime || 'image/jpeg', Drafty.logger);
|
||||||
return {
|
return {
|
||||||
src: data.preref || base64toObjectUrl(data.preview, data.premime || 'image/json', Drafty.logger),
|
src: poster,
|
||||||
'data-src': data.ref || base64toObjectUrl(data.val, data.mime, Drafty.logger),
|
'data-src': data.ref || base64toObjectUrl(data.val, data.mime, Drafty.logger),
|
||||||
'data-width': data.width,
|
'data-width': data.width,
|
||||||
'data-height': data.height,
|
'data-height': data.height,
|
||||||
'data-preload': data.ref ? 'metadata' : 'auto',
|
'data-preload': data.ref ? 'metadata' : 'auto',
|
||||||
'data-preview': base64toObjectUrl(data.preview, data.premime || 'image/json', Drafty.logger),
|
'data-preview': poster,
|
||||||
'data-duration': data.duration | 0,
|
'data-duration': data.duration | 0,
|
||||||
'data-name': data.name,
|
'data-name': data.name,
|
||||||
'data-size': data.val ? data.val.length * 0.75 | 0 : data.size | 0,
|
'data-size': data.val ? data.val.length * 0.75 | 0 : data.size | 0,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-3593
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user