From 8c4bab1c0be2b474daebe8b80bd5a6a90a7e642e Mon Sep 17 00:00:00 2001 From: mei23 Date: Thu, 11 Apr 2019 04:14:19 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A6=E3=82=A3=E3=82=B8=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=81=AB=E9=A1=94=E6=96=87=E5=AD=97=E3=81=A8=E5=85=AC=E9=96=8B?= =?UTF-8?q?=E7=AF=84=E5=9B=B2=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/common/views/widgets/post-form.vue | 61 +++++++++++++++---- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/src/client/app/common/views/widgets/post-form.vue b/src/client/app/common/views/widgets/post-form.vue index f1826cc59fcc..60fc2454c03f 100644 --- a/src/client/app/common/views/widgets/post-form.vue +++ b/src/client/app/common/views/widgets/post-form.vue @@ -34,6 +34,14 @@ @@ -46,6 +54,8 @@ import define from '../../../common/define-widget'; import i18n from '../../../i18n'; import insertTextAtCursor from 'insert-text-at-cursor'; import * as XDraggable from 'vuedraggable'; +import getFace from '../../../common/scripts/get-face'; +import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue'; export default define({ name: 'post-form', @@ -56,7 +66,8 @@ export default define({ i18n: i18n('desktop/views/widgets/post-form.vue'), components: { - XDraggable + XDraggable, + MkVisibilityChooser }, data() { @@ -64,6 +75,8 @@ export default define({ posting: false, text: '', files: [], + visibility: 'public', + localOnly: false, }; }, @@ -81,6 +94,11 @@ export default define({ } }, + mounted() { + // デフォルト公開範囲 + this.applyVisibility(this.$store.state.settings.defaultNoteVisibility); + }, + methods: { func() { if (this.props.design == 1) { @@ -173,25 +191,39 @@ export default define({ }); }, - post() { - this.posting = true; + kao() { + this.text += getFace(); + }, - let visibility = 'public'; - let localOnly = false; + setVisibility() { + const w = this.$root.new(MkVisibilityChooser, { + source: this.$refs.visibilityButton, + currentVisibility: this.visibility + }); + w.$once('chosen', v => { + this.applyVisibility(v); + }); + }, - const m = this.$store.state.settings.defaultNoteVisibility.match(/^local-(.+)/); + applyVisibility(v :string) { + const m = v.match(/^local-(.+)/); if (m) { - visibility = m[1]; - localOnly = true; + this.localOnly = true; + this.visibility = m[1]; } else { - visibility = this.$store.state.settings.defaultNoteVisibility; + this.localOnly = false; + this.visibility = v; } + }, + + post() { + this.posting = true; this.$root.api('notes/create', { text: this.text == '' ? undefined : this.text, fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined, - visibility, - localOnly, + visibility: this.visibility, + localOnly: this.localOnly, }).then(data => { this.clear(); }).catch(err => { @@ -294,6 +326,13 @@ export default define({ &:hover color var(--textHighlighted) + > button > .localOnly + color var(--primary) + position absolute + top 0 + right 2px + transform scale(.8) + > .post display block margin 0 0 0 auto