mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	fix(react/dialogs): add back selection in revisions list
This commit is contained in:
		| @@ -83,6 +83,7 @@ function RevisionsDialogComponent() { | |||||||
|                             setCurrentRevision(correspondingRevision); |                             setCurrentRevision(correspondingRevision); | ||||||
|                         } |                         } | ||||||
|                     }} |                     }} | ||||||
|  |                     currentRevision={currentRevision} | ||||||
|                 /> |                 /> | ||||||
|  |  | ||||||
|                 <div className="revision-content-wrapper" style={{ |                 <div className="revision-content-wrapper" style={{ | ||||||
| @@ -104,13 +105,14 @@ function RevisionsDialogComponent() { | |||||||
|     ) |     ) | ||||||
| } | } | ||||||
|  |  | ||||||
| function RevisionsList({ revisions, onSelect }: { revisions: RevisionItem[], onSelect: (val: string) => void }) { | function RevisionsList({ revisions, onSelect, currentRevision }: { revisions: RevisionItem[], onSelect: (val: string) => void, currentRevision?: RevisionItem }) { | ||||||
|     return ( |     return ( | ||||||
|         <FormList style={{ height: "100%", flexShrink: 0 }} onSelect={onSelect}> |         <FormList style={{ height: "100%", flexShrink: 0 }} onSelect={onSelect}> | ||||||
|             {revisions.map((item) =>  |             {revisions.map((item) =>  | ||||||
|                 <FormListItem |                 <FormListItem | ||||||
|                     title={t("revisions.revision_last_edited", { date: item.dateLastEdited })} |                     title={t("revisions.revision_last_edited", { date: item.dateLastEdited })} | ||||||
|                     value={item.revisionId} |                     value={item.revisionId} | ||||||
|  |                     active={currentRevision && item.revisionId === currentRevision.revisionId} | ||||||
|                 > |                 > | ||||||
|                     {item.dateLastEdited && item.dateLastEdited.substr(0, 16)} ({item.contentLength && utils.formatSize(item.contentLength)}) |                     {item.dateLastEdited && item.dateLastEdited.substr(0, 16)} ({item.contentLength && utils.formatSize(item.contentLength)}) | ||||||
|                 </FormListItem> |                 </FormListItem> | ||||||
|   | |||||||
| @@ -29,11 +29,12 @@ interface FormListItemOpts { | |||||||
|     icon?: string; |     icon?: string; | ||||||
|     value?: string; |     value?: string; | ||||||
|     title?: string; |     title?: string; | ||||||
|  |     active?: boolean; | ||||||
| } | } | ||||||
|  |  | ||||||
| export function FormListItem({ children, icon, value, title }: FormListItemOpts) { | export function FormListItem({ children, icon, value, title, active }: FormListItemOpts) { | ||||||
|     return ( |     return ( | ||||||
|         <a class="dropdown-item" data-value={value} title={title}> |         <a class={`dropdown-item ${active ? "active" : ""}`} data-value={value} title={title}> | ||||||
|             <Icon icon={icon} />  |             <Icon icon={icon} />  | ||||||
|             {children} |             {children} | ||||||
|         </a> |         </a> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user