fix: relpy markdown message

This commit is contained in:
zerosoul
2022-04-06 16:27:53 +08:00
parent 236064a573
commit a590839aff
3 changed files with 27 additions and 8 deletions
+3
View File
@@ -72,6 +72,9 @@ const renderContent = (data) => {
case ContentTypes.text:
res = <span className="txt"> {content}</span>;
break;
case ContentTypes.markdown:
res = <span className="txt">[markdown]</span>;
break;
case ContentTypes.image:
case ContentTypes.imageJPG:
res = <img className="pic" src={thumbnail} />;
+3
View File
@@ -69,6 +69,9 @@ const renderContent = (data) => {
case ContentTypes.text:
res = content;
break;
case ContentTypes.markdown:
res = `[markdown]`;
break;
case ContentTypes.image:
case ContentTypes.imageJPG:
res = <img className="pic" src={pictureIcon} />;
+21 -8
View File
@@ -96,14 +96,27 @@ function Send({
}
}
};
const sendMarkdown = (content) => {
sendMessage({
id,
type: "markdown",
content,
from_uid,
properties: { local_id: new Date().getTime() },
});
const sendMarkdown = async (content) => {
if (replying_mid) {
console.log("replying", replying_mid);
await replyMessage({
id,
reply_mid: replying_mid,
type: "markdown",
content,
context,
from_uid,
});
dispatch(removeReplyingMessage(id));
} else {
sendMessage({
id,
type: "markdown",
content,
from_uid,
properties: { local_id: new Date().getTime() },
});
}
};
const toggleMode = () => {
dispatch(updateInputMode(mode == Modes.text ? Modes.markdown : Modes.text));