microboard-temp 0.5.124 → 0.5.125
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/browser.js +9 -58
- package/dist/cjs/index.js +9 -58
- package/dist/cjs/node.js +9 -58
- package/dist/esm/browser.js +9 -58
- package/dist/esm/index.js +9 -58
- package/dist/esm/node.js +9 -58
- package/dist/types/Items/Audio/AudioHelpers.d.ts +1 -2
- package/dist/types/Items/Image/ImageHelpers.d.ts +1 -2
- package/dist/types/Items/Video/VideoHelpers.d.ts +1 -2
- package/dist/types/api/MediaHelpers.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -629,8 +629,6 @@ __export(exports_browser, {
|
|
|
629
629
|
viewModeHotkeyRegistry: () => viewModeHotkeyRegistry,
|
|
630
630
|
validateRichTextData: () => validateRichTextData,
|
|
631
631
|
validateItemsMap: () => validateItemsMap,
|
|
632
|
-
uploadVideoToStorage: () => uploadVideoToStorage,
|
|
633
|
-
uploadToTheStorage: () => uploadToTheStorage,
|
|
634
632
|
updateRects: () => updateRects,
|
|
635
633
|
translateElementBy: () => translateElementBy,
|
|
636
634
|
transformHtmlOrTextToMarkdown: () => transformHtmlOrTextToMarkdown,
|
|
@@ -40923,12 +40921,12 @@ var uploadWithPresignedUrl = async (blob, accessToken, boardId, type, baseUrl) =
|
|
|
40923
40921
|
}
|
|
40924
40922
|
return url;
|
|
40925
40923
|
};
|
|
40926
|
-
var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
|
|
40924
|
+
var uploadMediaToStorage = async (blob, accessToken, boardId, type, baseUrl) => {
|
|
40927
40925
|
try {
|
|
40928
40926
|
if (blob.type === "image/svg+xml") {
|
|
40929
|
-
return await uploadSvgDirectly(blob, accessToken, boardId);
|
|
40927
|
+
return await uploadSvgDirectly(blob, accessToken, boardId, baseUrl);
|
|
40930
40928
|
} else {
|
|
40931
|
-
return await uploadWithPresignedUrl(blob, accessToken, boardId, type);
|
|
40929
|
+
return await uploadWithPresignedUrl(blob, accessToken, boardId, type, baseUrl);
|
|
40932
40930
|
}
|
|
40933
40931
|
} catch (error) {
|
|
40934
40932
|
console.error("Media upload process error:", error);
|
|
@@ -41403,30 +41401,6 @@ async function fileTosha256(file) {
|
|
|
41403
41401
|
}
|
|
41404
41402
|
|
|
41405
41403
|
// src/Items/Image/ImageHelpers.ts
|
|
41406
|
-
var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
|
|
41407
|
-
return new Promise((resolve2, reject) => {
|
|
41408
|
-
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
41409
|
-
fetch(`${window?.location.origin}/api/v1/media/image/${boardId}`, {
|
|
41410
|
-
method: "POST",
|
|
41411
|
-
headers: {
|
|
41412
|
-
"Content-Type": mimeType,
|
|
41413
|
-
"X-Image-Id": hash,
|
|
41414
|
-
Authorization: `Bearer ${accessToken}`
|
|
41415
|
-
},
|
|
41416
|
-
body: blob
|
|
41417
|
-
}).then(async (response) => {
|
|
41418
|
-
if (response.status !== 200) {
|
|
41419
|
-
return conf.hooks.onUploadMediaError(response, "image");
|
|
41420
|
-
}
|
|
41421
|
-
return response.json();
|
|
41422
|
-
}).then((data) => {
|
|
41423
|
-
resolve2(data.src);
|
|
41424
|
-
}).catch((error) => {
|
|
41425
|
-
console.error("Media storage error:", error);
|
|
41426
|
-
reject(error);
|
|
41427
|
-
});
|
|
41428
|
-
});
|
|
41429
|
-
};
|
|
41430
41404
|
var getBlobFromDataURL = (dataURL) => {
|
|
41431
41405
|
const base64String = dataURL.split(",")[1];
|
|
41432
41406
|
const mimeType = dataURL.split(",")[0].split(":")[1].split(";")[0];
|
|
@@ -41501,9 +41475,9 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
41501
41475
|
}
|
|
41502
41476
|
});
|
|
41503
41477
|
};
|
|
41504
|
-
var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
41478
|
+
var prepareImage = (inp, accessToken, boardId, baseUrl) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
41505
41479
|
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
41506
|
-
return uploadMediaToStorage(blob, accessToken, boardId, "image").then((src) => {
|
|
41480
|
+
return uploadMediaToStorage(blob, accessToken, boardId, "image", baseUrl).then((src) => {
|
|
41507
41481
|
return {
|
|
41508
41482
|
imageDimension: { width: width2, height: height2 },
|
|
41509
41483
|
base64: dataURL,
|
|
@@ -41513,29 +41487,6 @@ var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).the
|
|
|
41513
41487
|
});
|
|
41514
41488
|
|
|
41515
41489
|
// src/Items/Video/VideoHelpers.ts
|
|
41516
|
-
var uploadVideoToStorage = async (hash, videoBlob, accessToken, boardId, baseUrl) => {
|
|
41517
|
-
return new Promise((resolve2, reject) => {
|
|
41518
|
-
fetch(`${window.location.origin}/api/v1/media/video/${boardId}`, {
|
|
41519
|
-
method: "POST",
|
|
41520
|
-
headers: {
|
|
41521
|
-
"Content-Type": videoBlob.type,
|
|
41522
|
-
"x-video-id": hash,
|
|
41523
|
-
Authorization: `Bearer ${accessToken}`
|
|
41524
|
-
},
|
|
41525
|
-
body: videoBlob
|
|
41526
|
-
}).then(async (response) => {
|
|
41527
|
-
if (response.status !== 200) {
|
|
41528
|
-
return conf.hooks.onUploadMediaError(response, "video");
|
|
41529
|
-
}
|
|
41530
|
-
return response.json();
|
|
41531
|
-
}).then((data) => {
|
|
41532
|
-
resolve2(data.src);
|
|
41533
|
-
}).catch((error) => {
|
|
41534
|
-
console.error("Media storage error:", error);
|
|
41535
|
-
reject(error);
|
|
41536
|
-
});
|
|
41537
|
-
});
|
|
41538
|
-
};
|
|
41539
41490
|
var getVideoMetadata = (file) => {
|
|
41540
41491
|
return new Promise((resolve2, reject) => {
|
|
41541
41492
|
const video = document.createElement("video");
|
|
@@ -41565,7 +41516,7 @@ var createVideoItem = (board, extension2, videoData, onLoadCb) => {
|
|
|
41565
41516
|
onLoadCb(boardVideo);
|
|
41566
41517
|
});
|
|
41567
41518
|
};
|
|
41568
|
-
var prepareVideo = (file, accessToken, boardId) => {
|
|
41519
|
+
var prepareVideo = (file, accessToken, boardId, baseUrl) => {
|
|
41569
41520
|
return new Promise((resolve2, reject) => {
|
|
41570
41521
|
const video = document.createElement("video");
|
|
41571
41522
|
video.src = URL.createObjectURL(file);
|
|
@@ -41573,7 +41524,7 @@ var prepareVideo = (file, accessToken, boardId) => {
|
|
|
41573
41524
|
video.onseeked = () => {
|
|
41574
41525
|
video.onseeked = null;
|
|
41575
41526
|
prepareImage(captureFrame(0.1, video)?.src, accessToken, boardId).then((imageData) => {
|
|
41576
|
-
uploadMediaToStorage(file, accessToken, boardId, "video").then((url) => {
|
|
41527
|
+
uploadMediaToStorage(file, accessToken, boardId, "video", baseUrl).then((url) => {
|
|
41577
41528
|
resolve2({
|
|
41578
41529
|
url,
|
|
41579
41530
|
previewUrl: imageData.storageLink
|
|
@@ -41871,12 +41822,12 @@ class AudioItem extends BaseItem {
|
|
|
41871
41822
|
}
|
|
41872
41823
|
}
|
|
41873
41824
|
// src/Items/Audio/AudioHelpers.ts
|
|
41874
|
-
var prepareAudio = (file, accessToken, boardId) => {
|
|
41825
|
+
var prepareAudio = (file, accessToken, boardId, baseUrl) => {
|
|
41875
41826
|
return new Promise((resolve2, reject) => {
|
|
41876
41827
|
const audio = document.createElement("audio");
|
|
41877
41828
|
audio.src = URL.createObjectURL(file);
|
|
41878
41829
|
audio.onloadedmetadata = () => {
|
|
41879
|
-
uploadMediaToStorage(file, accessToken, boardId, "audio").then((url) => {
|
|
41830
|
+
uploadMediaToStorage(file, accessToken, boardId, "audio", baseUrl).then((url) => {
|
|
41880
41831
|
resolve2(url);
|
|
41881
41832
|
}).catch(reject);
|
|
41882
41833
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -629,8 +629,6 @@ __export(exports_src, {
|
|
|
629
629
|
viewModeHotkeyRegistry: () => viewModeHotkeyRegistry,
|
|
630
630
|
validateRichTextData: () => validateRichTextData,
|
|
631
631
|
validateItemsMap: () => validateItemsMap,
|
|
632
|
-
uploadVideoToStorage: () => uploadVideoToStorage,
|
|
633
|
-
uploadToTheStorage: () => uploadToTheStorage,
|
|
634
632
|
updateRects: () => updateRects,
|
|
635
633
|
translateElementBy: () => translateElementBy,
|
|
636
634
|
transformHtmlOrTextToMarkdown: () => transformHtmlOrTextToMarkdown,
|
|
@@ -40923,12 +40921,12 @@ var uploadWithPresignedUrl = async (blob, accessToken, boardId, type, baseUrl) =
|
|
|
40923
40921
|
}
|
|
40924
40922
|
return url;
|
|
40925
40923
|
};
|
|
40926
|
-
var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
|
|
40924
|
+
var uploadMediaToStorage = async (blob, accessToken, boardId, type, baseUrl) => {
|
|
40927
40925
|
try {
|
|
40928
40926
|
if (blob.type === "image/svg+xml") {
|
|
40929
|
-
return await uploadSvgDirectly(blob, accessToken, boardId);
|
|
40927
|
+
return await uploadSvgDirectly(blob, accessToken, boardId, baseUrl);
|
|
40930
40928
|
} else {
|
|
40931
|
-
return await uploadWithPresignedUrl(blob, accessToken, boardId, type);
|
|
40929
|
+
return await uploadWithPresignedUrl(blob, accessToken, boardId, type, baseUrl);
|
|
40932
40930
|
}
|
|
40933
40931
|
} catch (error) {
|
|
40934
40932
|
console.error("Media upload process error:", error);
|
|
@@ -41403,30 +41401,6 @@ async function fileTosha256(file) {
|
|
|
41403
41401
|
}
|
|
41404
41402
|
|
|
41405
41403
|
// src/Items/Image/ImageHelpers.ts
|
|
41406
|
-
var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
|
|
41407
|
-
return new Promise((resolve2, reject) => {
|
|
41408
|
-
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
41409
|
-
fetch(`${window?.location.origin}/api/v1/media/image/${boardId}`, {
|
|
41410
|
-
method: "POST",
|
|
41411
|
-
headers: {
|
|
41412
|
-
"Content-Type": mimeType,
|
|
41413
|
-
"X-Image-Id": hash,
|
|
41414
|
-
Authorization: `Bearer ${accessToken}`
|
|
41415
|
-
},
|
|
41416
|
-
body: blob
|
|
41417
|
-
}).then(async (response) => {
|
|
41418
|
-
if (response.status !== 200) {
|
|
41419
|
-
return conf.hooks.onUploadMediaError(response, "image");
|
|
41420
|
-
}
|
|
41421
|
-
return response.json();
|
|
41422
|
-
}).then((data) => {
|
|
41423
|
-
resolve2(data.src);
|
|
41424
|
-
}).catch((error) => {
|
|
41425
|
-
console.error("Media storage error:", error);
|
|
41426
|
-
reject(error);
|
|
41427
|
-
});
|
|
41428
|
-
});
|
|
41429
|
-
};
|
|
41430
41404
|
var getBlobFromDataURL = (dataURL) => {
|
|
41431
41405
|
const base64String = dataURL.split(",")[1];
|
|
41432
41406
|
const mimeType = dataURL.split(",")[0].split(":")[1].split(";")[0];
|
|
@@ -41501,9 +41475,9 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
41501
41475
|
}
|
|
41502
41476
|
});
|
|
41503
41477
|
};
|
|
41504
|
-
var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
41478
|
+
var prepareImage = (inp, accessToken, boardId, baseUrl) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
41505
41479
|
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
41506
|
-
return uploadMediaToStorage(blob, accessToken, boardId, "image").then((src) => {
|
|
41480
|
+
return uploadMediaToStorage(blob, accessToken, boardId, "image", baseUrl).then((src) => {
|
|
41507
41481
|
return {
|
|
41508
41482
|
imageDimension: { width: width2, height: height2 },
|
|
41509
41483
|
base64: dataURL,
|
|
@@ -41513,29 +41487,6 @@ var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).the
|
|
|
41513
41487
|
});
|
|
41514
41488
|
|
|
41515
41489
|
// src/Items/Video/VideoHelpers.ts
|
|
41516
|
-
var uploadVideoToStorage = async (hash, videoBlob, accessToken, boardId, baseUrl) => {
|
|
41517
|
-
return new Promise((resolve2, reject) => {
|
|
41518
|
-
fetch(`${window.location.origin}/api/v1/media/video/${boardId}`, {
|
|
41519
|
-
method: "POST",
|
|
41520
|
-
headers: {
|
|
41521
|
-
"Content-Type": videoBlob.type,
|
|
41522
|
-
"x-video-id": hash,
|
|
41523
|
-
Authorization: `Bearer ${accessToken}`
|
|
41524
|
-
},
|
|
41525
|
-
body: videoBlob
|
|
41526
|
-
}).then(async (response) => {
|
|
41527
|
-
if (response.status !== 200) {
|
|
41528
|
-
return conf.hooks.onUploadMediaError(response, "video");
|
|
41529
|
-
}
|
|
41530
|
-
return response.json();
|
|
41531
|
-
}).then((data) => {
|
|
41532
|
-
resolve2(data.src);
|
|
41533
|
-
}).catch((error) => {
|
|
41534
|
-
console.error("Media storage error:", error);
|
|
41535
|
-
reject(error);
|
|
41536
|
-
});
|
|
41537
|
-
});
|
|
41538
|
-
};
|
|
41539
41490
|
var getVideoMetadata = (file) => {
|
|
41540
41491
|
return new Promise((resolve2, reject) => {
|
|
41541
41492
|
const video = document.createElement("video");
|
|
@@ -41565,7 +41516,7 @@ var createVideoItem = (board, extension2, videoData, onLoadCb) => {
|
|
|
41565
41516
|
onLoadCb(boardVideo);
|
|
41566
41517
|
});
|
|
41567
41518
|
};
|
|
41568
|
-
var prepareVideo = (file, accessToken, boardId) => {
|
|
41519
|
+
var prepareVideo = (file, accessToken, boardId, baseUrl) => {
|
|
41569
41520
|
return new Promise((resolve2, reject) => {
|
|
41570
41521
|
const video = document.createElement("video");
|
|
41571
41522
|
video.src = URL.createObjectURL(file);
|
|
@@ -41573,7 +41524,7 @@ var prepareVideo = (file, accessToken, boardId) => {
|
|
|
41573
41524
|
video.onseeked = () => {
|
|
41574
41525
|
video.onseeked = null;
|
|
41575
41526
|
prepareImage(captureFrame(0.1, video)?.src, accessToken, boardId).then((imageData) => {
|
|
41576
|
-
uploadMediaToStorage(file, accessToken, boardId, "video").then((url) => {
|
|
41527
|
+
uploadMediaToStorage(file, accessToken, boardId, "video", baseUrl).then((url) => {
|
|
41577
41528
|
resolve2({
|
|
41578
41529
|
url,
|
|
41579
41530
|
previewUrl: imageData.storageLink
|
|
@@ -41871,12 +41822,12 @@ class AudioItem extends BaseItem {
|
|
|
41871
41822
|
}
|
|
41872
41823
|
}
|
|
41873
41824
|
// src/Items/Audio/AudioHelpers.ts
|
|
41874
|
-
var prepareAudio = (file, accessToken, boardId) => {
|
|
41825
|
+
var prepareAudio = (file, accessToken, boardId, baseUrl) => {
|
|
41875
41826
|
return new Promise((resolve2, reject) => {
|
|
41876
41827
|
const audio = document.createElement("audio");
|
|
41877
41828
|
audio.src = URL.createObjectURL(file);
|
|
41878
41829
|
audio.onloadedmetadata = () => {
|
|
41879
|
-
uploadMediaToStorage(file, accessToken, boardId, "audio").then((url) => {
|
|
41830
|
+
uploadMediaToStorage(file, accessToken, boardId, "audio", baseUrl).then((url) => {
|
|
41880
41831
|
resolve2(url);
|
|
41881
41832
|
}).catch(reject);
|
|
41882
41833
|
};
|
package/dist/cjs/node.js
CHANGED
|
@@ -1666,8 +1666,6 @@ __export(exports_node, {
|
|
|
1666
1666
|
viewModeHotkeyRegistry: () => viewModeHotkeyRegistry,
|
|
1667
1667
|
validateRichTextData: () => validateRichTextData,
|
|
1668
1668
|
validateItemsMap: () => validateItemsMap,
|
|
1669
|
-
uploadVideoToStorage: () => uploadVideoToStorage,
|
|
1670
|
-
uploadToTheStorage: () => uploadToTheStorage,
|
|
1671
1669
|
updateRects: () => updateRects,
|
|
1672
1670
|
translateElementBy: () => translateElementBy,
|
|
1673
1671
|
transformHtmlOrTextToMarkdown: () => transformHtmlOrTextToMarkdown,
|
|
@@ -43396,12 +43394,12 @@ var uploadWithPresignedUrl = async (blob, accessToken, boardId, type, baseUrl) =
|
|
|
43396
43394
|
}
|
|
43397
43395
|
return url;
|
|
43398
43396
|
};
|
|
43399
|
-
var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
|
|
43397
|
+
var uploadMediaToStorage = async (blob, accessToken, boardId, type, baseUrl) => {
|
|
43400
43398
|
try {
|
|
43401
43399
|
if (blob.type === "image/svg+xml") {
|
|
43402
|
-
return await uploadSvgDirectly(blob, accessToken, boardId);
|
|
43400
|
+
return await uploadSvgDirectly(blob, accessToken, boardId, baseUrl);
|
|
43403
43401
|
} else {
|
|
43404
|
-
return await uploadWithPresignedUrl(blob, accessToken, boardId, type);
|
|
43402
|
+
return await uploadWithPresignedUrl(blob, accessToken, boardId, type, baseUrl);
|
|
43405
43403
|
}
|
|
43406
43404
|
} catch (error) {
|
|
43407
43405
|
console.error("Media upload process error:", error);
|
|
@@ -43876,30 +43874,6 @@ async function fileTosha256(file) {
|
|
|
43876
43874
|
}
|
|
43877
43875
|
|
|
43878
43876
|
// src/Items/Image/ImageHelpers.ts
|
|
43879
|
-
var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
|
|
43880
|
-
return new Promise((resolve2, reject) => {
|
|
43881
|
-
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
43882
|
-
fetch(`${window?.location.origin}/api/v1/media/image/${boardId}`, {
|
|
43883
|
-
method: "POST",
|
|
43884
|
-
headers: {
|
|
43885
|
-
"Content-Type": mimeType,
|
|
43886
|
-
"X-Image-Id": hash,
|
|
43887
|
-
Authorization: `Bearer ${accessToken}`
|
|
43888
|
-
},
|
|
43889
|
-
body: blob
|
|
43890
|
-
}).then(async (response) => {
|
|
43891
|
-
if (response.status !== 200) {
|
|
43892
|
-
return conf.hooks.onUploadMediaError(response, "image");
|
|
43893
|
-
}
|
|
43894
|
-
return response.json();
|
|
43895
|
-
}).then((data) => {
|
|
43896
|
-
resolve2(data.src);
|
|
43897
|
-
}).catch((error) => {
|
|
43898
|
-
console.error("Media storage error:", error);
|
|
43899
|
-
reject(error);
|
|
43900
|
-
});
|
|
43901
|
-
});
|
|
43902
|
-
};
|
|
43903
43877
|
var getBlobFromDataURL = (dataURL) => {
|
|
43904
43878
|
const base64String = dataURL.split(",")[1];
|
|
43905
43879
|
const mimeType = dataURL.split(",")[0].split(":")[1].split(";")[0];
|
|
@@ -43974,9 +43948,9 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
43974
43948
|
}
|
|
43975
43949
|
});
|
|
43976
43950
|
};
|
|
43977
|
-
var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
43951
|
+
var prepareImage = (inp, accessToken, boardId, baseUrl) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
43978
43952
|
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
43979
|
-
return uploadMediaToStorage(blob, accessToken, boardId, "image").then((src) => {
|
|
43953
|
+
return uploadMediaToStorage(blob, accessToken, boardId, "image", baseUrl).then((src) => {
|
|
43980
43954
|
return {
|
|
43981
43955
|
imageDimension: { width: width2, height: height2 },
|
|
43982
43956
|
base64: dataURL,
|
|
@@ -43986,29 +43960,6 @@ var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).the
|
|
|
43986
43960
|
});
|
|
43987
43961
|
|
|
43988
43962
|
// src/Items/Video/VideoHelpers.ts
|
|
43989
|
-
var uploadVideoToStorage = async (hash, videoBlob, accessToken, boardId, baseUrl) => {
|
|
43990
|
-
return new Promise((resolve2, reject) => {
|
|
43991
|
-
fetch(`${window.location.origin}/api/v1/media/video/${boardId}`, {
|
|
43992
|
-
method: "POST",
|
|
43993
|
-
headers: {
|
|
43994
|
-
"Content-Type": videoBlob.type,
|
|
43995
|
-
"x-video-id": hash,
|
|
43996
|
-
Authorization: `Bearer ${accessToken}`
|
|
43997
|
-
},
|
|
43998
|
-
body: videoBlob
|
|
43999
|
-
}).then(async (response) => {
|
|
44000
|
-
if (response.status !== 200) {
|
|
44001
|
-
return conf.hooks.onUploadMediaError(response, "video");
|
|
44002
|
-
}
|
|
44003
|
-
return response.json();
|
|
44004
|
-
}).then((data) => {
|
|
44005
|
-
resolve2(data.src);
|
|
44006
|
-
}).catch((error) => {
|
|
44007
|
-
console.error("Media storage error:", error);
|
|
44008
|
-
reject(error);
|
|
44009
|
-
});
|
|
44010
|
-
});
|
|
44011
|
-
};
|
|
44012
43963
|
var getVideoMetadata = (file) => {
|
|
44013
43964
|
return new Promise((resolve2, reject) => {
|
|
44014
43965
|
const video = document.createElement("video");
|
|
@@ -44038,7 +43989,7 @@ var createVideoItem = (board, extension2, videoData, onLoadCb) => {
|
|
|
44038
43989
|
onLoadCb(boardVideo);
|
|
44039
43990
|
});
|
|
44040
43991
|
};
|
|
44041
|
-
var prepareVideo = (file, accessToken, boardId) => {
|
|
43992
|
+
var prepareVideo = (file, accessToken, boardId, baseUrl) => {
|
|
44042
43993
|
return new Promise((resolve2, reject) => {
|
|
44043
43994
|
const video = document.createElement("video");
|
|
44044
43995
|
video.src = URL.createObjectURL(file);
|
|
@@ -44046,7 +43997,7 @@ var prepareVideo = (file, accessToken, boardId) => {
|
|
|
44046
43997
|
video.onseeked = () => {
|
|
44047
43998
|
video.onseeked = null;
|
|
44048
43999
|
prepareImage(captureFrame(0.1, video)?.src, accessToken, boardId).then((imageData) => {
|
|
44049
|
-
uploadMediaToStorage(file, accessToken, boardId, "video").then((url) => {
|
|
44000
|
+
uploadMediaToStorage(file, accessToken, boardId, "video", baseUrl).then((url) => {
|
|
44050
44001
|
resolve2({
|
|
44051
44002
|
url,
|
|
44052
44003
|
previewUrl: imageData.storageLink
|
|
@@ -44344,12 +44295,12 @@ class AudioItem extends BaseItem {
|
|
|
44344
44295
|
}
|
|
44345
44296
|
}
|
|
44346
44297
|
// src/Items/Audio/AudioHelpers.ts
|
|
44347
|
-
var prepareAudio = (file, accessToken, boardId) => {
|
|
44298
|
+
var prepareAudio = (file, accessToken, boardId, baseUrl) => {
|
|
44348
44299
|
return new Promise((resolve2, reject) => {
|
|
44349
44300
|
const audio = document.createElement("audio");
|
|
44350
44301
|
audio.src = URL.createObjectURL(file);
|
|
44351
44302
|
audio.onloadedmetadata = () => {
|
|
44352
|
-
uploadMediaToStorage(file, accessToken, boardId, "audio").then((url) => {
|
|
44303
|
+
uploadMediaToStorage(file, accessToken, boardId, "audio", baseUrl).then((url) => {
|
|
44353
44304
|
resolve2(url);
|
|
44354
44305
|
}).catch(reject);
|
|
44355
44306
|
};
|
package/dist/esm/browser.js
CHANGED
|
@@ -40767,12 +40767,12 @@ var uploadWithPresignedUrl = async (blob, accessToken, boardId, type, baseUrl) =
|
|
|
40767
40767
|
}
|
|
40768
40768
|
return url;
|
|
40769
40769
|
};
|
|
40770
|
-
var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
|
|
40770
|
+
var uploadMediaToStorage = async (blob, accessToken, boardId, type, baseUrl) => {
|
|
40771
40771
|
try {
|
|
40772
40772
|
if (blob.type === "image/svg+xml") {
|
|
40773
|
-
return await uploadSvgDirectly(blob, accessToken, boardId);
|
|
40773
|
+
return await uploadSvgDirectly(blob, accessToken, boardId, baseUrl);
|
|
40774
40774
|
} else {
|
|
40775
|
-
return await uploadWithPresignedUrl(blob, accessToken, boardId, type);
|
|
40775
|
+
return await uploadWithPresignedUrl(blob, accessToken, boardId, type, baseUrl);
|
|
40776
40776
|
}
|
|
40777
40777
|
} catch (error) {
|
|
40778
40778
|
console.error("Media upload process error:", error);
|
|
@@ -41247,30 +41247,6 @@ async function fileTosha256(file) {
|
|
|
41247
41247
|
}
|
|
41248
41248
|
|
|
41249
41249
|
// src/Items/Image/ImageHelpers.ts
|
|
41250
|
-
var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
|
|
41251
|
-
return new Promise((resolve2, reject) => {
|
|
41252
|
-
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
41253
|
-
fetch(`${window?.location.origin}/api/v1/media/image/${boardId}`, {
|
|
41254
|
-
method: "POST",
|
|
41255
|
-
headers: {
|
|
41256
|
-
"Content-Type": mimeType,
|
|
41257
|
-
"X-Image-Id": hash,
|
|
41258
|
-
Authorization: `Bearer ${accessToken}`
|
|
41259
|
-
},
|
|
41260
|
-
body: blob
|
|
41261
|
-
}).then(async (response) => {
|
|
41262
|
-
if (response.status !== 200) {
|
|
41263
|
-
return conf.hooks.onUploadMediaError(response, "image");
|
|
41264
|
-
}
|
|
41265
|
-
return response.json();
|
|
41266
|
-
}).then((data) => {
|
|
41267
|
-
resolve2(data.src);
|
|
41268
|
-
}).catch((error) => {
|
|
41269
|
-
console.error("Media storage error:", error);
|
|
41270
|
-
reject(error);
|
|
41271
|
-
});
|
|
41272
|
-
});
|
|
41273
|
-
};
|
|
41274
41250
|
var getBlobFromDataURL = (dataURL) => {
|
|
41275
41251
|
const base64String = dataURL.split(",")[1];
|
|
41276
41252
|
const mimeType = dataURL.split(",")[0].split(":")[1].split(";")[0];
|
|
@@ -41345,9 +41321,9 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
41345
41321
|
}
|
|
41346
41322
|
});
|
|
41347
41323
|
};
|
|
41348
|
-
var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
41324
|
+
var prepareImage = (inp, accessToken, boardId, baseUrl) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
41349
41325
|
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
41350
|
-
return uploadMediaToStorage(blob, accessToken, boardId, "image").then((src) => {
|
|
41326
|
+
return uploadMediaToStorage(blob, accessToken, boardId, "image", baseUrl).then((src) => {
|
|
41351
41327
|
return {
|
|
41352
41328
|
imageDimension: { width: width2, height: height2 },
|
|
41353
41329
|
base64: dataURL,
|
|
@@ -41357,29 +41333,6 @@ var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).the
|
|
|
41357
41333
|
});
|
|
41358
41334
|
|
|
41359
41335
|
// src/Items/Video/VideoHelpers.ts
|
|
41360
|
-
var uploadVideoToStorage = async (hash, videoBlob, accessToken, boardId, baseUrl) => {
|
|
41361
|
-
return new Promise((resolve2, reject) => {
|
|
41362
|
-
fetch(`${window.location.origin}/api/v1/media/video/${boardId}`, {
|
|
41363
|
-
method: "POST",
|
|
41364
|
-
headers: {
|
|
41365
|
-
"Content-Type": videoBlob.type,
|
|
41366
|
-
"x-video-id": hash,
|
|
41367
|
-
Authorization: `Bearer ${accessToken}`
|
|
41368
|
-
},
|
|
41369
|
-
body: videoBlob
|
|
41370
|
-
}).then(async (response) => {
|
|
41371
|
-
if (response.status !== 200) {
|
|
41372
|
-
return conf.hooks.onUploadMediaError(response, "video");
|
|
41373
|
-
}
|
|
41374
|
-
return response.json();
|
|
41375
|
-
}).then((data) => {
|
|
41376
|
-
resolve2(data.src);
|
|
41377
|
-
}).catch((error) => {
|
|
41378
|
-
console.error("Media storage error:", error);
|
|
41379
|
-
reject(error);
|
|
41380
|
-
});
|
|
41381
|
-
});
|
|
41382
|
-
};
|
|
41383
41336
|
var getVideoMetadata = (file) => {
|
|
41384
41337
|
return new Promise((resolve2, reject) => {
|
|
41385
41338
|
const video = document.createElement("video");
|
|
@@ -41409,7 +41362,7 @@ var createVideoItem = (board, extension2, videoData, onLoadCb) => {
|
|
|
41409
41362
|
onLoadCb(boardVideo);
|
|
41410
41363
|
});
|
|
41411
41364
|
};
|
|
41412
|
-
var prepareVideo = (file, accessToken, boardId) => {
|
|
41365
|
+
var prepareVideo = (file, accessToken, boardId, baseUrl) => {
|
|
41413
41366
|
return new Promise((resolve2, reject) => {
|
|
41414
41367
|
const video = document.createElement("video");
|
|
41415
41368
|
video.src = URL.createObjectURL(file);
|
|
@@ -41417,7 +41370,7 @@ var prepareVideo = (file, accessToken, boardId) => {
|
|
|
41417
41370
|
video.onseeked = () => {
|
|
41418
41371
|
video.onseeked = null;
|
|
41419
41372
|
prepareImage(captureFrame(0.1, video)?.src, accessToken, boardId).then((imageData) => {
|
|
41420
|
-
uploadMediaToStorage(file, accessToken, boardId, "video").then((url) => {
|
|
41373
|
+
uploadMediaToStorage(file, accessToken, boardId, "video", baseUrl).then((url) => {
|
|
41421
41374
|
resolve2({
|
|
41422
41375
|
url,
|
|
41423
41376
|
previewUrl: imageData.storageLink
|
|
@@ -41715,12 +41668,12 @@ class AudioItem extends BaseItem {
|
|
|
41715
41668
|
}
|
|
41716
41669
|
}
|
|
41717
41670
|
// src/Items/Audio/AudioHelpers.ts
|
|
41718
|
-
var prepareAudio = (file, accessToken, boardId) => {
|
|
41671
|
+
var prepareAudio = (file, accessToken, boardId, baseUrl) => {
|
|
41719
41672
|
return new Promise((resolve2, reject) => {
|
|
41720
41673
|
const audio = document.createElement("audio");
|
|
41721
41674
|
audio.src = URL.createObjectURL(file);
|
|
41722
41675
|
audio.onloadedmetadata = () => {
|
|
41723
|
-
uploadMediaToStorage(file, accessToken, boardId, "audio").then((url) => {
|
|
41676
|
+
uploadMediaToStorage(file, accessToken, boardId, "audio", baseUrl).then((url) => {
|
|
41724
41677
|
resolve2(url);
|
|
41725
41678
|
}).catch(reject);
|
|
41726
41679
|
};
|
|
@@ -57122,8 +57075,6 @@ export {
|
|
|
57122
57075
|
viewModeHotkeyRegistry,
|
|
57123
57076
|
validateRichTextData,
|
|
57124
57077
|
validateItemsMap,
|
|
57125
|
-
uploadVideoToStorage,
|
|
57126
|
-
uploadToTheStorage,
|
|
57127
57078
|
updateRects,
|
|
57128
57079
|
translateElementBy,
|
|
57129
57080
|
transformHtmlOrTextToMarkdown,
|
package/dist/esm/index.js
CHANGED
|
@@ -40760,12 +40760,12 @@ var uploadWithPresignedUrl = async (blob, accessToken, boardId, type, baseUrl) =
|
|
|
40760
40760
|
}
|
|
40761
40761
|
return url;
|
|
40762
40762
|
};
|
|
40763
|
-
var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
|
|
40763
|
+
var uploadMediaToStorage = async (blob, accessToken, boardId, type, baseUrl) => {
|
|
40764
40764
|
try {
|
|
40765
40765
|
if (blob.type === "image/svg+xml") {
|
|
40766
|
-
return await uploadSvgDirectly(blob, accessToken, boardId);
|
|
40766
|
+
return await uploadSvgDirectly(blob, accessToken, boardId, baseUrl);
|
|
40767
40767
|
} else {
|
|
40768
|
-
return await uploadWithPresignedUrl(blob, accessToken, boardId, type);
|
|
40768
|
+
return await uploadWithPresignedUrl(blob, accessToken, boardId, type, baseUrl);
|
|
40769
40769
|
}
|
|
40770
40770
|
} catch (error) {
|
|
40771
40771
|
console.error("Media upload process error:", error);
|
|
@@ -41240,30 +41240,6 @@ async function fileTosha256(file) {
|
|
|
41240
41240
|
}
|
|
41241
41241
|
|
|
41242
41242
|
// src/Items/Image/ImageHelpers.ts
|
|
41243
|
-
var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
|
|
41244
|
-
return new Promise((resolve2, reject) => {
|
|
41245
|
-
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
41246
|
-
fetch(`${window?.location.origin}/api/v1/media/image/${boardId}`, {
|
|
41247
|
-
method: "POST",
|
|
41248
|
-
headers: {
|
|
41249
|
-
"Content-Type": mimeType,
|
|
41250
|
-
"X-Image-Id": hash,
|
|
41251
|
-
Authorization: `Bearer ${accessToken}`
|
|
41252
|
-
},
|
|
41253
|
-
body: blob
|
|
41254
|
-
}).then(async (response) => {
|
|
41255
|
-
if (response.status !== 200) {
|
|
41256
|
-
return conf.hooks.onUploadMediaError(response, "image");
|
|
41257
|
-
}
|
|
41258
|
-
return response.json();
|
|
41259
|
-
}).then((data) => {
|
|
41260
|
-
resolve2(data.src);
|
|
41261
|
-
}).catch((error) => {
|
|
41262
|
-
console.error("Media storage error:", error);
|
|
41263
|
-
reject(error);
|
|
41264
|
-
});
|
|
41265
|
-
});
|
|
41266
|
-
};
|
|
41267
41243
|
var getBlobFromDataURL = (dataURL) => {
|
|
41268
41244
|
const base64String = dataURL.split(",")[1];
|
|
41269
41245
|
const mimeType = dataURL.split(",")[0].split(":")[1].split(";")[0];
|
|
@@ -41338,9 +41314,9 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
41338
41314
|
}
|
|
41339
41315
|
});
|
|
41340
41316
|
};
|
|
41341
|
-
var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
41317
|
+
var prepareImage = (inp, accessToken, boardId, baseUrl) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
41342
41318
|
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
41343
|
-
return uploadMediaToStorage(blob, accessToken, boardId, "image").then((src) => {
|
|
41319
|
+
return uploadMediaToStorage(blob, accessToken, boardId, "image", baseUrl).then((src) => {
|
|
41344
41320
|
return {
|
|
41345
41321
|
imageDimension: { width: width2, height: height2 },
|
|
41346
41322
|
base64: dataURL,
|
|
@@ -41350,29 +41326,6 @@ var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).the
|
|
|
41350
41326
|
});
|
|
41351
41327
|
|
|
41352
41328
|
// src/Items/Video/VideoHelpers.ts
|
|
41353
|
-
var uploadVideoToStorage = async (hash, videoBlob, accessToken, boardId, baseUrl) => {
|
|
41354
|
-
return new Promise((resolve2, reject) => {
|
|
41355
|
-
fetch(`${window.location.origin}/api/v1/media/video/${boardId}`, {
|
|
41356
|
-
method: "POST",
|
|
41357
|
-
headers: {
|
|
41358
|
-
"Content-Type": videoBlob.type,
|
|
41359
|
-
"x-video-id": hash,
|
|
41360
|
-
Authorization: `Bearer ${accessToken}`
|
|
41361
|
-
},
|
|
41362
|
-
body: videoBlob
|
|
41363
|
-
}).then(async (response) => {
|
|
41364
|
-
if (response.status !== 200) {
|
|
41365
|
-
return conf.hooks.onUploadMediaError(response, "video");
|
|
41366
|
-
}
|
|
41367
|
-
return response.json();
|
|
41368
|
-
}).then((data) => {
|
|
41369
|
-
resolve2(data.src);
|
|
41370
|
-
}).catch((error) => {
|
|
41371
|
-
console.error("Media storage error:", error);
|
|
41372
|
-
reject(error);
|
|
41373
|
-
});
|
|
41374
|
-
});
|
|
41375
|
-
};
|
|
41376
41329
|
var getVideoMetadata = (file) => {
|
|
41377
41330
|
return new Promise((resolve2, reject) => {
|
|
41378
41331
|
const video = document.createElement("video");
|
|
@@ -41402,7 +41355,7 @@ var createVideoItem = (board, extension2, videoData, onLoadCb) => {
|
|
|
41402
41355
|
onLoadCb(boardVideo);
|
|
41403
41356
|
});
|
|
41404
41357
|
};
|
|
41405
|
-
var prepareVideo = (file, accessToken, boardId) => {
|
|
41358
|
+
var prepareVideo = (file, accessToken, boardId, baseUrl) => {
|
|
41406
41359
|
return new Promise((resolve2, reject) => {
|
|
41407
41360
|
const video = document.createElement("video");
|
|
41408
41361
|
video.src = URL.createObjectURL(file);
|
|
@@ -41410,7 +41363,7 @@ var prepareVideo = (file, accessToken, boardId) => {
|
|
|
41410
41363
|
video.onseeked = () => {
|
|
41411
41364
|
video.onseeked = null;
|
|
41412
41365
|
prepareImage(captureFrame(0.1, video)?.src, accessToken, boardId).then((imageData) => {
|
|
41413
|
-
uploadMediaToStorage(file, accessToken, boardId, "video").then((url) => {
|
|
41366
|
+
uploadMediaToStorage(file, accessToken, boardId, "video", baseUrl).then((url) => {
|
|
41414
41367
|
resolve2({
|
|
41415
41368
|
url,
|
|
41416
41369
|
previewUrl: imageData.storageLink
|
|
@@ -41708,12 +41661,12 @@ class AudioItem extends BaseItem {
|
|
|
41708
41661
|
}
|
|
41709
41662
|
}
|
|
41710
41663
|
// src/Items/Audio/AudioHelpers.ts
|
|
41711
|
-
var prepareAudio = (file, accessToken, boardId) => {
|
|
41664
|
+
var prepareAudio = (file, accessToken, boardId, baseUrl) => {
|
|
41712
41665
|
return new Promise((resolve2, reject) => {
|
|
41713
41666
|
const audio = document.createElement("audio");
|
|
41714
41667
|
audio.src = URL.createObjectURL(file);
|
|
41715
41668
|
audio.onloadedmetadata = () => {
|
|
41716
|
-
uploadMediaToStorage(file, accessToken, boardId, "audio").then((url) => {
|
|
41669
|
+
uploadMediaToStorage(file, accessToken, boardId, "audio", baseUrl).then((url) => {
|
|
41717
41670
|
resolve2(url);
|
|
41718
41671
|
}).catch(reject);
|
|
41719
41672
|
};
|
|
@@ -57020,8 +56973,6 @@ export {
|
|
|
57020
56973
|
viewModeHotkeyRegistry,
|
|
57021
56974
|
validateRichTextData,
|
|
57022
56975
|
validateItemsMap,
|
|
57023
|
-
uploadVideoToStorage,
|
|
57024
|
-
uploadToTheStorage,
|
|
57025
56976
|
updateRects,
|
|
57026
56977
|
translateElementBy,
|
|
57027
56978
|
transformHtmlOrTextToMarkdown,
|
package/dist/esm/node.js
CHANGED
|
@@ -43228,12 +43228,12 @@ var uploadWithPresignedUrl = async (blob, accessToken, boardId, type, baseUrl) =
|
|
|
43228
43228
|
}
|
|
43229
43229
|
return url;
|
|
43230
43230
|
};
|
|
43231
|
-
var uploadMediaToStorage = async (blob, accessToken, boardId, type) => {
|
|
43231
|
+
var uploadMediaToStorage = async (blob, accessToken, boardId, type, baseUrl) => {
|
|
43232
43232
|
try {
|
|
43233
43233
|
if (blob.type === "image/svg+xml") {
|
|
43234
|
-
return await uploadSvgDirectly(blob, accessToken, boardId);
|
|
43234
|
+
return await uploadSvgDirectly(blob, accessToken, boardId, baseUrl);
|
|
43235
43235
|
} else {
|
|
43236
|
-
return await uploadWithPresignedUrl(blob, accessToken, boardId, type);
|
|
43236
|
+
return await uploadWithPresignedUrl(blob, accessToken, boardId, type, baseUrl);
|
|
43237
43237
|
}
|
|
43238
43238
|
} catch (error) {
|
|
43239
43239
|
console.error("Media upload process error:", error);
|
|
@@ -43708,30 +43708,6 @@ async function fileTosha256(file) {
|
|
|
43708
43708
|
}
|
|
43709
43709
|
|
|
43710
43710
|
// src/Items/Image/ImageHelpers.ts
|
|
43711
|
-
var uploadToTheStorage = async (hash, dataURL, accessToken, boardId) => {
|
|
43712
|
-
return new Promise((resolve2, reject) => {
|
|
43713
|
-
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
43714
|
-
fetch(`${window?.location.origin}/api/v1/media/image/${boardId}`, {
|
|
43715
|
-
method: "POST",
|
|
43716
|
-
headers: {
|
|
43717
|
-
"Content-Type": mimeType,
|
|
43718
|
-
"X-Image-Id": hash,
|
|
43719
|
-
Authorization: `Bearer ${accessToken}`
|
|
43720
|
-
},
|
|
43721
|
-
body: blob
|
|
43722
|
-
}).then(async (response) => {
|
|
43723
|
-
if (response.status !== 200) {
|
|
43724
|
-
return conf.hooks.onUploadMediaError(response, "image");
|
|
43725
|
-
}
|
|
43726
|
-
return response.json();
|
|
43727
|
-
}).then((data) => {
|
|
43728
|
-
resolve2(data.src);
|
|
43729
|
-
}).catch((error) => {
|
|
43730
|
-
console.error("Media storage error:", error);
|
|
43731
|
-
reject(error);
|
|
43732
|
-
});
|
|
43733
|
-
});
|
|
43734
|
-
};
|
|
43735
43711
|
var getBlobFromDataURL = (dataURL) => {
|
|
43736
43712
|
const base64String = dataURL.split(",")[1];
|
|
43737
43713
|
const mimeType = dataURL.split(",")[0].split(":")[1].split(";")[0];
|
|
@@ -43806,9 +43782,9 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
43806
43782
|
}
|
|
43807
43783
|
});
|
|
43808
43784
|
};
|
|
43809
|
-
var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
43785
|
+
var prepareImage = (inp, accessToken, boardId, baseUrl) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash }) => {
|
|
43810
43786
|
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
43811
|
-
return uploadMediaToStorage(blob, accessToken, boardId, "image").then((src) => {
|
|
43787
|
+
return uploadMediaToStorage(blob, accessToken, boardId, "image", baseUrl).then((src) => {
|
|
43812
43788
|
return {
|
|
43813
43789
|
imageDimension: { width: width2, height: height2 },
|
|
43814
43790
|
base64: dataURL,
|
|
@@ -43818,29 +43794,6 @@ var prepareImage = (inp, accessToken, boardId) => resizeAndConvertToPng(inp).the
|
|
|
43818
43794
|
});
|
|
43819
43795
|
|
|
43820
43796
|
// src/Items/Video/VideoHelpers.ts
|
|
43821
|
-
var uploadVideoToStorage = async (hash, videoBlob, accessToken, boardId, baseUrl) => {
|
|
43822
|
-
return new Promise((resolve2, reject) => {
|
|
43823
|
-
fetch(`${window.location.origin}/api/v1/media/video/${boardId}`, {
|
|
43824
|
-
method: "POST",
|
|
43825
|
-
headers: {
|
|
43826
|
-
"Content-Type": videoBlob.type,
|
|
43827
|
-
"x-video-id": hash,
|
|
43828
|
-
Authorization: `Bearer ${accessToken}`
|
|
43829
|
-
},
|
|
43830
|
-
body: videoBlob
|
|
43831
|
-
}).then(async (response) => {
|
|
43832
|
-
if (response.status !== 200) {
|
|
43833
|
-
return conf.hooks.onUploadMediaError(response, "video");
|
|
43834
|
-
}
|
|
43835
|
-
return response.json();
|
|
43836
|
-
}).then((data) => {
|
|
43837
|
-
resolve2(data.src);
|
|
43838
|
-
}).catch((error) => {
|
|
43839
|
-
console.error("Media storage error:", error);
|
|
43840
|
-
reject(error);
|
|
43841
|
-
});
|
|
43842
|
-
});
|
|
43843
|
-
};
|
|
43844
43797
|
var getVideoMetadata = (file) => {
|
|
43845
43798
|
return new Promise((resolve2, reject) => {
|
|
43846
43799
|
const video = document.createElement("video");
|
|
@@ -43870,7 +43823,7 @@ var createVideoItem = (board, extension2, videoData, onLoadCb) => {
|
|
|
43870
43823
|
onLoadCb(boardVideo);
|
|
43871
43824
|
});
|
|
43872
43825
|
};
|
|
43873
|
-
var prepareVideo = (file, accessToken, boardId) => {
|
|
43826
|
+
var prepareVideo = (file, accessToken, boardId, baseUrl) => {
|
|
43874
43827
|
return new Promise((resolve2, reject) => {
|
|
43875
43828
|
const video = document.createElement("video");
|
|
43876
43829
|
video.src = URL.createObjectURL(file);
|
|
@@ -43878,7 +43831,7 @@ var prepareVideo = (file, accessToken, boardId) => {
|
|
|
43878
43831
|
video.onseeked = () => {
|
|
43879
43832
|
video.onseeked = null;
|
|
43880
43833
|
prepareImage(captureFrame(0.1, video)?.src, accessToken, boardId).then((imageData) => {
|
|
43881
|
-
uploadMediaToStorage(file, accessToken, boardId, "video").then((url) => {
|
|
43834
|
+
uploadMediaToStorage(file, accessToken, boardId, "video", baseUrl).then((url) => {
|
|
43882
43835
|
resolve2({
|
|
43883
43836
|
url,
|
|
43884
43837
|
previewUrl: imageData.storageLink
|
|
@@ -44176,12 +44129,12 @@ class AudioItem extends BaseItem {
|
|
|
44176
44129
|
}
|
|
44177
44130
|
}
|
|
44178
44131
|
// src/Items/Audio/AudioHelpers.ts
|
|
44179
|
-
var prepareAudio = (file, accessToken, boardId) => {
|
|
44132
|
+
var prepareAudio = (file, accessToken, boardId, baseUrl) => {
|
|
44180
44133
|
return new Promise((resolve2, reject) => {
|
|
44181
44134
|
const audio = document.createElement("audio");
|
|
44182
44135
|
audio.src = URL.createObjectURL(file);
|
|
44183
44136
|
audio.onloadedmetadata = () => {
|
|
44184
|
-
uploadMediaToStorage(file, accessToken, boardId, "audio").then((url) => {
|
|
44137
|
+
uploadMediaToStorage(file, accessToken, boardId, "audio", baseUrl).then((url) => {
|
|
44185
44138
|
resolve2(url);
|
|
44186
44139
|
}).catch(reject);
|
|
44187
44140
|
};
|
|
@@ -59655,8 +59608,6 @@ export {
|
|
|
59655
59608
|
viewModeHotkeyRegistry,
|
|
59656
59609
|
validateRichTextData,
|
|
59657
59610
|
validateItemsMap,
|
|
59658
|
-
uploadVideoToStorage,
|
|
59659
|
-
uploadToTheStorage,
|
|
59660
59611
|
updateRects,
|
|
59661
59612
|
translateElementBy,
|
|
59662
59613
|
transformHtmlOrTextToMarkdown,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Board } from '../../Board';
|
|
2
2
|
import { AudioItem } from '../Audio/Audio';
|
|
3
3
|
import { Matrix } from '../Transformation/Matrix';
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const prepareAudio: (file: File, accessToken: string | null, boardId: string) => Promise<string>;
|
|
4
|
+
export declare const prepareAudio: (file: File, accessToken: string | null, boardId: string, baseUrl?: string) => Promise<string>;
|
|
6
5
|
export declare const calculateAudioPosition: (board: Board, audioItem: AudioItem) => Matrix;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ImageConstructorData } from './Image';
|
|
2
|
-
export declare const uploadToTheStorage: (hash: string, dataURL: string, accessToken: string | null, boardId: string) => Promise<string>;
|
|
3
2
|
export declare const getBlobFromDataURL: (dataURL: string) => {
|
|
4
3
|
blob: Blob;
|
|
5
4
|
base64String: string;
|
|
@@ -17,4 +16,4 @@ export declare const resizeAndConvertToPng: (inp: string | ArrayBuffer | null |
|
|
|
17
16
|
* @param boardId
|
|
18
17
|
* @returns An object containing prepared image information on success, err otherwise
|
|
19
18
|
*/
|
|
20
|
-
export declare const prepareImage: (inp: string | ArrayBuffer | null | undefined, accessToken: string | null, boardId: string) => Promise<ImageConstructorData>;
|
|
19
|
+
export declare const prepareImage: (inp: string | ArrayBuffer | null | undefined, accessToken: string | null, boardId: string, baseUrl?: string) => Promise<ImageConstructorData>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Board } from '../../Board';
|
|
2
2
|
import { VideoConstructorData, VideoItem } from './Video';
|
|
3
|
-
export declare const uploadVideoToStorage: (hash: string, videoBlob: Blob, accessToken: string | null, boardId: string, baseUrl?: string) => Promise<string>;
|
|
4
3
|
export declare const getVideoMetadata: (file: File) => Promise<{
|
|
5
4
|
width: number;
|
|
6
5
|
height: number;
|
|
7
6
|
}>;
|
|
8
7
|
export declare const createVideoItem: (board: Board, extension: "mp4" | "webm", videoData: VideoConstructorData, onLoadCb: (video: VideoItem) => void) => void;
|
|
9
|
-
export declare const prepareVideo: (file: File, accessToken: string | null, boardId: string) => Promise<{
|
|
8
|
+
export declare const prepareVideo: (file: File, accessToken: string | null, boardId: string, baseUrl?: string) => Promise<{
|
|
10
9
|
url: string;
|
|
11
10
|
previewUrl: string;
|
|
12
11
|
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const uploadMediaToStorage: (blob: Blob, accessToken: string | null, boardId: string, type: "video" | "audio" | "image") => Promise<string>;
|
|
1
|
+
export declare const uploadMediaToStorage: (blob: Blob, accessToken: string | null, boardId: string, type: "video" | "audio" | "image", baseUrl?: string) => Promise<string>;
|
|
2
2
|
export declare const getMediaSignedUrl: (url: string, accessToken: string | null) => Promise<string | null>;
|