/
DisplayEmbeddedContent.vue
89 lines (82 loc) · 2.81 KB
/
DisplayEmbeddedContent.vue
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!--
- Copyright (c) Enalean, 2019 - present. All Rights Reserved.
-
- This file is a part of Tuleap.
-
- Tuleap is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- Tuleap is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
-->
<template>
<div class="tlp-framed">
<div class="document-header">
<div class="embedded-document-header-title">
<h1>{{ embedded_title }}</h1>
</div>
<actions-header v-bind:item="embedded_file"/>
</div>
<section class="tlp-pane">
<div class="tlp-pane-container">
<section class="tlp-pane-section" v-dompurify-html="embedded_content"></section>
</div>
</section>
<update-embedded-file-modal v-bind:is="shown_modal" v-bind:item="embedded_file"/>
</div>
</template>
<script>
import DropdownButton from "../ActionsDropDown/DropdownButton.vue";
import DropdownMenu from "../ActionsDropDown/DropdownMenu.vue";
import UpdateItemButton from "../ActionsButton/UpdateItemButton.vue";
import UpdateEmbeddedFileModal from "../ModalUpdateItem/UpdateEmbeddedFileModal.vue";
import ActionsHeader from "./ActionsHeader.vue";
export default {
name: "DisplayEmbeddedContent",
components: {
ActionsHeader,
UpdateEmbeddedFileModal,
DropdownMenu,
UpdateItemButton,
DropdownButton
},
props: {
embedded_file: Object
},
data() {
return {
shown_modal: ""
};
},
computed: {
embedded_title() {
return this.embedded_file.title;
},
embedded_content() {
if (!this.embedded_file.embedded_file_properties) {
return "";
}
return this.embedded_file.embedded_file_properties.content;
}
},
mounted() {
document.addEventListener("show-update-item-modal", this.showUpdateItemModal);
this.$once("hook:beforeDestroy", () => {
document.removeEventListener("show-update-item-modal", this.showUpdateItemModal);
});
},
methods: {
showUpdateItemModal() {
this.shown_modal = () =>
import(/* webpackChunkName: "document-update-embedded-file-modal" */ "../ModalUpdateItem/UpdateEmbeddedFileModal.vue");
}
}
};
</script>