diff --git a/shared/editor/embeds/Tldraw.test.ts b/shared/editor/embeds/Tldraw.test.ts index ce0ca957a..8e0f59ae8 100644 --- a/shared/editor/embeds/Tldraw.test.ts +++ b/shared/editor/embeds/Tldraw.test.ts @@ -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); }); }); diff --git a/shared/editor/embeds/Tldraw.tsx b/shared/editor/embeds/Tldraw.tsx index 5554d8180..7d014e47d 100644 --- a/shared/editor/embeds/Tldraw.tsx +++ b/shared/editor/embeds/Tldraw.tsx @@ -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;