非ASCIIなドメインへのメンションの修正 (#2903)

* punycodeでされたmentionのラベルをunicodeとして表示する

* post-form mentionはpunycodeにする

* mentionの表示はURLもAPI向けもunicodeにする
This commit is contained in:
MeiMei
2018-10-14 16:56:19 +09:00
committed by syuilo
parent be82d845a4
commit 5dce81c0db
6 changed files with 27 additions and 13 deletions

View File

@ -1,6 +1,6 @@
import * as getCaretCoordinates from 'textarea-caret';
import MkAutocomplete from '../components/autocomplete.vue';
import renderAcct from '../../../../../misc/acct/render';
import { toASCII } from 'punycode';
export default {
bind(el, binding, vn) {
@ -188,7 +188,7 @@ class Autocomplete {
const trimmedBefore = before.substring(0, before.lastIndexOf('@'));
const after = source.substr(caret);
const acct = renderAcct(value);
const acct = value.host === null ? value.username : `${value.username}@${toASCII(value.host)}`;
// 挿入
this.text = `${trimmedBefore}@${acct} ${after}`;