@tldraw/editor 5.5.0-canary.e4dba4e76649 → 5.5.0-canary.ede4a53bffb0
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 +1 -1
- package/dist-cjs/lib/editor/Editor.js +25 -15
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/utils/sync/LocalIndexedDb.js +13 -17
- package/dist-cjs/lib/utils/sync/LocalIndexedDb.js.map +2 -2
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +78 -40
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +25 -15
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/utils/sync/LocalIndexedDb.mjs +13 -17
- package/dist-esm/lib/utils/sync/LocalIndexedDb.mjs.map +2 -2
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +78 -40
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/editor/Editor.ts +31 -15
- package/src/lib/utils/sync/LocalIndexedDb.test.ts +28 -0
- package/src/lib/utils/sync/LocalIndexedDb.ts +18 -20
- package/src/lib/utils/sync/TLLocalSyncClient.test.ts +236 -0
- package/src/lib/utils/sync/TLLocalSyncClient.ts +106 -54
- package/src/version.ts +3 -3
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.
|
|
395
|
+
"5.5.0-canary.ede4a53bffb0",
|
|
396
396
|
"cjs"
|
|
397
397
|
);
|
|
398
398
|
//# sourceMappingURL=index.js.map
|
|
@@ -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
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
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;
|