Merge branch 'develop' into sw-notification-action

This commit is contained in:
tamaina
2021-04-03 23:55:55 +09:00
32 changed files with 263 additions and 1772 deletions

View File

@@ -58,7 +58,7 @@ import insertTextAtCursor from 'insert-text-at-cursor';
import { length } from 'stringz';
import { toASCII } from 'punycode';
import XNotePreview from './note-preview.vue';
import { parse } from '../../mfm/parse';
import * as mfm from 'mfm-js';
import { host, url } from '@client/config';
import { erase, unique } from '../../prelude/array';
import extractMentions from '@/misc/extract-mentions';
@@ -257,7 +257,7 @@ export default defineComponent({
}
if (this.reply && this.reply.text != null) {
const ast = parse(this.reply.text);
const ast = mfm.parse(this.reply.text);
for (const x of extractMentions(ast)) {
const mention = x.host ? `@${x.username}@${toASCII(x.host)}` : `@${x.username}`;
@@ -606,7 +606,7 @@ export default defineComponent({
this.deleteDraft();
this.$emit('posted');
if (this.text && this.text != '') {
const hashtags = parse(this.text).filter(x => x.node.type === 'hashtag').map(x => x.node.props.hashtag);
const hashtags = mfm.parse(this.text).filter(x => x.type === 'hashtag').map(x => x.props.hashtag);
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
}