File tree 3 files changed +21
-1
lines changed
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 61
61
<script setup>
62
62
import { ref , computed , onMounted , watch } from ' vue'
63
63
import mediumZoom from ' medium-zoom'
64
+ import { useRoute } from ' vue-router'
64
65
65
66
const img = ref (null );
66
67
const zoom = ref (null );
@@ -71,12 +72,19 @@ const props = defineProps({
71
72
meta: Object ,
72
73
})
73
74
75
+ const route = useRoute ();
74
76
const url = computed (() => {
75
77
return props .record [` previewUrl_${ props .meta .pluginInstanceId } ` ];
76
78
});
77
79
78
- const maxWidth = computed (() => props .meta .maxWidth ? { maxWidth: props .meta .maxWidth } : {});
80
+ const maxWidth = computed (() => {
81
+ const isShowPage = route .path .includes (' /show/' );
82
+ const width = isShowPage
83
+ ? (props .meta .maxShowWidth || props .meta .maxWidth )
84
+ : (props .meta .maxListWidth || props .meta .maxWidth );
79
85
86
+ return width ? { maxWidth: width } : {};
87
+ });
80
88
81
89
// since we have no way to know the content type of the file, we will try to guess it from extension
82
90
// for better experience probably we should check whether user saves content type in the database and use it here
Original file line number Diff line number Diff line change @@ -127,6 +127,8 @@ getBucketLifecycleConfiguration on bucket ${this.options.s3Bucket} in region ${t
127
127
pathColumnLabel : resourceConfig . columns [ pathColumnIndex ] . label ,
128
128
fieldsForContext : this . options . generation ?. fieldsForContext ,
129
129
maxWidth : this . options . preview ?. maxWidth ,
130
+ maxListWidth : this . options . preview ?. maxListWidth ,
131
+ maxShowWidth : this . options . preview ?. maxShowWidth ,
130
132
} ;
131
133
// define components which will be imported from other components
132
134
this . componentPath ( 'imageGenerator.vue' ) ;
Original file line number Diff line number Diff line change @@ -69,6 +69,16 @@ export type PluginOptions = {
69
69
*/
70
70
maxWidth ?: string ,
71
71
72
+ /**
73
+ * Maximum width of the preview image in list view
74
+ */
75
+ maxListWidth ?: string ,
76
+
77
+ /**
78
+ * Maximum width of the preview image in show view
79
+ */
80
+ maxShowWidth ?: string ,
81
+
72
82
/**
73
83
* Used to display preview (if it is image) in list and show views.
74
84
* Defaulted to the AWS S3 presigned URL if resource is private or public URL if resource is public.
You can’t perform that action at this time.
0 commit comments