@drax/media-vue 2.1.2 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "2.1.2",
6
+ "version": "2.2.1",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "module": "./src/index.ts",
@@ -46,5 +46,5 @@
46
46
  "vue-tsc": "^3.2.4",
47
47
  "vuetify": "^3.11.8"
48
48
  },
49
- "gitHead": "0dfd52ea60e9e9c188581bed9269da568b053604"
49
+ "gitHead": "28b52dd92f9f23ccc40315f284861ce1ba3fed51"
50
50
  }
@@ -48,7 +48,7 @@ function onFileClick() {
48
48
  }
49
49
 
50
50
  const valueModelUrl = computed(() =>
51
- valueModel.value.url || '')
51
+ valueModel.value?.url || '')
52
52
 
53
53
  async function onFileChanged(e: Event) {
54
54
  if (e.target && (e.target as HTMLInputElement).files) {
@@ -101,12 +101,12 @@ defineEmits(['updateValue'])
101
101
 
102
102
  const isImage = computed(() => {
103
103
 
104
- if (typeof valueModel.value.url !== 'string' || !valueModel.value.url.trim()) return false;
104
+ if (valueModel.value && (typeof valueModel.value?.url !== 'string' || !valueModel.value?.url.trim())) return false;
105
105
 
106
106
  // supports optional query/hash: ".../file.jpg?x=1#y"
107
107
  const imageExtRegex = /\.(?:jpe?g|png|gif|webp|bmp|svg|tiff?|avif|ico)(?:[?#].*)?$/i;
108
108
 
109
- return imageExtRegex.test(valueModel.value.url);
109
+ return imageExtRegex.test(valueModel.value?.url);
110
110
  });
111
111
 
112
112
  </script>
@@ -157,7 +157,7 @@ const isImage = computed(() => {
157
157
  <v-btn @click="onFileClick" :loading="loading" density="compact" color="grey" variant="text">Click | Drag & Drop</v-btn>
158
158
 
159
159
  <template v-if="preview && isImage">
160
- <v-img :src="valueModel.url" alt="Preview" :height="previewHeight" class="mt-4"></v-img>
160
+ <v-img :src="valueModel?.url" alt="Preview" :height="previewHeight" class="mt-4"></v-img>
161
161
  </template>
162
162
 
163
163
  </div>