corrected inline image width on mobile
This commit is contained in:
+7
-1
@@ -2366,7 +2366,8 @@
|
|||||||
attr.key = elementKey;
|
attr.key = elementKey;
|
||||||
if (style == "IM") {
|
if (style == "IM") {
|
||||||
// Additional processing for images
|
// Additional processing for images
|
||||||
var size = imageScaleDown(data.width, data.height, REM_SIZE * 36, REM_SIZE * 24);
|
var size = imageScaleDown(data.width, data.height,
|
||||||
|
Math.min(this.props.viewportWidth - REM_SIZE * 4, REM_SIZE * 36), REM_SIZE * 24);
|
||||||
attr.className = "inline-image";
|
attr.className = "inline-image";
|
||||||
attr.style = size ? { width: size.width + "px", height: size.height + "px" } : null;
|
attr.style = size ? { width: size.width + "px", height: size.height + "px" } : null;
|
||||||
attr.onClick = this.handlePreviewImage;
|
attr.onClick = this.handlePreviewImage;
|
||||||
@@ -2743,6 +2744,7 @@
|
|||||||
timestamp={msg.ts} response={isReply}
|
timestamp={msg.ts} response={isReply}
|
||||||
userFrom={userFrom} userName={userName} userAvatar={userAvatar}
|
userFrom={userFrom} userName={userName} userAvatar={userAvatar}
|
||||||
sequence={sequence} received={msgReceived}
|
sequence={sequence} received={msgReceived}
|
||||||
|
viewportWidth={this.props.viewportWidth}
|
||||||
onImagePreview={this.handleImagePreview} key={msg.seq} />
|
onImagePreview={this.handleImagePreview} key={msg.seq} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3045,6 +3047,8 @@
|
|||||||
window.addEventListener('online', function(e) { instance.handleOnline(true); });
|
window.addEventListener('online', function(e) { instance.handleOnline(true); });
|
||||||
window.addEventListener('offline', function(e) { instance.handleOnline(false); });
|
window.addEventListener('offline', function(e) { instance.handleOnline(false); });
|
||||||
|
|
||||||
|
this.setState({viewportWidth: document.documentElement.clientWidth});
|
||||||
|
|
||||||
Tinode.enableLogging(true, true);
|
Tinode.enableLogging(true, true);
|
||||||
Tinode.onConnect = this.handleConnected;
|
Tinode.onConnect = this.handleConnected;
|
||||||
Tinode.onDisconnect = this.handleDisconnect;
|
Tinode.onDisconnect = this.handleDisconnect;
|
||||||
@@ -3056,6 +3060,7 @@
|
|||||||
},
|
},
|
||||||
handleResize: function() {
|
handleResize: function() {
|
||||||
var mobile = document.documentElement.clientWidth <= MEDIA_BREAKPOINT;
|
var mobile = document.documentElement.clientWidth <= MEDIA_BREAKPOINT;
|
||||||
|
this.setState({viewportWidth: document.documentElement.clientWidth});
|
||||||
if (this.state.displayMobile != mobile) {
|
if (this.state.displayMobile != mobile) {
|
||||||
this.setState({displayMobile: mobile});
|
this.setState({displayMobile: mobile});
|
||||||
}
|
}
|
||||||
@@ -3527,6 +3532,7 @@
|
|||||||
connected={this.state.connected}
|
connected={this.state.connected}
|
||||||
online={this.state.topicSelectedOnline}
|
online={this.state.topicSelectedOnline}
|
||||||
displayMobile={this.state.displayMobile}
|
displayMobile={this.state.displayMobile}
|
||||||
|
viewportWidth={this.state.viewportWidth}
|
||||||
hideSelf={this.state.displayMobile &&
|
hideSelf={this.state.displayMobile &&
|
||||||
(this.state.mobilePanel !== 'topic-view' || this.state.showInfoPanel)}
|
(this.state.mobilePanel !== 'topic-view' || this.state.showInfoPanel)}
|
||||||
topic={this.state.topicSelected}
|
topic={this.state.topicSelected}
|
||||||
|
|||||||
Reference in New Issue
Block a user