File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 6161<script setup>
6262import { ref , computed , onMounted , watch } from ' vue'
6363import mediumZoom from ' medium-zoom'
64+ import { useRoute } from ' vue-router'
6465
6566const img = ref (null );
6667const zoom = ref (null );
@@ -71,12 +72,19 @@ const props = defineProps({
7172 meta: Object ,
7273})
7374
75+ const route = useRoute ();
7476const url = computed (() => {
7577 return props .record [` previewUrl_${ props .meta .pluginInstanceId } ` ];
7678});
7779
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 );
7985
86+ return width ? { maxWidth: width } : {};
87+ });
8088
8189// since we have no way to know the content type of the file, we will try to guess it from extension
8290// 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
127127 pathColumnLabel : resourceConfig . columns [ pathColumnIndex ] . label ,
128128 fieldsForContext : this . options . generation ?. fieldsForContext ,
129129 maxWidth : this . options . preview ?. maxWidth ,
130+ maxListWidth : this . options . preview ?. maxListWidth ,
131+ maxShowWidth : this . options . preview ?. maxShowWidth ,
130132 } ;
131133 // define components which will be imported from other components
132134 this . componentPath ( 'imageGenerator.vue' ) ;
Original file line number Diff line number Diff line change @@ -69,6 +69,16 @@ export type PluginOptions = {
6969 */
7070 maxWidth ?: string ,
7171
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+
7282 /**
7383 * Used to display preview (if it is image) in list and show views.
7484 * 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