-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
471449f
commit 3af6fc3
Showing
19 changed files
with
272 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template> | ||
<div class="d-flex flex-row flex-wrap"> | ||
<v-img | ||
v-for="(img, i) in images" | ||
:key="'img-' + i" | ||
:alt="img.alt" | ||
:src="img.src" | ||
class="ma-2 selectable" | ||
max-height="100" | ||
max-width="100" | ||
@click="selectImage(img)" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
/** | ||
* Example of a custom Image selector | ||
* Key is to emit a select-file event when a file needs to be added | ||
*/ | ||
import { VImg } from 'vuetify/lib' | ||
export default { | ||
name: "FileSelector", | ||
components: { VImg }, | ||
data() { | ||
// Some public domain images from wikimedia. | ||
return { | ||
images: [ | ||
{ src: 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Streifenhoernchen.jpg/1024px-Streifenhoernchen.jpg', alt: 'Siberian Chipmunk' }, | ||
{ src: 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/NASA_Mars_Rover.jpg/750px-NASA_Mars_Rover.jpg', alt: 'NASA Mars Rover' }, | ||
{ src: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Muybridge_race_horse_animated.gif', alt: 'Muybridge race horse animated' }, | ||
{ src: 'https://upload.wikimedia.org/wikipedia/commons/2/2a/Locomotive_TEM2M-063_2006_G2.jpg', alt: 'Locomotive TEM2M-063 2006 G2' }, | ||
{ src: 'https://upload.wikimedia.org/wikipedia/commons/8/80/ISS_March_2009.jpg', alt: 'ISS March 2009' }, | ||
{ src: 'https://upload.wikimedia.org/wikipedia/commons/4/44/F-18F_after_launch_from_USS_Abraham_Lincoln_%28CVN-72%29.jpg', alt: 'F-18F after launch from USS Abraham Lincoln (CVN-72)' }, | ||
] | ||
}; | ||
}, | ||
methods: { | ||
selectImage(img) { | ||
this.$emit('select-file', img); | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.selectable { | ||
cursor: pointer; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<div> | ||
<v-text-field | ||
v-model="form.src" | ||
:label="$i18n.getMsg('extensions.Image.window.form.sourceLink')" | ||
/> | ||
<v-text-field | ||
v-model="form.alt" | ||
:label="$i18n.getMsg('extensions.Image.window.form.altText')" | ||
/> | ||
<v-btn @click="addImage"> | ||
{{ $i18n.getMsg('extensions.Image.window.form.addImage') }} | ||
</v-btn> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { mixins } from 'vue-class-component' | ||
import { Component } from 'vue-property-decorator' | ||
import { VTextField } from 'vuetify/lib' | ||
import I18nMixin from '../../../mixins/I18nMixin' | ||
import EVENTS from '~/extensions/nativeExtensions/image/events' | ||
@Component({ | ||
components: { VTextField } | ||
}) | ||
export default class ImageForm extends mixins(I18nMixin) { | ||
form: { | ||
src: null | string | ||
alt: null | string | ||
} = { | ||
src: null, // 'https://www.nationalgeographic.com/content/dam/news/2018/05/17/you-can-train-your-cat/02-cat-training-NationalGeographic_1484324.jpg' | ||
alt: null | ||
} | ||
addImage () { | ||
this.$emit(EVENTS.SELECT_FILE, { | ||
src: this.form.src, | ||
alt: this.form.alt | ||
}) | ||
this.form.src = null | ||
this.form.alt = null | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default interface ImageSource { | ||
src: null | string | ||
alt: null | string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.