wip: adding out of band image sending

This commit is contained in:
or-else
2020-10-13 14:46:45 -07:00
parent 09baee8d73
commit fbdf1df9d0
3 changed files with 84 additions and 15 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ export default class ImagePreview extends React.PureComponent {
handleSendImage(caption) {
this.props.onClose();
this.props.onSendMessage(caption, this.props.content.type, this.props.content.bits,
this.props.onSendMessage(caption, this.props.content.type,
this.props.content.width, this.props.content.height, this.props.content.filename);
}
@@ -47,7 +47,7 @@ export default class ImagePreview extends React.PureComponent {
size.maxHeight = '100%';
let filename = this.props.content.filename;
// Averate font aspect ratio is ~0.5; File name takes 1/3 of the viewport width.
// Average font aspect ratio is ~0.5; File name takes 1/3 of the viewport width.
const maxlength = Math.max(((this.state.width / REM_SIZE / 1.5) | 0) - 2, 12);
if (filename.length > maxlength) {
filename = filename.slice(0, maxlength/2 - 1) + '…' + filename.slice(1 - maxlength/2);