ArticleRemoteContentBadge.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed, ref } from 'vue'
  4. import CommonSectionPopup from '#mobile/components/CommonSectionPopup/CommonSectionPopup.vue'
  5. export interface Props {
  6. originalFormattingUrl?: string
  7. }
  8. const props = defineProps<Props>()
  9. const showPopup = ref(false)
  10. const popupItems = computed(() =>
  11. props.originalFormattingUrl
  12. ? [
  13. {
  14. type: 'link' as const,
  15. label: __('Original Formatting'),
  16. link: props.originalFormattingUrl,
  17. attributes: {
  18. 'rest-api': true,
  19. target: '_blank',
  20. },
  21. },
  22. ]
  23. : [],
  24. )
  25. </script>
  26. <template>
  27. <button
  28. v-bind="$attrs"
  29. type="button"
  30. class="inline-flex h-7 grow items-center gap-1 rounded-lg px-2 py-1 text-xs font-bold"
  31. @click.prevent="showPopup = !showPopup"
  32. @keydown.space.prevent="showPopup = !showPopup"
  33. >
  34. <CommonIcon name="warning" decorative size="xs" />
  35. {{ $t('Blocked Content') }}
  36. </button>
  37. <CommonSectionPopup v-model:state="showPopup" :messages="popupItems">
  38. <template #header>
  39. <div
  40. class="flex flex-col items-center gap-2 border-b border-b-white/10 p-4"
  41. >
  42. <div class="flex w-full items-center justify-center gap-1">
  43. <CommonIcon name="warning" size="tiny" />
  44. {{ $t('Blocked Content') }}
  45. </div>
  46. <div>
  47. {{
  48. $t(
  49. 'This message contains images or other content hosted by an external source. It was blocked, but you can download the original formatting here.',
  50. )
  51. }}
  52. </div>
  53. </div>
  54. </template>
  55. </CommonSectionPopup>
  56. </template>