Skip to content

Commit

Permalink
Merge branch 'main' of github.com:utomic-media/directus-extension-fie…
Browse files Browse the repository at this point in the history
…ld-actions
  • Loading branch information
Dominic-Marcelino committed Aug 9, 2023
2 parents 1ecccc2 + 9d8b522 commit 095583d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/display/display.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
outlined
small
:class="copyPosition === 'start' ? '-order-1' : 'order-1'"
v-tooltip="`Copy: ${computedLink}`"
v-tooltip="`Copy: ${computedCopyValue}`"
@click.stop="copyValue"
>
<v-icon
Expand Down Expand Up @@ -63,7 +63,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import { useClipboard } from '../shared/composable/use-clipboard';
import { useLink } from '../shared/composable/use-link';
import { usePrefixedValues } from '../shared/composable/use-prefixed-values';
import { useStores } from '@directus/extensions-sdk';
const props = defineProps({
Expand Down Expand Up @@ -131,11 +131,11 @@ const { isCopySupported, copyToClipboard } = useClipboard();
const { useNotificationsStore } = useStores();
const notificationStore = useNotificationsStore();
const { computedLink } = useLink(props);
const { computedLink, computedCopyValue } = usePrefixedValues(props);
async function copyValue() {
await copyToClipboard(computedLink.value, notificationStore);
await copyToClipboard(computedCopyValue.value, notificationStore);
};
Expand Down
8 changes: 4 additions & 4 deletions src/interface/interface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<v-button
v-if="showCopy && isCopySupported"
:disabled="!value"
v-tooltip="value ? `Copy: ${computedLink}` : `Can't copy empty value`"
v-tooltip="value ? `Copy: ${computedCopyValue}` : `Can't copy empty value`"
icon
secondary
xLarge
Expand Down Expand Up @@ -66,7 +66,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import { useClipboard } from '../shared/composable/use-clipboard';
import { useLink } from '../shared/composable/use-link';
import { usePrefixedValues } from '../shared/composable/use-prefixed-values';
import { useStores } from '@directus/extensions-sdk';
const props = defineProps({
Expand Down Expand Up @@ -148,7 +148,7 @@ const { isCopySupported, copyToClipboard } = useClipboard();
const { useNotificationsStore } = useStores();
const notificationStore = useNotificationsStore();
const { computedLink } = useLink(props);
const { computedLink, computedCopyValue } = usePrefixedValues(props);
const inputType = computed(() => {
Expand All @@ -158,7 +158,7 @@ const inputType = computed(() => {
async function copyValue() {
await copyToClipboard(`${computedLink.value}`, notificationStore);
await copyToClipboard(`${computedCopyValue.value}`, notificationStore);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { computed } from 'vue';
import { usePrefix } from './use-prefix';

export function useLink(props: any) {
export function usePrefixedValues(props: any) {

// TODO: make sure it's always a valid link (absolute + relative)

Expand All @@ -10,5 +10,10 @@ export function useLink(props: any) {
return prefix.value + props.value;
});

return { computedLink };
const computedCopyValue = computed(() => {
const prefix = usePrefix(props.copyPrefix);
return prefix.value + props.value;
});

return { computedLink, computedCopyValue };
}

0 comments on commit 095583d

Please sign in to comment.