generated from lucien/api-template
fix: fixed message text wraping
This commit is contained in:
parent
4045681913
commit
2795d4686e
2 changed files with 24 additions and 11 deletions
|
@ -12,18 +12,20 @@ export default function MessageComponent({ message, user, channel, deleteMessage
|
|||
|
||||
return (
|
||||
<div key={message.id} className="message">
|
||||
<Link to={`/u/${message.username}`}>{message.username}</Link>:{" "}
|
||||
{message.content.split(" ").map((word, index) => {
|
||||
if (word.startsWith("@")) {
|
||||
const mention = message.mentions.find((mention) => `@${mention.username}` === word);
|
||||
if (mention) {
|
||||
return <span><Link key={index} to={`/u/${mention.username}`}>{word}</Link> </span>;
|
||||
<div className="message-content">
|
||||
<Link to={`/u/${message.username}`}>{message.username}</Link>:{" "}
|
||||
{message.content.split(" ").map((word, index) => {
|
||||
if (word.startsWith("@")) {
|
||||
const mention = message.mentions.find((mention) => `@${mention.username}` === word);
|
||||
if (mention) {
|
||||
return <span><Link key={index} to={`/u/${mention.username}`}>{word}</Link> </span>;
|
||||
}
|
||||
} else if (word.startsWith("https://") || word.startsWith("http://")) {
|
||||
return <span><Link to={word}>{word}</Link> </span>
|
||||
}
|
||||
} else if (word.startsWith("https://") || word.startsWith("http://")) {
|
||||
return <span><Link to={word}>{word}</Link> </span>
|
||||
}
|
||||
return <span key={index}>{word} </span>;
|
||||
})}
|
||||
return <span key={index}>{word} </span>;
|
||||
})}
|
||||
</div>
|
||||
<p>{new Date(message.date * 1000).toLocaleString()}</p>
|
||||
<div>
|
||||
{message.content.toLocaleLowerCase().includes("gros cochon") && (
|
||||
|
|
|
@ -3,3 +3,14 @@
|
|||
border: 1px solid #270722;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.message-content {
|
||||
word-break: break-word;
|
||||
overflow-wrap: break-word;
|
||||
display: -webkit-box;
|
||||
line-clamp: 10;
|
||||
-webkit-line-clamp: 10;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue