diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2023-05-24 18:55:20 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2023-05-24 18:55:20 +0000 |
| commit | c730c9b6d0fac2b79e0fa5900117c66d073e4a9d (patch) | |
| tree | b33e33e9da2225c05cce2f47f87c5bc54d01cdc1 /src/components/settings_modal/helpers/attachment_setting.js | |
| parent | 4bf085b8feb81ad52bad6cb8979786df22baba9e (diff) | |
| parent | cbd22d52b8d0cacf01f71edcb799294b93754f60 (diff) | |
Merge branch 'improve_settings_reusability' into 'develop'
AdminFE functionality in PleromaFE
See merge request pleroma/pleroma-fe!1800
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) + } + } + } +} |
