summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts/autocomplete.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/client/src/scripts/autocomplete.ts')
-rw-r--r--packages/client/src/scripts/autocomplete.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/packages/client/src/scripts/autocomplete.ts b/packages/client/src/scripts/autocomplete.ts
index f4a3a4c0fc..8d9bdee8f5 100644
--- a/packages/client/src/scripts/autocomplete.ts
+++ b/packages/client/src/scripts/autocomplete.ts
@@ -1,5 +1,5 @@
-import { nextTick, Ref, ref } from 'vue';
-import * as getCaretCoordinates from 'textarea-caret';
+import { nextTick, Ref, ref, defineAsyncComponent } from 'vue';
+import getCaretCoordinates from 'textarea-caret';
import { toASCII } from 'punycode/';
import { popup } from '@/os';
@@ -74,21 +74,21 @@ export class Autocomplete {
emojiIndex,
mfmTagIndex);
- if (max == -1) {
+ if (max === -1) {
this.close();
return;
}
- const isMention = mentionIndex != -1;
- const isHashtag = hashtagIndex != -1;
- const isMfmTag = mfmTagIndex != -1;
- const isEmoji = emojiIndex != -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(':');
+ const isMention = mentionIndex !== -1;
+ const isHashtag = hashtagIndex !== -1;
+ const isMfmTag = mfmTagIndex !== -1;
+ const isEmoji = emojiIndex !== -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(':');
let opened = false;
if (isMention) {
const username = text.substr(mentionIndex + 1);
- if (username != '' && username.match(/^[a-zA-Z0-9_]+$/)) {
+ if (username !== '' && username.match(/^[a-zA-Z0-9_]+$/)) {
this.open('user', username);
opened = true;
} else if (username === '') {
@@ -130,7 +130,7 @@ export class Autocomplete {
* サジェストを提示します。
*/
private async open(type: string, q: string | null) {
- if (type != this.currentType) {
+ if (type !== this.currentType) {
this.close();
}
if (this.opening) return;
@@ -157,7 +157,7 @@ export class Autocomplete {
const _y = ref(y);
const _q = ref(q);
- const { dispose } = await popup(import('@/components/autocomplete.vue'), {
+ const { dispose } = await popup(defineAsyncComponent(() => import('@/components/autocomplete.vue')), {
textarea: this.textarea,
close: this.close,
type: type,
@@ -201,7 +201,7 @@ export class Autocomplete {
const caret = this.textarea.selectionStart;
- if (type == 'user') {
+ if (type === 'user') {
const source = this.text;
const before = source.substr(0, caret);
@@ -219,7 +219,7 @@ export class Autocomplete {
const pos = trimmedBefore.length + (acct.length + 2);
this.textarea.setSelectionRange(pos, pos);
});
- } else if (type == 'hashtag') {
+ } else if (type === 'hashtag') {
const source = this.text;
const before = source.substr(0, caret);
@@ -235,7 +235,7 @@ export class Autocomplete {
const pos = trimmedBefore.length + (value.length + 2);
this.textarea.setSelectionRange(pos, pos);
});
- } else if (type == 'emoji') {
+ } else if (type === 'emoji') {
const source = this.text;
const before = source.substr(0, caret);
@@ -251,7 +251,7 @@ export class Autocomplete {
const pos = trimmedBefore.length + value.length;
this.textarea.setSelectionRange(pos, pos);
});
- } else if (type == 'mfmTag') {
+ } else if (type === 'mfmTag') {
const source = this.text;
const before = source.substr(0, caret);