@tldraw/editor 5.5.0-canary.efd2cd7e73e0 → 5.5.0-canary.f35842e3ba7e

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.
package/dist-cjs/index.js CHANGED
@@ -392,7 +392,7 @@ var import_uniq = require("./lib/utils/uniq");
392
392
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
393
393
  (0, import_utils.registerTldrawLibraryVersion)(
394
394
  "@tldraw/editor",
395
- "5.5.0-canary.efd2cd7e73e0",
395
+ "5.5.0-canary.f35842e3ba7e",
396
396
  "cjs"
397
397
  );
398
398
  //# sourceMappingURL=index.js.map
@@ -2501,7 +2501,7 @@ class Editor extends import_eventemitter3.default {
2501
2501
  setCamera(point, opts) {
2502
2502
  const { isLocked } = this._cameraOptions.__unsafe__getWithoutCapture();
2503
2503
  if (isLocked && !opts?.force) return this;
2504
- const _point = import_Vec.Vec.Cast(point);
2504
+ const _point = new import_Vec.Vec(point.x, point.y, point.z ?? this.getZoomLevel());
2505
2505
  if (!Number.isFinite(_point.x) || !Number.isFinite(_point.y) || !Number.isFinite(_point.z)) {
2506
2506
  throw Error(
2507
2507
  `Editor.setCamera: expected finite values, got (${_point.x}, ${_point.y}, ${_point.z}).`
@@ -3755,7 +3755,9 @@ class Editor extends import_eventemitter3.default {
3755
3755
  if (ids.length <= 0) return this;
3756
3756
  this.run(
3757
3757
  () => {
3758
- this.store.props.assets.remove?.(ids);
3758
+ Promise.resolve(this.store.props.assets.remove?.(ids)).catch(
3759
+ (err) => console.error("Error while removing assets from the asset store:", err)
3760
+ );
3759
3761
  this.store.remove(ids);
3760
3762
  },
3761
3763
  { history: "ignore" }
@@ -6939,21 +6941,29 @@ class Editor extends import_eventemitter3.default {
6939
6941
  await Promise.allSettled(
6940
6942
  content.assets.map(async (asset) => {
6941
6943
  if ((asset.type === "image" || asset.type === "video") && !asset.props.src?.startsWith("data:image") && !asset.props.src?.startsWith("data:video") && !asset.props.src?.startsWith("http")) {
6942
- const assetWithDataUrl = (0, import_utils.structuredClone)(asset);
6943
- const objectUrl = await this.store.props.assets.resolve(asset, {
6944
- screenScale: 1,
6945
- steppedScreenScale: 1,
6946
- dpr: 1,
6947
- networkEffectiveType: null,
6948
- shouldResolveToOriginal: true
6949
- });
6950
- assetWithDataUrl.props.src = await import_utils.FileHelpers.blobToDataUrl(
6951
- await (0, import_utils.fetch)(objectUrl).then((r) => r.blob())
6952
- );
6953
- assets.push(assetWithDataUrl);
6954
- } else {
6955
- assets.push(asset);
6944
+ try {
6945
+ const objectUrl = await this.store.props.assets.resolve(asset, {
6946
+ screenScale: 1,
6947
+ steppedScreenScale: 1,
6948
+ dpr: 1,
6949
+ networkEffectiveType: null,
6950
+ shouldResolveToOriginal: true
6951
+ });
6952
+ if (objectUrl) {
6953
+ const response = await (0, import_utils.fetch)(objectUrl);
6954
+ if (response.ok) {
6955
+ const assetWithDataUrl = (0, import_utils.structuredClone)(asset);
6956
+ assetWithDataUrl.props.src = await import_utils.FileHelpers.blobToDataUrl(await response.blob());
6957
+ assets.push(assetWithDataUrl);
6958
+ return;
6959
+ }
6960
+ console.warn(`Could not inline asset ${asset.id}: fetch returned ${response.status}`);
6961
+ }
6962
+ } catch (err) {
6963
+ console.warn(`Could not inline asset ${asset.id}`, err);
6964
+ }
6956
6965
  }
6966
+ assets.push(asset);
6957
6967
  })
6958
6968
  );
6959
6969
  content.assets = assets;