diff options
| author | Henry Jameson <me@hjkos.com> | 2023-06-05 21:53:14 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2023-06-05 21:53:14 +0300 |
| commit | 5e656cc0b40a26435556fff79636c0b2e9c8af4f (patch) | |
| tree | 8efc5369ac64d471b4d61f731bd99653f7e1e19d /src/components/settings_modal/helpers/attachment_setting.js | |
| parent | 00b47e16736f8b472f20dab8def30fb22d54c8be (diff) | |
| parent | ae5181d21eefecc0167e2a076e6c8ad44f3ca859 (diff) | |
Merge remote-tracking branch 'origin/develop' into harden-parser
Diffstat (limited to 'src/components/settings_modal/helpers/attachment_setting.js')
| -rw-r--r-- | src/components/settings_modal/helpers/attachment_setting.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/components/settings_modal/helpers/attachment_setting.js b/src/components/settings_modal/helpers/attachment_setting.js new file mode 100644 index 00000000..ac5c6f86 --- /dev/null +++ b/src/components/settings_modal/helpers/attachment_setting.js @@ -0,0 +1,43 @@ +import Setting from './setting.js' +import { fileTypeExt } from 'src/services/file_type/file_type.service.js' +import MediaUpload from 'src/components/media_upload/media_upload.vue' +import Attachment from 'src/components/attachment/attachment.vue' + +export default { + ...Setting, + props: { + ...Setting.props, + acceptTypes: { + type: String, + required: false, + default: 'image/*' + } + }, + components: { + ...Setting.components, + MediaUpload, + Attachment + }, + computed: { + ...Setting.computed, + attachment () { + const path = this.realDraftMode ? this.draft : this.state + // The "server" part is primarily for local dev, but could be useful for alt-domain or multiuser usage. + const url = path.includes('://') ? path : this.$store.state.instance.server + path + return { + mimetype: fileTypeExt(url), + url + } + } + }, + methods: { + ...Setting.methods, + setMediaFile (fileInfo) { + if (this.realDraftMode) { + this.draft = fileInfo.url + } else { + this.configSink(this.path, fileInfo.url) + } + } + } +} |
