merge with drag-n-drop
This commit is contained in:
@@ -2975,6 +2975,34 @@ ul.tabbar li.active > a {
|
|||||||
color: #666C;
|
color: #666C;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Drag-and-drop container.
|
||||||
|
*/
|
||||||
|
.drag-and-drop {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drag-and-drop .banner {
|
||||||
|
border: dashed grey 1px;
|
||||||
|
background-color: rgba(255,255,255,.8);
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
/* Center text & font. */
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 2rem;
|
||||||
|
color: grey;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Very wide monitor.
|
Very wide monitor.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": true,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "Drag file here",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": false,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": true,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,6 +239,10 @@
|
|||||||
"defaultMessage": "Unsupported",
|
"defaultMessage": "Unsupported",
|
||||||
"description": "Unsupported entity in drafty"
|
"description": "Unsupported entity in drafty"
|
||||||
},
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner"
|
||||||
|
},
|
||||||
"editing_message": {
|
"editing_message": {
|
||||||
"defaultMessage": "Editing",
|
"defaultMessage": "Editing",
|
||||||
"description": "Title over message editing preview"
|
"description": "Title over message editing preview"
|
||||||
|
|||||||
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": true,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": true,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": true,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": true,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": true,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1521,5 +1521,12 @@
|
|||||||
"description": "Icon tool tip for sending a message",
|
"description": "Icon tool tip for sending a message",
|
||||||
"missing": false,
|
"missing": false,
|
||||||
"obsolete": false
|
"obsolete": false
|
||||||
|
},
|
||||||
|
"drag_file": {
|
||||||
|
"translation": "",
|
||||||
|
"defaultMessage": "Drag file here",
|
||||||
|
"description": "Prompt on the file drag-n-drop overlay banner",
|
||||||
|
"missing": true,
|
||||||
|
"obsolete": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+72
-44
@@ -9,6 +9,7 @@ import CallPanel from '../widgets/call-panel.jsx';
|
|||||||
import ChatMessage from '../widgets/chat-message.jsx';
|
import ChatMessage from '../widgets/chat-message.jsx';
|
||||||
import ContactBadges from '../widgets/contact-badges.jsx';
|
import ContactBadges from '../widgets/contact-badges.jsx';
|
||||||
import DocPreview from '../widgets/doc-preview.jsx';
|
import DocPreview from '../widgets/doc-preview.jsx';
|
||||||
|
import DragAndDrop from '../widgets/drag-and-drop.jsx'
|
||||||
import ErrorPanel from '../widgets/error-panel.jsx';
|
import ErrorPanel from '../widgets/error-panel.jsx';
|
||||||
import GroupSubs from '../widgets/group-subs.jsx';
|
import GroupSubs from '../widgets/group-subs.jsx';
|
||||||
import ImagePreview from '../widgets/image-preview.jsx';
|
import ImagePreview from '../widgets/image-preview.jsx';
|
||||||
@@ -68,6 +69,11 @@ const messages = defineMessages({
|
|||||||
id: 'editing_message',
|
id: 'editing_message',
|
||||||
defaultMessage: 'Editing',
|
defaultMessage: 'Editing',
|
||||||
description: 'Title over message editing preview'
|
description: 'Title over message editing preview'
|
||||||
|
},
|
||||||
|
drag_file: {
|
||||||
|
id: 'drag_file',
|
||||||
|
defaultMessage: 'Drag file here',
|
||||||
|
description: 'Prompt on the file drag-n-drop overlay banner'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -130,6 +136,7 @@ class MessagesView extends React.Component {
|
|||||||
this.postReadNotification = this.postReadNotification.bind(this);
|
this.postReadNotification = this.postReadNotification.bind(this);
|
||||||
this.clearNotificationQueue = this.clearNotificationQueue.bind(this);
|
this.clearNotificationQueue = this.clearNotificationQueue.bind(this);
|
||||||
this.goToLatestMessage = this.goToLatestMessage.bind(this);
|
this.goToLatestMessage = this.goToLatestMessage.bind(this);
|
||||||
|
this.handleFileDrop = this.handleFileDrop.bind(this);
|
||||||
|
|
||||||
this.handlePickReply = this.handlePickReply.bind(this);
|
this.handlePickReply = this.handlePickReply.bind(this);
|
||||||
this.handleEditMessage = this.handleEditMessage.bind(this);
|
this.handleEditMessage = this.handleEditMessage.bind(this);
|
||||||
@@ -1044,6 +1051,19 @@ class MessagesView extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handleFileDrop is called when the user drags & drops a file upon the message view.
|
||||||
|
handleFileDrop(files) {
|
||||||
|
if (!files || files.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const file = files[0];
|
||||||
|
if (file.type && file.type.startsWith('image/')) {
|
||||||
|
this.handleAttachImageOrVideo(file);
|
||||||
|
} else {
|
||||||
|
this.handleAttachFile(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sendAudioAttachment sends audio bits inband as Drafty message (no preview).
|
// sendAudioAttachment sends audio bits inband as Drafty message (no preview).
|
||||||
sendAudioAttachment(url, preview, duration) {
|
sendAudioAttachment(url, preview, duration) {
|
||||||
fetch(url)
|
fetch(url)
|
||||||
@@ -1368,51 +1388,8 @@ class MessagesView extends React.Component {
|
|||||||
|
|
||||||
const titleClass = 'panel-title' + (this.state.deleted ? ' deleted' : '');
|
const titleClass = 'panel-title' + (this.state.deleted ? ' deleted' : '');
|
||||||
|
|
||||||
component2 = (
|
let messagesComponent = (
|
||||||
<>
|
<>
|
||||||
<div id="topic-caption-panel" className="caption-panel">
|
|
||||||
{this.props.displayMobile ?
|
|
||||||
<a href="#" id="hide-message-view" onClick={(e) => {e.preventDefault(); this.props.onHideMessagesView();}}>
|
|
||||||
<i className="material-icons">arrow_back</i>
|
|
||||||
</a>
|
|
||||||
:
|
|
||||||
null}
|
|
||||||
<div className="avatar-box">
|
|
||||||
<LetterTile
|
|
||||||
tinode={this.props.tinode}
|
|
||||||
avatar={avatar}
|
|
||||||
topic={this.state.topic}
|
|
||||||
title={this.state.title}
|
|
||||||
deleted={this.state.deleted} />
|
|
||||||
{!isChannel ? <span className={online} /> : null}
|
|
||||||
</div>
|
|
||||||
<div id="topic-title-group">
|
|
||||||
<div id="topic-title" className={titleClass}>{
|
|
||||||
this.state.title ||
|
|
||||||
<i><FormattedMessage id="unnamed_topic" defaultMessage="Unnamed"
|
|
||||||
description="Title shown when the topic has no name" /></i>
|
|
||||||
}<ContactBadges badges={icon_badges} /></div>
|
|
||||||
<div id="topic-last-seen">{lastSeen}</div>
|
|
||||||
</div>
|
|
||||||
{groupTopic ?
|
|
||||||
<GroupSubs
|
|
||||||
tinode={this.props.tinode}
|
|
||||||
subscribers={this.state.onlineSubs} /> :
|
|
||||||
<div id="topic-users" />
|
|
||||||
}
|
|
||||||
<div>
|
|
||||||
<a href="#" onClick={this.handleContextClick}>
|
|
||||||
<i className="material-icons">more_vert</i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{this.props.displayMobile ?
|
|
||||||
<ErrorPanel
|
|
||||||
level={this.props.errorLevel}
|
|
||||||
text={this.props.errorText}
|
|
||||||
onClearError={this.props.onError} />
|
|
||||||
: null}
|
|
||||||
<LoadSpinner show={this.state.fetchingMessages} />
|
|
||||||
<div id="messages-container">
|
<div id="messages-container">
|
||||||
<button className={'action-button' + (this.state.showGoToLastButton ? '' : ' hidden')}
|
<button className={'action-button' + (this.state.showGoToLastButton ? '' : ' hidden')}
|
||||||
onClick={this.goToLatestMessage}>
|
onClick={this.goToLatestMessage}>
|
||||||
@@ -1463,6 +1440,57 @@ class MessagesView extends React.Component {
|
|||||||
onCancelReply={this.handleCancelReply} />}
|
onCancelReply={this.handleCancelReply} />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
component2 = (
|
||||||
|
<>
|
||||||
|
<div id="topic-caption-panel" className="caption-panel">
|
||||||
|
{this.props.displayMobile ?
|
||||||
|
<a href="#" id="hide-message-view" onClick={(e) => {e.preventDefault(); this.props.onHideMessagesView();}}>
|
||||||
|
<i className="material-icons">arrow_back</i>
|
||||||
|
</a>
|
||||||
|
:
|
||||||
|
null}
|
||||||
|
<div className="avatar-box">
|
||||||
|
<LetterTile
|
||||||
|
tinode={this.props.tinode}
|
||||||
|
avatar={avatar}
|
||||||
|
topic={this.state.topic}
|
||||||
|
title={this.state.title}
|
||||||
|
deleted={this.state.deleted} />
|
||||||
|
{!isChannel ? <span className={online} /> : null}
|
||||||
|
</div>
|
||||||
|
<div id="topic-title-group">
|
||||||
|
<div id="topic-title" className={titleClass}>{
|
||||||
|
this.state.title ||
|
||||||
|
<i><FormattedMessage id="unnamed_topic" defaultMessage="Unnamed"
|
||||||
|
description="Title shown when the topic has no name" /></i>
|
||||||
|
}<ContactBadges badges={icon_badges} /></div>
|
||||||
|
<div id="topic-last-seen">{lastSeen}</div>
|
||||||
|
</div>
|
||||||
|
{groupTopic ?
|
||||||
|
<GroupSubs
|
||||||
|
tinode={this.props.tinode}
|
||||||
|
subscribers={this.state.onlineSubs} /> :
|
||||||
|
<div id="topic-users" />
|
||||||
|
}
|
||||||
|
<div>
|
||||||
|
<a href="#" onClick={this.handleContextClick}>
|
||||||
|
<i className="material-icons">more_vert</i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{this.props.displayMobile ?
|
||||||
|
<ErrorPanel
|
||||||
|
level={this.props.errorLevel}
|
||||||
|
text={this.props.errorText}
|
||||||
|
onClearError={this.props.onError} />
|
||||||
|
: null}
|
||||||
|
<LoadSpinner show={this.state.fetchingMessages} />
|
||||||
|
{!this.state.unconfirmed && !this.props.forwardMessage ?
|
||||||
|
<DragAndDrop actionPrompt={this.props.intl.formatMessage(messages.drag_file)} onDrop={this.handleFileDrop} >{messagesComponent}</DragAndDrop>
|
||||||
|
: messagesComponent}
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
component = <div id="topic-view">{component2}</div>
|
component = <div id="topic-view">{component2}</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
// Drag & drop container: displays a banner on drag and calls a handler on drop.
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default class DragAndDrop extends React.PureComponent {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
// A file is being dragged over the container.
|
||||||
|
dragging: false
|
||||||
|
};
|
||||||
|
this.dropRef = React.createRef();
|
||||||
|
// Keeps track of the drag event.
|
||||||
|
// Need a counter b/c the browser's 'drag' events may fire multiple times
|
||||||
|
// when the user takes the mouse pointer over the container:
|
||||||
|
// for the component itself and for all nested/child elements.
|
||||||
|
this.dragCounter = 0;
|
||||||
|
|
||||||
|
this.handleDrag = this.handleDrag.bind(this);
|
||||||
|
this.handleDragIn = this.handleDragIn.bind(this);
|
||||||
|
this.handleDragOut = this.handleDragOut.bind(this);
|
||||||
|
this.handleDrop = this.handleDrop.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
let div = this.dropRef.current;
|
||||||
|
div.addEventListener('dragenter', this.handleDragIn);
|
||||||
|
div.addEventListener('dragleave', this.handleDragOut);
|
||||||
|
div.addEventListener('dragover', this.handleDrag);
|
||||||
|
div.addEventListener('drop', this.handleDrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
let div = this.dropRef.current;
|
||||||
|
div.removeEventListener('dragenter', this.handleDragIn);
|
||||||
|
div.removeEventListener('dragleave', this.handleDragOut);
|
||||||
|
div.removeEventListener('dragover', this.handleDrag);
|
||||||
|
div.removeEventListener('drop', this.handleDrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleDrag(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleDragIn(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.dragCounter++;
|
||||||
|
if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
|
||||||
|
this.setState({dragging: true});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleDragOut(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.dragCounter--;
|
||||||
|
if (this.dragCounter == 0) {
|
||||||
|
this.setState({dragging: false});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleDrop(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.setState({dragging: false});
|
||||||
|
if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
|
||||||
|
this.props.onDrop(e.dataTransfer.files);
|
||||||
|
e.dataTransfer.clearData();
|
||||||
|
this.dragCounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className='drag-and-drop' ref={this.dropRef}>
|
||||||
|
{this.state.dragging ?
|
||||||
|
<div className='banner'>{this.props.actionPrompt}</div>
|
||||||
|
: null}
|
||||||
|
{this.props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -80,6 +80,7 @@ class SendMessage extends React.PureComponent {
|
|||||||
this.handleSend = this.handleSend.bind(this);
|
this.handleSend = this.handleSend.bind(this);
|
||||||
this.handleKeyPress = this.handleKeyPress.bind(this);
|
this.handleKeyPress = this.handleKeyPress.bind(this);
|
||||||
this.handleMessageTyping = this.handleMessageTyping.bind(this);
|
this.handleMessageTyping = this.handleMessageTyping.bind(this);
|
||||||
|
this.handleDropAttach = this.handleDropAttach.bind(this);
|
||||||
|
|
||||||
this.handleQuoteClick = this.handleQuoteClick.bind(this);
|
this.handleQuoteClick = this.handleQuoteClick.bind(this);
|
||||||
|
|
||||||
@@ -159,6 +160,13 @@ class SendMessage extends React.PureComponent {
|
|||||||
e.target.value = '';
|
e.target.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleDropAttach(files) {
|
||||||
|
if (files && files.length > 0) {
|
||||||
|
console.log('Dropping ', files);
|
||||||
|
this.props.onAttachFile(files[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleAttachAudio(url, preview, duration) {
|
handleAttachAudio(url, preview, duration) {
|
||||||
this.setState({audioRec: false});
|
this.setState({audioRec: false});
|
||||||
this.props.onAttachAudio(url, preview, duration);
|
this.props.onAttachAudio(url, preview, duration);
|
||||||
@@ -260,10 +268,9 @@ class SendMessage extends React.PureComponent {
|
|||||||
onFinished={this.handleAttachAudio}/>
|
onFinished={this.handleAttachAudio}/>
|
||||||
</Suspense>) :
|
</Suspense>) :
|
||||||
<textarea id="sendMessage" placeholder={prompt}
|
<textarea id="sendMessage" placeholder={prompt}
|
||||||
value={this.state.message}
|
value={this.state.message} onChange={this.handleMessageTyping}
|
||||||
onChange={this.handleMessageTyping}
|
|
||||||
onKeyPress={this.handleKeyPress}
|
onKeyPress={this.handleKeyPress}
|
||||||
ref={ref => {this.messageEditArea = ref;}}
|
ref={(ref) => {this.messageEditArea = ref;}}
|
||||||
autoFocus />)}
|
autoFocus />)}
|
||||||
{this.state.message || !audioEnabled ?
|
{this.state.message || !audioEnabled ?
|
||||||
<a href="#" onClick={this.handleSend} title={formatMessage(messages.icon_title_send)}>
|
<a href="#" onClick={this.handleSend} title={formatMessage(messages.icon_title_send)}>
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+229
-108
@@ -5355,21 +5355,23 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _widgets_chat_message_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../widgets/chat-message.jsx */ "./src/widgets/chat-message.jsx");
|
/* harmony import */ var _widgets_chat_message_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../widgets/chat-message.jsx */ "./src/widgets/chat-message.jsx");
|
||||||
/* harmony import */ var _widgets_contact_badges_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../widgets/contact-badges.jsx */ "./src/widgets/contact-badges.jsx");
|
/* harmony import */ var _widgets_contact_badges_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../widgets/contact-badges.jsx */ "./src/widgets/contact-badges.jsx");
|
||||||
/* harmony import */ var _widgets_doc_preview_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../widgets/doc-preview.jsx */ "./src/widgets/doc-preview.jsx");
|
/* harmony import */ var _widgets_doc_preview_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../widgets/doc-preview.jsx */ "./src/widgets/doc-preview.jsx");
|
||||||
/* harmony import */ var _widgets_error_panel_jsx__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../widgets/error-panel.jsx */ "./src/widgets/error-panel.jsx");
|
/* harmony import */ var _widgets_drag_and_drop_jsx__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../widgets/drag-and-drop.jsx */ "./src/widgets/drag-and-drop.jsx");
|
||||||
/* harmony import */ var _widgets_group_subs_jsx__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../widgets/group-subs.jsx */ "./src/widgets/group-subs.jsx");
|
/* harmony import */ var _widgets_error_panel_jsx__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../widgets/error-panel.jsx */ "./src/widgets/error-panel.jsx");
|
||||||
/* harmony import */ var _widgets_image_preview_jsx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../widgets/image-preview.jsx */ "./src/widgets/image-preview.jsx");
|
/* harmony import */ var _widgets_group_subs_jsx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../widgets/group-subs.jsx */ "./src/widgets/group-subs.jsx");
|
||||||
/* harmony import */ var _widgets_invitation_jsx__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../widgets/invitation.jsx */ "./src/widgets/invitation.jsx");
|
/* harmony import */ var _widgets_image_preview_jsx__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../widgets/image-preview.jsx */ "./src/widgets/image-preview.jsx");
|
||||||
/* harmony import */ var _widgets_letter_tile_jsx__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../widgets/letter-tile.jsx */ "./src/widgets/letter-tile.jsx");
|
/* harmony import */ var _widgets_invitation_jsx__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../widgets/invitation.jsx */ "./src/widgets/invitation.jsx");
|
||||||
/* harmony import */ var _widgets_load_spinner_jsx__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../widgets/load-spinner.jsx */ "./src/widgets/load-spinner.jsx");
|
/* harmony import */ var _widgets_letter_tile_jsx__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../widgets/letter-tile.jsx */ "./src/widgets/letter-tile.jsx");
|
||||||
/* harmony import */ var _logo_view_jsx__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./logo-view.jsx */ "./src/views/logo-view.jsx");
|
/* harmony import */ var _widgets_load_spinner_jsx__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../widgets/load-spinner.jsx */ "./src/widgets/load-spinner.jsx");
|
||||||
/* harmony import */ var _widgets_meta_message_jsx__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../widgets/meta-message.jsx */ "./src/widgets/meta-message.jsx");
|
/* harmony import */ var _logo_view_jsx__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./logo-view.jsx */ "./src/views/logo-view.jsx");
|
||||||
/* harmony import */ var _widgets_send_message_jsx__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../widgets/send-message.jsx */ "./src/widgets/send-message.jsx");
|
/* harmony import */ var _widgets_meta_message_jsx__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../widgets/meta-message.jsx */ "./src/widgets/meta-message.jsx");
|
||||||
/* harmony import */ var _widgets_video_preview_jsx__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../widgets/video-preview.jsx */ "./src/widgets/video-preview.jsx");
|
/* harmony import */ var _widgets_send_message_jsx__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../widgets/send-message.jsx */ "./src/widgets/send-message.jsx");
|
||||||
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../config.js */ "./src/config.js");
|
/* harmony import */ var _widgets_video_preview_jsx__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../widgets/video-preview.jsx */ "./src/widgets/video-preview.jsx");
|
||||||
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../constants.js */ "./src/constants.js");
|
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../config.js */ "./src/config.js");
|
||||||
/* harmony import */ var _lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../lib/blob-helpers.js */ "./src/lib/blob-helpers.js");
|
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../constants.js */ "./src/constants.js");
|
||||||
/* harmony import */ var _lib_navigation_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../lib/navigation.js */ "./src/lib/navigation.js");
|
/* harmony import */ var _lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../lib/blob-helpers.js */ "./src/lib/blob-helpers.js");
|
||||||
/* harmony import */ var _lib_strformat_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../lib/strformat.js */ "./src/lib/strformat.js");
|
/* harmony import */ var _lib_navigation_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../lib/navigation.js */ "./src/lib/navigation.js");
|
||||||
|
/* harmony import */ var _lib_strformat_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../lib/strformat.js */ "./src/lib/strformat.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -5455,6 +5457,13 @@ const messages = (0,react_intl__WEBPACK_IMPORTED_MODULE_1__.defineMessages)({
|
|||||||
"type": 0,
|
"type": 0,
|
||||||
"value": "Editing"
|
"value": "Editing"
|
||||||
}]
|
}]
|
||||||
|
},
|
||||||
|
drag_file: {
|
||||||
|
id: "drag_file",
|
||||||
|
defaultMessage: [{
|
||||||
|
"type": 0,
|
||||||
|
"value": "Drag file here"
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
function isUnconfirmed(acs) {
|
function isUnconfirmed(acs) {
|
||||||
@@ -5472,7 +5481,7 @@ function isPeerRestricted(acs) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function shouldPresentCallPanel(callState) {
|
function shouldPresentCallPanel(callState) {
|
||||||
return callState == _constants_js__WEBPACK_IMPORTED_MODULE_18__.CALL_STATE_OUTGOING_INITATED || callState == _constants_js__WEBPACK_IMPORTED_MODULE_18__.CALL_STATE_IN_PROGRESS;
|
return callState == _constants_js__WEBPACK_IMPORTED_MODULE_19__.CALL_STATE_OUTGOING_INITATED || callState == _constants_js__WEBPACK_IMPORTED_MODULE_19__.CALL_STATE_IN_PROGRESS;
|
||||||
}
|
}
|
||||||
class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
|
class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -5507,6 +5516,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
this.postReadNotification = this.postReadNotification.bind(this);
|
this.postReadNotification = this.postReadNotification.bind(this);
|
||||||
this.clearNotificationQueue = this.clearNotificationQueue.bind(this);
|
this.clearNotificationQueue = this.clearNotificationQueue.bind(this);
|
||||||
this.goToLatestMessage = this.goToLatestMessage.bind(this);
|
this.goToLatestMessage = this.goToLatestMessage.bind(this);
|
||||||
|
this.handleFileDrop = this.handleFileDrop.bind(this);
|
||||||
this.handlePickReply = this.handlePickReply.bind(this);
|
this.handlePickReply = this.handlePickReply.bind(this);
|
||||||
this.handleEditMessage = this.handleEditMessage.bind(this);
|
this.handleEditMessage = this.handleEditMessage.bind(this);
|
||||||
this.handleCancelReply = this.handleCancelReply.bind(this);
|
this.handleCancelReply = this.handleCancelReply.bind(this);
|
||||||
@@ -5635,7 +5645,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
if (topic.public) {
|
if (topic.public) {
|
||||||
Object.assign(nextState, {
|
Object.assign(nextState, {
|
||||||
title: topic.public.fn,
|
title: topic.public.fn,
|
||||||
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.makeImageUrl)(topic.public.photo)
|
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.makeImageUrl)(topic.public.photo)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Object.assign(nextState, {
|
Object.assign(nextState, {
|
||||||
@@ -5719,7 +5729,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
const newTopic = this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic;
|
const newTopic = this.props.newTopicParams && this.props.newTopicParams._topicName == this.props.topic;
|
||||||
let getQuery = topic.startMetaQuery().withLaterDesc().withLaterSub();
|
let getQuery = topic.startMetaQuery().withLaterDesc().withLaterSub();
|
||||||
if (this.state.isReader || newTopic) {
|
if (this.state.isReader || newTopic) {
|
||||||
getQuery = getQuery.withLaterData(_config_js__WEBPACK_IMPORTED_MODULE_17__.MESSAGES_PAGE);
|
getQuery = getQuery.withLaterData(_config_js__WEBPACK_IMPORTED_MODULE_18__.MESSAGES_PAGE);
|
||||||
if (this.state.isReader) {
|
if (this.state.isReader) {
|
||||||
getQuery = getQuery.withLaterDel();
|
getQuery = getQuery.withLaterDel();
|
||||||
}
|
}
|
||||||
@@ -5730,7 +5740,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
const setQuery = newTopic ? this.props.newTopicParams : undefined;
|
const setQuery = newTopic ? this.props.newTopicParams : undefined;
|
||||||
topic.subscribe(getQuery.build(), setQuery).then(ctrl => {
|
topic.subscribe(getQuery.build(), setQuery).then(ctrl => {
|
||||||
if (ctrl.code == 303) {
|
if (ctrl.code == 303) {
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_20__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_20__["default"].setUrlTopic('', ctrl.params.topic));
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_21__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_21__["default"].setUrlTopic('', ctrl.params.topic));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.state.topic != ctrl.topic) {
|
if (this.state.topic != ctrl.topic) {
|
||||||
@@ -5804,7 +5814,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
this.setState({
|
this.setState({
|
||||||
fetchingMessages: true
|
fetchingMessages: true
|
||||||
}, _ => {
|
}, _ => {
|
||||||
topic.getMessagesPage(_config_js__WEBPACK_IMPORTED_MODULE_17__.MESSAGES_PAGE).catch(err => this.props.onError(err.message, 'err')).finally(_ => this.setState({
|
topic.getMessagesPage(_config_js__WEBPACK_IMPORTED_MODULE_18__.MESSAGES_PAGE).catch(err => this.props.onError(err.message, 'err')).finally(_ => this.setState({
|
||||||
fetchingMessages: false
|
fetchingMessages: false
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@@ -5823,7 +5833,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
if (desc.public) {
|
if (desc.public) {
|
||||||
this.setState({
|
this.setState({
|
||||||
title: desc.public.fn,
|
title: desc.public.fn,
|
||||||
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.makeImageUrl)(desc.public.photo)
|
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.makeImageUrl)(desc.public.photo)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -5878,7 +5888,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
this.readNotificationQueue.push({
|
this.readNotificationQueue.push({
|
||||||
topicName: this.state.topic,
|
topicName: this.state.topic,
|
||||||
seq: seq,
|
seq: seq,
|
||||||
sendAt: now.setMilliseconds(now.getMilliseconds() + _config_js__WEBPACK_IMPORTED_MODULE_17__.READ_DELAY)
|
sendAt: now.setMilliseconds(now.getMilliseconds() + _config_js__WEBPACK_IMPORTED_MODULE_18__.READ_DELAY)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
clearNotificationQueue() {
|
clearNotificationQueue() {
|
||||||
@@ -5956,7 +5966,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
clearTimeout(this.keyPressTimer);
|
clearTimeout(this.keyPressTimer);
|
||||||
this.keyPressTimer = setTimeout(_ => this.setState({
|
this.keyPressTimer = setTimeout(_ => this.setState({
|
||||||
typingIndicator: false
|
typingIndicator: false
|
||||||
}), _config_js__WEBPACK_IMPORTED_MODULE_17__.KEYPRESS_DELAY + 1000);
|
}), _config_js__WEBPACK_IMPORTED_MODULE_18__.KEYPRESS_DELAY + 1000);
|
||||||
if (!this.state.typingIndicator) {
|
if (!this.state.typingIndicator) {
|
||||||
this.setState({
|
this.setState({
|
||||||
typingIndicator: true
|
typingIndicator: true
|
||||||
@@ -6048,7 +6058,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
handleEnablePeer(e) {
|
handleEnablePeer(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.onChangePermissions(this.state.topic, _config_js__WEBPACK_IMPORTED_MODULE_17__.DEFAULT_P2P_ACCESS_MODE, this.state.topic);
|
this.props.onChangePermissions(this.state.topic, _config_js__WEBPACK_IMPORTED_MODULE_18__.DEFAULT_P2P_ACCESS_MODE, this.state.topic);
|
||||||
}
|
}
|
||||||
sendKeyPress(audio) {
|
sendKeyPress(audio) {
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
@@ -6095,7 +6105,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
sendFileAttachment(file) {
|
sendFileAttachment(file) {
|
||||||
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
|
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
|
||||||
if (file.size > maxInbandAttachmentSize) {
|
if (file.size > maxInbandAttachmentSize) {
|
||||||
const uploader = this.props.tinode.getLargeFileHelper();
|
const uploader = this.props.tinode.getLargeFileHelper();
|
||||||
if (!uploader) {
|
if (!uploader) {
|
||||||
@@ -6111,7 +6121,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
});
|
});
|
||||||
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
||||||
} else {
|
} else {
|
||||||
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.fileToBase64)(file).then(b64 => this.sendMessage(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.attachFile(null, {
|
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.fileToBase64)(file).then(b64 => this.sendMessage(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.attachFile(null, {
|
||||||
mime: b64.mime,
|
mime: b64.mime,
|
||||||
data: b64.bits,
|
data: b64.bits,
|
||||||
filename: b64.name
|
filename: b64.name
|
||||||
@@ -6119,11 +6129,11 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleAttachFile(file) {
|
handleAttachFile(file) {
|
||||||
const maxExternAttachmentSize = this.props.tinode.getServerParam('maxFileUploadSize', _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_EXTERN_ATTACHMENT_SIZE);
|
const maxExternAttachmentSize = this.props.tinode.getServerParam('maxFileUploadSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_EXTERN_ATTACHMENT_SIZE);
|
||||||
if (file.size > maxExternAttachmentSize) {
|
if (file.size > maxExternAttachmentSize) {
|
||||||
this.props.onError(this.props.intl.formatMessage(messages.file_attachment_too_large, {
|
this.props.onError(this.props.intl.formatMessage(messages.file_attachment_too_large, {
|
||||||
size: (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_21__.bytesToHumanSize)(file.size),
|
size: (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_22__.bytesToHumanSize)(file.size),
|
||||||
limit: (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_21__.bytesToHumanSize)(maxExternAttachmentSize)
|
limit: (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_22__.bytesToHumanSize)(maxExternAttachmentSize)
|
||||||
}), 'err');
|
}), 'err');
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -6148,7 +6158,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
const width = this.state.imagePreview.width;
|
const width = this.state.imagePreview.width;
|
||||||
const height = this.state.imagePreview.height;
|
const height = this.state.imagePreview.height;
|
||||||
const fname = this.state.imagePreview.name;
|
const fname = this.state.imagePreview.name;
|
||||||
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
|
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
|
||||||
if (blob.size > maxInbandAttachmentSize) {
|
if (blob.size > maxInbandAttachmentSize) {
|
||||||
const uploader = this.props.tinode.getLargeFileHelper();
|
const uploader = this.props.tinode.getLargeFileHelper();
|
||||||
if (!uploader) {
|
if (!uploader) {
|
||||||
@@ -6156,7 +6166,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const uploadCompletionPromise = uploader.upload(blob);
|
const uploadCompletionPromise = uploader.upload(blob);
|
||||||
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.imageScaled)(blob, _config_js__WEBPACK_IMPORTED_MODULE_17__.IMAGE_PREVIEW_DIM, _config_js__WEBPACK_IMPORTED_MODULE_17__.IMAGE_PREVIEW_DIM, -1, false).then(scaled => (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.blobToBase64)(scaled.blob)).then(b64 => {
|
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.imageScaled)(blob, _config_js__WEBPACK_IMPORTED_MODULE_18__.IMAGE_PREVIEW_DIM, _config_js__WEBPACK_IMPORTED_MODULE_18__.IMAGE_PREVIEW_DIM, -1, false).then(scaled => (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.blobToBase64)(scaled.blob)).then(b64 => {
|
||||||
let msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.insertImage(null, 0, {
|
let msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.insertImage(null, 0, {
|
||||||
mime: mime,
|
mime: mime,
|
||||||
_tempPreview: b64.bits,
|
_tempPreview: b64.bits,
|
||||||
@@ -6175,7 +6185,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}).catch(err => this.props.onError(err, 'err'));
|
}).catch(err => this.props.onError(err, 'err'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.blobToBase64)(blob).then(b64 => {
|
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.blobToBase64)(blob).then(b64 => {
|
||||||
let msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.insertImage(null, 0, {
|
let msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.insertImage(null, 0, {
|
||||||
mime: b64.mime,
|
mime: b64.mime,
|
||||||
bits: b64.bits,
|
bits: b64.bits,
|
||||||
@@ -6194,7 +6204,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
sendVideoAttachment(caption, videoBlob, previewBlob, params) {
|
sendVideoAttachment(caption, videoBlob, previewBlob, params) {
|
||||||
const width = params.width;
|
const width = params.width;
|
||||||
const height = params.height;
|
const height = params.height;
|
||||||
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
|
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
|
||||||
const uploads = [];
|
const uploads = [];
|
||||||
let uploader;
|
let uploader;
|
||||||
if (videoBlob.size + previewBlob.size > maxInbandAttachmentSize) {
|
if (videoBlob.size + previewBlob.size > maxInbandAttachmentSize) {
|
||||||
@@ -6207,7 +6217,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
uploads[1] = previewBlob.size > maxInbandAttachmentSize * 0.275 ? uploader.upload(previewBlob) : null;
|
uploads[1] = previewBlob.size > maxInbandAttachmentSize * 0.275 ? uploader.upload(previewBlob) : null;
|
||||||
}
|
}
|
||||||
if (uploads.length == 0) {
|
if (uploads.length == 0) {
|
||||||
Promise.all((0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.blobToBase64)(videoBlob), (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.blobToBase64)(previewBlob)).then(b64s => {
|
Promise.all((0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.blobToBase64)(videoBlob), (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.blobToBase64)(previewBlob)).then(b64s => {
|
||||||
const [v64, i64] = b64s;
|
const [v64, i64] = b64s;
|
||||||
let msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.insertVideo(null, 0, {
|
let msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.insertVideo(null, 0, {
|
||||||
mime: v64.mime,
|
mime: v64.mime,
|
||||||
@@ -6230,9 +6240,9 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
const uploadCompletionPromise = Promise.all(uploads);
|
const uploadCompletionPromise = Promise.all(uploads);
|
||||||
const b64conv = [];
|
const b64conv = [];
|
||||||
b64conv[0] = uploads[0] ? null : (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.blobToBase64)(videoBlob);
|
b64conv[0] = uploads[0] ? null : (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.blobToBase64)(videoBlob);
|
||||||
b64conv[1] = uploads[1] ? null : (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.imageScaled)(previewBlob, _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_IMAGE_DIM, _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_IMAGE_DIM, -1, false).then(scaled => (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.blobToBase64)(scaled.blob));
|
b64conv[1] = uploads[1] ? null : (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.imageScaled)(previewBlob, _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_IMAGE_DIM, _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_IMAGE_DIM, -1, false).then(scaled => (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.blobToBase64)(scaled.blob));
|
||||||
b64conv[2] = (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.imageScaled)(previewBlob, _config_js__WEBPACK_IMPORTED_MODULE_17__.VIDEO_PREVIEW_DIM, _config_js__WEBPACK_IMPORTED_MODULE_17__.VIDEO_PREVIEW_DIM, -1, false).then(scaled => (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.blobToBase64)(scaled.blob));
|
b64conv[2] = (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.imageScaled)(previewBlob, _config_js__WEBPACK_IMPORTED_MODULE_18__.VIDEO_PREVIEW_DIM, _config_js__WEBPACK_IMPORTED_MODULE_18__.VIDEO_PREVIEW_DIM, -1, false).then(scaled => (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.blobToBase64)(scaled.blob));
|
||||||
Promise.all(b64conv).then(b64s => {
|
Promise.all(b64conv).then(b64s => {
|
||||||
const [video, img, preview] = b64s;
|
const [video, img, preview] = b64s;
|
||||||
let msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.insertVideo(null, 0, {
|
let msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.insertVideo(null, 0, {
|
||||||
@@ -6256,7 +6266,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}).catch(err => this.props.onError(err.message, 'err'));
|
}).catch(err => this.props.onError(err.message, 'err'));
|
||||||
}
|
}
|
||||||
handleAttachImageOrVideo(file) {
|
handleAttachImageOrVideo(file) {
|
||||||
const maxExternAttachmentSize = this.props.tinode.getServerParam('maxFileUploadSize', _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_EXTERN_ATTACHMENT_SIZE);
|
const maxExternAttachmentSize = this.props.tinode.getServerParam('maxFileUploadSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_EXTERN_ATTACHMENT_SIZE);
|
||||||
if (file.type.startsWith('video/')) {
|
if (file.type.startsWith('video/')) {
|
||||||
this.setState({
|
this.setState({
|
||||||
videoPreview: {
|
videoPreview: {
|
||||||
@@ -6269,7 +6279,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.imageScaled)(file, _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_IMAGE_DIM, _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_IMAGE_DIM, maxExternAttachmentSize, false).then(scaled => {
|
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.imageScaled)(file, _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_IMAGE_DIM, _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_IMAGE_DIM, maxExternAttachmentSize, false).then(scaled => {
|
||||||
this.setState({
|
this.setState({
|
||||||
imagePreview: {
|
imagePreview: {
|
||||||
url: URL.createObjectURL(scaled.blob),
|
url: URL.createObjectURL(scaled.blob),
|
||||||
@@ -6285,9 +6295,20 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
this.props.onError(err.message, 'err');
|
this.props.onError(err.message, 'err');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
handleFileDrop(files) {
|
||||||
|
if (!files || files.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const file = files[0];
|
||||||
|
if (file.type && file.type.startsWith('image/')) {
|
||||||
|
this.handleAttachImageOrVideo(file);
|
||||||
|
} else {
|
||||||
|
this.handleAttachFile(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
sendAudioAttachment(url, preview, duration) {
|
sendAudioAttachment(url, preview, duration) {
|
||||||
fetch(url).then(result => result.blob()).then(blob => {
|
fetch(url).then(result => result.blob()).then(blob => {
|
||||||
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_17__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024;
|
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024;
|
||||||
if (blob.size > maxInbandAttachmentSize) {
|
if (blob.size > maxInbandAttachmentSize) {
|
||||||
const uploader = this.props.tinode.getLargeFileHelper();
|
const uploader = this.props.tinode.getLargeFileHelper();
|
||||||
if (!uploader) {
|
if (!uploader) {
|
||||||
@@ -6304,7 +6325,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
});
|
});
|
||||||
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
||||||
} else {
|
} else {
|
||||||
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.blobToBase64)(blob).then(b64 => {
|
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.blobToBase64)(blob).then(b64 => {
|
||||||
this.sendMessage(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.appendAudio(null, {
|
this.sendMessage(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.appendAudio(null, {
|
||||||
mime: b64.mime,
|
mime: b64.mime,
|
||||||
bits: b64.bits,
|
bits: b64.bits,
|
||||||
@@ -6336,7 +6357,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
content = typeof content == 'string' ? tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.init(content) : content;
|
content = typeof content == 'string' ? tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.init(content) : content;
|
||||||
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isValid(content)) {
|
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isValid(content)) {
|
||||||
content = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.replyContent(content, _config_js__WEBPACK_IMPORTED_MODULE_17__.QUOTED_REPLY_LENGTH);
|
content = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.replyContent(content, _config_js__WEBPACK_IMPORTED_MODULE_18__.QUOTED_REPLY_LENGTH);
|
||||||
} else {
|
} else {
|
||||||
content = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.append(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.init('\u26A0 '), tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.wrapInto(this.props.intl.formatMessage(messages.invalid_content), 'EM'));
|
content = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.append(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.init('\u26A0 '), tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.wrapInto(this.props.intl.formatMessage(messages.invalid_content), 'EM'));
|
||||||
}
|
}
|
||||||
@@ -6358,7 +6379,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
content = typeof content == 'string' ? tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.init(content) : content;
|
content = typeof content == 'string' ? tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.init(content) : content;
|
||||||
const editable = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.toMarkdown(content);
|
const editable = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.toMarkdown(content);
|
||||||
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isValid(content)) {
|
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isValid(content)) {
|
||||||
content = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.replyContent(content, _config_js__WEBPACK_IMPORTED_MODULE_17__.EDIT_PREVIEW_LENGTH);
|
content = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.replyContent(content, _config_js__WEBPACK_IMPORTED_MODULE_18__.EDIT_PREVIEW_LENGTH);
|
||||||
} else {
|
} else {
|
||||||
content = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.append(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.init('\u26A0 '), tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.wrapInto(this.props.intl.formatMessage(messages.invalid_content), 'EM'));
|
content = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.append(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.init('\u26A0 '), tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.wrapInto(this.props.intl.formatMessage(messages.invalid_content), 'EM'));
|
||||||
}
|
}
|
||||||
@@ -6402,14 +6423,14 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
if (this.props.hideSelf) {
|
if (this.props.hideSelf) {
|
||||||
component = null;
|
component = null;
|
||||||
} else if (!this.state.topic) {
|
} else if (!this.state.topic) {
|
||||||
component = react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_logo_view_jsx__WEBPACK_IMPORTED_MODULE_13__["default"], {
|
component = react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_logo_view_jsx__WEBPACK_IMPORTED_MODULE_14__["default"], {
|
||||||
serverVersion: this.props.serverVersion,
|
serverVersion: this.props.serverVersion,
|
||||||
serverAddress: this.props.serverAddress
|
serverAddress: this.props.serverAddress
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let component2;
|
let component2;
|
||||||
if (this.state.imagePreview) {
|
if (this.state.imagePreview) {
|
||||||
component2 = react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_image_preview_jsx__WEBPACK_IMPORTED_MODULE_9__["default"], {
|
component2 = react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_image_preview_jsx__WEBPACK_IMPORTED_MODULE_10__["default"], {
|
||||||
content: this.state.imagePreview,
|
content: this.state.imagePreview,
|
||||||
tinode: this.props.tinode,
|
tinode: this.props.tinode,
|
||||||
reply: this.state.reply,
|
reply: this.state.reply,
|
||||||
@@ -6418,7 +6439,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
onSendMessage: this.sendImageAttachment
|
onSendMessage: this.sendImageAttachment
|
||||||
});
|
});
|
||||||
} else if (this.state.videoPreview) {
|
} else if (this.state.videoPreview) {
|
||||||
component2 = react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_video_preview_jsx__WEBPACK_IMPORTED_MODULE_16__["default"], {
|
component2 = react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_video_preview_jsx__WEBPACK_IMPORTED_MODULE_17__["default"], {
|
||||||
content: this.state.videoPreview,
|
content: this.state.videoPreview,
|
||||||
tinode: this.props.tinode,
|
tinode: this.props.tinode,
|
||||||
reply: this.state.reply,
|
reply: this.state.reply,
|
||||||
@@ -6427,7 +6448,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
onSendMessage: this.sendVideoAttachment
|
onSendMessage: this.sendVideoAttachment
|
||||||
});
|
});
|
||||||
} else if (this.state.imagePostview) {
|
} else if (this.state.imagePostview) {
|
||||||
component2 = react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_image_preview_jsx__WEBPACK_IMPORTED_MODULE_9__["default"], {
|
component2 = react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_image_preview_jsx__WEBPACK_IMPORTED_MODULE_10__["default"], {
|
||||||
content: this.state.imagePostview,
|
content: this.state.imagePostview,
|
||||||
onClose: this.handleClosePreview
|
onClose: this.handleClosePreview
|
||||||
});
|
});
|
||||||
@@ -6506,7 +6527,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
const user = topic.userDesc(thisFrom);
|
const user = topic.userDesc(thisFrom);
|
||||||
if (user && user.public) {
|
if (user && user.public) {
|
||||||
userName = user.public.fn;
|
userName = user.public.fn;
|
||||||
userAvatar = (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_19__.makeImageUrl)(user.public.photo);
|
userAvatar = (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.makeImageUrl)(user.public.photo);
|
||||||
}
|
}
|
||||||
chatBoxClass = groupTopic ? 'chat-box group' : 'chat-box';
|
chatBoxClass = groupTopic ? 'chat-box group' : 'chat-box';
|
||||||
const ref = this.getOrCreateMessageRef(msg.seq);
|
const ref = this.getOrCreateMessageRef(msg.seq);
|
||||||
@@ -6515,15 +6536,15 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
replyToSeq = null;
|
replyToSeq = null;
|
||||||
}
|
}
|
||||||
if (msg.hi) {
|
if (msg.hi) {
|
||||||
messageNodes.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_meta_message_jsx__WEBPACK_IMPORTED_MODULE_14__["default"], {
|
messageNodes.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_meta_message_jsx__WEBPACK_IMPORTED_MODULE_15__["default"], {
|
||||||
deleted: true,
|
deleted: true,
|
||||||
key: msg.seq
|
key: msg.seq
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
const thisDate = new Date(msg.ts);
|
const thisDate = new Date(msg.ts);
|
||||||
if (!prevDate || prevDate.toDateString() != thisDate.toDateString()) {
|
if (!prevDate || prevDate.toDateString() != thisDate.toDateString()) {
|
||||||
messageNodes.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_meta_message_jsx__WEBPACK_IMPORTED_MODULE_14__["default"], {
|
messageNodes.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_meta_message_jsx__WEBPACK_IMPORTED_MODULE_15__["default"], {
|
||||||
date: (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_21__.relativeDateFormat)(msg.ts),
|
date: (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_22__.relativeDateFormat)(msg.ts),
|
||||||
locale: this.props.intl.locale,
|
locale: this.props.intl.locale,
|
||||||
key: 'date-' + msg.seq
|
key: 'date-' + msg.seq
|
||||||
}));
|
}));
|
||||||
@@ -6570,67 +6591,14 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
if (cont.online) {
|
if (cont.online) {
|
||||||
lastSeen = formatMessage(messages.online_now);
|
lastSeen = formatMessage(messages.online_now);
|
||||||
} else if (cont.seen) {
|
} else if (cont.seen) {
|
||||||
lastSeen = formatMessage(messages.last_seen) + ": " + (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_21__.shortDateFormat)(cont.seen.when, this.props.intl.locale);
|
lastSeen = formatMessage(messages.last_seen) + ": " + (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_22__.shortDateFormat)(cont.seen.when, this.props.intl.locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const avatar = this.state.avatar || true;
|
const avatar = this.state.avatar || true;
|
||||||
const online = this.state.deleted ? null : this.props.online ? 'online' + (this.state.typingIndicator ? ' typing' : '') : 'offline';
|
const online = this.state.deleted ? null : this.props.online ? 'online' + (this.state.typingIndicator ? ' typing' : '') : 'offline';
|
||||||
const titleClass = 'panel-title' + (this.state.deleted ? ' deleted' : '');
|
const titleClass = 'panel-title' + (this.state.deleted ? ' deleted' : '');
|
||||||
component2 = react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
let messagesComponent = react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
id: "topic-caption-panel",
|
|
||||||
className: "caption-panel"
|
|
||||||
}, this.props.displayMobile ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
||||||
href: "#",
|
|
||||||
id: "hide-message-view",
|
|
||||||
onClick: e => {
|
|
||||||
e.preventDefault();
|
|
||||||
this.props.onHideMessagesView();
|
|
||||||
}
|
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", {
|
|
||||||
className: "material-icons"
|
|
||||||
}, "arrow_back")) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
||||||
className: "avatar-box"
|
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_letter_tile_jsx__WEBPACK_IMPORTED_MODULE_11__["default"], {
|
|
||||||
tinode: this.props.tinode,
|
|
||||||
avatar: avatar,
|
|
||||||
topic: this.state.topic,
|
|
||||||
title: this.state.title,
|
|
||||||
deleted: this.state.deleted
|
|
||||||
}), !isChannel ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
||||||
className: online
|
|
||||||
}) : null), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
||||||
id: "topic-title-group"
|
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
||||||
id: "topic-title",
|
|
||||||
className: titleClass
|
|
||||||
}, this.state.title || react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
|
||||||
id: "unnamed_topic",
|
|
||||||
defaultMessage: [{
|
|
||||||
"type": 0,
|
|
||||||
"value": "Unnamed"
|
|
||||||
}]
|
|
||||||
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_contact_badges_jsx__WEBPACK_IMPORTED_MODULE_5__["default"], {
|
|
||||||
badges: icon_badges
|
|
||||||
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
||||||
id: "topic-last-seen"
|
|
||||||
}, lastSeen)), groupTopic ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_group_subs_jsx__WEBPACK_IMPORTED_MODULE_8__["default"], {
|
|
||||||
tinode: this.props.tinode,
|
|
||||||
subscribers: this.state.onlineSubs
|
|
||||||
}) : react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
||||||
id: "topic-users"
|
|
||||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
||||||
href: "#",
|
|
||||||
onClick: this.handleContextClick
|
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", {
|
|
||||||
className: "material-icons"
|
|
||||||
}, "more_vert")))), this.props.displayMobile ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_error_panel_jsx__WEBPACK_IMPORTED_MODULE_7__["default"], {
|
|
||||||
level: this.props.errorLevel,
|
|
||||||
text: this.props.errorText,
|
|
||||||
onClearError: this.props.onError
|
|
||||||
}) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_load_spinner_jsx__WEBPACK_IMPORTED_MODULE_12__["default"], {
|
|
||||||
show: this.state.fetchingMessages
|
|
||||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
||||||
id: "messages-container"
|
id: "messages-container"
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
|
||||||
className: 'action-button' + (this.state.showGoToLastButton ? '' : ' hidden'),
|
className: 'action-button' + (this.state.showGoToLastButton ? '' : ' hidden'),
|
||||||
@@ -6672,9 +6640,9 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
"type": 0,
|
"type": 0,
|
||||||
"value": "Enable"
|
"value": "Enable"
|
||||||
}]
|
}]
|
||||||
})), ".") : null, this.state.unconfirmed ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_invitation_jsx__WEBPACK_IMPORTED_MODULE_10__["default"], {
|
})), ".") : null, this.state.unconfirmed ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_invitation_jsx__WEBPACK_IMPORTED_MODULE_11__["default"], {
|
||||||
onAction: this.handleNewChatAcceptance
|
onAction: this.handleNewChatAcceptance
|
||||||
}) : react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_send_message_jsx__WEBPACK_IMPORTED_MODULE_15__["default"], {
|
}) : react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_send_message_jsx__WEBPACK_IMPORTED_MODULE_16__["default"], {
|
||||||
tinode: this.props.tinode,
|
tinode: this.props.tinode,
|
||||||
topicName: this.state.topic,
|
topicName: this.state.topic,
|
||||||
noInput: !!this.props.forwardMessage,
|
noInput: !!this.props.forwardMessage,
|
||||||
@@ -6691,6 +6659,63 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
onQuoteClick: this.handleQuoteClick,
|
onQuoteClick: this.handleQuoteClick,
|
||||||
onCancelReply: this.handleCancelReply
|
onCancelReply: this.handleCancelReply
|
||||||
}));
|
}));
|
||||||
|
component2 = react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
|
id: "topic-caption-panel",
|
||||||
|
className: "caption-panel"
|
||||||
|
}, this.props.displayMobile ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||||
|
href: "#",
|
||||||
|
id: "hide-message-view",
|
||||||
|
onClick: e => {
|
||||||
|
e.preventDefault();
|
||||||
|
this.props.onHideMessagesView();
|
||||||
|
}
|
||||||
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", {
|
||||||
|
className: "material-icons"
|
||||||
|
}, "arrow_back")) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
|
className: "avatar-box"
|
||||||
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_letter_tile_jsx__WEBPACK_IMPORTED_MODULE_12__["default"], {
|
||||||
|
tinode: this.props.tinode,
|
||||||
|
avatar: avatar,
|
||||||
|
topic: this.state.topic,
|
||||||
|
title: this.state.title,
|
||||||
|
deleted: this.state.deleted
|
||||||
|
}), !isChannel ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
||||||
|
className: online
|
||||||
|
}) : null), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
|
id: "topic-title-group"
|
||||||
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
|
id: "topic-title",
|
||||||
|
className: titleClass
|
||||||
|
}, this.state.title || react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
||||||
|
id: "unnamed_topic",
|
||||||
|
defaultMessage: [{
|
||||||
|
"type": 0,
|
||||||
|
"value": "Unnamed"
|
||||||
|
}]
|
||||||
|
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_contact_badges_jsx__WEBPACK_IMPORTED_MODULE_5__["default"], {
|
||||||
|
badges: icon_badges
|
||||||
|
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
|
id: "topic-last-seen"
|
||||||
|
}, lastSeen)), groupTopic ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_group_subs_jsx__WEBPACK_IMPORTED_MODULE_9__["default"], {
|
||||||
|
tinode: this.props.tinode,
|
||||||
|
subscribers: this.state.onlineSubs
|
||||||
|
}) : react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
|
id: "topic-users"
|
||||||
|
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||||
|
href: "#",
|
||||||
|
onClick: this.handleContextClick
|
||||||
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", {
|
||||||
|
className: "material-icons"
|
||||||
|
}, "more_vert")))), this.props.displayMobile ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_error_panel_jsx__WEBPACK_IMPORTED_MODULE_8__["default"], {
|
||||||
|
level: this.props.errorLevel,
|
||||||
|
text: this.props.errorText,
|
||||||
|
onClearError: this.props.onError
|
||||||
|
}) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_load_spinner_jsx__WEBPACK_IMPORTED_MODULE_13__["default"], {
|
||||||
|
show: this.state.fetchingMessages
|
||||||
|
}), !this.state.unconfirmed && !this.props.forwardMessage ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_drag_and_drop_jsx__WEBPACK_IMPORTED_MODULE_7__["default"], {
|
||||||
|
actionPrompt: this.props.intl.formatMessage(messages.drag_file),
|
||||||
|
onDrop: this.handleFileDrop
|
||||||
|
}, messagesComponent) : messagesComponent);
|
||||||
}
|
}
|
||||||
component = react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
component = react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
id: "topic-view"
|
id: "topic-view"
|
||||||
@@ -12650,6 +12675,95 @@ class DocPreview extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompo
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./src/widgets/drag-and-drop.jsx":
|
||||||
|
/*!***************************************!*\
|
||||||
|
!*** ./src/widgets/drag-and-drop.jsx ***!
|
||||||
|
\***************************************/
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": () => (/* binding */ DragAndDrop)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
||||||
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
|
||||||
|
class DragAndDrop extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComponent) {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
dragging: false
|
||||||
|
};
|
||||||
|
this.dropRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
|
||||||
|
this.dragCounter = 0;
|
||||||
|
this.handleDrag = this.handleDrag.bind(this);
|
||||||
|
this.handleDragIn = this.handleDragIn.bind(this);
|
||||||
|
this.handleDragOut = this.handleDragOut.bind(this);
|
||||||
|
this.handleDrop = this.handleDrop.bind(this);
|
||||||
|
}
|
||||||
|
componentDidMount() {
|
||||||
|
let div = this.dropRef.current;
|
||||||
|
div.addEventListener('dragenter', this.handleDragIn);
|
||||||
|
div.addEventListener('dragleave', this.handleDragOut);
|
||||||
|
div.addEventListener('dragover', this.handleDrag);
|
||||||
|
div.addEventListener('drop', this.handleDrop);
|
||||||
|
}
|
||||||
|
componentWillUnmount() {
|
||||||
|
let div = this.dropRef.current;
|
||||||
|
div.removeEventListener('dragenter', this.handleDragIn);
|
||||||
|
div.removeEventListener('dragleave', this.handleDragOut);
|
||||||
|
div.removeEventListener('dragover', this.handleDrag);
|
||||||
|
div.removeEventListener('drop', this.handleDrop);
|
||||||
|
}
|
||||||
|
handleDrag(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
handleDragIn(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.dragCounter++;
|
||||||
|
if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
|
||||||
|
this.setState({
|
||||||
|
dragging: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleDragOut(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.dragCounter--;
|
||||||
|
if (this.dragCounter == 0) {
|
||||||
|
this.setState({
|
||||||
|
dragging: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleDrop(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.setState({
|
||||||
|
dragging: false
|
||||||
|
});
|
||||||
|
if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
|
||||||
|
this.props.onDrop(e.dataTransfer.files);
|
||||||
|
e.dataTransfer.clearData();
|
||||||
|
this.dragCounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
return react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
|
className: "drag-and-drop",
|
||||||
|
ref: this.dropRef
|
||||||
|
}, this.state.dragging ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
|
className: "banner"
|
||||||
|
}, this.props.actionPrompt) : null, this.props.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./src/widgets/error-panel.jsx":
|
/***/ "./src/widgets/error-panel.jsx":
|
||||||
/*!*************************************!*\
|
/*!*************************************!*\
|
||||||
!*** ./src/widgets/error-panel.jsx ***!
|
!*** ./src/widgets/error-panel.jsx ***!
|
||||||
@@ -14880,6 +14994,7 @@ class SendMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
|
|||||||
this.handleSend = this.handleSend.bind(this);
|
this.handleSend = this.handleSend.bind(this);
|
||||||
this.handleKeyPress = this.handleKeyPress.bind(this);
|
this.handleKeyPress = this.handleKeyPress.bind(this);
|
||||||
this.handleMessageTyping = this.handleMessageTyping.bind(this);
|
this.handleMessageTyping = this.handleMessageTyping.bind(this);
|
||||||
|
this.handleDropAttach = this.handleDropAttach.bind(this);
|
||||||
this.handleQuoteClick = this.handleQuoteClick.bind(this);
|
this.handleQuoteClick = this.handleQuoteClick.bind(this);
|
||||||
this.formatReply = this.formatReply.bind(this);
|
this.formatReply = this.formatReply.bind(this);
|
||||||
}
|
}
|
||||||
@@ -14951,6 +15066,12 @@ class SendMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
|
|||||||
}
|
}
|
||||||
e.target.value = '';
|
e.target.value = '';
|
||||||
}
|
}
|
||||||
|
handleDropAttach(files) {
|
||||||
|
if (files && files.length > 0) {
|
||||||
|
console.log('Dropping ', files);
|
||||||
|
this.props.onAttachFile(files[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
handleAttachAudio(url, preview, duration) {
|
handleAttachAudio(url, preview, duration) {
|
||||||
this.setState({
|
this.setState({
|
||||||
audioRec: false
|
audioRec: false
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user