diff options
author | Dessalines <tyhou13@gmx.com> | 2020-02-12 12:12:19 -0500 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-02-12 12:12:19 -0500 |
commit | 0b69974e49747f63d116e28d6b0ad5043452cab4 (patch) | |
tree | e176e3f736c99d4f319b64d0959973a312091152 /ui/src/components/post-form.tsx | |
parent | 774518e4fe336ac60c6e8ccdbc9a98e0cb8b9310 (diff) |
Add community refine by searching on new post creation. Fixes #521
Diffstat (limited to 'ui/src/components/post-form.tsx')
-rw-r--r-- | ui/src/components/post-form.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx index 7984c2a8..8abdf26d 100644 --- a/ui/src/components/post-form.tsx +++ b/ui/src/components/post-form.tsx @@ -35,6 +35,7 @@ import { } from '../utils'; import autosize from 'autosize'; import Tribute from 'tributejs/src/Tribute.js'; +import Selectr from 'mobius1-selectr'; import { i18n } from '../i18next'; const MAX_POST_TITLE_LENGTH = 200; @@ -514,6 +515,13 @@ export class PostForm extends Component<PostFormProps, PostFormState> { this.state.postForm.community_id = data.communities[0].id; } this.setState(this.state); + + // Set up select searching + let selectId: any = document.getElementById('post-community'); + let selector = new Selectr(selectId, {}); + selector.on('selectr.select', option => { + this.state.postForm.community_id = Number(option.value); + }); } else if (res.op == UserOperation.CreatePost) { let data = res.data as PostResponse; if (data.post.creator_id == UserService.Instance.user.id) { |