|
50 | 50 | <div v-if="editorConvoMode">
|
51 | 51 | <!-- Select User -->
|
52 | 52 | <label>To</label>
|
53 |
| - <input type="text" /> |
54 |
| - <!-- <tags-input min-length="1" placeholder="Type username(s) to message" add-from-autocomplete-only="true" replace-spaces-with-dashes="false" display-property="username" allow-leftover-text="false" ng-model="receivers" modal-focus="{{showEditor && editorConvoMode}}"> |
| 53 | + <Multiselect v-model="msgTagsInput.value" v-bind="msgTagsInput" /> |
| 54 | + <label>Subject</label> |
| 55 | + <input type="text" v-model="newMessage.content.subject" minlength="1" maxlength="255" /> |
| 56 | + <!-- <tags-input min-length="1" placeholder="Type username(s) to message" add-from-autocomplete-only="true" replace-spaces-with-dashes="false" display-property="username" allow-leftover-text="false" ng-model="receivers" modal-focus="{{showEditor && editorConvoMode}}"> |
55 | 57 | <auto-complete min-length="1" debounce-delay="250" source="loadTags($query)"></auto-complete>
|
56 | 58 | </tags-input> -->
|
57 | 59 | <!-- Subject -->
|
58 |
| - <label>Subject</label> |
59 |
| - <input type="text" v-model="newMessage.content.subject" minlength="1" maxlength="255" /> |
60 | 60 | </div>
|
61 | 61 |
|
62 | 62 | <!-- Post Editor Mode -->
|
|
234 | 234 | import { reactive, toRefs, watch } from 'vue'
|
235 | 235 | // import { useRoute, useRouter } from 'vue-router'
|
236 | 236 | import ImageUploader from '@/components/images/ImageUploader.vue'
|
| 237 | +import Multiselect from '@vueform/multiselect' |
| 238 | +import { usersApi } from '@/api' |
237 | 239 |
|
238 | 240 | export default {
|
239 | 241 | props: ['editorConvoMode', 'threadEditorMode', 'postEditorMode', 'createAction', 'updateAction', 'showEditor', 'thread' ],
|
240 | 242 | emits: ['close'],
|
241 |
| - components: { ImageUploader }, |
| 243 | + components: { ImageUploader, Multiselect }, |
242 | 244 | setup(props, { emit }) {
|
243 | 245 |
|
244 | 246 | const canCreate = () => true
|
@@ -268,7 +270,24 @@ export default {
|
268 | 270 | posting: { post: { title: '', body: '', thread_id: props?.thread?.id }},
|
269 | 271 | newMessage: { content: { subject: '', body: '' } },
|
270 | 272 | rightToLeft: false,
|
271 |
| - rtl: false |
| 273 | + rtl: false, |
| 274 | + msgTagsInput: { |
| 275 | + mode: 'tags', |
| 276 | + value: [], |
| 277 | + placeholder: 'Type username(s) to message', |
| 278 | + noOptionsText: 'Enter a username to start lookup...', |
| 279 | + minChars: 1, |
| 280 | + resolveOnLoad: false, |
| 281 | + delay: 0, |
| 282 | + searchable: true, |
| 283 | + maxHeight: 100, |
| 284 | + options: async q => { |
| 285 | + return await usersApi.lookup(q, { restricted: true }) |
| 286 | + // convert array into array of objects |
| 287 | + .then(d => d.map(u =>{ return { label: u.username, value: { username: u.username, user_id: u.id } } })) |
| 288 | + .catch(() => { return [] }) |
| 289 | + } |
| 290 | + } |
272 | 291 | })
|
273 | 292 |
|
274 | 293 | watch(() => props.thread, t => {
|
|
0 commit comments