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
|
<!--
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="template-field__text">
<label :for="fieldId">
{{ fieldLabel }}
</label>
<NcTextField :id="fieldId"
type="text"
:value.sync="value"
:label="fieldLabel"
:label-outside="true"
:placeholder="field.content"
@input="input" />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import NcTextField from '@nextcloud/vue/components/NcTextField'
export default defineComponent({
name: 'TemplateRichTextField',
components: {
NcTextField,
},
props: {
field: {
type: Object,
default: () => {},
},
},
data() {
return {
value: '',
}
},
computed: {
fieldLabel() {
const label = this.field.name || this.field.alias
return (label.charAt(0).toUpperCase() + label.slice(1))
},
fieldId() {
return 'text-field' + this.field.index
},
},
methods: {
input() {
this.$emit('input', {
index: this.field.index,
property: 'content',
value: this.value,
})
},
},
})
</script>
<style lang="scss" scoped>
.template-field__text {
margin: 20px 0;
label {
font-weight: bold;
}
}
</style>
|