Skip to content

Commit

Permalink
Add placeholder for the description input
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Co-authored-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
  • Loading branch information
juliusknorr and skjnldsv committed Nov 13, 2020
1 parent 968d254 commit 998d725
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/card/Description.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@
</Actions>
</h5>

<div v-if="!descriptionEditing"
<div v-if="!descriptionEditing && hasDescription"
id="description-preview"
@click="clickedPreview"
v-html="renderedDescription" />
<p v-else-if="!descriptionEditing" class="placeholder" @click="showEditor()">
{{ t('deck', 'Write a description …') }}
</p>
<VueEasymde v-else
:key="card.id"
ref="markdownEditor"
Expand Down Expand Up @@ -109,6 +112,7 @@ export default {
autofocus: true,
autosave: { enabled: false, uniqueId: 'unique' },
toolbar: false,
placeholder: t('deck', 'Write a description …'),
},
descriptionSaveTimeout: null,
descriptionSaving: false,
Expand Down Expand Up @@ -143,6 +147,9 @@ export default {
renderedDescription() {
return markdownIt.render(this.card.description || '')
},
hasDescription() {
return this.card?.description?.trim?.() !== ''
},
},
methods: {
showEditor() {
Expand Down Expand Up @@ -226,6 +233,11 @@ export default {
}
}
.placeholder {
color: var(--color-text-maxcontrast);
padding: 2px;
}
#description-preview {
min-height: 100px;
Expand Down Expand Up @@ -281,6 +293,10 @@ h5 {
color: var(--color-main-text);
}
.CodeMirror-placeholder {
color: var(--color-text-maxcontrast);
}
.editor-preview,
.editor-statusbar {
display: none;
Expand Down

0 comments on commit 998d725

Please sign in to comment.