/
String.vue
98 lines (85 loc) · 1.85 KB
/
String.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
90
91
92
93
94
95
96
97
98
<template>
<b-form-group
label-class="d-flex align-items-center text-primary p-0"
:state="state"
:class="formGroupStyleClasses"
>
<template
v-if="!valueOnly"
#label
>
<span class="d-inline-block text-truncate mw-100 py-1">
{{ label }}
</span>
<hint
:id="field.fieldID"
:text="hint"
/>
</template>
<div
class="small text-muted"
:class="{ 'mb-1': description }"
>
{{ description }}
</div>
<multi
v-if="field.isMulti"
v-slot="ctx"
:value.sync="value"
:errors="errors"
>
<c-rich-text-input
v-if="field.options.useRichTextEditor"
v-model="value[ctx.index]"
class="mr-2"
/>
<b-form-textarea
v-else-if="field.options.multiLine"
v-model="value[ctx.index]"
class="mr-2"
/>
<b-form-input
v-else
v-model="value[ctx.index]"
class="mr-2"
/>
</multi>
<template v-else>
<c-rich-text-input
v-if="field.options.useRichTextEditor"
v-model="value"
class="mr-2"
:labels="{
urlPlaceholder: $t('content.urlPlaceholder'),
ok: $t('content.ok'),
openLinkInNewTab: $t('content.openLinkInNewTab'),
}"
/>
<b-form-textarea
v-else-if="field.options.multiLine"
v-model="value"
class="mr-2"
/>
<b-form-input
v-else
v-model="value"
class="mr-2"
/>
<errors :errors="errors" />
</template>
</b-form-group>
</template>
<script>
import base from './base'
import { components } from '@cortezaproject/corteza-vue'
const { CRichTextInput } = components
export default {
i18nOptions: {
namespaces: 'block',
},
components: {
CRichTextInput,
},
extends: base,
}
</script>