-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathPreviewOptions.vue
More file actions
109 lines (99 loc) 路 2.47 KB
/
Copy pathPreviewOptions.vue
File metadata and controls
109 lines (99 loc) 路 2.47 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!--
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div contenteditable="false" class="preview-options-container">
<NcActions data-text-preview-options="select"
class="preview-options"
:open.sync="open"
@open="onOpen">
<template #icon>
<DotsVerticalIcon :size="20" />
</template>
<NcActionCaption :name="t('text', 'Preview options')" />
<NcActionRadio data-text-preview-option="text-only"
name="preview-option"
value="text-only"
:checked="type === 'text-only'"
@change="e => toggle(e.currentTarget.value)">
{{ t('text', 'Text only') }}
</NcActionRadio>
<NcActionRadio data-text-preview-option="link-preview"
name="preview-option"
value="link-preview"
:checked="type === 'link-preview'"
@change="e => toggle(e.currentTarget.value)">
{{ t('text', 'Show link preview') }}
</NcActionRadio>
<NcActionSeparator />
<NcActionButton close-after-click @click="deleteNode">
<template #icon>
<DeleteIcon :size="20" />
</template>
{{ t('text','Remove link') }}
</NcActionButton>
</NcActions>
</div>
</template>
<script>
import NcActions from '@nextcloud/vue/components/NcActions'
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
import NcActionRadio from '@nextcloud/vue/components/NcActionRadio'
import NcActionCaption from '@nextcloud/vue/components/NcActionCaption'
import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
import DotsVerticalIcon from 'vue-material-design-icons/DotsVertical.vue'
import DeleteIcon from 'vue-material-design-icons/Delete.vue'
export default {
name: 'PreviewOptions',
components: {
DotsVerticalIcon,
NcActions,
NcActionButton,
NcActionCaption,
NcActionRadio,
NcActionSeparator,
DeleteIcon,
},
props: {
type: {
type: String,
required: true,
},
},
data() {
return {
open: false,
}
},
methods: {
onOpen() {
this.$emit('open')
},
toggle(type) {
this.open = false
this.$emit('toggle', type)
},
deleteNode() {
this.$emit('delete')
},
},
}
</script>
<style lang="scss" scoped>
div[contenteditable=false] {
padding: 0;
margin: 0;
}
.preview-options-container {
position: absolute;
width: 0 !important;
left: -44px;
top: 50%;
transform: translate(0, -50%);
}
// Inside details, button needs to be shifted further
.details-content .preview-options-container {
left: calc(-44px - 24px);
}
</style>