Skip to content

Commit 4549a2b

Browse files
authored
Merge pull request #2520 from nextcloud/bugfix/noid/description-placeholder
Add placeholder for the description input
2 parents a50058d + 998d725 commit 4549a2b

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/components/card/Description.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@
4545
</Actions>
4646
</h5>
4747

48-
<div v-if="!descriptionEditing"
48+
<div v-if="!descriptionEditing && hasDescription"
4949
id="description-preview"
5050
@click="clickedPreview"
5151
v-html="renderedDescription" />
52+
<p v-else-if="!descriptionEditing" class="placeholder" @click="showEditor()">
53+
{{ t('deck', 'Write a description …') }}
54+
</p>
5255
<VueEasymde v-else
5356
:key="card.id"
5457
ref="markdownEditor"
@@ -109,6 +112,7 @@ export default {
109112
autofocus: true,
110113
autosave: { enabled: false, uniqueId: 'unique' },
111114
toolbar: false,
115+
placeholder: t('deck', 'Write a description …'),
112116
},
113117
descriptionSaveTimeout: null,
114118
descriptionSaving: false,
@@ -143,6 +147,9 @@ export default {
143147
renderedDescription() {
144148
return markdownIt.render(this.card.description || '')
145149
},
150+
hasDescription() {
151+
return this.card?.description?.trim?.() !== ''
152+
},
146153
},
147154
methods: {
148155
showEditor() {
@@ -226,6 +233,11 @@ export default {
226233
}
227234
}
228235
236+
.placeholder {
237+
color: var(--color-text-maxcontrast);
238+
padding: 2px;
239+
}
240+
229241
#description-preview {
230242
min-height: 100px;
231243
@@ -281,6 +293,10 @@ h5 {
281293
color: var(--color-main-text);
282294
}
283295
296+
.CodeMirror-placeholder {
297+
color: var(--color-text-maxcontrast);
298+
}
299+
284300
.editor-preview,
285301
.editor-statusbar {
286302
display: none;

0 commit comments

Comments
 (0)