last fix for the attachments, bump version
This commit is contained in:
+4
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tinode-webapp",
|
||||
"description": "Tinode Web Client",
|
||||
"version": "0.15.5",
|
||||
"version": "0.15.6-rc1",
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-minify": "^0.4.3",
|
||||
@@ -18,11 +18,13 @@
|
||||
"build": "npm run build:babel && npm run build:prod && npm run build:css",
|
||||
"build:dev": "browserify ./src/index.js --standalone Webapp > ./umd/index.dev.js",
|
||||
"build:prod": "browserify ./src/index.js --standalone Webapp --plugin tinyify > ./umd/index.prod.js",
|
||||
"build:babel": "babel ./src/webapp.jsx --presets react --out-file ./webapp.js",
|
||||
"build:babel": "babel ./src/webapp.jsx --presets react --out-file ./src/webapp.js",
|
||||
"build:css": "postcss css/base.css > css/base.min.css",
|
||||
"babel-version": "babel --version"
|
||||
},
|
||||
"files": [
|
||||
"src/index.js",
|
||||
"src/webapp.jsx",
|
||||
"audio/msg.mp3",
|
||||
"css/base.css",
|
||||
"css/base.min.css",
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
var Tinode = require('tinode-sdk');
|
||||
var TinodeWeb = require('../webapp.js');
|
||||
var Drafty = Tinode.Drafty;
|
||||
var TinodeWeb = require('./webapp.js');
|
||||
|
||||
ReactDOM.render(
|
||||
React.createElement(TinodeWeb, null),
|
||||
|
||||
+23
-32
@@ -3354,11 +3354,11 @@ class ChatMessage extends React.Component {
|
||||
};
|
||||
|
||||
var sideClass = this.props.sequence + " " + (this.props.response ? "left" : "right");
|
||||
var bubbleClass = (this.props.sequence === "single" || this.props.sequence === "last") ?
|
||||
var bubbleClass = (this.props.sequence == "single" || this.props.sequence == "last") ?
|
||||
"bubble tip" : "bubble";
|
||||
var avatar = this.props.userAvatar || true;
|
||||
var fullDisplay = (this.props.userFrom && this.props.response &&
|
||||
(this.props.sequence === "single" || this.props.sequence === "last"));
|
||||
(this.props.sequence == "single" || this.props.sequence == "last"));
|
||||
|
||||
var content = this.props.content;
|
||||
var attachments = [];
|
||||
@@ -3375,6 +3375,8 @@ class ChatMessage extends React.Component {
|
||||
key={i} />);
|
||||
}, this);
|
||||
content = React.createElement('span', null, Drafty.format(content, formatter, this));
|
||||
} else if (typeof content != 'string') {
|
||||
content = <span><i className="material-icons">error_outline</i> <i>invalid content</i></span>
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -3391,12 +3393,13 @@ class ChatMessage extends React.Component {
|
||||
null}
|
||||
<div>
|
||||
<div className={bubbleClass}>
|
||||
<div className="message-content">{content}
|
||||
{attachments}
|
||||
<ReceivedMarker
|
||||
timestamp={this.props.timestamp}
|
||||
received={this.props.received} />
|
||||
</p>
|
||||
<div className="message-content">
|
||||
{content}
|
||||
{attachments}
|
||||
<ReceivedMarker
|
||||
timestamp={this.props.timestamp}
|
||||
received={this.props.received} />
|
||||
</div>
|
||||
<span className="menuTrigger">
|
||||
<a href="javascript:;" onClick={this.handleContextClick}>
|
||||
<i className="material-icons">expand_more</i>
|
||||
@@ -3858,18 +3861,18 @@ class MessagesView extends React.Component {
|
||||
}
|
||||
|
||||
var sequence = "single";
|
||||
if (msg.from === previousFrom) {
|
||||
if (msg.from === nextFrom) {
|
||||
if (msg.from == previousFrom) {
|
||||
if (msg.from == nextFrom) {
|
||||
sequence = "middle";
|
||||
} else {
|
||||
sequence = "last";
|
||||
}
|
||||
} else if (msg.from === nextFrom) {
|
||||
} else if (msg.from == nextFrom) {
|
||||
sequence = "first";
|
||||
}
|
||||
previousFrom = msg.from;
|
||||
|
||||
var isReply = !(msg.from === this.props.myUserId);
|
||||
var isReply = !(msg.from == this.props.myUserId);
|
||||
var deliveryStatus = topic.msgStatus(msg);
|
||||
|
||||
var userName, userAvatar, userFrom, chatBoxClass;
|
||||
@@ -4811,29 +4814,11 @@ class TinodeWeb extends React.Component {
|
||||
// with attachments.
|
||||
handleSendMessage(msg, promise, uploader) {
|
||||
let topic = this.state.tinode.getTopic(this.state.topicSelected);
|
||||
let mimeType, attachments;
|
||||
let dft = typeof msg == 'string' ? Drafty.parse(msg) : msg;
|
||||
if (dft && !Drafty.isPlainText(dft)) {
|
||||
msg = dft;
|
||||
mimeType = Drafty.getContentType();
|
||||
if (Drafty.hasAttachments(msg)) {
|
||||
attachments = [];
|
||||
Drafty.attachments(msg, (val) => {
|
||||
if (val.ref) {
|
||||
attachments.push(val.ref);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
msg = topic.createMessage(msg, false, mimeType, attachments);
|
||||
msg = topic.createMessage(msg, false);
|
||||
// The uploader is used to show progress.
|
||||
msg._uploader = uploader;
|
||||
|
||||
if (promise) {
|
||||
promise.catch((err) => {
|
||||
this.handleError(err.message, "err");
|
||||
});
|
||||
}
|
||||
if (!topic.isSubscribed()) {
|
||||
if (!promise) {
|
||||
promise = Promise.resolve();
|
||||
@@ -4841,6 +4826,12 @@ class TinodeWeb extends React.Component {
|
||||
promise = promise.then(() => { return topic.subscribe(); });
|
||||
}
|
||||
|
||||
if (promise) {
|
||||
promise = promise.catch((err) => {
|
||||
this.handleError(err.message, "err");
|
||||
});
|
||||
}
|
||||
|
||||
topic.publishDraft(msg, promise)
|
||||
.catch((err) => {
|
||||
this.handleError(err.message, "err");
|
||||
|
||||
Reference in New Issue
Block a user