Repository navigation
feat!: rebuild version history and customize snapshot actions #3090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 24 commits
b7d78ae
72a1702
621902e
11b4d59
9be8d14
f2857ad
f8ecfc9
194f69f
48bec82
a82f062
9cb2b5b
b60ac63
2f9b255
e4a5779
459b4db
10062b6
449b9c5
e754cb6
72fd1e5
c7fe526
afec519
c9bc61b
6105796
e537940
4dd8c83
6939146
26312d6
60fbd84
c492792
2f583c7
4a26842
8aa535a
ad01251
b93aa89
ba4e246
f96a8a6
1ce3379
44ffe1c
15ec810
3c5ee8a
b29be57
ae21c0b
bffcb7a
32463db
a38ba03
e2d5fbc
784de3a
46605aa
32197f9
43e2f6f
2170aa7
85734d9
10082b8
206d4be
fa085bd
155d256
616f23a
60a6a3a
7db8d83
57020b3
ca3de6a
12d669c
bb83965
3ff2fa3
0d62219
33a4f5e
fc7fda1
6f08421
0a489b5
5021fd0
d3b9cf5
0682856
2e8bf07
ce541df
07a833a
225d57c
be2fcfb
019d1f1
6147acf
47fe3fb
f4d4991
4c2828f
e1dc6bb
ce406d8
d96013e
adbede8
664aab7
d87fd62
cc63dad
e463df3
154e925
326f1f6
f833032
fb29f1f
f175543
89c1253
0708896
12a81e6
18ffca9
ef4015d
6863e9a
9eb1b06
5c033cb
98eac12
cd9808c
55c872a
01e7fdb
c1e2f51
903b460
a2d830e
8cfb79a
58079f7
1c1be9f
04fd335
087ef08
6514154
efae099
045f94b
ba40c2b
7567884
cd6e9aa
bcd6a21
b5c2ed3
12432ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
|
|
||
| This example shows how to use the `VersioningExtension` with collaborative editing using `yjs` (v13). Snapshots are stored in localStorage using Yjs state updates. | ||
|
|
||
| **Try it out:** Edit the document, then click the "Version History" button to open the sidebar. From there you can save snapshots, preview older versions, rename them, and restore them. | ||
| The sidebar opens on a document with a few versions already in its history, so you can preview them, rename them, and restore them right away. The editor is read-only while the sidebar is open: close it to edit the document, then reopen it with the "History" button and press "Save version" to add a version of your own. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Save version doesn't exist anymore
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be good to mark this example as deprecated / unsupported, because it's yjs 13. In general, I think it's worthwhile to think which example should have
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, styling for this example is off? |
||
|
|
||
| **Relevant Docs:** | ||
|
|
||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,11 @@ | ||
| import { VersioningSidebar } from "@blocknote/react"; | ||
| import { useState } from "react"; | ||
|
|
||
| import { SettingsSelect } from "./SettingsSelect"; | ||
|
|
||
| export const VersionHistorySidebar = () => { | ||
| const [filter, setFilter] = useState<"named" | "all">("all"); | ||
| import { VersioningSidebar } from "@blocknote/react/versioning"; | ||
|
|
||
| export const VersionHistorySidebar = ({ onClose }: { onClose: () => void }) => { | ||
| return ( | ||
| <div className={"sidebar-section"}> | ||
| <div className={"settings"}> | ||
| <SettingsSelect | ||
| label={"Filter"} | ||
| items={[ | ||
| { | ||
| text: "All", | ||
| icon: null, | ||
| onClick: () => setFilter("all"), | ||
| isSelected: filter === "all", | ||
| }, | ||
| { | ||
| text: "Named", | ||
| icon: null, | ||
| onClick: () => setFilter("named"), | ||
| isSelected: filter === "named", | ||
| }, | ||
| ]} | ||
| /> | ||
| </div> | ||
| <VersioningSidebar filter={filter} /> | ||
| {/* Filtering to named versions is built in — the sidebar's own header | ||
| toggle drives it. The header's close button calls `onClose`. */} | ||
| <VersioningSidebar onClose={onClose} /> | ||
| </div> | ||
| ); | ||
| }; |
Uh oh!
There was an error while loading. Please reload this page.