-
Notifications
You must be signed in to change notification settings - Fork 0
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
01a4df2
commit 56a37dc
Showing
163 changed files
with
55,102 additions
and
112,066 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
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
94 changes: 94 additions & 0 deletions
94
admin/vue-components/Pages/Components/Editor/Fields/FieldUploadVideo.vue
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,94 @@ | ||
<template> | ||
<div> | ||
<div class="relative mb-2" v-if="inputData(field, col)"> | ||
<div class="aspect-ratio-16/9"></div> | ||
<video | ||
:key="inputData(field, col)" | ||
class="absolute top-0 left-0 object-contain object-center w-full h-full bg-gray-200 border-none rounded " | ||
controls | ||
autoplay | ||
muted | ||
loop | ||
> | ||
<source :src="inputData(field, col)" type="video/mp4" /> | ||
</video> | ||
</div> | ||
<div class="flex mt-2 space-x-2"> | ||
<button class="w-1/2 btn btn-primary" @click="openLibrary"> | ||
Select video | ||
</button> | ||
<button class="w-1/2 btn btn-default" @click="removeImage">Remove</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ["field", "col", "lang"], | ||
components: {}, | ||
computed: {}, | ||
data() { | ||
return { | ||
frame: false, | ||
}; | ||
}, | ||
methods: { | ||
inputData(field, activeCol) { | ||
let data = this.col.data["default"][field.id]; | ||
if (!data) { | ||
data = field.default; | ||
activeCol.data["default"][field.id] = data; | ||
} | ||
return data; | ||
}, | ||
removeImage() { | ||
this.col.data["default"][this.field.id] = ""; | ||
}, | ||
mediaLibrary() { | ||
this.frame = wp.media({ | ||
title: "Media Library", | ||
button: { | ||
text: "Use this video", | ||
}, | ||
library: { | ||
type: ["video"], | ||
}, | ||
multiple: false, | ||
}); | ||
const self = this; | ||
this.frame.on("select", function () { | ||
self.frame | ||
.state() | ||
.get("selection") | ||
.map(function (attachment) { | ||
if (attachment.attributes.type === "video") { | ||
if (attachment.toJSON().url) { | ||
const path = attachment | ||
.toJSON() | ||
.url.replace(/^(?:\/\/|[^/]+)*\//, ""); | ||
self.col.data["default"][self.field.id] = `/${path}`; | ||
self.$forceUpdate(); | ||
} | ||
} else { | ||
self.$dialog | ||
.confirm( | ||
"Video filetype is not supported, please select a valid video." | ||
) | ||
.then((dialog) => { | ||
self.frame.open(); | ||
}); | ||
} | ||
}) | ||
.join(); | ||
}); | ||
}, | ||
openLibrary() { | ||
this.frame.open(); | ||
}, | ||
}, | ||
mounted() { | ||
this.mediaLibrary(); | ||
}, | ||
}; | ||
</script> |
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 |
---|---|---|
|
@@ -29,6 +29,7 @@ export default { | |
"italic", | ||
"underline", | ||
"blockquote", | ||
"link", | ||
{ list: "bullet" }, | ||
{ align: [] }, | ||
], | ||
|
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
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.