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

This commit is contained in:
Pranav Joglekar
2023-11-28 18:52:42 +05:30
committed by GitHub
parent 654e4c9ce6
commit a4341b0d89
2 changed files with 20 additions and 1 deletions

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);
});
});

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;