adding message deletion - incomplete yet
This commit is contained in:
+32
-14
@@ -247,6 +247,36 @@ ul.menu > li.separator {
|
|||||||
ul.menu > li.separator:hover {
|
ul.menu > li.separator:hover {
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The down arrow head - trigger for context menu */
|
||||||
|
li .menuTrigger {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.25rem;
|
||||||
|
right: 0.25rem;
|
||||||
|
width: 1.5rem;
|
||||||
|
height: 1.2rem;
|
||||||
|
line-height: 1.2rem;
|
||||||
|
border-radius: 0.6rem;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
li:hover .menuTrigger {
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
li:hover .menuTrigger a {
|
||||||
|
color: #757575;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.left:hover .menuTrigger {
|
||||||
|
-text-shadow: #c5e1a5 0 0 15px, #c5e1a5 0 0 5px;
|
||||||
|
background-image: radial-gradient(#c5e1a5 40%, transparent 75%);
|
||||||
|
}
|
||||||
|
li.right:hover .menuTrigger {
|
||||||
|
-text-shadow: #fafafa 0 0 15px, #fafafa 0 0 5px;
|
||||||
|
background-image: radial-gradient(#fafafa 40%, transparent 75%);
|
||||||
|
}
|
||||||
|
|
||||||
/* END popup/dropdown menu */
|
/* END popup/dropdown menu */
|
||||||
|
|
||||||
/* Generic text colors */
|
/* Generic text colors */
|
||||||
@@ -581,6 +611,7 @@ table.permission-editor td.checkbox {
|
|||||||
|
|
||||||
.contact-box > li {
|
.contact-box > li {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
position: relative;
|
||||||
padding: 0.35rem 0.25rem 0.5rem 0.35rem;
|
padding: 0.35rem 0.25rem 0.5rem 0.35rem;
|
||||||
min-height: 3.5rem;
|
min-height: 3.5rem;
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
@@ -612,20 +643,6 @@ table.permission-editor td.checkbox {
|
|||||||
font-weight: lighter;
|
font-weight: lighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The down arrow head - trigger for context menu in contacts list */
|
|
||||||
.contact-box li .menuTrigger {
|
|
||||||
position: relative;
|
|
||||||
margin-left: auto;
|
|
||||||
width: 1.5rem;
|
|
||||||
height: 1.5rem;
|
|
||||||
}
|
|
||||||
.contact-box li .menuTrigger a {
|
|
||||||
color: transparent;
|
|
||||||
}
|
|
||||||
.contact-box li:hover .menuTrigger a {
|
|
||||||
color: #757575;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Avatar and online-offline indicator */
|
/* Avatar and online-offline indicator */
|
||||||
.contact-box .avatar-box {
|
.contact-box .avatar-box {
|
||||||
margin-right: 0.35rem;
|
margin-right: 0.35rem;
|
||||||
@@ -1011,6 +1028,7 @@ table.permission-editor td.checkbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.chat-box .bubble {
|
.chat-box .bubble {
|
||||||
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
max-width: 40rem;
|
max-width: 40rem;
|
||||||
min-width: 12rem;
|
min-width: 12rem;
|
||||||
|
|||||||
+23
-2
@@ -2457,6 +2457,13 @@
|
|||||||
type: e.target.dataset.mime
|
type: e.target.dataset.mime
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleContextClick: function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.props.showContextMenu(this.props.seq, e.pageY, e.pageX);
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var elementKey = 0;
|
var elementKey = 0;
|
||||||
|
|
||||||
@@ -2515,6 +2522,11 @@
|
|||||||
<Message.ReceivedMarker response={this.props.response}
|
<Message.ReceivedMarker response={this.props.response}
|
||||||
timestamp={this.props.timestamp} received={this.props.received} />
|
timestamp={this.props.timestamp} received={this.props.received} />
|
||||||
</p>
|
</p>
|
||||||
|
<span className="menuTrigger">
|
||||||
|
<a href="#" onClick={this.handleContextClick}>
|
||||||
|
<i className="material-icons">expand_more</i>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{fullDisplay ? <div className="author">{this.props.userName}</div> : null}
|
{fullDisplay ? <div className="author">{this.props.userName}</div> : null}
|
||||||
</div>
|
</div>
|
||||||
@@ -2635,7 +2647,9 @@
|
|||||||
|
|
||||||
this.handleDescChange(topic);
|
this.handleDescChange(topic);
|
||||||
topic.messages(function(msg) {
|
topic.messages(function(msg) {
|
||||||
|
if (!msg.deleted) {
|
||||||
msgs = msgs.concat(msg);
|
msgs = msgs.concat(msg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -2735,11 +2749,13 @@
|
|||||||
var topic = Tinode.getTopic(this.state.topic);
|
var topic = Tinode.getTopic(this.state.topic);
|
||||||
var newState = {messages: []};
|
var newState = {messages: []};
|
||||||
topic.messages(function(m) {
|
topic.messages(function(m) {
|
||||||
|
if (!m.deleted) {
|
||||||
newState.messages = newState.messages.concat(m);
|
newState.messages = newState.messages.concat(m);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// msg could be null if one or more messages were deleted.
|
// msg could be null if one or more messages were deleted.
|
||||||
if (msg) {
|
if (msg && !msg.deleted) {
|
||||||
// If the message is added to the end of the message list,
|
// If the message is added to the end of the message list,
|
||||||
// scroll to the bottom.
|
// scroll to the bottom.
|
||||||
if (topic.msgPosition(msg.seq) <= 1) {
|
if (topic.msgPosition(msg.seq) <= 1) {
|
||||||
@@ -2791,6 +2807,10 @@
|
|||||||
this.props.showContextMenu(this.state.topic, e.pageY, e.pageX);
|
this.props.showContextMenu(this.state.topic, e.pageY, e.pageX);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleMessageContextMenu: function(seq, y, x) {
|
||||||
|
console.log("Message cklicked", seq, x, y);
|
||||||
|
},
|
||||||
|
|
||||||
handleBackNavigation: function() {
|
handleBackNavigation: function() {
|
||||||
this.props.onHideMessagesView();
|
this.props.onHideMessagesView();
|
||||||
},
|
},
|
||||||
@@ -2843,10 +2863,11 @@
|
|||||||
|
|
||||||
messageNodes.push(
|
messageNodes.push(
|
||||||
<Message content={msg.content} mimeType={msg.head ? msg.head.mime : null}
|
<Message content={msg.content} mimeType={msg.head ? msg.head.mime : null}
|
||||||
timestamp={msg.ts} response={isReply}
|
timestamp={msg.ts} response={isReply} seq={msg.seq}
|
||||||
userFrom={userFrom} userName={userName} userAvatar={userAvatar}
|
userFrom={userFrom} userName={userName} userAvatar={userAvatar}
|
||||||
sequence={sequence} received={msgReceived}
|
sequence={sequence} received={msgReceived}
|
||||||
viewportWidth={this.props.viewportWidth}
|
viewportWidth={this.props.viewportWidth}
|
||||||
|
showContextMenu={this.handleMessageContextMenu}
|
||||||
onImagePreview={this.handleImagePreview} key={msg.seq} />
|
onImagePreview={this.handleImagePreview} key={msg.seq} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user