make broken image not clickable

This commit is contained in:
or-else
2019-01-25 17:03:50 +03:00
parent b0be1fd012
commit 9bbddc08e6
8 changed files with 25 additions and 13 deletions
+6 -3
View File
@@ -511,6 +511,10 @@ table.permission-editor td.checkbox {
cursor: pointer; cursor: pointer;
} }
.image-clickable {
cursor: pointer;
}
/* END of top-level layout */ /* END of top-level layout */
/* Sidepanel styles */ /* Sidepanel styles */
@@ -1306,8 +1310,8 @@ i.search {
* (group chat only) * (group chat only)
*/ */
.chat-box .author { .chat-box .author {
font-size: 80%; font-size: 80%;
color:#777; color:#777;
} }
/* Inline image styles */ /* Inline image styles */
@@ -1316,7 +1320,6 @@ i.search {
max-height: 24rem; max-height: 24rem;
overflow: hidden; overflow: hidden;
border-radius: 0.1rem; border-radius: 0.1rem;
cursor: pointer;
display: block; display: block;
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -33,7 +33,7 @@ export const REM_SIZE = 13;
export const AVATAR_SIZE = 128; export const AVATAR_SIZE = 128;
// Size of the broken_image shown in MessagesView // Size of the broken_image shown in MessagesView
export const BROKEN_IMAGE_SIZE = 48; export const BROKEN_IMAGE_SIZE = 32;
// Number of chat messages to fetch in one call. // Number of chat messages to fetch in one call.
export const MESSAGES_PAGE = 24; export const MESSAGES_PAGE = 24;
+6 -2
View File
@@ -159,12 +159,16 @@ function draftyFormatter(style, data, values, key) {
// Additional processing for images // Additional processing for images
if (data) { if (data) {
attr.className = 'inline-image'; attr.className = 'inline-image';
attr.onClick = this.handlePreviewImage;
let dim = fitImageSize(data.width, data.height, let dim = fitImageSize(data.width, data.height,
Math.min(this.props.viewportWidth - REM_SIZE * 4, REM_SIZE * 36), REM_SIZE * 24, false); Math.min(this.props.viewportWidth - REM_SIZE * 4, REM_SIZE * 36), REM_SIZE * 24, false);
dim = dim || {dstWidth: BROKEN_IMAGE_SIZE, dstHeight: BROKEN_IMAGE_SIZE}; dim = dim || {dstWidth: BROKEN_IMAGE_SIZE, dstHeight: BROKEN_IMAGE_SIZE};
attr.style = { width: dim.dstWidth + 'px', height: dim.dstHeight + 'px' }; attr.style = { width: dim.dstWidth + 'px', height: dim.dstHeight + 'px' };
attr.src = attr.src || 'img/broken_image.png'; if (attr.src) {
attr.onClick = this.handlePreviewImage;
attr.className += ' image-clickable';
} else {
attr.src = 'img/broken_image.png';
}
} }
break; break;
case 'BN': case 'BN':
+8 -3
View File
@@ -182,7 +182,7 @@ var MIN_TAG_LENGTH = 4;
var MEDIA_BREAKPOINT = 640; var MEDIA_BREAKPOINT = 640;
var REM_SIZE = 13; var REM_SIZE = 13;
var AVATAR_SIZE = 128; var AVATAR_SIZE = 128;
var BROKEN_IMAGE_SIZE = 48; var BROKEN_IMAGE_SIZE = 32;
var MESSAGES_PAGE = 24; var MESSAGES_PAGE = 24;
var MAX_INBAND_ATTACHMENT_SIZE = 195840; var MAX_INBAND_ATTACHMENT_SIZE = 195840;
var MAX_EXTERN_ATTACHMENT_SIZE = 1 << 23; var MAX_EXTERN_ATTACHMENT_SIZE = 1 << 23;
@@ -5959,7 +5959,6 @@ function draftyFormatter(style, data, values, key) {
case 'IM': case 'IM':
if (data) { if (data) {
attr.className = 'inline-image'; attr.className = 'inline-image';
attr.onClick = this.handlePreviewImage;
var dim = Object(_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_7__["fitImageSize"])(data.width, data.height, Math.min(this.props.viewportWidth - _config_js__WEBPACK_IMPORTED_MODULE_6__["REM_SIZE"] * 4, _config_js__WEBPACK_IMPORTED_MODULE_6__["REM_SIZE"] * 36), _config_js__WEBPACK_IMPORTED_MODULE_6__["REM_SIZE"] * 24, false); var dim = Object(_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_7__["fitImageSize"])(data.width, data.height, Math.min(this.props.viewportWidth - _config_js__WEBPACK_IMPORTED_MODULE_6__["REM_SIZE"] * 4, _config_js__WEBPACK_IMPORTED_MODULE_6__["REM_SIZE"] * 36), _config_js__WEBPACK_IMPORTED_MODULE_6__["REM_SIZE"] * 24, false);
dim = dim || { dim = dim || {
dstWidth: _config_js__WEBPACK_IMPORTED_MODULE_6__["BROKEN_IMAGE_SIZE"], dstWidth: _config_js__WEBPACK_IMPORTED_MODULE_6__["BROKEN_IMAGE_SIZE"],
@@ -5969,7 +5968,13 @@ function draftyFormatter(style, data, values, key) {
width: dim.dstWidth + 'px', width: dim.dstWidth + 'px',
height: dim.dstHeight + 'px' height: dim.dstHeight + 'px'
}; };
attr.src = attr.src || 'img/broken_image.png';
if (attr.src) {
attr.onClick = this.handlePreviewImage;
attr.className += ' image-clickable';
} else {
attr.src = 'img/broken_image.png';
}
} }
break; break;
+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