diff options
| author | Henry Jameson <me@hjkos.com> | 2019-06-08 16:23:58 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-06-08 16:23:58 +0300 |
| commit | 8872b4802e2b0dff25eaaf884884d740ed016c98 (patch) | |
| tree | 838506a0073ee82f0f12a6227fc995e8dc48d186 /src/components/post_status_form | |
| parent | ca3140fd3ed1ce4522c04d445de42d721a0fbc87 (diff) | |
standartized autocomplete panel suggesions format, fixed some bugs
Diffstat (limited to 'src/components/post_status_form')
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 37 | ||||
| -rw-r--r-- | src/components/post_status_form/post_status_form.vue | 18 |
2 files changed, 12 insertions, 43 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 1516dd43..008b821a 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -83,43 +83,6 @@ const PostStatusForm = { } }, computed: { - candidates () { - const firstchar = this.textAtCaret.charAt(0) - if (firstchar === '@') { - const query = this.textAtCaret.slice(1).toUpperCase() - const matchedUsers = filter(this.users, (user) => { - return user.screen_name.toUpperCase().startsWith(query) || - user.name && user.name.toUpperCase().startsWith(query) - }) - if (matchedUsers.length <= 0) { - return false - } - // eslint-disable-next-line camelcase - return map(take(matchedUsers, 5), ({screen_name, name, profile_image_url_original}, index) => ({ - // eslint-disable-next-line camelcase - screen_name: `@${screen_name}`, - name: name, - img: profile_image_url_original, - highlighted: index === this.highlighted - })) - } else if (firstchar === ':') { - if (this.textAtCaret === ':') { return } - const matchedEmoji = filter(this.emoji.concat(this.customEmoji), (emoji) => emoji.shortcode.startsWith(this.textAtCaret.slice(1))) - if (matchedEmoji.length <= 0) { - return false - } - return map(take(matchedEmoji, 5), ({shortcode, image_url, utf}, index) => ({ - screen_name: `:${shortcode}:`, - name: '', - utf: utf || '', - // eslint-disable-next-line camelcase - img: utf ? '' : this.$store.state.instance.server + image_url, - highlighted: index === this.highlighted - })) - } else { - return false - } - }, users () { return this.$store.state.users.users }, diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 507b14bf..a8a34265 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -32,24 +32,29 @@ <span v-else>{{ $t('post_status.direct_warning_to_all') }}</span> </p> <emoji-input - :suggest="emojiSuggestor" v-model="newStatus.spoilerText" v-if="newStatus.spoilerText || alwaysShowSubject" + :suggest="emojiSuggestor" + v-model="newStatus.spoilerText" + class="form-control" > <input type="text" :placeholder="$t('post_status.content_warning')" v-model="newStatus.spoilerText" - classname="form-control" + class="form-post-subject" /> </emoji-input> - <emoji-input :suggest="emojiUserSuggestor" v-model="newStatus.status"> + <emoji-input + :suggest="emojiUserSuggestor" + v-model="newStatus.status" + class="form-control" + > <textarea ref="textarea" v-model="newStatus.status" :placeholder="$t('post_status.default')" rows="1" - class="form-control" @keydown.meta.enter="postStatus(newStatus)" @keyup.ctrl.enter="postStatus(newStatus)" @drop="fileDrop" @@ -57,6 +62,7 @@ @input="resize" @paste="paste" :disabled="posting" + class="form-post-body" > </textarea> </emoji-input> @@ -251,7 +257,7 @@ min-height: 1px; } - form textarea.form-control { + .form-post-body { line-height:16px; resize: none; overflow: hidden; @@ -260,7 +266,7 @@ box-sizing: content-box; } - form textarea.form-control:focus { + .form-post-body:focus { min-height: 48px; } |
