Skip to content

Commit 8fb2b44

Browse files
committed
feat: initial port of multi select for sending messages
1 parent ca332f4 commit 8fb2b44

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

src/components/layout/Editor.vue

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
<div v-if="editorConvoMode">
5151
<!-- Select User -->
5252
<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}}">
5557
<auto-complete min-length="1" debounce-delay="250" source="loadTags($query)"></auto-complete>
5658
</tags-input> -->
5759
<!-- Subject -->
58-
<label>Subject</label>
59-
<input type="text" v-model="newMessage.content.subject" minlength="1" maxlength="255" />
6060
</div>
6161

6262
<!-- Post Editor Mode -->
@@ -234,11 +234,13 @@
234234
import { reactive, toRefs, watch } from 'vue'
235235
// import { useRoute, useRouter } from 'vue-router'
236236
import ImageUploader from '@/components/images/ImageUploader.vue'
237+
import Multiselect from '@vueform/multiselect'
238+
import { usersApi } from '@/api'
237239
238240
export default {
239241
props: ['editorConvoMode', 'threadEditorMode', 'postEditorMode', 'createAction', 'updateAction', 'showEditor', 'thread' ],
240242
emits: ['close'],
241-
components: { ImageUploader },
243+
components: { ImageUploader, Multiselect },
242244
setup(props, { emit }) {
243245
244246
const canCreate = () => true
@@ -268,7 +270,24 @@ export default {
268270
posting: { post: { title: '', body: '', thread_id: props?.thread?.id }},
269271
newMessage: { content: { subject: '', body: '' } },
270272
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+
}
272291
})
273292
274293
watch(() => props.thread, t => {

0 commit comments

Comments
 (0)