fix preview of received videos

This commit is contained in:
or-else
2022-12-30 10:20:13 -08:00
parent 4489646144
commit 9fbc601870
5 changed files with 6 additions and 6 deletions
+1 -2
View File
@@ -189,7 +189,6 @@ function handleImageData(el, data, attr) {
}; };
if (!Drafty.isProcessing(data)) { if (!Drafty.isProcessing(data)) {
attr.src = this.authorizeURL(sanitizeUrlForMime(attr.src, 'image')); attr.src = this.authorizeURL(sanitizeUrlForMime(attr.src, 'image'));
attr['data-src'] = sanitizeUrlForMime(attr.src, 'video');
attr.alt = data.name; attr.alt = data.name;
if (attr.src) { if (attr.src) {
if (Math.max(data.width || 0, data.height || 0) > IMAGE_THUMBNAIL_DIM) { if (Math.max(data.width || 0, data.height || 0) > IMAGE_THUMBNAIL_DIM) {
@@ -219,7 +218,6 @@ function handleVideoData(el, data, attr) {
}; };
return el; return el;
} }
attr.className = 'inline-image'; attr.className = 'inline-image';
const dim = fitImageSize(data.width, data.height, const dim = fitImageSize(data.width, data.height,
this.viewportWidth > 0 ? Math.min(this.viewportWidth - REM_SIZE * 6.5, REM_SIZE * 34.5) : this.viewportWidth > 0 ? Math.min(this.viewportWidth - REM_SIZE * 6.5, REM_SIZE * 34.5) :
@@ -233,6 +231,7 @@ function handleVideoData(el, data, attr) {
minHeight: dim.dstHeight + 'px' minHeight: dim.dstHeight + 'px'
}; };
if (!Drafty.isProcessing(data)) { if (!Drafty.isProcessing(data)) {
attr.src = this.authorizeURL(sanitizeUrlForMime(attr.src, 'image'));
attr.alt = data.name; attr.alt = data.name;
if (data.ref || data.val) { if (data.ref || data.val) {
attr.onClick = this.onVideoPreview; attr.onClick = this.onVideoPreview;
+2 -1
View File
@@ -2749,7 +2749,6 @@ function handleImageData(el, data, attr) {
}; };
if (!tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isProcessing(data)) { if (!tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isProcessing(data)) {
attr.src = this.authorizeURL((0,_utils_js__WEBPACK_IMPORTED_MODULE_12__.sanitizeUrlForMime)(attr.src, 'image')); attr.src = this.authorizeURL((0,_utils_js__WEBPACK_IMPORTED_MODULE_12__.sanitizeUrlForMime)(attr.src, 'image'));
attr['data-src'] = (0,_utils_js__WEBPACK_IMPORTED_MODULE_12__.sanitizeUrlForMime)(attr.src, 'video');
attr.alt = data.name; attr.alt = data.name;
if (attr.src) { if (attr.src) {
if (Math.max(data.width || 0, data.height || 0) > _config_js__WEBPACK_IMPORTED_MODULE_9__.IMAGE_THUMBNAIL_DIM) { if (Math.max(data.width || 0, data.height || 0) > _config_js__WEBPACK_IMPORTED_MODULE_9__.IMAGE_THUMBNAIL_DIM) {
@@ -2786,6 +2785,7 @@ function handleVideoData(el, data, attr) {
minHeight: dim.dstHeight + 'px' minHeight: dim.dstHeight + 'px'
}; };
if (!tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isProcessing(data)) { if (!tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isProcessing(data)) {
attr.src = this.authorizeURL((0,_utils_js__WEBPACK_IMPORTED_MODULE_12__.sanitizeUrlForMime)(attr.src, 'image'));
attr.alt = data.name; attr.alt = data.name;
if (data.ref || data.val) { if (data.ref || data.val) {
attr.onClick = this.onVideoPreview; attr.onClick = this.onVideoPreview;
@@ -13758,6 +13758,7 @@ class InlineVideo extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
super(props); super(props);
this.videoRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef(); this.videoRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
console.log(props);
} }
handleClick(e) { handleClick(e) {
if (this.props.onClick) { if (this.props.onClick) {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long