mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
Add Web Share api to ContextMenu.vue (#462)
* Add Web Share api to ContextMenu.vue. Copy to clipboard is the fallback * Add Web Share api to ContextMenu.vue. Copy to clipboard is the fallback * Add translation
This commit is contained in:
parent
59f8b74460
commit
f7f5c97f07
15287
frontend/package-lock.json
generated
15287
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import ConfirmationDialog from "@/components/UI/Dialogs/ConfirmationDialog.vue";
|
import ConfirmationDialog from "@/components/UI/Dialogs/ConfirmationDialog.vue";
|
||||||
import { api } from "@/api";
|
import { api } from "@/api";
|
||||||
|
import { utils } from "@/utils";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ConfirmationDialog,
|
ConfirmationDialog,
|
||||||
@ -44,6 +45,9 @@ export default {
|
|||||||
menuIcon: {
|
menuIcon: {
|
||||||
default: "mdi-dots-vertical",
|
default: "mdi-dots-vertical",
|
||||||
},
|
},
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
loggedIn() {
|
loggedIn() {
|
||||||
@ -64,8 +68,8 @@ export default {
|
|||||||
action: "print",
|
action: "print",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t("general.link"),
|
title: this.$t("general.share"),
|
||||||
icon: "mdi-content-copy",
|
icon: "mdi-share-variant",
|
||||||
color: "accent",
|
color: "accent",
|
||||||
action: "share",
|
action: "share",
|
||||||
},
|
},
|
||||||
@ -88,6 +92,9 @@ export default {
|
|||||||
...this.defaultMenu,
|
...this.defaultMenu,
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
recipeText() {
|
||||||
|
return this.$t("recipe.share-recipe-message", [this.name]);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -103,7 +110,15 @@ export default {
|
|||||||
this.$refs.deleteRecipieConfirm.open();
|
this.$refs.deleteRecipieConfirm.open();
|
||||||
break;
|
break;
|
||||||
case "share":
|
case "share":
|
||||||
this.updateClipboard();
|
if (navigator.share){
|
||||||
|
navigator.share({
|
||||||
|
title: this.name,
|
||||||
|
text: this.recipeText,
|
||||||
|
url: this.recipeURL,
|
||||||
|
})
|
||||||
|
.then(() => console.log('Successful share'))
|
||||||
|
.catch((error) => console.log('WebShareAPI not supported', error))
|
||||||
|
} else this.updateClipboard();
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
this.$router.push(`/recipe/${this.slug}` + "?edit=true");
|
this.$router.push(`/recipe/${this.slug}` + "?edit=true");
|
||||||
@ -123,10 +138,10 @@ export default {
|
|||||||
updateClipboard() {
|
updateClipboard() {
|
||||||
const copyText = this.recipeURL;
|
const copyText = this.recipeURL;
|
||||||
navigator.clipboard.writeText(copyText).then(
|
navigator.clipboard.writeText(copyText).then(
|
||||||
() => console.log("Copied", copyText),
|
() => { console.log("Copied to Clipboard", copyText);
|
||||||
() => console.log("Copied Failed", copyText)
|
utils.notify.success("Copied to Clipboard");},
|
||||||
);
|
() => console.log("Copied Failed", copyText));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -34,7 +34,11 @@
|
|||||||
:value="rating"
|
:value="rating"
|
||||||
></v-rating>
|
></v-rating>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<ContextMenu :slug="slug" menu-icon="mdi-dots-horizontal" />
|
<ContextMenu
|
||||||
|
:slug="slug"
|
||||||
|
menu-icon="mdi-dots-horizontal"
|
||||||
|
:name="name"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<Rating :value="rating" :name="name" :slug="slug" :small="true" />
|
<Rating :value="rating" :name="name" :slug="slug" :small="true" />
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<RecipeChips :truncate="true" :items="tags" :title="false" :limit="2" :small="true" :isCategory="false" />
|
<RecipeChips :truncate="true" :items="tags" :title="false" :limit="2" :small="true" :isCategory="false" />
|
||||||
<ContextMenu :slug="slug" />
|
<ContextMenu :slug="slug" :name="name"/>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-hover>
|
</v-hover>
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
"saturday": "Saturday",
|
"saturday": "Saturday",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
|
"share": "Share",
|
||||||
"shuffle": "Shuffle",
|
"shuffle": "Shuffle",
|
||||||
"sort": "Sort",
|
"sort": "Sort",
|
||||||
"sort-alphabetically": "Alphabetical",
|
"sort-alphabetically": "Alphabetical",
|
||||||
@ -214,6 +215,7 @@
|
|||||||
"ingredient": "Ingredient",
|
"ingredient": "Ingredient",
|
||||||
"ingredients": "Ingredients",
|
"ingredients": "Ingredients",
|
||||||
"instructions": "Instructions",
|
"instructions": "Instructions",
|
||||||
|
"share-recipe-message": "I wanted to share you my {0} recipe.",
|
||||||
"key-name-required": "Key Name Required",
|
"key-name-required": "Key Name Required",
|
||||||
"landscape-view-coming-soon": "Landscape View (Coming Soon)",
|
"landscape-view-coming-soon": "Landscape View (Coming Soon)",
|
||||||
"milligrams": "milligrams",
|
"milligrams": "milligrams",
|
||||||
@ -249,6 +251,7 @@
|
|||||||
"total-time": "Total Time",
|
"total-time": "Total Time",
|
||||||
"unable-to-delete-recipe": "Unable to Delete Recipe",
|
"unable-to-delete-recipe": "Unable to Delete Recipe",
|
||||||
"view-recipe": "View Recipe"
|
"view-recipe": "View Recipe"
|
||||||
|
|
||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
"and": "and",
|
"and": "and",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user