mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Remove markdown elements from PM (#11150)
* Remove markdown elements from PM * Replacing limit number of characters to limit number of lines * Add ellipsis
This commit is contained in:
committed by
Matteo Pagliazzi
parent
0908fa2a48
commit
3df056105c
@@ -35,7 +35,7 @@
|
|||||||
.time
|
.time
|
||||||
span.mr-1(v-if='conversation.username') @{{ conversation.username }} •
|
span.mr-1(v-if='conversation.username') @{{ conversation.username }} •
|
||||||
span {{ conversation.date | timeAgo }}
|
span {{ conversation.date | timeAgo }}
|
||||||
div {{conversation.lastMessageText ? conversation.lastMessageText.substring(0, 30) : ''}}
|
div.messagePreview {{ conversation.lastMessageText ? removeTags(parseMarkdown(conversation.lastMessageText)) : '' }}
|
||||||
.col-8.messages.d-flex.flex-column.justify-content-between
|
.col-8.messages.d-flex.flex-column.justify-content-between
|
||||||
.empty-messages.text-center(v-if='!selectedConversation.key')
|
.empty-messages.text-center(v-if='!selectedConversation.key')
|
||||||
.svg-icon.envelope(v-html="icons.messageIcon")
|
.svg-icon.envelope(v-html="icons.messageIcon")
|
||||||
@@ -209,6 +209,16 @@
|
|||||||
color: $gray-200;
|
color: $gray-200;
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.messagePreview {
|
||||||
|
display: block;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -218,6 +228,7 @@ import filter from 'lodash/filter';
|
|||||||
import sortBy from 'lodash/sortBy';
|
import sortBy from 'lodash/sortBy';
|
||||||
import groupBy from 'lodash/groupBy';
|
import groupBy from 'lodash/groupBy';
|
||||||
import { mapState } from 'client/libs/store';
|
import { mapState } from 'client/libs/store';
|
||||||
|
import habiticaMarkdown from 'habitica-markdown';
|
||||||
import styleHelper from 'client/mixins/styleHelper';
|
import styleHelper from 'client/mixins/styleHelper';
|
||||||
import toggleSwitch from 'client/components/ui/toggleSwitch';
|
import toggleSwitch from 'client/components/ui/toggleSwitch';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
@@ -500,6 +511,15 @@ export default {
|
|||||||
if (!message.contributor) return;
|
if (!message.contributor) return;
|
||||||
return this.icons[`tier${message.contributor.level}`];
|
return this.icons[`tier${message.contributor.level}`];
|
||||||
},
|
},
|
||||||
|
removeTags (html) {
|
||||||
|
let tmp = document.createElement('DIV');
|
||||||
|
tmp.innerHTML = html;
|
||||||
|
return tmp.textContent || tmp.innerText || '';
|
||||||
|
},
|
||||||
|
parseMarkdown (text) {
|
||||||
|
if (!text) return;
|
||||||
|
return habiticaMarkdown.render(String(text));
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user