Skip to content

Commit

Permalink
add copy button to custom fields that can use it
Browse files Browse the repository at this point in the history
  • Loading branch information
subzdev committed Dec 24, 2021
1 parent e4cd9c0 commit 9037ef1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion web/src/components/ui/CustomField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
:rules="[...validationRules]"
reactive-rules
autogrow
/>

>
<template v-slot:append>
<q-icon name="content_copy" class="cursor-pointer" @click="copyToClipboard(modelValue)">
</q-icon>
</template>
</q-input>
<q-toggle
v-else-if="field.type === 'checkbox'"
ref="input"
Expand Down Expand Up @@ -85,6 +90,8 @@

<script>
import { truncateText } from "@/utils/format";
import { copyToClipboard } from 'quasar'
import { notifySuccess, notifyError } from "@/utils/notify";
export default {
name: "CustomField",
props: ["field", "modelValue"],
Expand All @@ -107,6 +114,15 @@ export default {
? "q-mb-xl q-mt-xl"
: "";
},
copyToClipboard(modelValue) {
copyToClipboard(modelValue)
.then(() => {
notifySuccess("Copied to clipboard!");
})
.catch(() => {
notifyError("Unable to copy to clipboard!");
});
},
},
computed: {
validationRules() {
Expand Down

0 comments on commit 9037ef1

Please sign in to comment.