@tldraw/editor 4.2.0-canary.2bb634d0af63 → 4.2.0-canary.2d743164f8d3

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.
Files changed (37) hide show
  1. package/dist-cjs/index.d.ts +16 -3
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +11 -11
  4. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  5. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  6. package/dist-cjs/lib/license/LicenseManager.js +1 -0
  7. package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
  8. package/dist-cjs/lib/license/Watermark.js +8 -2
  9. package/dist-cjs/lib/license/Watermark.js.map +2 -2
  10. package/dist-cjs/lib/utils/runtime.js +2 -2
  11. package/dist-cjs/lib/utils/runtime.js.map +2 -2
  12. package/dist-cjs/lib/utils/window-open.js +2 -2
  13. package/dist-cjs/lib/utils/window-open.js.map +2 -2
  14. package/dist-cjs/version.js +3 -3
  15. package/dist-cjs/version.js.map +1 -1
  16. package/dist-esm/index.d.mts +16 -3
  17. package/dist-esm/index.mjs +1 -1
  18. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +11 -11
  19. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  20. package/dist-esm/lib/license/LicenseManager.mjs +1 -0
  21. package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
  22. package/dist-esm/lib/license/Watermark.mjs +8 -2
  23. package/dist-esm/lib/license/Watermark.mjs.map +2 -2
  24. package/dist-esm/lib/utils/runtime.mjs +2 -2
  25. package/dist-esm/lib/utils/runtime.mjs.map +2 -2
  26. package/dist-esm/lib/utils/window-open.mjs +2 -2
  27. package/dist-esm/lib/utils/window-open.mjs.map +2 -2
  28. package/dist-esm/version.mjs +3 -3
  29. package/dist-esm/version.mjs.map +1 -1
  30. package/package.json +7 -7
  31. package/src/lib/components/default-components/DefaultCanvas.tsx +9 -9
  32. package/src/lib/editor/types/emit-types.ts +1 -0
  33. package/src/lib/license/LicenseManager.ts +1 -0
  34. package/src/lib/license/Watermark.tsx +8 -2
  35. package/src/lib/utils/runtime.ts +3 -3
  36. package/src/lib/utils/window-open.ts +13 -3
  37. package/src/version.ts +3 -3
@@ -172,17 +172,17 @@ export function DefaultCanvas({ className }: TLCanvasComponentProps) {
172
172
  <LiveCollaborators />
173
173
  </div>
174
174
  </div>
175
- <div
176
- className="tl-canvas__in-front"
177
- onPointerDown={editor.markEventAsHandled}
178
- onPointerUp={editor.markEventAsHandled}
179
- onTouchStart={editor.markEventAsHandled}
180
- onTouchEnd={editor.markEventAsHandled}
181
- >
182
- <InFrontOfTheCanvasWrapper />
183
- </div>
184
175
  <MovingCameraHitTestBlocker />
185
176
  </div>
177
+ <div
178
+ className="tl-canvas__in-front"
179
+ onPointerDown={editor.markEventAsHandled}
180
+ onPointerUp={editor.markEventAsHandled}
181
+ onTouchStart={editor.markEventAsHandled}
182
+ onTouchEnd={editor.markEventAsHandled}
183
+ >
184
+ <InFrontOfTheCanvasWrapper />
185
+ </div>
186
186
  <MenuClickCapture />
187
187
  </>
188
188
  )
@@ -22,6 +22,7 @@ export interface TLEventMap {
22
22
  'edited-shapes': [TLRecord[]]
23
23
  'deleted-shapes': [TLShapeId[]]
24
24
  edit: []
25
+ 'click-watermark': [{ url: string }]
25
26
  }
26
27
 
27
28
  /** @public */
@@ -180,6 +180,7 @@ export class LicenseManager {
180
180
  : 'unknown'
181
181
  url.searchParams.set('sku', sku)
182
182
  }
183
+ url.searchParams.set('url', window.location.href)
183
184
  if (process.env.NODE_ENV) {
184
185
  url.searchParams.set('environment', process.env.NODE_ENV)
185
186
  }
@@ -70,7 +70,10 @@ const UnlicensedWatermark = memo(function UnlicensedWatermark({
70
70
  preventDefault(e)
71
71
  }}
72
72
  title="The tldraw SDK requires a license key to work in production. You can get a free 100-day trial license at tldraw.dev/pricing."
73
- onClick={() => runtime.openWindow(url, '_blank')}
73
+ onClick={() => {
74
+ editor.emit('click-watermark', { url })
75
+ runtime.openWindow(url, '_blank', true)
76
+ }} // allow referrer
74
77
  >
75
78
  Get a license for production
76
79
  </button>
@@ -120,7 +123,10 @@ const WatermarkInner = memo(function WatermarkInner({
120
123
  preventDefault(e)
121
124
  }}
122
125
  title="Build infinite canvas applications with the tldraw SDK. Learn more at https://tldraw.dev."
123
- onClick={() => runtime.openWindow(url, '_blank')}
126
+ onClick={() => {
127
+ editor.emit('click-watermark', { url })
128
+ runtime.openWindow(url, '_blank')
129
+ }}
124
130
  style={{ mask: maskCss, WebkitMask: maskCss }}
125
131
  />
126
132
  </div>
@@ -1,11 +1,11 @@
1
1
  /** @public */
2
2
  export const runtime: {
3
- openWindow(url: string, target: string): void
3
+ openWindow(url: string, target: string, allowReferrer?: boolean): void
4
4
  refreshPage(): void
5
5
  hardReset(): void
6
6
  } = {
7
- openWindow(url, target) {
8
- window.open(url, target, 'noopener noreferrer')
7
+ openWindow(url, target, allowReferrer = false) {
8
+ return window.open(url, target, allowReferrer ? 'noopener' : 'noopener noreferrer')
9
9
  },
10
10
  refreshPage() {
11
11
  window.location.reload()
@@ -1,6 +1,16 @@
1
1
  import { runtime } from './runtime'
2
2
 
3
- /** @public */
4
- export function openWindow(url: string, target = '_blank') {
5
- runtime.openWindow(url, target)
3
+ /**
4
+ * Open a new window with the given URL and target. Prefer this to the window.open function, as it
5
+ * will work more reliably in embedded scenarios, such as our VS Code extension. See the runtime
6
+ * object in tldraw/editor for more details.
7
+ *
8
+ * @param url - The URL to open.
9
+ * @param target - The target window to open the URL in.
10
+ * @param allowReferrer - Whether to allow the referrer to be sent to the new window.
11
+ * @returns The new window object.
12
+ * @public
13
+ */
14
+ export function openWindow(url: string, target = '_blank', allowReferrer?: boolean) {
15
+ return runtime.openWindow(url, target, allowReferrer)
6
16
  }
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 = '4.2.0-canary.2bb634d0af63'
4
+ export const version = '4.2.0-canary.2d743164f8d3'
5
5
  export const publishDates = {
6
6
  major: '2025-09-18T14:39:22.803Z',
7
- minor: '2025-10-21T13:14:44.760Z',
8
- patch: '2025-10-21T13:14:44.760Z',
7
+ minor: '2025-11-10T17:19:29.058Z',
8
+ patch: '2025-11-10T17:19:29.058Z',
9
9
  }