Issue 12033 - Use version of habitica-markdown that includes mentions (#12089)

* Issue 12033 - Use version of habitica-markdown that includes mention plugin

Also fixes frontend parts of 11504 and 10924

* Issue 12033 - Reduce duplication in chatCard & messageCard

* Issue 12033 - Use habitica-markdown version 2.0.0

* Issue 12033 - Use new entry point and fix tests

* Issue 12033 - Rename renderMarkdown to renderWithMentions
This commit is contained in:
Bart Enkelaar
2020-05-09 20:04:14 +02:00
committed by GitHub
parent ef99943646
commit c218b8d56c
9 changed files with 44 additions and 67 deletions

View File

@@ -21,7 +21,7 @@
</p>
<div
class="text"
v-html="atHighlight(parseMarkdown(msg.text))"
v-html="parseMarkdown(msg.text)"
></div>
<div
v-if="isMessageReported"
@@ -139,13 +139,12 @@
import axios from 'axios';
import moment from 'moment';
import habiticaMarkdown from 'habitica-markdown';
import renderWithMentions from '@/libs/renderWithMentions';
import { mapState } from '@/libs/store';
import userLink from '../userLink';
import deleteIcon from '@/assets/svg/delete.svg';
import reportIcon from '@/assets/svg/report.svg';
import { highlightUsers } from '../../libs/highlightUsers';
export default {
components: {
@@ -204,12 +203,8 @@ export default {
await axios.delete(`/api/v4/inbox/messages/${message.id}`);
},
atHighlight (text) {
return highlightUsers(text, this.user.auth.local.username, this.user.profile.name);
},
parseMarkdown (text) {
if (!text) return null;
return habiticaMarkdown.render(String(text));
return renderWithMentions(text, this.user);
},
},
};