This commit is contained in:
syuilo 2020-09-19 17:13:48 +09:00
parent 0b4b5fad6d
commit e796d24292
4 changed files with 12 additions and 4 deletions

View File

@ -35,6 +35,7 @@ import { twemojiSvgBase } from '../../misc/twemoji-base';
import { getStaticImageUrl } from '@/scripts/get-static-image-url'; import { getStaticImageUrl } from '@/scripts/get-static-image-url';
import MkUserSelect from './user-select.vue'; import MkUserSelect from './user-select.vue';
import { acct } from '../filters/user'; import { acct } from '../filters/user';
import * as os from '@/os';
type EmojiDef = { type EmojiDef = {
emoji: string; emoji: string;
@ -74,7 +75,6 @@ for (const x of lib) {
} }
emjdb.sort((a, b) => a.name.length - b.name.length); emjdb.sort((a, b) => a.name.length - b.name.length);
import * as os from '@/os';
export default defineComponent({ export default defineComponent({
props: { props: {

View File

@ -3,7 +3,7 @@
<div class="buttons" ref="buttons" :class="{ showFocus }"> <div class="buttons" ref="buttons" :class="{ showFocus }">
<button class="_button" v-for="(reaction, i) in rs" :key="reaction" @click="react(reaction)" :tabindex="i + 1" :title="reaction" v-particle><x-reaction-icon :reaction="reaction"/></button> <button class="_button" v-for="(reaction, i) in rs" :key="reaction" @click="react(reaction)" :tabindex="i + 1" :title="reaction" v-particle><x-reaction-icon :reaction="reaction"/></button>
</div> </div>
<input class="text" v-model.trim="text" :placeholder="$t('enterEmoji')" @keyup.enter="reactText" @input="tryReactText" v-autocomplete="{ model: 'text' }"> <input class="text" ref="text" v-model.trim="text" :placeholder="$t('enterEmoji')" @keyup.enter="reactText" @input="tryReactText">
</div> </div>
</template> </template>
@ -12,6 +12,7 @@ import { defineComponent } from 'vue';
import { emojiRegex } from '../../misc/emoji-regex'; import { emojiRegex } from '../../misc/emoji-regex';
import XReactionIcon from './reaction-icon.vue'; import XReactionIcon from './reaction-icon.vue';
import * as os from '@/os'; import * as os from '@/os';
import { Autocomplete } from '@/scripts/autocomplete';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -69,6 +70,8 @@ export default defineComponent({
mounted() { mounted() {
this.focus = 0; this.focus = 0;
new Autocomplete(this.$refs.text, this, { model: 'text' });
}, },
methods: { methods: {

View File

@ -16,7 +16,7 @@
</template> </template>
<div class="search"> <div class="search">
<fa :icon="faSearch"/> <fa :icon="faSearch"/>
<input type="search" :placeholder="$t('search')" v-model="searchQuery" v-autocomplete="{ model: 'searchQuery' }" :disabled="searchWait" @keypress="searchKeypress"/> <input type="search" ref="search" :placeholder="$t('search')" v-model="searchQuery" :disabled="searchWait" @keypress="searchKeypress"/>
</div> </div>
<button v-if="$store.getters.isSignedIn" class="post _buttonPrimary" @click="post()"><fa :icon="faPencilAlt"/></button> <button v-if="$store.getters.isSignedIn" class="post _buttonPrimary" @click="post()"><fa :icon="faPencilAlt"/></button>
<x-clock v-if="isDesktop" class="clock"/> <x-clock v-if="isDesktop" class="clock"/>
@ -95,6 +95,7 @@ import { search } from '@/scripts/search';
import { StickySidebar } from '@/scripts/sticky-sidebar'; import { StickySidebar } from '@/scripts/sticky-sidebar';
import { widgets } from './widgets'; import { widgets } from './widgets';
import XSidebar from '@/components/sidebar.vue'; import XSidebar from '@/components/sidebar.vue';
import { Autocomplete } from '@/scripts/autocomplete';
import * as os from './os'; import * as os from './os';
const DESKTOP_THRESHOLD = 1100; const DESKTOP_THRESHOLD = 1100;
@ -240,6 +241,8 @@ export default defineComponent({
// widget follow // widget follow
this.attachSticky(); this.attachSticky();
new Autocomplete(this.$refs.search, this, { model: 'searchQuery' });
this.$nextTick(() => { this.$nextTick(() => {
this.calcHeaderWidth(); this.calcHeaderWidth();
}); });

View File

@ -9,7 +9,6 @@
@keypress="onKeypress" @keypress="onKeypress"
@paste="onPaste" @paste="onPaste"
:placeholder="$t('inputMessageHere')" :placeholder="$t('inputMessageHere')"
v-autocomplete="{ model: 'text' }"
></textarea> ></textarea>
<div class="file" @click="file = null" v-if="file">{{ file.name }}</div> <div class="file" @click="file = null" v-if="file">{{ file.name }}</div>
<x-uploader ref="uploader" @uploaded="onUploaded"/> <x-uploader ref="uploader" @uploaded="onUploaded"/>
@ -30,6 +29,7 @@ import * as autosize from 'autosize';
import { formatTimeString } from '../../../misc/format-time-string'; import { formatTimeString } from '../../../misc/format-time-string';
import { selectFile } from '@/scripts/select-file'; import { selectFile } from '@/scripts/select-file';
import * as os from '@/os'; import * as os from '@/os';
import { Autocomplete } from '@/scripts/autocomplete';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -79,6 +79,8 @@ export default defineComponent({
mounted() { mounted() {
autosize(this.$refs.text); autosize(this.$refs.text);
new Autocomplete(this.$refs.text, this, { model: 'text' });
// 稿 // 稿
const draft = JSON.parse(localStorage.getItem('message_drafts') || '{}')[this.draftKey]; const draft = JSON.parse(localStorage.getItem('message_drafts') || '{}')[this.draftKey];
if (draft) { if (draft) {