This commit is contained in:
syuilo 2020-09-20 14:09:51 +09:00
parent 404583a285
commit ea303daf64
2 changed files with 19 additions and 12 deletions

View File

@ -58,7 +58,6 @@ import { faEyeSlash, faLaughSquint } from '@fortawesome/free-regular-svg-icons';
import insertTextAtCursor from 'insert-text-at-cursor';
import { length } from 'stringz';
import { toASCII } from 'punycode';
import MkVisibilityChooser from './visibility-chooser.vue';
import MkUserSelect from './user-select.vue';
import XNotePreview from './note-preview.vue';
import { parse } from '../../mfm/parse';
@ -419,18 +418,23 @@ export default defineComponent({
this.saveDraft();
},
setVisibility() {
async setVisibility() {
if (this.channel) {
// TODO: information dialog
return;
}
os.modal(MkVisibilityChooser, {
source: this.$refs.visibilityButton,
os.modal(await import('./visibility-chooser.vue'), {
currentVisibility: this.visibility,
currentLocalOnly: this.localOnly
}).then(({ visibility, localOnly }) => {
this.applyVisibility(visibility);
this.localOnly = localOnly;
}, {
'change-visibility': visibility => {
this.applyVisibility(visibility);
},
'change-local-only': localOnly => {
this.localOnly = localOnly;
}
}, {
source: this.$refs.visibilityButton
});
},

View File

@ -46,11 +46,7 @@ import { faGlobe, faUnlock, faHome, faBiohazard, faToggleOn, faToggleOff } from
import { faEnvelope } from '@fortawesome/free-regular-svg-icons';
export default defineComponent({
emits: ['done'],
props: {
source: {
required: true
},
currentVisibility: {
type: String,
required: false
@ -60,6 +56,7 @@ export default defineComponent({
required: false
}
},
emits: ['done', 'change-visibility', 'change-local-only'],
data() {
return {
v: this.$store.state.settings.rememberNoteVisibility ? this.$store.state.deviceUser.visibility : (this.currentVisibility || this.$store.state.settings.defaultNoteVisibility),
@ -67,12 +64,18 @@ export default defineComponent({
faGlobe, faUnlock, faEnvelope, faHome, faBiohazard, faToggleOn, faToggleOff
}
},
watch: {
localOnly() {
this.$emit('change-local-only', this.localOnly);
}
},
methods: {
choose(visibility) {
if (this.$store.state.settings.rememberNoteVisibility) {
this.$store.commit('deviceUser/setVisibility', visibility);
}
this.$emit('done', { visibility, localOnly: this.localOnly });
this.$emit('change-visibility', visibility);
this.$emit('done');
},
}
});