fix(editor): show placeholder if an event's title is empty

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
This commit is contained in:
Richard Steinmetz 2024-03-20 10:18:23 +01:00
parent 59fe5d0cac
commit b6383fe090
No known key found for this signature in database
GPG Key ID: 27137D9E7D273FB2
1 changed files with 14 additions and 1 deletions

View File

@ -103,7 +103,7 @@
:is-read-only="isReadOnlyOrViewing || !canModifyCalendar"
@update:value="changeCalendar" />
<PropertyTitle :value="title"
<PropertyTitle :value="titleOrPlaceholder"
:is-read-only="isReadOnlyOrViewing"
@update:value="updateTitle" />
@ -262,6 +262,19 @@ export default {
isReadOnlyOrViewing() {
return this.isReadOnly || this.isViewing || this.isWidget
},
/**
* Return the event's title or a placeholder if it is empty
*
* @return {string}
*/
titleOrPlaceholder() {
if (this.title === '' && this.isReadOnlyOrViewing && !this.isLoading) {
return t('calendar', 'Untitled event')
}
return this.title
}
},
watch: {
$route(to, from) {