Welcome to mirror list, hosted at ThFree Co, Russian Federation.

blob.vue « pages « repository « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c09e21339360e98174315cdf8f4a0794a49f42ae (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
33
34
35
36
37
38
39
40
41
<script>
// This file is in progress and behind a feature flag, please see the following issue for more:
// https://gitlab.com/gitlab-org/gitlab/-/issues/323200

import BlobContentViewer from '../components/blob_content_viewer.vue';
import { LIMITED_CONTAINER_WIDTH_CLASS } from '../constants';

export default {
  components: {
    BlobContentViewer,
  },
  beforeRouteEnter(to, from, next) {
    next(({ $options }) => {
      $options.limitedContainerElements.forEach((el) =>
        el.classList.remove(LIMITED_CONTAINER_WIDTH_CLASS),
      );
    });
  },
  beforeRouteLeave(to, from, next) {
    this.$options.limitedContainerElements.forEach((el) =>
      el.classList.add(LIMITED_CONTAINER_WIDTH_CLASS),
    );
    next();
  },
  props: {
    path: {
      type: String,
      required: true,
    },
    projectPath: {
      type: String,
      required: true,
    },
  },
  limitedContainerElements: document.querySelectorAll(`.${LIMITED_CONTAINER_WIDTH_CLASS}`),
};
</script>

<template>
  <blob-content-viewer :path="path" :project-path="projectPath" />
</template>