forked from FoundKeyGang/FoundKey
Better mention handling
This commit is contained in:
parent
5e4a0fd4ec
commit
67b3461c24
2 changed files with 24 additions and 0 deletions
|
@ -49,6 +49,7 @@ import Vue from 'vue';
|
||||||
import * as XDraggable from 'vuedraggable';
|
import * as XDraggable from 'vuedraggable';
|
||||||
import getKao from '../../../common/scripts/get-kao';
|
import getKao from '../../../common/scripts/get-kao';
|
||||||
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
||||||
|
import parse from '../../../../../text/parse';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
|
@ -110,6 +111,17 @@ export default Vue.extend({
|
||||||
this.text = `@${this.reply.user.username}@${this.reply.user.host} `;
|
this.text = `@${this.reply.user.username}@${this.reply.user.host} `;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.reply && this.reply.text != null) {
|
||||||
|
const ast = parse(this.reply.text);
|
||||||
|
|
||||||
|
ast.filter(t => t.type == 'mention').forEach(x => {
|
||||||
|
const mention = x.host ? `@${x.username}@${x.host}` : `@${x.username}`;
|
||||||
|
if (this.text.indexOf(`${mention} `) == -1) {
|
||||||
|
this.text += `${mention} `;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
// 書きかけの投稿を復元
|
// 書きかけの投稿を復元
|
||||||
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId];
|
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId];
|
||||||
|
|
|
@ -49,6 +49,7 @@ import Vue from 'vue';
|
||||||
import * as XDraggable from 'vuedraggable';
|
import * as XDraggable from 'vuedraggable';
|
||||||
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
||||||
import getKao from '../../../common/scripts/get-kao';
|
import getKao from '../../../common/scripts/get-kao';
|
||||||
|
import parse from '../../../../../text/parse';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
|
@ -78,6 +79,17 @@ export default Vue.extend({
|
||||||
this.text = `@${this.reply.user.username}@${this.reply.user.host} `;
|
this.text = `@${this.reply.user.username}@${this.reply.user.host} `;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.reply && this.reply.text != null) {
|
||||||
|
const ast = parse(this.reply.text);
|
||||||
|
|
||||||
|
ast.filter(t => t.type == 'mention').forEach(x => {
|
||||||
|
const mention = x.host ? `@${x.username}@${x.host}` : `@${x.username}`;
|
||||||
|
if (this.text.indexOf(`${mention} `) == -1) {
|
||||||
|
this.text += `${mention} `;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.focus();
|
this.focus();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue