Add placeholder for the description input
Signed-off-by: Julius Härtl <jus@bitgrid.net> Co-authored-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
This commit is contained in:
@@ -45,10 +45,13 @@
|
|||||||
</Actions>
|
</Actions>
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<div v-if="!descriptionEditing"
|
<div v-if="!descriptionEditing && hasDescription"
|
||||||
id="description-preview"
|
id="description-preview"
|
||||||
@click="clickedPreview"
|
@click="clickedPreview"
|
||||||
v-html="renderedDescription" />
|
v-html="renderedDescription" />
|
||||||
|
<p v-else-if="!descriptionEditing" class="placeholder" @click="showEditor()">
|
||||||
|
{{ t('deck', 'Write a description …') }}
|
||||||
|
</p>
|
||||||
<VueEasymde v-else
|
<VueEasymde v-else
|
||||||
:key="card.id"
|
:key="card.id"
|
||||||
ref="markdownEditor"
|
ref="markdownEditor"
|
||||||
@@ -109,6 +112,7 @@ export default {
|
|||||||
autofocus: true,
|
autofocus: true,
|
||||||
autosave: { enabled: false, uniqueId: 'unique' },
|
autosave: { enabled: false, uniqueId: 'unique' },
|
||||||
toolbar: false,
|
toolbar: false,
|
||||||
|
placeholder: t('deck', 'Write a description …'),
|
||||||
},
|
},
|
||||||
descriptionSaveTimeout: null,
|
descriptionSaveTimeout: null,
|
||||||
descriptionSaving: false,
|
descriptionSaving: false,
|
||||||
@@ -143,6 +147,9 @@ export default {
|
|||||||
renderedDescription() {
|
renderedDescription() {
|
||||||
return markdownIt.render(this.card.description || '')
|
return markdownIt.render(this.card.description || '')
|
||||||
},
|
},
|
||||||
|
hasDescription() {
|
||||||
|
return this.card?.description?.trim?.() !== ''
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showEditor() {
|
showEditor() {
|
||||||
@@ -226,6 +233,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
color: var(--color-text-maxcontrast);
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
#description-preview {
|
#description-preview {
|
||||||
min-height: 100px;
|
min-height: 100px;
|
||||||
|
|
||||||
@@ -281,6 +293,10 @@ h5 {
|
|||||||
color: var(--color-main-text);
|
color: var(--color-main-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.CodeMirror-placeholder {
|
||||||
|
color: var(--color-text-maxcontrast);
|
||||||
|
}
|
||||||
|
|
||||||
.editor-preview,
|
.editor-preview,
|
||||||
.editor-statusbar {
|
.editor-statusbar {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user