aboutsummaryrefslogtreecommitdiff
path: root/src/components/settings_modal/helpers/attachment_setting.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2023-04-13 01:11:20 +0300
committerHenry Jameson <me@hjkos.com>2023-04-13 01:11:20 +0300
commit9aaa8a86f52bc97838c768a8859919a3ad6fd54f (patch)
tree0b17c009f4151eb567fdf1d9ccb472be09130dfd /src/components/settings_modal/helpers/attachment_setting.js
parentd8ed541d12382ec58ea1ab75acb1ca153e22f2e4 (diff)
initial implementation of attachmentsetting
Diffstat (limited to 'src/components/settings_modal/helpers/attachment_setting.js')
-rw-r--r--src/components/settings_modal/helpers/attachment_setting.js42
1 files changed, 42 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..a0a12ead
--- /dev/null
+++ b/src/components/settings_modal/helpers/attachment_setting.js
@@ -0,0 +1,42 @@
+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,
+ type: {
+ type: Array,
+ required: false,
+ default: []
+ }
+ },
+ components: {
+ ...Setting.components,
+ MediaUpload,
+ Attachment
+ },
+ computed: {
+ ...Setting.computed,
+ attachment () {
+ const path = this.realDraftMode ? this.draft : this.state
+ 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)
+ }
+ }
+ }
+}