Calm motion: animations on this site only fade, with no movement
Version history
Saved versions with the author and the time, and a restore button
Lists the saved versions of a document, newest first. The reader can look at an old version and bring it back. To see the changes line by line, use the diff beside it.
Basic
Looking at: v5
versionsis a list of versions, newest first. Each version has anid, anauthor, and atimeas text. It can also have alabel, anavatar, asummary, and the countsaddedandremoved.- The first version is the current one and has a "Current" tag. The other versions have a restore button that emits
restorewith the id. v-model:selectedis the id of the version that the reader looks at. A click on a version sets it. With no value, the current version is the selected one.- The counts show as "+12 −3". Screen readers hear them in words, such as "12 added, 3 removed".
- Change the words with
labelsor a label pack:title,current,restore, andchanges(a function of the two counts).
Usage
ts
import { BlessVersionHistory } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
versions* | BlessVersion[] | — | newest first; the first is the current version |
labels | Partial<{ title: string; current: string; restore: string; changes: (added: number, removed: number) => string; }> | — | |
selected | string | — | the id of the version the reader looks at |
Events
| Name | Payload | Description |
|---|---|---|
update:selected | [value: string | undefined] | |
restore | [id: string] |