feat: add support for tldraw snapshot links (#6210)

This commit is contained in:
Pranav Joglekar authored and GitHub committed 2023-11-28 05:22:42 -08:00
1 parent 654e4c9ce6
commit a4341b0d89
2 files changed
+20 -1

No files matched your search

+17
View File
@@ -9,9 +9,26 @@ describe("Tldraw", () => {
).toBeTruthy();
});
test("to be enabled for snapshot link", () => {
expect(
"https://beta.tldraw.com/s/v2_c_r5WVtGaktE99D3wyFFsoL".match(match)
).toBeTruthy();
});
test("to be enabled for read only urls having v", () => {
expect(
"https://www.tldraw.com/v/-2VIEZVwrbtdNq0Pmfpf2?viewport=-608%2C-549%2C1998%2C1943&page=page%3AWd7DfjA-igxOMso931W_S".match(
match
)
).toBeTruthy();
});
test("to not be enabled elsewhere", () => {
expect("https://wwww.tldraw.com/r/c9d837d74182317".match(match)).toBe(null);
expect("https://wwwwtldraw.com/r/c9d837d74182317".match(match)).toBe(null);
expect("https://www.tldrawwcom/r/c9d837d74182317".match(match)).toBe(null);
expect(
"https://beta.tldraw.com/e/v2_c_r5WVtGaktE99D3wyFFsoL".match(match)
).toBe(null);
});
});
+3 -1
View File
@@ -14,6 +14,8 @@ function Tldraw(props: Props) {
);
}
Tldraw.ENABLED = [new RegExp("^https?://(beta|www|old)\\.tldraw\\.com/r/(.*)")];
Tldraw.ENABLED = [
new RegExp("^https?://(beta|www|old)\\.tldraw\\.com/[rsv]/(.*)"),
];
export default Tldraw;