@tldraw/editor 5.6.0 → 5.7.0-canary.071f910ee80b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -760,6 +760,37 @@ describe('LicenseManager', () => {
760
760
  }
761
761
  })
762
762
 
763
+ it('Licenses our VS Code extension webview when no key is provided', async () => {
764
+ const manager = await createManagerOnHost(
765
+ 'vscode-webview://1ipd8pun8ud7nd7hv9d112g7evi7m10vak9vviuvia66ou6aibp3/index.html?id=6ec2dc7a-afe9-45d9-bd71-1749f9568d28&swVersion=4&extensionId=tldraw-org.tldraw-vscode&platform=electron'
766
+ )
767
+
768
+ expect(await manager.getLicenseFromKey('')).toMatchObject({
769
+ isLicenseParseable: true,
770
+ isDomainValid: true,
771
+ isLicensedWithWatermark: true,
772
+ })
773
+ expect(manager.state.get()).toBe('licensed-with-watermark')
774
+ manager.dispose()
775
+ })
776
+
777
+ it('Does not license other VS Code extension webviews', async () => {
778
+ const urls = [
779
+ 'vscode-webview://abc/index.html?extensionId=evil-org.evil-vscode&x=tldraw-org.tldraw-vscode',
780
+ 'vscode-webview://tldraw-org.tldraw-vscode/index.html?extensionId=evil-org.evil-vscode',
781
+ ]
782
+
783
+ for (const url of urls) {
784
+ const manager = await createManagerOnHost(url)
785
+
786
+ expect(await manager.getLicenseFromKey('')).toMatchObject({
787
+ isLicenseParseable: false,
788
+ reason: 'no-key-provided',
789
+ })
790
+ manager.dispose()
791
+ }
792
+ })
793
+
763
794
  it('Never sends a watermark tracking ping for our own domains', async () => {
764
795
  const manager = await createManagerOnHost('https://makereal.tldraw.com')
765
796
 
@@ -59,6 +59,9 @@ const CANONICAL_TLDRAW_HOSTS = [
59
59
  'tldraw.xyz',
60
60
  ]
61
61
 
62
+ /** Our VS Code extension, whose webviews are served from `vscode-webview:` with a random hostname. */
63
+ const CANONICAL_VSCODE_EXTENSION_ID = 'tldraw-org.tldraw-vscode'
64
+
62
65
  /** Marks a license as the keyless canonical-host grant, which is never tracked. */
63
66
  const CANONICAL_HOST_LICENSE_ID = 'tldraw-canonical-host'
64
67
 
@@ -237,8 +240,12 @@ export class LicenseManager {
237
240
  return host === 'localhost' || host === '::1' || /^127(?:\.\d{1,3}){3}$/.test(host)
238
241
  }
239
242
 
240
- /** Whether the page is served from one of tldraw's own domains, or a subdomain of one. */
243
+ /** Whether the page is served from one of tldraw's own domains, a subdomain of one, or our VS Code extension. */
241
244
  private isCanonicalTldrawHost() {
245
+ if (window.location.protocol === 'vscode-webview:') {
246
+ const extensionId = new URL(window.location.href).searchParams.get('extensionId')
247
+ return extensionId === CANONICAL_VSCODE_EXTENSION_ID
248
+ }
242
249
  const hostname = window.location.hostname.toLowerCase()
243
250
  return CANONICAL_TLDRAW_HOSTS.some((host) => hostname === host || hostname.endsWith(`.${host}`))
244
251
  }
package/src/version.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // This file is automatically generated by internal/scripts/refresh-assets.ts.
2
2
  // Do not edit manually. Or do, I'm a comment, not a cop.
3
3
 
4
- export const version = '5.6.0'
4
+ export const version = '5.7.0-canary.071f910ee80b'
5
5
  export const publishDates = {
6
6
  major: '2026-05-06T16:28:18.473Z',
7
- minor: '2026-10-28T14:20:57.238Z',
8
- patch: '2026-10-28T14:20:57.238Z',
7
+ minor: '2026-11-03T19:11:29.223Z',
8
+ patch: '2026-11-03T19:11:29.223Z',
9
9
  }