summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/content_editor/components/wrappers/image.vue
blob: 5b81e5fddcc14107660a16ba597ce3934794a8fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<script>
import { GlLoadingIcon } from '@gitlab/ui';
import { NodeViewWrapper } from '@tiptap/vue-2';

export default {
  name: 'ImageWrapper',
  components: {
    NodeViewWrapper,
    GlLoadingIcon,
  },
  props: {
    node: {
      type: Object,
      required: true,
    },
  },
};
</script>
<template>
  <node-view-wrapper class="gl-display-inline-block">
    <span class="gl-relative">
      <img
        data-testid="image"
        class="gl-max-w-full gl-h-auto"
        :title="node.attrs.title"
        :class="{ 'gl-opacity-5': node.attrs.uploading }"
        :src="node.attrs.src"
      />
      <gl-loading-icon v-if="node.attrs.uploading" class="gl-absolute gl-left-50p gl-top-half" />
    </span>
  </node-view-wrapper>
</template>