1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Fixed rendering of alarm time in detailed note list

This commit is contained in:
Laurent Cozic 2024-04-05 10:32:52 +01:00
parent 660ebcfc77
commit 5b4477f7bd
2 changed files with 8 additions and 2 deletions

View File

@ -10,6 +10,11 @@ interface Cell {
contentHtml: ()=> string;
}
const valueToString = (value: any) => {
if (value === undefined || value === null) return '';
return value.toString();
};
export default (columns: NoteListColumns, itemTemplate: string, itemValueTemplates: ListRendererItemValueTemplates, view: RenderNoteView) => {
// `note.title` is special and has already been rendered to HTML at this point, so we need
// to ensure the string is not going to be escaped.
@ -36,7 +41,7 @@ export default (columns: NoteListColumns, itemTemplate: string, itemValueTemplat
if (itemValueTemplates[name]) {
return Mustache.render(itemValueTemplates[name], view);
}
return ['note.titleHtml', 'note.title'].includes(name) ? this.value : escapeHtml(this.value);
return ['note.titleHtml', 'note.title'].includes(name) ? this.value : escapeHtml(valueToString(this.value));
},
});
}

View File

@ -12,13 +12,14 @@ export interface RenderViewPropsOptions {
noteTitleHtml: string;
}
const renderViewProp = (name: ListRendererDependency, value: any, options: RenderViewPropsOptions) => {
const renderViewProp = (name: ListRendererDependency, value: any, options: RenderViewPropsOptions): string => {
const renderers: Partial<Record<ListRendererDependency, ()=> string>> = {
'note.user_updated_time': () => time.formatMsToLocal(value),
'note.user_created_time': () => time.formatMsToLocal(value),
'note.updated_time': () => time.formatMsToLocal(value),
'note.created_time': () => time.formatMsToLocal(value),
'note.todo_completed': () => value ? time.formatMsToLocal(value) : '',
'note.todo_due': () => value ? time.formatMsToLocal(value) : '',
'note.tags': () => value ? value.map((t: TagEntity) => t.title).join(', ') : '',
'note.title': () => options.noteTitleHtml,
};