Use mfm-js for MFM parsing (#7415)
* wip * Update mfm.ts * wip * update mfmjs * refactor * nanka * Update mfm.ts * Update to-html.ts * Update to-html.ts * wip * fix test * fix test
This commit is contained in:
parent
b378066ebf
commit
1f4ae2f63a
31 changed files with 262 additions and 1771 deletions
|
@ -1,11 +1,11 @@
|
|||
import $ from 'cafy';
|
||||
import * as mfm from 'mfm-js';
|
||||
import { ID } from '@/misc/cafy-id';
|
||||
import { publishMainStream, publishUserEvent } from '../../../../services/stream';
|
||||
import acceptAllFollowRequests from '../../../../services/following/requests/accept-all';
|
||||
import { publishToFollowers } from '../../../../services/i/update';
|
||||
import define from '../../define';
|
||||
import { parse, parsePlain } from '../../../../mfm/parse';
|
||||
import extractEmojis from '@/misc/extract-emojis';
|
||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm';
|
||||
import extractHashtags from '@/misc/extract-hashtags';
|
||||
import * as langmap from 'langmap';
|
||||
import { updateUsertags } from '../../../../services/update-hashtag';
|
||||
|
@ -291,13 +291,13 @@ export default define(meta, async (ps, _user, token) => {
|
|||
const newDescription = profileUpdates.description === undefined ? profile.description : profileUpdates.description;
|
||||
|
||||
if (newName != null) {
|
||||
const tokens = parsePlain(newName);
|
||||
emojis = emojis.concat(extractEmojis(tokens!));
|
||||
const tokens = mfm.parsePlain(newName);
|
||||
emojis = emojis.concat(extractCustomEmojisFromMfm(tokens!));
|
||||
}
|
||||
|
||||
if (newDescription != null) {
|
||||
const tokens = parse(newDescription);
|
||||
emojis = emojis.concat(extractEmojis(tokens!));
|
||||
const tokens = mfm.parse(newDescription);
|
||||
emojis = emojis.concat(extractCustomEmojisFromMfm(tokens!));
|
||||
tags = extractHashtags(tokens!).map(tag => normalizeForSearch(tag)).splice(0, 32);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue