More bug fixes.
This commit is contained in:
@@ -15,6 +15,7 @@ import LetterTile from '../widgets/letter-tile.jsx';
|
|||||||
import LoadSpinner from '../widgets/load-spinner.jsx';
|
import LoadSpinner from '../widgets/load-spinner.jsx';
|
||||||
import LogoView from './logo-view.jsx';
|
import LogoView from './logo-view.jsx';
|
||||||
import SendMessage from '../widgets/send-message.jsx';
|
import SendMessage from '../widgets/send-message.jsx';
|
||||||
|
import UploadingImage from '../widgets/uploading-image.jsx'
|
||||||
|
|
||||||
import { DEFAULT_P2P_ACCESS_MODE, IMAGE_PREVIEW_DIM, KEYPRESS_DELAY, MESSAGES_PAGE,
|
import { DEFAULT_P2P_ACCESS_MODE, IMAGE_PREVIEW_DIM, KEYPRESS_DELAY, MESSAGES_PAGE,
|
||||||
MAX_EXTERN_ATTACHMENT_SIZE, MAX_IMAGE_DIM, MAX_INBAND_ATTACHMENT_SIZE, READ_DELAY,
|
MAX_EXTERN_ATTACHMENT_SIZE, MAX_IMAGE_DIM, MAX_INBAND_ATTACHMENT_SIZE, READ_DELAY,
|
||||||
@@ -974,6 +975,7 @@ class MessagesView extends React.Component {
|
|||||||
<ImagePreview
|
<ImagePreview
|
||||||
content={this.state.imagePreview}
|
content={this.state.imagePreview}
|
||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
|
viewportWidth={this.props.viewportWidth}
|
||||||
replyTo={this.state.reply}
|
replyTo={this.state.reply}
|
||||||
formatter={draftyFormatter}
|
formatter={draftyFormatter}
|
||||||
onCancelReply={this.handleCancelReply}
|
onCancelReply={this.handleCancelReply}
|
||||||
@@ -993,6 +995,7 @@ class MessagesView extends React.Component {
|
|||||||
<DocPreview
|
<DocPreview
|
||||||
content={this.state.docPreview}
|
content={this.state.docPreview}
|
||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
|
viewportWidth={this.props.viewportWidth}
|
||||||
replyTo={this.state.reply}
|
replyTo={this.state.reply}
|
||||||
formatter={draftyFormatter}
|
formatter={draftyFormatter}
|
||||||
onCancelReply={this.handleCancelReply}
|
onCancelReply={this.handleCancelReply}
|
||||||
@@ -1178,6 +1181,7 @@ class MessagesView extends React.Component {
|
|||||||
<SendMessage
|
<SendMessage
|
||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
disabled={!this.state.isWriter}
|
disabled={!this.state.isWriter}
|
||||||
|
viewportWidth={this.props.viewportWidth}
|
||||||
onKeyPress={this.sendKeyPress}
|
onKeyPress={this.sendKeyPress}
|
||||||
onSendMessage={this.sendMessage}
|
onSendMessage={this.sendMessage}
|
||||||
onAttachFile={this.handleAttachFile}
|
onAttachFile={this.handleAttachFile}
|
||||||
@@ -1276,8 +1280,11 @@ function draftyFormatter(style, data, values, key) {
|
|||||||
attr.src = this.props.tinode.authorizeURL(sanitizeImageUrl(attr.src));
|
attr.src = this.props.tinode.authorizeURL(sanitizeImageUrl(attr.src));
|
||||||
attr.alt = data.name;
|
attr.alt = data.name;
|
||||||
if (attr.src) {
|
if (attr.src) {
|
||||||
attr.onClick = this.handleImagePreview;
|
if (Math.max(data.width || 0, data.height || 0) > IMAGE_THUMBNAIL_DIM) {
|
||||||
attr.className += ' image-clickable';
|
// Allow previews for large enough images.
|
||||||
|
attr.onClick = this.handleImagePreview;
|
||||||
|
attr.className += ' image-clickable';
|
||||||
|
}
|
||||||
attr.loading = 'lazy';
|
attr.loading = 'lazy';
|
||||||
} else {
|
} else {
|
||||||
attr.src = 'img/broken_image.png';
|
attr.src = 'img/broken_image.png';
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { Drafty } from 'tinode-sdk';
|
|||||||
import Attachment from './attachment.jsx';
|
import Attachment from './attachment.jsx';
|
||||||
import LetterTile from './letter-tile.jsx';
|
import LetterTile from './letter-tile.jsx';
|
||||||
import ReceivedMarker from './received-marker.jsx'
|
import ReceivedMarker from './received-marker.jsx'
|
||||||
import UploadingImage from './uploading-image.jsx'
|
|
||||||
|
|
||||||
import { sanitizeImageUrl, sanitizeUrl } from '../lib/utils.js';
|
import { sanitizeImageUrl, sanitizeUrl } from '../lib/utils.js';
|
||||||
|
|
||||||
|
|||||||
@@ -424,7 +424,6 @@ class ContextMenu extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
replyToMessage(params, errorHandler) {
|
replyToMessage(params, errorHandler) {
|
||||||
console.log("Reply to message", params);
|
|
||||||
params.pickReply({ seq: params.seq, content: params.content });
|
params.pickReply({ seq: params.seq, content: params.content });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export default class DocPreview extends React.PureComponent {
|
|||||||
<SendMessage
|
<SendMessage
|
||||||
noInput={true}
|
noInput={true}
|
||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
|
viewportWidth={this.props.viewportWidth}
|
||||||
replyTo={this.props.replyTo}
|
replyTo={this.props.replyTo}
|
||||||
formatter={this.props.formatter}
|
formatter={this.props.formatter}
|
||||||
onCancelReply={this.props.onCancelReply}
|
onCancelReply={this.props.onCancelReply}
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export default class ImagePreview extends React.PureComponent {
|
|||||||
messagePrompt="add_image_caption"
|
messagePrompt="add_image_caption"
|
||||||
acceptBlank={true}
|
acceptBlank={true}
|
||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
|
viewportWidth={this.props.viewportWidth}
|
||||||
replyTo={this.props.replyTo}
|
replyTo={this.props.replyTo}
|
||||||
formatter={this.props.formatter}
|
formatter={this.props.formatter}
|
||||||
onCancelReply={this.props.onCancelReply}
|
onCancelReply={this.props.onCancelReply}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class SendMessage extends React.PureComponent {
|
|||||||
handleQuoteClick(e) {
|
handleQuoteClick(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (this.props.replyTo) {
|
if (this.props.replyTo && this.props.onQuoteClick) {
|
||||||
const replyToSeq = this.props.replyTo.seq;
|
const replyToSeq = this.props.replyTo.seq;
|
||||||
this.props.onQuoteClick(replyToSeq);
|
this.props.onQuoteClick(replyToSeq);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user