microboard-temp 0.13.79 → 0.13.81
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 +126 -42
- package/dist/cjs/index.js +126 -42
- package/dist/cjs/node.js +126 -42
- package/dist/esm/browser.js +146 -62
- package/dist/esm/index.js +146 -62
- package/dist/esm/node.js +146 -62
- package/dist/types/Events/Events.d.ts +6 -0
- package/dist/types/Events/Log/getSnapshotFromList.d.ts +1 -1
- package/dist/types/Items/Audio/AudioHelpers.d.ts +1 -1
- package/dist/types/Items/Image/ImageHelpers.d.ts +1 -1
- package/dist/types/Items/Video/VideoHelpers.d.ts +1 -1
- package/dist/types/Settings.d.ts +8 -0
- package/dist/types/api/AuthRequest.d.ts +6 -0
- package/dist/types/api/MediaHelpers.d.ts +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -3638,6 +3638,8 @@ var init_Settings = __esm(() => {
|
|
|
3638
3638
|
getDPI: () => 1,
|
|
3639
3639
|
reactEditorFocus: () => {},
|
|
3640
3640
|
reactEditorToSlatePoint: () => null,
|
|
3641
|
+
onAuthInvalid: async () => false,
|
|
3642
|
+
onAuthTerminalFailure: () => {},
|
|
3641
3643
|
planNames: {
|
|
3642
3644
|
basic: "Basic",
|
|
3643
3645
|
plus: "Plus",
|
|
@@ -6148,11 +6150,12 @@ function getSnapshotFromList(list, board) {
|
|
|
6148
6150
|
const snapshot = {
|
|
6149
6151
|
events: list.getConfirmedRecords().map((record) => record.event),
|
|
6150
6152
|
items: board.serialize(),
|
|
6151
|
-
lastIndex: list
|
|
6153
|
+
lastIndex: getLastIndexFromList(list)
|
|
6152
6154
|
};
|
|
6153
6155
|
list.applyUnconfirmed();
|
|
6154
6156
|
return snapshot;
|
|
6155
6157
|
}
|
|
6158
|
+
var init_getSnapshotFromList = () => {};
|
|
6156
6159
|
|
|
6157
6160
|
// src/Events/Log/EventsLog.ts
|
|
6158
6161
|
class EventsLog {
|
|
@@ -6241,6 +6244,7 @@ var init_EventsLog = __esm(() => {
|
|
|
6241
6244
|
init_getUndoRecordFromList();
|
|
6242
6245
|
init_getUnpublishedEventFromList();
|
|
6243
6246
|
init_insertEventsFromOtherConnectionsIntoList();
|
|
6247
|
+
init_getSnapshotFromList();
|
|
6244
6248
|
});
|
|
6245
6249
|
|
|
6246
6250
|
// src/Events/Log/index.ts
|
|
@@ -14397,6 +14401,11 @@ class Events {
|
|
|
14397
14401
|
getOpKey(op) {
|
|
14398
14402
|
return op.method;
|
|
14399
14403
|
}
|
|
14404
|
+
refreshIdentity() {
|
|
14405
|
+
const sessionId = this.getSessionId();
|
|
14406
|
+
const authorUserId = this.getAuthorUserId();
|
|
14407
|
+
this.log.refreshUnconfirmedIdentity(sessionId, authorUserId);
|
|
14408
|
+
}
|
|
14400
14409
|
getSessionId() {
|
|
14401
14410
|
return getConnectionSessionId(this.connection);
|
|
14402
14411
|
}
|
|
@@ -31816,9 +31825,34 @@ var init_setLink = __esm(() => {
|
|
|
31816
31825
|
});
|
|
31817
31826
|
|
|
31818
31827
|
// src/Items/RichText/editorHelpers/common/getSelectionMarks.ts
|
|
31819
|
-
import { Editor as Editor13 } from "slate";
|
|
31828
|
+
import { Editor as Editor13, Range as Range6, Text as Text7 } from "slate";
|
|
31820
31829
|
function getSelectionMarks(editor) {
|
|
31821
|
-
|
|
31830
|
+
const marks = Editor13.marks(editor);
|
|
31831
|
+
if (!editor.selection) {
|
|
31832
|
+
return marks;
|
|
31833
|
+
}
|
|
31834
|
+
if (!Range6.isExpanded(editor.selection) || marks && Object.keys(marks).length > 0) {
|
|
31835
|
+
return marks;
|
|
31836
|
+
}
|
|
31837
|
+
const textEntries = Array.from(Editor13.nodes(editor, {
|
|
31838
|
+
at: editor.selection,
|
|
31839
|
+
match: (node) => Text7.isText(node)
|
|
31840
|
+
}));
|
|
31841
|
+
const [firstEntry, ...restEntries] = textEntries;
|
|
31842
|
+
if (!firstEntry) {
|
|
31843
|
+
return marks;
|
|
31844
|
+
}
|
|
31845
|
+
const { text: _firstText, ...firstMarks } = firstEntry[0];
|
|
31846
|
+
const commonMarks = { ...firstMarks };
|
|
31847
|
+
for (const [node] of restEntries) {
|
|
31848
|
+
const { text: _text, ...nodeMarks } = node;
|
|
31849
|
+
for (const key of Object.keys(commonMarks)) {
|
|
31850
|
+
if (commonMarks[key] !== nodeMarks[key]) {
|
|
31851
|
+
delete commonMarks[key];
|
|
31852
|
+
}
|
|
31853
|
+
}
|
|
31854
|
+
}
|
|
31855
|
+
return commonMarks;
|
|
31822
31856
|
}
|
|
31823
31857
|
var init_getSelectionMarks = () => {};
|
|
31824
31858
|
|
|
@@ -31837,13 +31871,13 @@ var init_clearText = __esm(() => {
|
|
|
31837
31871
|
});
|
|
31838
31872
|
|
|
31839
31873
|
// src/Items/RichText/editorHelpers/common/hasTextInSelection.ts
|
|
31840
|
-
import { Editor as Editor15, Range as
|
|
31874
|
+
import { Editor as Editor15, Range as Range7 } from "slate";
|
|
31841
31875
|
function hasTextInSelection(editor) {
|
|
31842
31876
|
const { selection } = editor;
|
|
31843
|
-
if (!selection ||
|
|
31877
|
+
if (!selection || Range7.isCollapsed(selection)) {
|
|
31844
31878
|
return false;
|
|
31845
31879
|
}
|
|
31846
|
-
const [start, end] =
|
|
31880
|
+
const [start, end] = Range7.edges(selection);
|
|
31847
31881
|
const text = Editor15.string(editor, { anchor: start, focus: end });
|
|
31848
31882
|
return text.length > 0;
|
|
31849
31883
|
}
|
|
@@ -39392,7 +39426,7 @@ function getParagraphWithPassedTextNode(textNode) {
|
|
|
39392
39426
|
}
|
|
39393
39427
|
|
|
39394
39428
|
// src/Items/RichText/editorHelpers/selectionOps/setSelectionFontSize.ts
|
|
39395
|
-
import { Editor as Editor24, Transforms as Transforms17 } from "slate";
|
|
39429
|
+
import { Editor as Editor24, Range as Range8, Text as Text8, Transforms as Transforms17 } from "slate";
|
|
39396
39430
|
import { ReactEditor as ReactEditor3 } from "slate-react";
|
|
39397
39431
|
function setSelectionFontSize(editor, isAutosize, fontSize, selectionContext) {
|
|
39398
39432
|
const size = fontSize;
|
|
@@ -39427,7 +39461,14 @@ function setSelectionFontSize(editor, isAutosize, fontSize, selectionContext) {
|
|
|
39427
39461
|
shouldUpdateElement = true;
|
|
39428
39462
|
}
|
|
39429
39463
|
} else {
|
|
39430
|
-
|
|
39464
|
+
if (editor.selection && Range8.isExpanded(editor.selection)) {
|
|
39465
|
+
Transforms17.setNodes(editor, { fontSize: size }, {
|
|
39466
|
+
match: (n) => Text8.isText(n),
|
|
39467
|
+
split: true
|
|
39468
|
+
});
|
|
39469
|
+
} else {
|
|
39470
|
+
Editor24.addMark(editor, "fontSize", size);
|
|
39471
|
+
}
|
|
39431
39472
|
}
|
|
39432
39473
|
}
|
|
39433
39474
|
if (selectionContext === "EditTextUnderPointer") {
|
|
@@ -39465,7 +39506,7 @@ var init_getEachNodeInSelectionStyles = __esm(() => {
|
|
|
39465
39506
|
});
|
|
39466
39507
|
|
|
39467
39508
|
// src/Items/RichText/editorHelpers/selectionOps/setSelectionFontStyle.ts
|
|
39468
|
-
import { Editor as Editor25, Range as
|
|
39509
|
+
import { Editor as Editor25, Range as Range9, Transforms as Transforms18 } from "slate";
|
|
39469
39510
|
function setSelectionFontStyle(editor, style) {
|
|
39470
39511
|
const styleList = Array.isArray(style) ? style : [style];
|
|
39471
39512
|
for (const style2 of styleList) {
|
|
@@ -39482,7 +39523,7 @@ function setSelectionFontStyle(editor, style) {
|
|
|
39482
39523
|
continue;
|
|
39483
39524
|
}
|
|
39484
39525
|
const { selection } = editor;
|
|
39485
|
-
if (selection &&
|
|
39526
|
+
if (selection && Range9.isExpanded(selection)) {
|
|
39486
39527
|
Transforms18.setNodes(editor, { [style2]: value }, {
|
|
39487
39528
|
match: (n) => !Editor25.isEditor(n) && n.type === "text",
|
|
39488
39529
|
split: true
|
|
@@ -39497,7 +39538,7 @@ var init_setSelectionFontStyle = __esm(() => {
|
|
|
39497
39538
|
});
|
|
39498
39539
|
|
|
39499
39540
|
// src/Items/RichText/editorHelpers/selectionOps/setSelectionFontColor.ts
|
|
39500
|
-
import { Editor as Editor26 } from "slate";
|
|
39541
|
+
import { Editor as Editor26, Range as Range10, Text as Text9, Transforms as Transforms19 } from "slate";
|
|
39501
39542
|
import { ReactEditor as ReactEditor4 } from "slate-react";
|
|
39502
39543
|
function setSelectionFontColor(editor, format, selectionContext) {
|
|
39503
39544
|
const marks = getSelectionMarks(editor);
|
|
@@ -39505,7 +39546,14 @@ function setSelectionFontColor(editor, format, selectionContext) {
|
|
|
39505
39546
|
return;
|
|
39506
39547
|
}
|
|
39507
39548
|
if (marks.fontColor !== format) {
|
|
39508
|
-
|
|
39549
|
+
if (editor.selection && Range10.isExpanded(editor.selection)) {
|
|
39550
|
+
Transforms19.setNodes(editor, { fontColor: format }, {
|
|
39551
|
+
match: (n) => Text9.isText(n),
|
|
39552
|
+
split: true
|
|
39553
|
+
});
|
|
39554
|
+
} else {
|
|
39555
|
+
Editor26.addMark(editor, "fontColor", format);
|
|
39556
|
+
}
|
|
39509
39557
|
}
|
|
39510
39558
|
if (selectionContext === "EditTextUnderPointer") {
|
|
39511
39559
|
try {
|
|
@@ -39523,7 +39571,7 @@ var init_setSelectionFontColor = __esm(() => {
|
|
|
39523
39571
|
import {
|
|
39524
39572
|
createEditor,
|
|
39525
39573
|
Editor as Editor27,
|
|
39526
|
-
Transforms as
|
|
39574
|
+
Transforms as Transforms20
|
|
39527
39575
|
} from "slate";
|
|
39528
39576
|
import { withReact } from "slate-react";
|
|
39529
39577
|
|
|
@@ -39799,7 +39847,7 @@ class EditorContainer {
|
|
|
39799
39847
|
break;
|
|
39800
39848
|
}
|
|
39801
39849
|
if (selection) {
|
|
39802
|
-
|
|
39850
|
+
Transforms20.select(this.editor, selection);
|
|
39803
39851
|
}
|
|
39804
39852
|
}
|
|
39805
39853
|
applyMaxWidth(maxWidth) {
|
|
@@ -39959,7 +40007,7 @@ class EditorContainer {
|
|
|
39959
40007
|
return JSON.parse(JSON.stringify(this.editor.selection));
|
|
39960
40008
|
}
|
|
39961
40009
|
splitNode() {
|
|
39962
|
-
|
|
40010
|
+
Transforms20.splitNodes(this.editor, { always: true });
|
|
39963
40011
|
}
|
|
39964
40012
|
getBlockNodes() {
|
|
39965
40013
|
return this.editor.children;
|
|
@@ -40049,7 +40097,7 @@ var init_findOptimalMaxWidthForTextAutoSize = __esm(() => {
|
|
|
40049
40097
|
});
|
|
40050
40098
|
|
|
40051
40099
|
// src/Items/RichText/editorHelpers/selectionOps/applySelectionFontColor.ts
|
|
40052
|
-
import { Editor as Editor28 } from "slate";
|
|
40100
|
+
import { Editor as Editor28, Range as Range11, Text as Text10, Transforms as Transforms21 } from "slate";
|
|
40053
40101
|
function applySelectionFontColor(editor, fontColor) {
|
|
40054
40102
|
if (!editor) {
|
|
40055
40103
|
throw new Error("Editor is not initialized");
|
|
@@ -40058,14 +40106,21 @@ function applySelectionFontColor(editor, fontColor) {
|
|
|
40058
40106
|
if (!marks) {
|
|
40059
40107
|
return;
|
|
40060
40108
|
}
|
|
40061
|
-
|
|
40109
|
+
if (editor.selection && Range11.isExpanded(editor.selection)) {
|
|
40110
|
+
Transforms21.setNodes(editor, { fontColor }, {
|
|
40111
|
+
match: (n) => Text10.isText(n),
|
|
40112
|
+
split: true
|
|
40113
|
+
});
|
|
40114
|
+
} else {
|
|
40115
|
+
Editor28.addMark(editor, "fontColor", fontColor);
|
|
40116
|
+
}
|
|
40062
40117
|
}
|
|
40063
40118
|
var init_applySelectionFontColor = __esm(() => {
|
|
40064
40119
|
init_getSelectionMarks();
|
|
40065
40120
|
});
|
|
40066
40121
|
|
|
40067
40122
|
// src/Items/RichText/editorHelpers/selectionOps/applySelectionFontSize.ts
|
|
40068
|
-
import { Editor as Editor29, Transforms as
|
|
40123
|
+
import { Editor as Editor29, Range as Range12, Text as Text11, Transforms as Transforms22 } from "slate";
|
|
40069
40124
|
function applySelectionFontSize(editor, fontSize, selectionContext) {
|
|
40070
40125
|
const size = fontSize;
|
|
40071
40126
|
if (typeof size !== "number") {
|
|
@@ -40080,12 +40135,19 @@ function applySelectionFontSize(editor, fontSize, selectionContext) {
|
|
|
40080
40135
|
return;
|
|
40081
40136
|
}
|
|
40082
40137
|
if (JSON.stringify(selection?.anchor) === JSON.stringify(selection?.focus)) {
|
|
40083
|
-
|
|
40138
|
+
Transforms22.select(editor, {
|
|
40084
40139
|
anchor: Editor29.start(editor, []),
|
|
40085
40140
|
focus: Editor29.end(editor, [])
|
|
40086
40141
|
});
|
|
40087
40142
|
}
|
|
40088
|
-
|
|
40143
|
+
if (editor.selection && Range12.isExpanded(editor.selection)) {
|
|
40144
|
+
Transforms22.setNodes(editor, { fontSize: size }, {
|
|
40145
|
+
match: (n) => Text11.isText(n),
|
|
40146
|
+
split: true
|
|
40147
|
+
});
|
|
40148
|
+
} else {
|
|
40149
|
+
Editor29.addMark(editor, "fontSize", size);
|
|
40150
|
+
}
|
|
40089
40151
|
if (selectionContext === "EditTextUnderPointer") {}
|
|
40090
40152
|
}
|
|
40091
40153
|
var init_applySelectionFontSize = __esm(() => {
|
|
@@ -40168,8 +40230,8 @@ var init_setEditorFocus = () => {};
|
|
|
40168
40230
|
import {
|
|
40169
40231
|
Editor as Editor31,
|
|
40170
40232
|
Element as Element9,
|
|
40171
|
-
Text as
|
|
40172
|
-
Transforms as
|
|
40233
|
+
Text as Text12,
|
|
40234
|
+
Transforms as Transforms23
|
|
40173
40235
|
} from "slate";
|
|
40174
40236
|
var isEditInProcessValue = false, counter = 0, RichText;
|
|
40175
40237
|
var init_RichText = __esm(() => {
|
|
@@ -40204,7 +40266,7 @@ var init_RichText = __esm(() => {
|
|
|
40204
40266
|
parent = "Board";
|
|
40205
40267
|
subject = new Subject;
|
|
40206
40268
|
editor;
|
|
40207
|
-
editorTransforms =
|
|
40269
|
+
editorTransforms = Transforms23;
|
|
40208
40270
|
editorEditor = Editor31;
|
|
40209
40271
|
isContainerSet = false;
|
|
40210
40272
|
isRenderEnabled = true;
|
|
@@ -40736,7 +40798,7 @@ var init_RichText = __esm(() => {
|
|
|
40736
40798
|
}
|
|
40737
40799
|
getMinFontSize() {
|
|
40738
40800
|
const textNodes = Editor31.nodes(this.editor.editor, {
|
|
40739
|
-
match: (n) =>
|
|
40801
|
+
match: (n) => Text12.isText(n),
|
|
40740
40802
|
at: []
|
|
40741
40803
|
});
|
|
40742
40804
|
const fontSizes = [];
|
|
@@ -40840,9 +40902,9 @@ var init_RichText = __esm(() => {
|
|
|
40840
40902
|
}
|
|
40841
40903
|
restoreSelection(selection) {
|
|
40842
40904
|
if (selection) {
|
|
40843
|
-
|
|
40905
|
+
Transforms23.select(this.editor.editor, selection);
|
|
40844
40906
|
} else {
|
|
40845
|
-
|
|
40907
|
+
Transforms23.deselect(this.editor.editor);
|
|
40846
40908
|
}
|
|
40847
40909
|
}
|
|
40848
40910
|
deserialize(data) {
|
|
@@ -41752,6 +41814,35 @@ var init_Audio = __esm(() => {
|
|
|
41752
41814
|
};
|
|
41753
41815
|
});
|
|
41754
41816
|
|
|
41817
|
+
// src/api/AuthRequest.ts
|
|
41818
|
+
async function authenticatedFetch(url2, init2 = {}, boardId) {
|
|
41819
|
+
const getAuthInit = (originalInit) => {
|
|
41820
|
+
const token = conf.getAccessToken();
|
|
41821
|
+
if (!token) {
|
|
41822
|
+
return originalInit;
|
|
41823
|
+
}
|
|
41824
|
+
const headers = new Headers(originalInit.headers);
|
|
41825
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
41826
|
+
return { ...originalInit, headers };
|
|
41827
|
+
};
|
|
41828
|
+
let response = await fetch(url2, getAuthInit(init2));
|
|
41829
|
+
if (response.status === 401) {
|
|
41830
|
+
const body = await response.clone().json().catch(() => ({}));
|
|
41831
|
+
if (body.code === "AUTH_INVALID_ACCESS_TOKEN") {
|
|
41832
|
+
const refreshed = await conf.onAuthInvalid(boardId);
|
|
41833
|
+
if (refreshed) {
|
|
41834
|
+
response = await fetch(url2, getAuthInit(init2));
|
|
41835
|
+
} else {
|
|
41836
|
+
conf.onAuthTerminalFailure(boardId, body.code);
|
|
41837
|
+
}
|
|
41838
|
+
}
|
|
41839
|
+
}
|
|
41840
|
+
return response;
|
|
41841
|
+
}
|
|
41842
|
+
var init_AuthRequest = __esm(() => {
|
|
41843
|
+
init_Settings();
|
|
41844
|
+
});
|
|
41845
|
+
|
|
41755
41846
|
// src/api/MediaHelpers.ts
|
|
41756
41847
|
function getAccessTypeFromUrl(url2) {
|
|
41757
41848
|
try {
|
|
@@ -41769,15 +41860,14 @@ function getAccessTypeFromUrl(url2) {
|
|
|
41769
41860
|
}
|
|
41770
41861
|
return null;
|
|
41771
41862
|
}
|
|
41772
|
-
var uploadSvgDirectly = async (blob,
|
|
41773
|
-
const response = await
|
|
41863
|
+
var uploadSvgDirectly = async (blob, boardId, baseUrl) => {
|
|
41864
|
+
const response = await authenticatedFetch(`${baseUrl || ""}/svg/${boardId}`, {
|
|
41774
41865
|
method: "POST",
|
|
41775
41866
|
headers: {
|
|
41776
|
-
"Content-Type": "image/svg+xml"
|
|
41777
|
-
Authorization: `Bearer ${accessToken}`
|
|
41867
|
+
"Content-Type": "image/svg+xml"
|
|
41778
41868
|
},
|
|
41779
41869
|
body: blob
|
|
41780
|
-
});
|
|
41870
|
+
}, boardId);
|
|
41781
41871
|
if (!response.ok) {
|
|
41782
41872
|
conf.hooks.onUploadMediaError(response, "image");
|
|
41783
41873
|
throw new Error(`Failed to upload SVG. Status: ${response.status}`);
|
|
@@ -41787,19 +41877,18 @@ var uploadSvgDirectly = async (blob, accessToken, boardId, baseUrl) => {
|
|
|
41787
41877
|
throw new Error("Server did not provide a key for the uploaded SVG.");
|
|
41788
41878
|
}
|
|
41789
41879
|
return data.url;
|
|
41790
|
-
}, uploadWithPresignedUrl = async (blob,
|
|
41791
|
-
const generateUrlResponse = await
|
|
41880
|
+
}, uploadWithPresignedUrl = async (blob, boardId, type, baseUrl) => {
|
|
41881
|
+
const generateUrlResponse = await authenticatedFetch(`${baseUrl || ""}/media/upload`, {
|
|
41792
41882
|
method: "POST",
|
|
41793
41883
|
headers: {
|
|
41794
|
-
"Content-Type": "application/json"
|
|
41795
|
-
Authorization: `Bearer ${accessToken}`
|
|
41884
|
+
"Content-Type": "application/json"
|
|
41796
41885
|
},
|
|
41797
41886
|
body: JSON.stringify({
|
|
41798
41887
|
fileSize: blob.size,
|
|
41799
41888
|
fileType: blob.type,
|
|
41800
41889
|
boardId
|
|
41801
41890
|
})
|
|
41802
|
-
});
|
|
41891
|
+
}, boardId);
|
|
41803
41892
|
if (!generateUrlResponse.ok) {
|
|
41804
41893
|
conf.hooks.onUploadMediaError(generateUrlResponse, type);
|
|
41805
41894
|
throw new Error(`Failed to get presigned URL. Status: ${generateUrlResponse.status}`);
|
|
@@ -41821,18 +41910,18 @@ var uploadSvgDirectly = async (blob, accessToken, boardId, baseUrl) => {
|
|
|
41821
41910
|
throw new Error(`Direct upload to storage failed. Status: ${uploadResponse.status}`);
|
|
41822
41911
|
}
|
|
41823
41912
|
return url2;
|
|
41824
|
-
}, uploadMediaToStorage = async (blob,
|
|
41913
|
+
}, uploadMediaToStorage = async (blob, boardId, type, baseUrl) => {
|
|
41825
41914
|
try {
|
|
41826
41915
|
if (blob.type === "image/svg+xml") {
|
|
41827
|
-
return await uploadSvgDirectly(blob,
|
|
41916
|
+
return await uploadSvgDirectly(blob, boardId, baseUrl);
|
|
41828
41917
|
} else {
|
|
41829
|
-
return await uploadWithPresignedUrl(blob,
|
|
41918
|
+
return await uploadWithPresignedUrl(blob, boardId, type, baseUrl);
|
|
41830
41919
|
}
|
|
41831
41920
|
} catch (error48) {
|
|
41832
41921
|
console.error("Media upload process error:", error48);
|
|
41833
41922
|
throw error48;
|
|
41834
41923
|
}
|
|
41835
|
-
}, getMediaSignedUrl = async (url2
|
|
41924
|
+
}, getMediaSignedUrl = async (url2) => {
|
|
41836
41925
|
const accessType = getAccessTypeFromUrl(url2);
|
|
41837
41926
|
if (!accessType) {
|
|
41838
41927
|
return null;
|
|
@@ -41840,15 +41929,9 @@ var uploadSvgDirectly = async (blob, accessToken, boardId, baseUrl) => {
|
|
|
41840
41929
|
if (accessType === "anonymous") {
|
|
41841
41930
|
return url2;
|
|
41842
41931
|
}
|
|
41843
|
-
if (!accessToken) {
|
|
41844
|
-
return null;
|
|
41845
|
-
}
|
|
41846
41932
|
try {
|
|
41847
|
-
const response = await
|
|
41848
|
-
method: "GET"
|
|
41849
|
-
headers: {
|
|
41850
|
-
Authorization: `Bearer ${accessToken}`
|
|
41851
|
-
}
|
|
41933
|
+
const response = await authenticatedFetch(url2, {
|
|
41934
|
+
method: "GET"
|
|
41852
41935
|
});
|
|
41853
41936
|
if (!response.ok) {
|
|
41854
41937
|
console.error("Failed to get media signed url:", response.status, response.statusText);
|
|
@@ -41863,15 +41946,16 @@ var uploadSvgDirectly = async (blob, accessToken, boardId, baseUrl) => {
|
|
|
41863
41946
|
};
|
|
41864
41947
|
var init_MediaHelpers = __esm(() => {
|
|
41865
41948
|
init_Settings();
|
|
41949
|
+
init_AuthRequest();
|
|
41866
41950
|
});
|
|
41867
41951
|
|
|
41868
41952
|
// src/Items/Audio/AudioHelpers.ts
|
|
41869
|
-
var prepareAudio = (file2,
|
|
41953
|
+
var prepareAudio = (file2, boardId, baseUrl) => {
|
|
41870
41954
|
return new Promise((resolve, reject) => {
|
|
41871
41955
|
const audio = document.createElement("audio");
|
|
41872
41956
|
audio.src = URL.createObjectURL(file2);
|
|
41873
41957
|
audio.onloadedmetadata = () => {
|
|
41874
|
-
uploadMediaToStorage(file2,
|
|
41958
|
+
uploadMediaToStorage(file2, boardId, "audio", baseUrl).then((url2) => {
|
|
41875
41959
|
resolve(url2);
|
|
41876
41960
|
}).catch(reject);
|
|
41877
41961
|
};
|
|
@@ -60398,7 +60482,7 @@ var init_Video = __esm(() => {
|
|
|
60398
60482
|
async setPreviewUrl(url2) {
|
|
60399
60483
|
if (this.isStorageUrl) {
|
|
60400
60484
|
try {
|
|
60401
|
-
this.preview.src = await getMediaSignedUrl(url2
|
|
60485
|
+
this.preview.src = await getMediaSignedUrl(url2) || "";
|
|
60402
60486
|
} catch (err) {
|
|
60403
60487
|
console.error(err);
|
|
60404
60488
|
this.onError();
|
|
@@ -60758,9 +60842,9 @@ var getBlobFromDataURL = (dataURL) => {
|
|
|
60758
60842
|
};
|
|
60759
60843
|
}
|
|
60760
60844
|
});
|
|
60761
|
-
}, prepareImage = (inp,
|
|
60845
|
+
}, prepareImage = (inp, boardId, baseUrl) => resizeAndConvertToPng(inp).then(({ width: width2, height: height2, dataURL, hash: hash2 }) => {
|
|
60762
60846
|
const { blob, mimeType } = getBlobFromDataURL(dataURL);
|
|
60763
|
-
return uploadMediaToStorage(blob,
|
|
60847
|
+
return uploadMediaToStorage(blob, boardId, "image", baseUrl).then((src) => {
|
|
60764
60848
|
return {
|
|
60765
60849
|
imageDimension: { width: width2, height: height2 },
|
|
60766
60850
|
base64: dataURL,
|
|
@@ -60801,15 +60885,15 @@ var getVideoMetadata = (file2) => {
|
|
|
60801
60885
|
board.selection.add(boardVideo);
|
|
60802
60886
|
onLoadCb(boardVideo);
|
|
60803
60887
|
});
|
|
60804
|
-
}, prepareVideo = (file2,
|
|
60888
|
+
}, prepareVideo = (file2, boardId, baseUrl) => {
|
|
60805
60889
|
return new Promise((resolve2, reject) => {
|
|
60806
60890
|
const video = document.createElement("video");
|
|
60807
60891
|
video.src = URL.createObjectURL(file2);
|
|
60808
60892
|
video.onloadedmetadata = () => {
|
|
60809
60893
|
video.onseeked = () => {
|
|
60810
60894
|
video.onseeked = null;
|
|
60811
|
-
prepareImage(captureFrame(0.1, video)?.src,
|
|
60812
|
-
uploadMediaToStorage(file2,
|
|
60895
|
+
prepareImage(captureFrame(0.1, video)?.src, boardId, baseUrl).then((imageData) => {
|
|
60896
|
+
uploadMediaToStorage(file2, boardId, "video", baseUrl).then((url2) => {
|
|
60813
60897
|
resolve2({
|
|
60814
60898
|
url: url2,
|
|
60815
60899
|
previewUrl: imageData.storageLink
|
|
@@ -66797,8 +66881,8 @@ var init_Card = __esm(() => {
|
|
|
66797
66881
|
async createImages() {
|
|
66798
66882
|
this.face = conf.documentFactory.createElement("img");
|
|
66799
66883
|
this.backside = conf.documentFactory.createElement("img");
|
|
66800
|
-
this.face.src = await getMediaSignedUrl(this.faceUrl
|
|
66801
|
-
this.backside.src = await getMediaSignedUrl(this.backsideUrl
|
|
66884
|
+
this.face.src = await getMediaSignedUrl(this.faceUrl) || "";
|
|
66885
|
+
this.backside.src = await getMediaSignedUrl(this.backsideUrl) || "";
|
|
66802
66886
|
this.face.onload = () => {
|
|
66803
66887
|
this.subject.publish(this);
|
|
66804
66888
|
};
|
|
@@ -67499,7 +67583,7 @@ var init_Dice = __esm(() => {
|
|
|
67499
67583
|
this.renderValues[index2] = value;
|
|
67500
67584
|
} else {
|
|
67501
67585
|
const image2 = conf.documentFactory.createElement("img");
|
|
67502
|
-
image2.src = await getMediaSignedUrl(value
|
|
67586
|
+
image2.src = await getMediaSignedUrl(value) || "";
|
|
67503
67587
|
this.renderValues[index2] = image2;
|
|
67504
67588
|
image2.onload = () => {
|
|
67505
67589
|
this.subject.publish(this);
|
|
@@ -67954,7 +68038,7 @@ var init_Screen = __esm(() => {
|
|
|
67954
68038
|
this.backgroundUrl = url2 || "";
|
|
67955
68039
|
if (url2) {
|
|
67956
68040
|
this.backgroundImage = conf.documentFactory.createElement("img");
|
|
67957
|
-
this.backgroundImage.src = await getMediaSignedUrl(url2
|
|
68041
|
+
this.backgroundImage.src = await getMediaSignedUrl(url2) || "";
|
|
67958
68042
|
this.applyBackgroundColor("none");
|
|
67959
68043
|
this.backgroundImage.onload = () => {
|
|
67960
68044
|
this.subject.publish(this);
|
|
@@ -69816,7 +69900,7 @@ var init_Image = __esm(() => {
|
|
|
69816
69900
|
}
|
|
69817
69901
|
async setStorageLink(link2) {
|
|
69818
69902
|
this.storageLink = link2;
|
|
69819
|
-
this.signedUrl = await getMediaSignedUrl(link2
|
|
69903
|
+
this.signedUrl = await getMediaSignedUrl(link2) || "";
|
|
69820
69904
|
if (!this.signedUrl) {
|
|
69821
69905
|
const canvas = conf.documentFactory.createElement("canvas");
|
|
69822
69906
|
canvas.width = 100;
|
|
@@ -70237,7 +70321,7 @@ function handleAudioGenerate(response, board) {
|
|
|
70237
70321
|
}
|
|
70238
70322
|
function handleImageGenerate(response, board) {
|
|
70239
70323
|
if (response.status === "completed" && response.base64) {
|
|
70240
|
-
prepareImage(response.base64,
|
|
70324
|
+
prepareImage(response.base64, board.getBoardId()).then((imageData) => {
|
|
70241
70325
|
const placeholderId = board.aiImagePlaceholder?.getId();
|
|
70242
70326
|
if (placeholderId) {
|
|
70243
70327
|
const placeholderNode = board.items.getById(placeholderId);
|