microboard-temp 0.1.11 → 0.1.13
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 +287 -257
- package/dist/cjs/index.js +271 -241
- package/dist/cjs/node.js +278 -248
- package/dist/esm/browser.js +287 -257
- package/dist/esm/index.js +271 -241
- package/dist/esm/node.js +278 -248
- package/dist/types/Keyboard/getHotkeyLabel.d.ts +1 -1
- package/dist/types/Keyboard/logHotkey.d.ts +3 -3
- package/dist/types/Settings.d.ts +8 -16
- package/dist/types/api/MockDocumentFactory.d.ts +8 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -2266,7 +2266,7 @@ __export(exports_browser, {
|
|
|
2266
2266
|
cursors: () => defaultCursors,
|
|
2267
2267
|
createVideoItem: () => createVideoItem,
|
|
2268
2268
|
createEvents: () => createEvents,
|
|
2269
|
-
conf: () =>
|
|
2269
|
+
conf: () => conf2,
|
|
2270
2270
|
checkHotkeys: () => checkHotkeys,
|
|
2271
2271
|
catmullRomInterpolate: () => catmullRomInterpolate,
|
|
2272
2272
|
catchErrorResponse: () => catchErrorResponse,
|
|
@@ -5124,6 +5124,32 @@ class BrowserPath2D {
|
|
|
5124
5124
|
}
|
|
5125
5125
|
}
|
|
5126
5126
|
|
|
5127
|
+
// src/api/MockDocumentFactory.ts
|
|
5128
|
+
class MockDocumentFactory {
|
|
5129
|
+
logPreInitializationCall(methodName) {
|
|
5130
|
+
console.warn(`WARNING: DocumentFactory.${methodName} was called before initialization.`, `
|
|
5131
|
+
Please make sure to initialize DocumentFactory properly before using it.`, `
|
|
5132
|
+
The application will continue but may not work as expected.`);
|
|
5133
|
+
console.trace(`Stack trace for DocumentFactory.${methodName} call:`);
|
|
5134
|
+
}
|
|
5135
|
+
createElement(tagName) {
|
|
5136
|
+
this.logPreInitializationCall("createElement");
|
|
5137
|
+
return {};
|
|
5138
|
+
}
|
|
5139
|
+
createElementNS(namespace, tagName) {
|
|
5140
|
+
this.logPreInitializationCall("createElementNS");
|
|
5141
|
+
return {};
|
|
5142
|
+
}
|
|
5143
|
+
caretPositionFromPoint(x, y, options) {
|
|
5144
|
+
this.logPreInitializationCall("caretPositionFromPoint");
|
|
5145
|
+
return null;
|
|
5146
|
+
}
|
|
5147
|
+
caretRangeFromPoint(x, y) {
|
|
5148
|
+
this.logPreInitializationCall("caretRangeFromPoint");
|
|
5149
|
+
return null;
|
|
5150
|
+
}
|
|
5151
|
+
}
|
|
5152
|
+
|
|
5127
5153
|
// src/api/MockPath2D.ts
|
|
5128
5154
|
class MockPath2D {
|
|
5129
5155
|
nativePath = null;
|
|
@@ -5223,10 +5249,10 @@ var ExportQuality;
|
|
|
5223
5249
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
5224
5250
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
5225
5251
|
})(ExportQuality ||= {});
|
|
5226
|
-
var
|
|
5252
|
+
var conf2 = {
|
|
5227
5253
|
connection: undefined,
|
|
5228
5254
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
5229
|
-
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory :
|
|
5255
|
+
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
5230
5256
|
getDOMParser: undefined,
|
|
5231
5257
|
measureCtx: undefined,
|
|
5232
5258
|
i18n: {},
|
|
@@ -5543,7 +5569,11 @@ var conf = {
|
|
|
5543
5569
|
overline: false,
|
|
5544
5570
|
subscript: false,
|
|
5545
5571
|
superscript: false
|
|
5546
|
-
}
|
|
5572
|
+
},
|
|
5573
|
+
LOG_HOTKEYS: false,
|
|
5574
|
+
FORCE_HOTKEYS: "auto",
|
|
5575
|
+
debug: false,
|
|
5576
|
+
FALLBACK_LNG: "en"
|
|
5547
5577
|
};
|
|
5548
5578
|
|
|
5549
5579
|
// src/Items/Transformation/Matrix.ts
|
|
@@ -6265,7 +6295,7 @@ class DrawingContext {
|
|
|
6265
6295
|
this.setCamera(camera);
|
|
6266
6296
|
}
|
|
6267
6297
|
dpi() {
|
|
6268
|
-
return
|
|
6298
|
+
return conf2.getDPI();
|
|
6269
6299
|
}
|
|
6270
6300
|
setCamera(camera) {
|
|
6271
6301
|
this.camera = camera;
|
|
@@ -6275,7 +6305,7 @@ class DrawingContext {
|
|
|
6275
6305
|
}
|
|
6276
6306
|
clear() {
|
|
6277
6307
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
6278
|
-
this.ctx.clearRect(0, 0,
|
|
6308
|
+
this.ctx.clearRect(0, 0, conf2.getDocumentWidth(), conf2.getDocumentHeight());
|
|
6279
6309
|
this.matrix.applyToContext(this.ctx);
|
|
6280
6310
|
}
|
|
6281
6311
|
clearCursor() {
|
|
@@ -6283,7 +6313,7 @@ class DrawingContext {
|
|
|
6283
6313
|
return;
|
|
6284
6314
|
}
|
|
6285
6315
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
6286
|
-
this.cursorCtx.clearRect(0, 0,
|
|
6316
|
+
this.cursorCtx.clearRect(0, 0, conf2.getDocumentWidth(), conf2.getDocumentHeight());
|
|
6287
6317
|
this.matrix.applyToContext(this.cursorCtx);
|
|
6288
6318
|
}
|
|
6289
6319
|
applyChanges() {
|
|
@@ -6386,7 +6416,7 @@ class Path {
|
|
|
6386
6416
|
this.width = this.getMbr().getWidth();
|
|
6387
6417
|
this.height = this.getMbr().getHeight();
|
|
6388
6418
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
6389
|
-
this.path2d = new
|
|
6419
|
+
this.path2d = new conf2.path2DFactory;
|
|
6390
6420
|
this.updateCache();
|
|
6391
6421
|
}
|
|
6392
6422
|
getBackgroundColor() {
|
|
@@ -6463,7 +6493,7 @@ class Path {
|
|
|
6463
6493
|
this.y = top - this.paddingTop;
|
|
6464
6494
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
6465
6495
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
6466
|
-
const path2d = new
|
|
6496
|
+
const path2d = new conf2.path2DFactory;
|
|
6467
6497
|
if (this.segments.length === 0) {
|
|
6468
6498
|
return;
|
|
6469
6499
|
}
|
|
@@ -7529,7 +7559,7 @@ var parsersHTML = {
|
|
|
7529
7559
|
"comment-item": parseHTMLComment
|
|
7530
7560
|
};
|
|
7531
7561
|
var decodeHtml = (htmlString) => {
|
|
7532
|
-
const parser =
|
|
7562
|
+
const parser = conf2.getDOMParser();
|
|
7533
7563
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
7534
7564
|
return doc.documentElement.textContent || "";
|
|
7535
7565
|
};
|
|
@@ -7558,10 +7588,10 @@ function parseHTMLRichText(el, options) {
|
|
|
7558
7588
|
italic: node.style.fontStyle === "italic",
|
|
7559
7589
|
underline: node.style.textDecoration.includes("underline"),
|
|
7560
7590
|
"line-through": node.style.textDecoration.includes("line-through"),
|
|
7561
|
-
fontColor: node.style.color ||
|
|
7562
|
-
fontHighlight: node.style.backgroundColor ||
|
|
7563
|
-
fontSize: parseFloat(node.style.fontSize) ||
|
|
7564
|
-
fontFamily: node.style.fontFamily ||
|
|
7591
|
+
fontColor: node.style.color || conf2.DEFAULT_TEXT_STYLES.fontColor,
|
|
7592
|
+
fontHighlight: node.style.backgroundColor || conf2.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
7593
|
+
fontSize: parseFloat(node.style.fontSize) || conf2.DEFAULT_TEXT_STYLES.fontSize,
|
|
7594
|
+
fontFamily: node.style.fontFamily || conf2.DEFAULT_TEXT_STYLES.fontFamily,
|
|
7565
7595
|
overline: false,
|
|
7566
7596
|
subscript: false,
|
|
7567
7597
|
superscript: false
|
|
@@ -7626,7 +7656,7 @@ function parseHTMLRichText(el, options) {
|
|
|
7626
7656
|
return {
|
|
7627
7657
|
type: "paragraph",
|
|
7628
7658
|
...extractCommonProps(),
|
|
7629
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
7659
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf2.DEFAULT_TEXT_STYLES.lineHeight,
|
|
7630
7660
|
children: children2
|
|
7631
7661
|
};
|
|
7632
7662
|
default:
|
|
@@ -14106,8 +14136,8 @@ class LinkTo {
|
|
|
14106
14136
|
const ctx = context.ctx;
|
|
14107
14137
|
ctx.save();
|
|
14108
14138
|
ctx.globalCompositeOperation = "destination-out";
|
|
14109
|
-
const size =
|
|
14110
|
-
const offset =
|
|
14139
|
+
const size = conf2.LINK_BTN_SIZE / scale;
|
|
14140
|
+
const offset = conf2.LINK_BTN_OFFSET / scale;
|
|
14111
14141
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
14112
14142
|
ctx.restore();
|
|
14113
14143
|
}
|
|
@@ -14258,7 +14288,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
14258
14288
|
} else if (node3.type === "ul_list" && !listData) {
|
|
14259
14289
|
listData = { level: 0, isNumberedList: false };
|
|
14260
14290
|
}
|
|
14261
|
-
const listMarks =
|
|
14291
|
+
const listMarks = conf2[getListMarkType((listData?.level || 0) + 1)];
|
|
14262
14292
|
for (let i = 0;i < data.children.length; i++) {
|
|
14263
14293
|
const child = structuredClone(data.children[i]);
|
|
14264
14294
|
switch (child.type) {
|
|
@@ -14663,8 +14693,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
14663
14693
|
rect2.height += paddingTop;
|
|
14664
14694
|
}
|
|
14665
14695
|
}
|
|
14666
|
-
|
|
14667
|
-
const measure =
|
|
14696
|
+
conf2.measureCtx.font = style.font;
|
|
14697
|
+
const measure = conf2.measureCtx.measureText(text);
|
|
14668
14698
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
14669
14699
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
14670
14700
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -23786,7 +23816,7 @@ var convertLinkNodeToTextNode = (node4) => {
|
|
|
23786
23816
|
const link = node4.link;
|
|
23787
23817
|
const text3 = node4.children.map((child) => child.text).join("");
|
|
23788
23818
|
return {
|
|
23789
|
-
...
|
|
23819
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
23790
23820
|
type: "text",
|
|
23791
23821
|
text: text3,
|
|
23792
23822
|
link,
|
|
@@ -23802,9 +23832,9 @@ function setNodeChildrenStyles({
|
|
|
23802
23832
|
horisontalAlignment,
|
|
23803
23833
|
node: node4
|
|
23804
23834
|
}) {
|
|
23805
|
-
let fontStyles =
|
|
23835
|
+
let fontStyles = conf2.DEFAULT_TEXT_STYLES;
|
|
23806
23836
|
if (editor) {
|
|
23807
|
-
fontStyles = Editor.marks(editor) ||
|
|
23837
|
+
fontStyles = Editor.marks(editor) || conf2.DEFAULT_TEXT_STYLES;
|
|
23808
23838
|
}
|
|
23809
23839
|
switch (node4.type) {
|
|
23810
23840
|
case "heading_one":
|
|
@@ -23836,7 +23866,7 @@ function setNodeChildrenStyles({
|
|
|
23836
23866
|
children.text += " ";
|
|
23837
23867
|
}
|
|
23838
23868
|
let fontColor = fontStyles.fontColor;
|
|
23839
|
-
if (fontColor ===
|
|
23869
|
+
if (fontColor === conf2.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
23840
23870
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
23841
23871
|
}
|
|
23842
23872
|
return {
|
|
@@ -23876,7 +23906,7 @@ function setNodeStyles({
|
|
|
23876
23906
|
}
|
|
23877
23907
|
|
|
23878
23908
|
// src/Items/RichText/editorHelpers/markdown/markdownProcessor.ts
|
|
23879
|
-
var { i18n: i18n2 } =
|
|
23909
|
+
var { i18n: i18n2 } = conf2;
|
|
23880
23910
|
|
|
23881
23911
|
class MarkdownProcessor {
|
|
23882
23912
|
chunksQueue = [];
|
|
@@ -24856,7 +24886,7 @@ function setEditorFocus(editor, selectionContext) {
|
|
|
24856
24886
|
}
|
|
24857
24887
|
|
|
24858
24888
|
// src/Items/RichText/RichText.ts
|
|
24859
|
-
var { i18n: i18n3 } =
|
|
24889
|
+
var { i18n: i18n3 } = conf2;
|
|
24860
24890
|
var isEditInProcessValue = false;
|
|
24861
24891
|
var counter = 0;
|
|
24862
24892
|
|
|
@@ -24879,7 +24909,7 @@ class RichText extends Mbr {
|
|
|
24879
24909
|
isContainerSet = false;
|
|
24880
24910
|
isRenderEnabled = true;
|
|
24881
24911
|
layoutNodes;
|
|
24882
|
-
clipPath = new
|
|
24912
|
+
clipPath = new conf2.path2DFactory;
|
|
24883
24913
|
updateRequired = false;
|
|
24884
24914
|
autoSizeScale = 1;
|
|
24885
24915
|
containerMaxWidth;
|
|
@@ -24894,7 +24924,7 @@ class RichText extends Mbr {
|
|
|
24894
24924
|
shrinkWidth = false;
|
|
24895
24925
|
prevMbr = null;
|
|
24896
24926
|
rtCounter = 0;
|
|
24897
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = i18n3?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles =
|
|
24927
|
+
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = i18n3?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf2.DEFAULT_TEXT_STYLES) {
|
|
24898
24928
|
super();
|
|
24899
24929
|
this.board = board;
|
|
24900
24930
|
this.container = container;
|
|
@@ -25027,11 +25057,11 @@ class RichText extends Mbr {
|
|
|
25027
25057
|
return;
|
|
25028
25058
|
}
|
|
25029
25059
|
try {
|
|
25030
|
-
|
|
25060
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
25031
25061
|
} catch {}
|
|
25032
25062
|
};
|
|
25033
25063
|
updateElement = () => {
|
|
25034
|
-
if (
|
|
25064
|
+
if (conf2.isNode()) {
|
|
25035
25065
|
return;
|
|
25036
25066
|
}
|
|
25037
25067
|
if (this.updateRequired) {
|
|
@@ -25160,7 +25190,7 @@ class RichText extends Mbr {
|
|
|
25160
25190
|
const container = this.getTransformedContainer();
|
|
25161
25191
|
const width = container.getWidth();
|
|
25162
25192
|
const height = container.getHeight();
|
|
25163
|
-
this.clipPath = new
|
|
25193
|
+
this.clipPath = new conf2.path2DFactory;
|
|
25164
25194
|
this.clipPath.rect(0, 0, width, height);
|
|
25165
25195
|
}
|
|
25166
25196
|
setContainer(container) {
|
|
@@ -25437,24 +25467,24 @@ class RichText extends Mbr {
|
|
|
25437
25467
|
this.clearLastClickPoint();
|
|
25438
25468
|
const domMbr = ref.getBoundingClientRect();
|
|
25439
25469
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
25440
|
-
if (refMbr.isInside(point5) && (
|
|
25441
|
-
const domRange =
|
|
25442
|
-
const textNode =
|
|
25443
|
-
const offset =
|
|
25444
|
-
const slatePoint =
|
|
25470
|
+
if (refMbr.isInside(point5) && (conf2.documentFactory.caretPositionFromPoint || conf2.documentFactory.caretRangeFromPoint)) {
|
|
25471
|
+
const domRange = conf2.documentFactory.caretPositionFromPoint ? conf2.documentFactory.caretPositionFromPoint(point5.x, point5.y) : conf2.documentFactory.caretRangeFromPoint(point5.x, point5.y);
|
|
25472
|
+
const textNode = conf2.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
25473
|
+
const offset = conf2.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
25474
|
+
const slatePoint = conf2.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
25445
25475
|
exactMatch: false,
|
|
25446
25476
|
suppressThrow: false
|
|
25447
25477
|
});
|
|
25448
25478
|
if (slatePoint) {
|
|
25449
25479
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
25450
25480
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
25451
|
-
|
|
25481
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
25452
25482
|
}
|
|
25453
25483
|
} else {
|
|
25454
|
-
if (!(
|
|
25484
|
+
if (!(conf2.documentFactory.caretPositionFromPoint || conf2.documentFactory.caretRangeFromPoint)) {
|
|
25455
25485
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
25456
25486
|
}
|
|
25457
|
-
|
|
25487
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
25458
25488
|
}
|
|
25459
25489
|
}
|
|
25460
25490
|
}
|
|
@@ -25561,11 +25591,11 @@ class RichText extends Mbr {
|
|
|
25561
25591
|
if (node4.type === "text" || "text" in node4) {
|
|
25562
25592
|
node4 = node4;
|
|
25563
25593
|
const text3 = node4.text.trim() !== "" ? decodeHtml(escapeHtml2(node4.text)) : " ";
|
|
25564
|
-
const textElement = node4.link ? Object.assign(
|
|
25594
|
+
const textElement = node4.link ? Object.assign(conf2.documentFactory.createElement("a"), {
|
|
25565
25595
|
href: node4.link,
|
|
25566
25596
|
target: "_blank",
|
|
25567
25597
|
rel: "noreferrer"
|
|
25568
|
-
}) :
|
|
25598
|
+
}) : conf2.documentFactory.createElement("span");
|
|
25569
25599
|
Object.assign(textElement.style, {
|
|
25570
25600
|
fontWeight: node4.bold ? "700" : "400",
|
|
25571
25601
|
fontStyle: node4.italic ? "italic" : "",
|
|
@@ -25573,10 +25603,10 @@ class RichText extends Mbr {
|
|
|
25573
25603
|
node4.underline ? "underline" : "",
|
|
25574
25604
|
node4["line-through"] ? "line-through" : ""
|
|
25575
25605
|
].filter(Boolean).join(" "),
|
|
25576
|
-
color: node4.fontColor ||
|
|
25577
|
-
backgroundColor: node4.fontHighlight ||
|
|
25578
|
-
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${
|
|
25579
|
-
fontFamily: node4.fontFamily ||
|
|
25606
|
+
color: node4.fontColor || conf2.DEFAULT_TEXT_STYLES.fontColor,
|
|
25607
|
+
backgroundColor: node4.fontHighlight || conf2.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
25608
|
+
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${conf2.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
25609
|
+
fontFamily: node4.fontFamily || conf2.DEFAULT_TEXT_STYLES.fontFamily
|
|
25580
25610
|
});
|
|
25581
25611
|
if (this.insideOf === "Frame") {
|
|
25582
25612
|
Object.assign(textElement.style, {
|
|
@@ -25611,14 +25641,14 @@ class RichText extends Mbr {
|
|
|
25611
25641
|
four: 4,
|
|
25612
25642
|
five: 5
|
|
25613
25643
|
};
|
|
25614
|
-
const header =
|
|
25644
|
+
const header = conf2.documentFactory.createElement(`h${levels2[level]}`);
|
|
25615
25645
|
applyCommonStyles(header);
|
|
25616
25646
|
header.append(...children);
|
|
25617
25647
|
return header;
|
|
25618
25648
|
}
|
|
25619
25649
|
case "code_block": {
|
|
25620
|
-
const pre =
|
|
25621
|
-
const code =
|
|
25650
|
+
const pre = conf2.documentFactory.createElement("pre");
|
|
25651
|
+
const code = conf2.documentFactory.createElement("code");
|
|
25622
25652
|
applyCommonStyles(pre);
|
|
25623
25653
|
if (node4.language) {
|
|
25624
25654
|
code.classList.add(`language-${node4.language}`);
|
|
@@ -25632,35 +25662,35 @@ class RichText extends Mbr {
|
|
|
25632
25662
|
return pre;
|
|
25633
25663
|
}
|
|
25634
25664
|
case "block-quote": {
|
|
25635
|
-
const blockquote =
|
|
25665
|
+
const blockquote = conf2.documentFactory.createElement("blockquote");
|
|
25636
25666
|
applyCommonStyles(blockquote);
|
|
25637
25667
|
blockquote.append(...children);
|
|
25638
25668
|
return blockquote;
|
|
25639
25669
|
}
|
|
25640
25670
|
case "ul_list": {
|
|
25641
|
-
const ul =
|
|
25671
|
+
const ul = conf2.documentFactory.createElement("ul");
|
|
25642
25672
|
applyCommonStyles(ul);
|
|
25643
25673
|
ul.append(...children);
|
|
25644
25674
|
return ul;
|
|
25645
25675
|
}
|
|
25646
25676
|
case "ol_list": {
|
|
25647
|
-
const ol =
|
|
25677
|
+
const ol = conf2.documentFactory.createElement("ol");
|
|
25648
25678
|
applyCommonStyles(ol);
|
|
25649
25679
|
ol.append(...children);
|
|
25650
25680
|
return ol;
|
|
25651
25681
|
}
|
|
25652
25682
|
case "list_item": {
|
|
25653
|
-
const li =
|
|
25683
|
+
const li = conf2.documentFactory.createElement("li");
|
|
25654
25684
|
applyCommonStyles(li);
|
|
25655
25685
|
li.append(...children);
|
|
25656
25686
|
return li;
|
|
25657
25687
|
}
|
|
25658
25688
|
case "paragraph":
|
|
25659
25689
|
default: {
|
|
25660
|
-
const par =
|
|
25690
|
+
const par = conf2.documentFactory.createElement("p");
|
|
25661
25691
|
applyCommonStyles(par);
|
|
25662
25692
|
Object.assign(par.style, {
|
|
25663
|
-
lineHeight: node4.lineHeight ? `${node4.lineHeight}` :
|
|
25693
|
+
lineHeight: node4.lineHeight ? `${node4.lineHeight}` : conf2.DEFAULT_TEXT_STYLES.lineHeight,
|
|
25664
25694
|
margin: "0"
|
|
25665
25695
|
});
|
|
25666
25696
|
par.append(...children);
|
|
@@ -25668,7 +25698,7 @@ class RichText extends Mbr {
|
|
|
25668
25698
|
}
|
|
25669
25699
|
}
|
|
25670
25700
|
}
|
|
25671
|
-
return
|
|
25701
|
+
return conf2.documentFactory.createElement("div");
|
|
25672
25702
|
};
|
|
25673
25703
|
const escapeHtml2 = (unsafe) => {
|
|
25674
25704
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -38731,7 +38761,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
38731
38761
|
markdownString = String(file).trim();
|
|
38732
38762
|
}
|
|
38733
38763
|
let slateNodes = [];
|
|
38734
|
-
if (
|
|
38764
|
+
if (conf2.URL_REGEX.test(text5)) {
|
|
38735
38765
|
slateNodes = [createLinkNode(text5)];
|
|
38736
38766
|
} else {
|
|
38737
38767
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -38747,7 +38777,7 @@ function createLinkNode(link2) {
|
|
|
38747
38777
|
type: "text",
|
|
38748
38778
|
link: link2,
|
|
38749
38779
|
text: link2,
|
|
38750
|
-
...
|
|
38780
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
38751
38781
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
38752
38782
|
};
|
|
38753
38783
|
}
|
|
@@ -38859,7 +38889,7 @@ class AINode {
|
|
|
38859
38889
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
38860
38890
|
this.board = board;
|
|
38861
38891
|
this.id = id;
|
|
38862
|
-
this.buttonIcon =
|
|
38892
|
+
this.buttonIcon = conf2.documentFactory.createElement("img");
|
|
38863
38893
|
this.buttonIcon.src = ICON_SRC;
|
|
38864
38894
|
this.contextItems = contextItems;
|
|
38865
38895
|
this.isUserRequest = isUserRequest;
|
|
@@ -40031,7 +40061,7 @@ function getLine(lineStyle, start2, end2, middle) {
|
|
|
40031
40061
|
}
|
|
40032
40062
|
|
|
40033
40063
|
// src/Items/Connector/Connector.ts
|
|
40034
|
-
var { i18n: i18n4 } =
|
|
40064
|
+
var { i18n: i18n4 } = conf2;
|
|
40035
40065
|
var ConnectionLineWidths = [1, 2, 3, 4, 5, 6, 7, 8, 12];
|
|
40036
40066
|
var CONNECTOR_COLOR = "rgb(20, 21, 26)";
|
|
40037
40067
|
var CONNECTOR_LINE_WIDTH = 1;
|
|
@@ -40091,9 +40121,9 @@ class Connector {
|
|
|
40091
40121
|
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, i18n4.t("connector.textPlaceholder", {
|
|
40092
40122
|
ns: "default"
|
|
40093
40123
|
}), true, false, "Connector", {
|
|
40094
|
-
...
|
|
40095
|
-
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) :
|
|
40096
|
-
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") :
|
|
40124
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
40125
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf2.DEFAULT_TEXT_STYLES.fontSize,
|
|
40126
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf2.DEFAULT_TEXT_STYLES.fontColor
|
|
40097
40127
|
});
|
|
40098
40128
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
40099
40129
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -40543,7 +40573,7 @@ class Connector {
|
|
|
40543
40573
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
40544
40574
|
this.text.render(context);
|
|
40545
40575
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
40546
|
-
ctx.strokeStyle =
|
|
40576
|
+
ctx.strokeStyle = conf2.SELECTION_COLOR;
|
|
40547
40577
|
ctx.lineWidth = 1;
|
|
40548
40578
|
ctx.beginPath();
|
|
40549
40579
|
ctx.rect(textMbr.left - TEXT_BORDER_PADDING, textMbr.top - TEXT_BORDER_PADDING, textMbr.getWidth() + TEXT_BORDER_PADDING * 2, textMbr.getHeight() + TEXT_BORDER_PADDING * 2);
|
|
@@ -40770,7 +40800,7 @@ class Connector {
|
|
|
40770
40800
|
}
|
|
40771
40801
|
}
|
|
40772
40802
|
updatePaths() {
|
|
40773
|
-
if (
|
|
40803
|
+
if (conf2.isNode()) {
|
|
40774
40804
|
return;
|
|
40775
40805
|
}
|
|
40776
40806
|
const startPoint = this.startPoint;
|
|
@@ -41581,7 +41611,7 @@ class DefaultShapeData {
|
|
|
41581
41611
|
text;
|
|
41582
41612
|
linkTo;
|
|
41583
41613
|
itemType = "Shape";
|
|
41584
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
41614
|
+
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor = conf2.SHAPE_DEFAULT_STROKE_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 1, transformation = new DefaultTransformationData, text5 = new DefaultRichTextData, linkTo) {
|
|
41585
41615
|
this.shapeType = shapeType;
|
|
41586
41616
|
this.backgroundColor = backgroundColor;
|
|
41587
41617
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -42868,7 +42898,7 @@ class Shape {
|
|
|
42868
42898
|
this.text.updateElement();
|
|
42869
42899
|
}
|
|
42870
42900
|
transformPath() {
|
|
42871
|
-
if (
|
|
42901
|
+
if (conf2.isNode()) {
|
|
42872
42902
|
return;
|
|
42873
42903
|
}
|
|
42874
42904
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -43097,7 +43127,7 @@ class Sticker {
|
|
|
43097
43127
|
return this;
|
|
43098
43128
|
}
|
|
43099
43129
|
transformPath() {
|
|
43100
|
-
if (
|
|
43130
|
+
if (conf2.isNode()) {
|
|
43101
43131
|
return;
|
|
43102
43132
|
}
|
|
43103
43133
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -43648,7 +43678,7 @@ class Frame {
|
|
|
43648
43678
|
this.path = Frames[this.shapeType].path.copy();
|
|
43649
43679
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
43650
43680
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
43651
|
-
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...
|
|
43681
|
+
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf2.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
|
|
43652
43682
|
this.text.setSelectionHorisontalAlignment("left");
|
|
43653
43683
|
this.transformation.subject.subscribe(() => {
|
|
43654
43684
|
this.transformPath();
|
|
@@ -44210,10 +44240,10 @@ class VideoCommand {
|
|
|
44210
44240
|
|
|
44211
44241
|
// src/Items/Video/Video.ts
|
|
44212
44242
|
var VIDEO_ICON_SRC = "data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 22 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15 0C15.2652 0 15.5196 0.105357 15.7071 0.292893C15.8946 0.48043 16 0.734784 16 1V5.2L21.213 1.55C21.288 1.49746 21.3759 1.4665 21.4672 1.4605C21.5586 1.4545 21.6498 1.4737 21.731 1.51599C21.8122 1.55829 21.8802 1.62206 21.9276 1.70035C21.9751 1.77865 22.0001 1.86846 22 1.96V14.04C22.0001 14.1315 21.9751 14.2214 21.9276 14.2996C21.8802 14.3779 21.8122 14.4417 21.731 14.484C21.6498 14.5263 21.5586 14.5455 21.4672 14.5395C21.3759 14.5335 21.288 14.5025 21.213 14.45L16 10.8V15C16 15.2652 15.8946 15.5196 15.7071 15.7071C15.5196 15.8946 15.2652 16 15 16H1C0.734784 16 0.48043 15.8946 0.292893 15.7071C0.105357 15.5196 0 15.2652 0 15V1C0 0.734784 0.105357 0.48043 0.292893 0.292893C0.48043 0.105357 0.734784 0 1 0H15ZM14 2H2V14H14V2ZM6.4 4.829C6.47611 4.82879 6.55069 4.8503 6.615 4.891L10.97 7.663C11.0266 7.69917 11.0731 7.749 11.1054 7.80789C11.1376 7.86679 11.1545 7.93285 11.1545 8C11.1545 8.06715 11.1376 8.13321 11.1054 8.19211C11.0731 8.251 11.0266 8.30083 10.97 8.337L6.615 11.11C6.55434 11.1487 6.48438 11.1703 6.41248 11.1725C6.34059 11.1748 6.26941 11.1576 6.20646 11.1228C6.14351 11.088 6.0911 11.0368 6.05477 10.9747C6.01844 10.9127 5.99951 10.8419 6 10.77V5.23C6 5.009 6.18 4.83 6.4 4.83V4.829ZM20 4.84L16 7.64V8.358L20 11.158V4.84Z' fill='%23FFFFFF'/%3E%3C/svg%3E";
|
|
44213
|
-
var videoIcon =
|
|
44243
|
+
var videoIcon = conf2.documentFactory.createElement("img");
|
|
44214
44244
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
44215
44245
|
var createPlaceholderImage = (width2, height2) => {
|
|
44216
|
-
const canvas =
|
|
44246
|
+
const canvas = conf2.documentFactory.createElement("canvas");
|
|
44217
44247
|
canvas.width = width2;
|
|
44218
44248
|
canvas.height = height2;
|
|
44219
44249
|
const ctx = canvas.getContext("2d");
|
|
@@ -44257,7 +44287,7 @@ class VideoItem extends Mbr {
|
|
|
44257
44287
|
this.events = events2;
|
|
44258
44288
|
this.id = id;
|
|
44259
44289
|
this.extension = extension2;
|
|
44260
|
-
this.isStorageUrl = !
|
|
44290
|
+
this.isStorageUrl = !conf2.getYouTubeId(url);
|
|
44261
44291
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
44262
44292
|
this.linkTo = new LinkTo(this.id, events2);
|
|
44263
44293
|
this.board = board;
|
|
@@ -44627,59 +44657,59 @@ async function fileTosha256(file) {
|
|
|
44627
44657
|
var catchErrorResponse = async (response, mediaType) => {
|
|
44628
44658
|
if (response.status === 403) {
|
|
44629
44659
|
const data = await response.json();
|
|
44630
|
-
let errorBody =
|
|
44660
|
+
let errorBody = conf2.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
44631
44661
|
if (!data.isOwnerRequest) {
|
|
44632
|
-
errorBody =
|
|
44662
|
+
errorBody = conf2.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
44633
44663
|
} else if (data.currentUsage && data.storageLimit) {
|
|
44634
|
-
errorBody =
|
|
44664
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
44635
44665
|
}
|
|
44636
|
-
|
|
44666
|
+
conf2.notify({
|
|
44637
44667
|
variant: "warning",
|
|
44638
|
-
header:
|
|
44668
|
+
header: conf2.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
44639
44669
|
body: errorBody,
|
|
44640
44670
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
44641
|
-
text:
|
|
44642
|
-
onClick: () =>
|
|
44671
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44672
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44643
44673
|
} : undefined,
|
|
44644
44674
|
duration: 8000
|
|
44645
44675
|
});
|
|
44646
44676
|
} else if (response.status === 413) {
|
|
44647
44677
|
const data = await response.json();
|
|
44648
|
-
let errorBody =
|
|
44678
|
+
let errorBody = conf2.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
44649
44679
|
let isBasicPlan = false;
|
|
44650
44680
|
if (data.fileSizeLimit && data.fileSize) {
|
|
44651
44681
|
if (mediaType === "image") {
|
|
44652
44682
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
44653
|
-
errorBody =
|
|
44683
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44654
44684
|
} else {
|
|
44655
44685
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
44656
|
-
errorBody =
|
|
44686
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44657
44687
|
}
|
|
44658
44688
|
}
|
|
44659
|
-
|
|
44689
|
+
conf2.notify({
|
|
44660
44690
|
variant: "warning",
|
|
44661
|
-
header:
|
|
44691
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44662
44692
|
body: errorBody,
|
|
44663
44693
|
button: isBasicPlan ? {
|
|
44664
|
-
text:
|
|
44665
|
-
onClick: () =>
|
|
44694
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44695
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44666
44696
|
} : undefined,
|
|
44667
44697
|
duration: 4000
|
|
44668
44698
|
});
|
|
44669
44699
|
} else if (response.status === 401) {
|
|
44670
|
-
|
|
44700
|
+
conf2.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
44671
44701
|
} else if (response.status === 415) {
|
|
44672
|
-
|
|
44702
|
+
conf2.notify({
|
|
44673
44703
|
variant: "warning",
|
|
44674
|
-
header:
|
|
44675
|
-
body:
|
|
44704
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
44705
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
44676
44706
|
duration: 4000
|
|
44677
44707
|
});
|
|
44678
44708
|
} else {
|
|
44679
|
-
|
|
44709
|
+
conf2.notify({
|
|
44680
44710
|
variant: "error",
|
|
44681
|
-
header:
|
|
44682
|
-
body:
|
|
44711
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
44712
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
44683
44713
|
duration: 4000
|
|
44684
44714
|
});
|
|
44685
44715
|
}
|
|
@@ -44687,17 +44717,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
44687
44717
|
};
|
|
44688
44718
|
var catchDuplicateErrorResponse = async (response) => {
|
|
44689
44719
|
if (response.status === 403) {
|
|
44690
|
-
|
|
44720
|
+
conf2.notify({
|
|
44691
44721
|
variant: "warning",
|
|
44692
|
-
header:
|
|
44693
|
-
body:
|
|
44722
|
+
header: conf2.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
44723
|
+
body: conf2.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
44694
44724
|
duration: 4000
|
|
44695
44725
|
});
|
|
44696
44726
|
} else {
|
|
44697
|
-
|
|
44727
|
+
conf2.notify({
|
|
44698
44728
|
variant: "error",
|
|
44699
|
-
header:
|
|
44700
|
-
body:
|
|
44729
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
44730
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
44701
44731
|
duration: 4000
|
|
44702
44732
|
});
|
|
44703
44733
|
}
|
|
@@ -44705,40 +44735,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
44705
44735
|
};
|
|
44706
44736
|
var validateMediaFile = (file, account2) => {
|
|
44707
44737
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
44708
|
-
if (!file.type.startsWith("image") && !
|
|
44709
|
-
|
|
44738
|
+
if (!file.type.startsWith("image") && !conf2.AUDIO_FORMATS.includes(fileExtension) && !conf2.VIDEO_FORMATS.includes(fileExtension)) {
|
|
44739
|
+
conf2.notify({
|
|
44710
44740
|
variant: "warning",
|
|
44711
|
-
header:
|
|
44712
|
-
body:
|
|
44741
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
44742
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
44713
44743
|
duration: 4000
|
|
44714
44744
|
});
|
|
44715
44745
|
return false;
|
|
44716
44746
|
}
|
|
44717
44747
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
44718
|
-
let errorBody =
|
|
44719
|
-
if (
|
|
44720
|
-
errorBody =
|
|
44748
|
+
let errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44749
|
+
if (conf2.AUDIO_FORMATS.includes(fileExtension) || conf2.VIDEO_FORMATS.includes(fileExtension)) {
|
|
44750
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44721
44751
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
44722
|
-
|
|
44752
|
+
conf2.notify({
|
|
44723
44753
|
variant: "warning",
|
|
44724
|
-
header:
|
|
44754
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44725
44755
|
body: errorBody,
|
|
44726
44756
|
button: isBasicPlan ? {
|
|
44727
|
-
text:
|
|
44728
|
-
onClick: () =>
|
|
44757
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44758
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44729
44759
|
} : undefined,
|
|
44730
44760
|
duration: 4000
|
|
44731
44761
|
});
|
|
44732
44762
|
return false;
|
|
44733
44763
|
}
|
|
44734
44764
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
44735
|
-
|
|
44765
|
+
conf2.notify({
|
|
44736
44766
|
variant: "warning",
|
|
44737
|
-
header:
|
|
44767
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44738
44768
|
body: errorBody,
|
|
44739
44769
|
button: isBasicPlan ? {
|
|
44740
|
-
text:
|
|
44741
|
-
onClick: () =>
|
|
44770
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44771
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44742
44772
|
} : undefined,
|
|
44743
44773
|
duration: 4000
|
|
44744
44774
|
});
|
|
@@ -44817,7 +44847,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
44817
44847
|
};
|
|
44818
44848
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
44819
44849
|
image2.onload = async () => {
|
|
44820
|
-
const parser =
|
|
44850
|
+
const parser = conf2.getDOMParser();
|
|
44821
44851
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
44822
44852
|
const svgElement = svgDoc.documentElement;
|
|
44823
44853
|
svgElement.removeAttribute("width");
|
|
@@ -45048,8 +45078,8 @@ class AudioItem extends Mbr {
|
|
|
45048
45078
|
this.subject.publish(this);
|
|
45049
45079
|
});
|
|
45050
45080
|
this.transformation.subject.subscribe(this.onTransform);
|
|
45051
|
-
this.right = this.left +
|
|
45052
|
-
this.bottom = this.top +
|
|
45081
|
+
this.right = this.left + conf2.AUDIO_DIMENSIONS.width;
|
|
45082
|
+
this.bottom = this.top + conf2.AUDIO_DIMENSIONS.height;
|
|
45053
45083
|
}
|
|
45054
45084
|
setCurrentTime(time2) {
|
|
45055
45085
|
this.currentTime = time2;
|
|
@@ -45116,8 +45146,8 @@ class AudioItem extends Mbr {
|
|
|
45116
45146
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
45117
45147
|
this.left = translateX;
|
|
45118
45148
|
this.top = translateY;
|
|
45119
|
-
this.right = this.left +
|
|
45120
|
-
this.bottom = this.top +
|
|
45149
|
+
this.right = this.left + conf2.AUDIO_DIMENSIONS.width * scaleX;
|
|
45150
|
+
this.bottom = this.top + conf2.AUDIO_DIMENSIONS.height * scaleY;
|
|
45121
45151
|
}
|
|
45122
45152
|
render(context) {
|
|
45123
45153
|
if (this.transformationRenderBlock) {
|
|
@@ -45146,8 +45176,8 @@ class AudioItem extends Mbr {
|
|
|
45146
45176
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
45147
45177
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
45148
45178
|
div.id = this.getId();
|
|
45149
|
-
div.style.width = `${
|
|
45150
|
-
div.style.height = `${
|
|
45179
|
+
div.style.width = `${conf2.AUDIO_DIMENSIONS.width}px`;
|
|
45180
|
+
div.style.height = `${conf2.AUDIO_DIMENSIONS.height}px`;
|
|
45151
45181
|
div.style.transformOrigin = "top left";
|
|
45152
45182
|
div.style.transform = transform;
|
|
45153
45183
|
div.style.position = "absolute";
|
|
@@ -45266,7 +45296,7 @@ class AudioItem extends Mbr {
|
|
|
45266
45296
|
}
|
|
45267
45297
|
download() {
|
|
45268
45298
|
if (this.extension) {
|
|
45269
|
-
const linkElem =
|
|
45299
|
+
const linkElem = conf2.documentFactory.createElement("a");
|
|
45270
45300
|
linkElem.href = this.url;
|
|
45271
45301
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
45272
45302
|
linkElem.click();
|
|
@@ -45668,7 +45698,7 @@ class ImageCommand {
|
|
|
45668
45698
|
|
|
45669
45699
|
// src/Items/Image/Image.ts
|
|
45670
45700
|
function getPlaceholderImage(board, imageDimension) {
|
|
45671
|
-
const placeholderCanvas =
|
|
45701
|
+
const placeholderCanvas = conf2.documentFactory.createElement("canvas");
|
|
45672
45702
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
45673
45703
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
45674
45704
|
const placeholder = new Placeholder;
|
|
@@ -46019,7 +46049,7 @@ class Drawing extends Mbr {
|
|
|
46019
46049
|
itemType = "Drawing";
|
|
46020
46050
|
parent = "Board";
|
|
46021
46051
|
transformation;
|
|
46022
|
-
path2d = new
|
|
46052
|
+
path2d = new conf2.path2DFactory;
|
|
46023
46053
|
subject = new Subject;
|
|
46024
46054
|
untransformedMbr = new Mbr;
|
|
46025
46055
|
lines = [];
|
|
@@ -46096,7 +46126,7 @@ class Drawing extends Mbr {
|
|
|
46096
46126
|
this.bottom = mbr.bottom;
|
|
46097
46127
|
}
|
|
46098
46128
|
updatePath2d() {
|
|
46099
|
-
this.path2d = new
|
|
46129
|
+
this.path2d = new conf2.path2DFactory;
|
|
46100
46130
|
const context = this.path2d;
|
|
46101
46131
|
const points = this.points;
|
|
46102
46132
|
if (points.length < 3) {
|
|
@@ -47269,9 +47299,9 @@ class Camera {
|
|
|
47269
47299
|
matrix = new Matrix2;
|
|
47270
47300
|
pointer = new Point;
|
|
47271
47301
|
window = {
|
|
47272
|
-
width:
|
|
47273
|
-
height:
|
|
47274
|
-
dpi:
|
|
47302
|
+
width: conf2.getDocumentWidth(),
|
|
47303
|
+
height: conf2.getDocumentHeight(),
|
|
47304
|
+
dpi: conf2.getDPI(),
|
|
47275
47305
|
getMbr: () => {
|
|
47276
47306
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
47277
47307
|
}
|
|
@@ -47647,9 +47677,9 @@ class Camera {
|
|
|
47647
47677
|
this.updateBoardPointer();
|
|
47648
47678
|
}
|
|
47649
47679
|
onWindowResize() {
|
|
47650
|
-
this.window.width =
|
|
47651
|
-
this.window.height =
|
|
47652
|
-
this.window.dpi =
|
|
47680
|
+
this.window.width = conf2.getDocumentWidth();
|
|
47681
|
+
this.window.height = conf2.getDocumentHeight();
|
|
47682
|
+
this.window.dpi = conf2.getDPI();
|
|
47653
47683
|
this.resizeSubject.publish(this);
|
|
47654
47684
|
this.subject.publish(this);
|
|
47655
47685
|
}
|
|
@@ -47662,10 +47692,10 @@ class Camera {
|
|
|
47662
47692
|
let y = 0;
|
|
47663
47693
|
const { activeKeys } = keyboard;
|
|
47664
47694
|
const directions = {
|
|
47665
|
-
ArrowRight: [-
|
|
47666
|
-
ArrowLeft: [
|
|
47667
|
-
ArrowDown: [0, -
|
|
47668
|
-
ArrowUp: [0,
|
|
47695
|
+
ArrowRight: [-conf2.NAVIGATION_STEP, 0],
|
|
47696
|
+
ArrowLeft: [conf2.NAVIGATION_STEP, 0],
|
|
47697
|
+
ArrowDown: [0, -conf2.NAVIGATION_STEP],
|
|
47698
|
+
ArrowUp: [0, conf2.NAVIGATION_STEP]
|
|
47669
47699
|
};
|
|
47670
47700
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
47671
47701
|
if (activeArrowKeys.length === 2) {
|
|
@@ -48198,7 +48228,7 @@ var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
|
48198
48228
|
|
|
48199
48229
|
// src/Keyboard/logHotkey.ts
|
|
48200
48230
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
48201
|
-
if (!
|
|
48231
|
+
if (!conf.LOG_HOTKEYS) {
|
|
48202
48232
|
return;
|
|
48203
48233
|
}
|
|
48204
48234
|
const isFunction = typeof hotkeyConfig === "function";
|
|
@@ -48290,7 +48320,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
48290
48320
|
// src/Keyboard/getHotkeyLabel.ts
|
|
48291
48321
|
function getHotkeyLabel(hotkey) {
|
|
48292
48322
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
48293
|
-
switch (
|
|
48323
|
+
switch (conf2.FORCE_HOTKEYS || "auto") {
|
|
48294
48324
|
case "windows":
|
|
48295
48325
|
return hotkeyLabel.windows;
|
|
48296
48326
|
case "macos":
|
|
@@ -50267,7 +50297,7 @@ class SpatialIndex {
|
|
|
50267
50297
|
this.itemsArray.push(item);
|
|
50268
50298
|
this.itemsIndex.insert(item);
|
|
50269
50299
|
}
|
|
50270
|
-
if (
|
|
50300
|
+
if (conf2.isNode()) {
|
|
50271
50301
|
return;
|
|
50272
50302
|
}
|
|
50273
50303
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -50834,8 +50864,8 @@ class Tool {
|
|
|
50834
50864
|
|
|
50835
50865
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
50836
50866
|
function getDecorationResizeType(point7, mbr, tolerance = 10) {
|
|
50837
|
-
for (const key in
|
|
50838
|
-
const decoration =
|
|
50867
|
+
for (const key in conf2.EXPORT_FRAME_DECORATIONS) {
|
|
50868
|
+
const decoration = conf2.EXPORT_FRAME_DECORATIONS[key];
|
|
50839
50869
|
const decorationBounds = {
|
|
50840
50870
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
50841
50871
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -50876,7 +50906,7 @@ class ExportSnapshot extends Tool {
|
|
|
50876
50906
|
super();
|
|
50877
50907
|
this.board = board;
|
|
50878
50908
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
50879
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
50909
|
+
this.mbr = new Mbr(cameraCenter.x - conf2.EXPORT_SELECTION_BOX_WIDTH / 2, cameraCenter.y - conf2.EXPORT_SELECTION_BOX_HEIGHT / 2, cameraCenter.x + conf2.EXPORT_SELECTION_BOX_WIDTH / 2, cameraCenter.y + conf2.EXPORT_SELECTION_BOX_HEIGHT / 2, "transparent", "transparent", 1);
|
|
50880
50910
|
this.board.selection.disable();
|
|
50881
50911
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
50882
50912
|
}
|
|
@@ -50888,11 +50918,11 @@ class ExportSnapshot extends Tool {
|
|
|
50888
50918
|
resize() {
|
|
50889
50919
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
50890
50920
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
50891
|
-
if (resize.mbr.getWidth() >
|
|
50921
|
+
if (resize.mbr.getWidth() > conf2.EXPORT_MIN_WIDTH) {
|
|
50892
50922
|
this.mbr.left = resize.mbr.left;
|
|
50893
50923
|
this.mbr.right = resize.mbr.right;
|
|
50894
50924
|
}
|
|
50895
|
-
if (resize.mbr.getHeight() >
|
|
50925
|
+
if (resize.mbr.getHeight() > conf2.EXPORT_MIN_HEIGHT) {
|
|
50896
50926
|
this.mbr.top = resize.mbr.top;
|
|
50897
50927
|
this.mbr.bottom = resize.mbr.bottom;
|
|
50898
50928
|
}
|
|
@@ -50981,7 +51011,7 @@ class ExportSnapshot extends Tool {
|
|
|
50981
51011
|
}
|
|
50982
51012
|
const res = await exportBoardSnapshot({
|
|
50983
51013
|
board: this.board,
|
|
50984
|
-
bgColor:
|
|
51014
|
+
bgColor: conf2.CANVAS_BG_COLOR,
|
|
50985
51015
|
selection: this.mbr,
|
|
50986
51016
|
upscaleTo: 4000,
|
|
50987
51017
|
nameToExport: this.board.getName()
|
|
@@ -51005,18 +51035,18 @@ class ExportSnapshot extends Tool {
|
|
|
51005
51035
|
const cameraMbr = context.camera.getMbr();
|
|
51006
51036
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
51007
51037
|
this.tempDrawingContext.clear();
|
|
51008
|
-
cameraMbr.backgroundColor =
|
|
51038
|
+
cameraMbr.backgroundColor = conf2.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
51009
51039
|
cameraMbr.strokeWidth = 0;
|
|
51010
51040
|
cameraMbr.render(this.tempDrawingContext);
|
|
51011
51041
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
51012
|
-
if (
|
|
51013
|
-
const topLeft =
|
|
51042
|
+
if (conf2.EXPORT_FRAME_DECORATIONS) {
|
|
51043
|
+
const topLeft = conf2.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
51014
51044
|
this.renderDecoration(this.tempDrawingContext, topLeft.path, this.mbr.left + (topLeft.offsetX ?? 0), this.mbr.top + (topLeft.offsetY ?? 0), topLeft.color, topLeft.lineWidth);
|
|
51015
|
-
const topRight =
|
|
51045
|
+
const topRight = conf2.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
51016
51046
|
this.renderDecoration(this.tempDrawingContext, topRight.path, this.mbr.right + (topRight.offsetX ?? 0), this.mbr.top + (topRight.offsetY ?? 0), topRight.color, topRight.lineWidth);
|
|
51017
|
-
const bottomLeft =
|
|
51047
|
+
const bottomLeft = conf2.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
51018
51048
|
this.renderDecoration(this.tempDrawingContext, bottomLeft.path, this.mbr.left + (bottomLeft.offsetX ?? 0), this.mbr.bottom + (bottomLeft.offsetY ?? 0), bottomLeft.color, bottomLeft.lineWidth);
|
|
51019
|
-
const bottomRight =
|
|
51049
|
+
const bottomRight = conf2.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
51020
51050
|
this.renderDecoration(this.tempDrawingContext, bottomRight.path, this.mbr.left + this.mbr.getWidth() - bottomRight.width, this.mbr.top + this.mbr.getHeight() - bottomRight.width, bottomRight.color, bottomRight.lineWidth);
|
|
51021
51051
|
}
|
|
51022
51052
|
}
|
|
@@ -51525,14 +51555,14 @@ class AddConnector extends BoardTool {
|
|
|
51525
51555
|
class AddDrawing extends BoardTool {
|
|
51526
51556
|
drawing = null;
|
|
51527
51557
|
isDown = false;
|
|
51528
|
-
strokeWidth =
|
|
51529
|
-
strokeColor =
|
|
51530
|
-
strokeStyle =
|
|
51558
|
+
strokeWidth = conf2.PEN_INITIAL_STROKE_WIDTH;
|
|
51559
|
+
strokeColor = conf2.PEN_DEFAULT_COLOR;
|
|
51560
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
51531
51561
|
constructor(board) {
|
|
51532
51562
|
super(board);
|
|
51533
51563
|
this.setCursor();
|
|
51534
|
-
if (
|
|
51535
|
-
const drawingSettings = localStorage.getItem(
|
|
51564
|
+
if (conf2.PEN_SETTINGS_KEY) {
|
|
51565
|
+
const drawingSettings = localStorage.getItem(conf2.PEN_SETTINGS_KEY);
|
|
51536
51566
|
if (drawingSettings) {
|
|
51537
51567
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
51538
51568
|
this.strokeWidth = strokeWidth;
|
|
@@ -51542,7 +51572,7 @@ class AddDrawing extends BoardTool {
|
|
|
51542
51572
|
}
|
|
51543
51573
|
}
|
|
51544
51574
|
updateSettings() {
|
|
51545
|
-
localStorage.setItem(
|
|
51575
|
+
localStorage.setItem(conf2.PEN_SETTINGS_KEY, JSON.stringify({
|
|
51546
51576
|
strokeWidth: this.strokeWidth,
|
|
51547
51577
|
strokeColor: this.strokeColor,
|
|
51548
51578
|
strokeStyle: this.strokeStyle
|
|
@@ -51572,7 +51602,7 @@ class AddDrawing extends BoardTool {
|
|
|
51572
51602
|
ctx.beginPath();
|
|
51573
51603
|
ctx.arc(point7.x, point7.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
51574
51604
|
ctx.lineWidth = 1;
|
|
51575
|
-
ctx.strokeStyle =
|
|
51605
|
+
ctx.strokeStyle = conf2.PEN_POINTER_CIRCLE_COLOR;
|
|
51576
51606
|
ctx.stroke();
|
|
51577
51607
|
}
|
|
51578
51608
|
setCursor() {
|
|
@@ -51654,7 +51684,7 @@ class AddDrawing extends BoardTool {
|
|
|
51654
51684
|
this.setCursor();
|
|
51655
51685
|
};
|
|
51656
51686
|
render(context) {
|
|
51657
|
-
if (
|
|
51687
|
+
if (conf2.PEN_RENDER_POINTER_CIRCLE) {
|
|
51658
51688
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
51659
51689
|
}
|
|
51660
51690
|
if (!this.drawing) {
|
|
@@ -51669,14 +51699,14 @@ class AddDrawing extends BoardTool {
|
|
|
51669
51699
|
}
|
|
51670
51700
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
51671
51701
|
class AddHighlighter extends AddDrawing {
|
|
51672
|
-
strokeWidth =
|
|
51673
|
-
strokeColor =
|
|
51674
|
-
strokeStyle =
|
|
51702
|
+
strokeWidth = conf2.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
51703
|
+
strokeColor = conf2.HIGHLIGHTER_DEFAULT_COLOR;
|
|
51704
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
51675
51705
|
constructor(board) {
|
|
51676
51706
|
super(board);
|
|
51677
51707
|
this.setCursor();
|
|
51678
|
-
if (
|
|
51679
|
-
const highlighterSettings = localStorage.getItem(
|
|
51708
|
+
if (conf2.HIGHLIGHTER_SETTINGS_KEY) {
|
|
51709
|
+
const highlighterSettings = localStorage.getItem(conf2.HIGHLIGHTER_SETTINGS_KEY);
|
|
51680
51710
|
if (highlighterSettings) {
|
|
51681
51711
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
51682
51712
|
this.strokeWidth = strokeWidth;
|
|
@@ -51689,7 +51719,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
51689
51719
|
return true;
|
|
51690
51720
|
}
|
|
51691
51721
|
updateSettings() {
|
|
51692
|
-
localStorage.setItem(
|
|
51722
|
+
localStorage.setItem(conf2.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
51693
51723
|
strokeWidth: this.strokeWidth,
|
|
51694
51724
|
strokeColor: this.strokeColor,
|
|
51695
51725
|
strokeStyle: this.strokeStyle
|
|
@@ -52013,7 +52043,7 @@ class AddShape extends BoardTool {
|
|
|
52013
52043
|
const point7 = this.board.pointer.point;
|
|
52014
52044
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52015
52045
|
this.bounds = this.line.getMbr();
|
|
52016
|
-
this.bounds.borderColor =
|
|
52046
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52017
52047
|
this.shape.apply({
|
|
52018
52048
|
class: "Shape",
|
|
52019
52049
|
method: "setShapeType",
|
|
@@ -52037,7 +52067,7 @@ class AddShape extends BoardTool {
|
|
|
52037
52067
|
}
|
|
52038
52068
|
this.line = new Line(startPoint, endPoint);
|
|
52039
52069
|
this.bounds = this.line.getMbr();
|
|
52040
|
-
this.bounds.borderColor =
|
|
52070
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52041
52071
|
this.initTransformation();
|
|
52042
52072
|
this.board.tools.publish();
|
|
52043
52073
|
return true;
|
|
@@ -52109,7 +52139,7 @@ class AddShape extends BoardTool {
|
|
|
52109
52139
|
const y = (top + bottom) / 2 - 50;
|
|
52110
52140
|
this.bounds = new Mbr(x, y, x, y);
|
|
52111
52141
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
52112
|
-
this.bounds.borderColor =
|
|
52142
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52113
52143
|
this.shape.apply({
|
|
52114
52144
|
class: "Shape",
|
|
52115
52145
|
method: "setShapeType",
|
|
@@ -52142,8 +52172,8 @@ class AddSticker extends BoardTool {
|
|
|
52142
52172
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
52143
52173
|
}
|
|
52144
52174
|
setCursor(color2) {
|
|
52145
|
-
if (
|
|
52146
|
-
const colorName = color2 ?
|
|
52175
|
+
if (conf2.STICKER_COLOR_NAMES) {
|
|
52176
|
+
const colorName = color2 ? conf2.STICKER_COLOR_NAMES[conf2.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
52147
52177
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
52148
52178
|
} else {
|
|
52149
52179
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -52167,7 +52197,7 @@ class AddSticker extends BoardTool {
|
|
|
52167
52197
|
const point7 = this.board.pointer.point;
|
|
52168
52198
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52169
52199
|
this.bounds = this.line.getMbr();
|
|
52170
|
-
this.bounds.borderColor =
|
|
52200
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52171
52201
|
this.board.tools.publish();
|
|
52172
52202
|
return true;
|
|
52173
52203
|
}
|
|
@@ -52176,7 +52206,7 @@ class AddSticker extends BoardTool {
|
|
|
52176
52206
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
52177
52207
|
this.sticker.applyDiagonal(this.line);
|
|
52178
52208
|
this.bounds = this.sticker.getMbr();
|
|
52179
|
-
this.bounds.borderColor =
|
|
52209
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52180
52210
|
this.board.tools.publish();
|
|
52181
52211
|
return true;
|
|
52182
52212
|
}
|
|
@@ -52276,7 +52306,7 @@ class AddText extends BoardTool {
|
|
|
52276
52306
|
const point7 = this.board.pointer.point;
|
|
52277
52307
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52278
52308
|
this.bounds = this.line.getMbr();
|
|
52279
|
-
this.bounds.borderColor =
|
|
52309
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52280
52310
|
this.board.tools.publish();
|
|
52281
52311
|
return true;
|
|
52282
52312
|
}
|
|
@@ -52287,7 +52317,7 @@ class AddText extends BoardTool {
|
|
|
52287
52317
|
const end2 = new Point(cursorPoint.x, start2.y + height2);
|
|
52288
52318
|
this.line = new Line(start2, end2);
|
|
52289
52319
|
this.bounds = this.line.getMbr();
|
|
52290
|
-
this.bounds.borderColor =
|
|
52320
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52291
52321
|
this.board.tools.publish();
|
|
52292
52322
|
return true;
|
|
52293
52323
|
}
|
|
@@ -52352,11 +52382,11 @@ class AddText extends BoardTool {
|
|
|
52352
52382
|
class Eraser extends BoardTool {
|
|
52353
52383
|
itemType = "Eraser";
|
|
52354
52384
|
isDown = false;
|
|
52355
|
-
strokeWidth =
|
|
52356
|
-
strokeColor =
|
|
52357
|
-
strokeStyle =
|
|
52385
|
+
strokeWidth = conf2.ERASER_STROKE_WIDTH;
|
|
52386
|
+
strokeColor = conf2.ERASER_DEFAULT_COLOR;
|
|
52387
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
52358
52388
|
drawing = new Drawing(this.board, []);
|
|
52359
|
-
maxPointsInLine =
|
|
52389
|
+
maxPointsInLine = conf2.ERASER_MAX_LINE_LENGTH;
|
|
52360
52390
|
constructor(board) {
|
|
52361
52391
|
super(board);
|
|
52362
52392
|
this.setCursor();
|
|
@@ -52518,7 +52548,7 @@ function createCanvasDrawer(board) {
|
|
|
52518
52548
|
borderDiv.id = "canvasBorder";
|
|
52519
52549
|
borderDiv.style.position = "absolute";
|
|
52520
52550
|
borderDiv.style.transformOrigin = "left top";
|
|
52521
|
-
borderDiv.style.border = `1px solid ${
|
|
52551
|
+
borderDiv.style.border = `1px solid ${conf2.SELECTION_COLOR}`;
|
|
52522
52552
|
borderDiv.style.boxSizing = "border-box";
|
|
52523
52553
|
borderDiv.style.left = `${leftOffset}px`;
|
|
52524
52554
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -52528,7 +52558,7 @@ function createCanvasDrawer(board) {
|
|
|
52528
52558
|
canvas.style.boxSizing = "border-box";
|
|
52529
52559
|
container.appendChild(borderDiv);
|
|
52530
52560
|
} else {
|
|
52531
|
-
canvas.style.border = `1px solid ${
|
|
52561
|
+
canvas.style.border = `1px solid ${conf2.SELECTION_COLOR}`;
|
|
52532
52562
|
canvas.style.boxSizing = "border-box";
|
|
52533
52563
|
}
|
|
52534
52564
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -52536,8 +52566,8 @@ function createCanvasDrawer(board) {
|
|
|
52536
52566
|
anchorDiv.style.position = "absolute";
|
|
52537
52567
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
52538
52568
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
52539
|
-
anchorDiv.style.backgroundColor = `${
|
|
52540
|
-
anchorDiv.style.border = `${
|
|
52569
|
+
anchorDiv.style.backgroundColor = `${conf2.SELECTION_ANCHOR_COLOR}`;
|
|
52570
|
+
anchorDiv.style.border = `${conf2.SELECTION_ANCHOR_WIDTH}px solid ${conf2.SELECTION_COLOR}`;
|
|
52541
52571
|
anchorDiv.style.borderRadius = "2px";
|
|
52542
52572
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
52543
52573
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -52545,10 +52575,10 @@ function createCanvasDrawer(board) {
|
|
|
52545
52575
|
return anchorDiv;
|
|
52546
52576
|
};
|
|
52547
52577
|
const anchors = [
|
|
52548
|
-
createAnchorDiv("0%", "0%",
|
|
52549
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
52550
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
52551
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
52578
|
+
createAnchorDiv("0%", "0%", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52579
|
+
createAnchorDiv("100% + 1px", "0%", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52580
|
+
createAnchorDiv("0%", "100% + 1px", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52581
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf2.SELECTION_ANCHOR_RADIUS)
|
|
52552
52582
|
];
|
|
52553
52583
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
52554
52584
|
for (const anchor of anchors) {
|
|
@@ -53890,8 +53920,8 @@ class Select extends Tool {
|
|
|
53890
53920
|
const { x, y } = pointer.point;
|
|
53891
53921
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
53892
53922
|
this.rect = this.line.getMbr();
|
|
53893
|
-
this.rect.borderColor =
|
|
53894
|
-
this.rect.backgroundColor =
|
|
53923
|
+
this.rect.borderColor = conf2.SELECTION_COLOR;
|
|
53924
|
+
this.rect.backgroundColor = conf2.SELECTION_BACKGROUND;
|
|
53895
53925
|
this.board.tools.publish();
|
|
53896
53926
|
this.board.presence.throttledEmit({
|
|
53897
53927
|
method: "DrawSelect",
|
|
@@ -53976,8 +54006,8 @@ class Select extends Tool {
|
|
|
53976
54006
|
const point7 = this.board.pointer.point.copy();
|
|
53977
54007
|
this.line = new Line(this.line.start, point7);
|
|
53978
54008
|
this.rect = this.line.getMbr();
|
|
53979
|
-
this.rect.borderColor =
|
|
53980
|
-
this.rect.backgroundColor =
|
|
54009
|
+
this.rect.borderColor = conf2.SELECTION_COLOR;
|
|
54010
|
+
this.rect.backgroundColor = conf2.SELECTION_BACKGROUND;
|
|
53981
54011
|
this.board.tools.publish();
|
|
53982
54012
|
this.board.presence.throttledEmit({
|
|
53983
54013
|
method: "DrawSelect",
|
|
@@ -55111,7 +55141,7 @@ class Board {
|
|
|
55111
55141
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
55112
55142
|
const css = INDEX_CSS;
|
|
55113
55143
|
const boardName = this.getName() || this.getBoardId();
|
|
55114
|
-
const items = this.items.getWholeHTML(
|
|
55144
|
+
const items = this.items.getWholeHTML(conf2.documentFactory);
|
|
55115
55145
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
55116
55146
|
const scripts = `
|
|
55117
55147
|
<script type="module">${customTagsScript}</script>
|
|
@@ -55151,7 +55181,7 @@ class Board {
|
|
|
55151
55181
|
return `${head}${body}`;
|
|
55152
55182
|
}
|
|
55153
55183
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
55154
|
-
const parser =
|
|
55184
|
+
const parser = conf2.getDOMParser();
|
|
55155
55185
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
55156
55186
|
const items = doc.body.querySelector("#items");
|
|
55157
55187
|
if (items) {
|
|
@@ -55203,7 +55233,7 @@ class Board {
|
|
|
55203
55233
|
return [];
|
|
55204
55234
|
}
|
|
55205
55235
|
deserializeHTML(stringedHTML) {
|
|
55206
|
-
const parser =
|
|
55236
|
+
const parser = conf2.getDOMParser();
|
|
55207
55237
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
55208
55238
|
const itemsDiv = doc.body.querySelector("#items");
|
|
55209
55239
|
if (!itemsDiv) {
|
|
@@ -55764,7 +55794,7 @@ class RichTextCommand {
|
|
|
55764
55794
|
item: id,
|
|
55765
55795
|
operation: {
|
|
55766
55796
|
...this.operation,
|
|
55767
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
55797
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf2.DEFAULT_TEXT_STYLES.fontColor
|
|
55768
55798
|
}
|
|
55769
55799
|
}));
|
|
55770
55800
|
case "setBlockType":
|
|
@@ -55788,7 +55818,7 @@ class RichTextCommand {
|
|
|
55788
55818
|
item: id,
|
|
55789
55819
|
operation: {
|
|
55790
55820
|
...this.operation,
|
|
55791
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
55821
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf2.DEFAULT_TEXT_STYLES.fontFamily
|
|
55792
55822
|
}
|
|
55793
55823
|
}));
|
|
55794
55824
|
case "setFontSize":
|
|
@@ -55796,7 +55826,7 @@ class RichTextCommand {
|
|
|
55796
55826
|
item: id,
|
|
55797
55827
|
operation: {
|
|
55798
55828
|
...this.operation,
|
|
55799
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
55829
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf2.DEFAULT_TEXT_STYLES.fontSize
|
|
55800
55830
|
}
|
|
55801
55831
|
}));
|
|
55802
55832
|
case "setFontHighlight":
|
|
@@ -55804,7 +55834,7 @@ class RichTextCommand {
|
|
|
55804
55834
|
item: id,
|
|
55805
55835
|
operation: {
|
|
55806
55836
|
...this.operation,
|
|
55807
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
55837
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf2.DEFAULT_TEXT_STYLES.fontHighlight
|
|
55808
55838
|
}
|
|
55809
55839
|
}));
|
|
55810
55840
|
case "setHorisontalAlignment":
|
|
@@ -57145,7 +57175,7 @@ class Transformer extends Tool {
|
|
|
57145
57175
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
57146
57176
|
if (mbr) {
|
|
57147
57177
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
57148
|
-
const selectionColor = isLockedItems ?
|
|
57178
|
+
const selectionColor = isLockedItems ? conf2.SELECTION_LOCKED_COLOR : conf2.SELECTION_COLOR;
|
|
57149
57179
|
mbr.borderColor = selectionColor;
|
|
57150
57180
|
mbr.render(context);
|
|
57151
57181
|
}
|
|
@@ -57171,7 +57201,7 @@ class Transformer extends Tool {
|
|
|
57171
57201
|
new Point(right, bottom)
|
|
57172
57202
|
];
|
|
57173
57203
|
for (const point7 of points) {
|
|
57174
|
-
const circle = new Anchor(point7.x, point7.y,
|
|
57204
|
+
const circle = new Anchor(point7.x, point7.y, conf2.SELECTION_ANCHOR_RADIUS, conf2.SELECTION_COLOR, conf2.SELECTION_ANCHOR_COLOR, conf2.SELECTION_ANCHOR_WIDTH);
|
|
57175
57205
|
anchors.push(circle);
|
|
57176
57206
|
}
|
|
57177
57207
|
}
|
|
@@ -58374,7 +58404,7 @@ class Selection2 {
|
|
|
58374
58404
|
renderItemMbr(context, item, customScale) {
|
|
58375
58405
|
const mbr = item.getMbr();
|
|
58376
58406
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
58377
|
-
const selectionColor = item.transformation.isLocked ?
|
|
58407
|
+
const selectionColor = item.transformation.isLocked ? conf2.SELECTION_LOCKED_COLOR : conf2.SELECTION_COLOR;
|
|
58378
58408
|
mbr.borderColor = selectionColor;
|
|
58379
58409
|
mbr.render(context);
|
|
58380
58410
|
}
|
|
@@ -59229,19 +59259,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
59229
59259
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
59230
59260
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
59231
59261
|
const transformed = { ...toTransform };
|
|
59232
|
-
const
|
|
59262
|
+
const conf3 = confirmed.path;
|
|
59233
59263
|
const path3 = transformed.path;
|
|
59234
|
-
if (Path3.equals(
|
|
59264
|
+
if (Path3.equals(conf3, path3)) {
|
|
59235
59265
|
return transformed;
|
|
59236
59266
|
}
|
|
59237
|
-
const isDescendant = path3.length >
|
|
59267
|
+
const isDescendant = path3.length > conf3.length && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i]);
|
|
59238
59268
|
if (isDescendant) {
|
|
59239
59269
|
const newPath = [...path3];
|
|
59240
59270
|
newPath[0] = newPath[0] + 1;
|
|
59241
59271
|
transformed.path = newPath;
|
|
59242
59272
|
return transformed;
|
|
59243
59273
|
}
|
|
59244
|
-
if (Path3.isBefore(
|
|
59274
|
+
if (Path3.isBefore(conf3, path3)) {
|
|
59245
59275
|
transformPath(confirmed, transformed);
|
|
59246
59276
|
}
|
|
59247
59277
|
return transformed;
|
|
@@ -59250,23 +59280,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
59250
59280
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
59251
59281
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
59252
59282
|
const transformed = { ...toTransform };
|
|
59253
|
-
const
|
|
59283
|
+
const conf3 = confirmed.path;
|
|
59254
59284
|
const path3 = transformed.path;
|
|
59255
|
-
if (Path3.equals(
|
|
59285
|
+
if (Path3.equals(conf3, path3)) {
|
|
59256
59286
|
return transformed;
|
|
59257
59287
|
}
|
|
59258
|
-
if (path3.length ===
|
|
59288
|
+
if (path3.length === conf3.length + 1 && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i])) {
|
|
59259
59289
|
const newPath = [...path3];
|
|
59260
|
-
if (
|
|
59290
|
+
if (conf3.length === 1) {
|
|
59261
59291
|
newPath[0] = newPath[0] + 1;
|
|
59262
59292
|
} else {
|
|
59263
|
-
newPath[
|
|
59293
|
+
newPath[conf3.length] = newPath[conf3.length] + 1;
|
|
59264
59294
|
}
|
|
59265
59295
|
transformed.path = newPath;
|
|
59266
59296
|
return transformed;
|
|
59267
59297
|
}
|
|
59268
|
-
const isDescendant = path3.length >
|
|
59269
|
-
if (Path3.isBefore(
|
|
59298
|
+
const isDescendant = path3.length > conf3.length && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i]);
|
|
59299
|
+
if (Path3.isBefore(conf3, path3) && !isDescendant) {
|
|
59270
59300
|
transformPath(confirmed, transformed);
|
|
59271
59301
|
}
|
|
59272
59302
|
return transformed;
|
|
@@ -59846,8 +59876,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
59846
59876
|
const transformed = [];
|
|
59847
59877
|
for (const transf of toTransform) {
|
|
59848
59878
|
let actualyTransformed = { ...transf };
|
|
59849
|
-
for (const
|
|
59850
|
-
const { operation: confOp } =
|
|
59879
|
+
for (const conf3 of confirmed) {
|
|
59880
|
+
const { operation: confOp } = conf3.body;
|
|
59851
59881
|
const { operation: transfOp } = actualyTransformed.body;
|
|
59852
59882
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
59853
59883
|
if (transformedOp) {
|
|
@@ -60479,7 +60509,7 @@ class Events2 {
|
|
|
60479
60509
|
return record !== null;
|
|
60480
60510
|
}
|
|
60481
60511
|
sendPresenceEvent(event) {
|
|
60482
|
-
|
|
60512
|
+
conf2.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
60483
60513
|
}
|
|
60484
60514
|
canUndoEvent(op, byUserId) {
|
|
60485
60515
|
if (op.method === "undo") {
|
|
@@ -60588,7 +60618,7 @@ function handleChatChunk(chunk, board) {
|
|
|
60588
60618
|
if (chunk.isExternalApiError) {
|
|
60589
60619
|
const editor = item2.getRichText().editor;
|
|
60590
60620
|
editor.clearText();
|
|
60591
|
-
editor.insertCopiedText(
|
|
60621
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60592
60622
|
}
|
|
60593
60623
|
}
|
|
60594
60624
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -60596,9 +60626,9 @@ function handleChatChunk(chunk, board) {
|
|
|
60596
60626
|
}
|
|
60597
60627
|
console.log("Error AI generate", chunk.error);
|
|
60598
60628
|
if (!chunk.isExternalApiError) {
|
|
60599
|
-
|
|
60600
|
-
header:
|
|
60601
|
-
body:
|
|
60629
|
+
conf2.notify({
|
|
60630
|
+
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
60631
|
+
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
60602
60632
|
variant: "error",
|
|
60603
60633
|
duration: 4000
|
|
60604
60634
|
});
|
|
@@ -60608,9 +60638,9 @@ function handleChatChunk(chunk, board) {
|
|
|
60608
60638
|
default:
|
|
60609
60639
|
board.camera.unsubscribeFromItem();
|
|
60610
60640
|
if (!chunk.isExternalApiError) {
|
|
60611
|
-
|
|
60612
|
-
header:
|
|
60613
|
-
body:
|
|
60641
|
+
conf2.notify({
|
|
60642
|
+
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
60643
|
+
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
60614
60644
|
variant: "error",
|
|
60615
60645
|
duration: 4000
|
|
60616
60646
|
});
|
|
@@ -60625,7 +60655,7 @@ function handleChatChunk(chunk, board) {
|
|
|
60625
60655
|
if (chunk.isExternalApiError) {
|
|
60626
60656
|
const editor = item2.getRichText().editor;
|
|
60627
60657
|
editor.clearText();
|
|
60628
|
-
editor.insertCopiedText(
|
|
60658
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60629
60659
|
}
|
|
60630
60660
|
}
|
|
60631
60661
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -60652,7 +60682,7 @@ function handleAudioGenerate(response, board) {
|
|
|
60652
60682
|
}
|
|
60653
60683
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
60654
60684
|
const { left, top, right } = placeholderNode.getMbr();
|
|
60655
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
60685
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf2.AUDIO_DIMENSIONS.width) / 2, top);
|
|
60656
60686
|
audio.updateMbr();
|
|
60657
60687
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
60658
60688
|
board.remove(placeholderNode, false);
|
|
@@ -60674,7 +60704,7 @@ function handleAudioGenerate(response, board) {
|
|
|
60674
60704
|
type: "audio/wav"
|
|
60675
60705
|
});
|
|
60676
60706
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
60677
|
-
const linkElem =
|
|
60707
|
+
const linkElem = conf2.documentFactory.createElement("a");
|
|
60678
60708
|
linkElem.href = audioUrl2;
|
|
60679
60709
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
60680
60710
|
linkElem.click();
|
|
@@ -60693,9 +60723,9 @@ function handleAudioGenerate(response, board) {
|
|
|
60693
60723
|
board.selection.add(placeholderNode);
|
|
60694
60724
|
}
|
|
60695
60725
|
console.error("Audio generation error:", response.message);
|
|
60696
|
-
|
|
60697
|
-
header:
|
|
60698
|
-
body:
|
|
60726
|
+
conf2.notify({
|
|
60727
|
+
header: conf2.i18n.t("AIInput.audioGenerationError.header"),
|
|
60728
|
+
body: conf2.i18n.t("AIInput.audioGenerationError.body"),
|
|
60699
60729
|
variant: "error",
|
|
60700
60730
|
duration: 4000
|
|
60701
60731
|
});
|
|
@@ -60758,14 +60788,14 @@ function handleImageGenerate(response, board) {
|
|
|
60758
60788
|
board.selection.add(item);
|
|
60759
60789
|
const editor = item.getRichText()?.editor;
|
|
60760
60790
|
editor?.clearText();
|
|
60761
|
-
editor?.insertCopiedText(
|
|
60791
|
+
editor?.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60762
60792
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
60763
60793
|
}
|
|
60764
60794
|
}
|
|
60765
60795
|
} else {
|
|
60766
|
-
|
|
60767
|
-
header:
|
|
60768
|
-
body:
|
|
60796
|
+
conf2.notify({
|
|
60797
|
+
header: conf2.i18n.t("AIInput.imageGenerationError.header"),
|
|
60798
|
+
body: conf2.i18n.t("AIInput.imageGenerationError.body"),
|
|
60769
60799
|
variant: "error",
|
|
60770
60800
|
duration: 4000
|
|
60771
60801
|
});
|
|
@@ -60832,10 +60862,10 @@ function startIntervals(board) {
|
|
|
60832
60862
|
}
|
|
60833
60863
|
log.publishIntervalTimer = setInterval(() => {
|
|
60834
60864
|
tryPublishEvent(board);
|
|
60835
|
-
},
|
|
60865
|
+
}, conf2.EVENTS_PUBLISH_INTERVAL);
|
|
60836
60866
|
log.resendIntervalTimer = setInterval(() => {
|
|
60837
60867
|
tryResendEvent(board);
|
|
60838
|
-
},
|
|
60868
|
+
}, conf2.EVENTS_RESEND_INTERVAL);
|
|
60839
60869
|
}
|
|
60840
60870
|
function tryPublishEvent(board) {
|
|
60841
60871
|
const { log } = board.events;
|
|
@@ -60854,14 +60884,14 @@ function tryResendEvent(board) {
|
|
|
60854
60884
|
return;
|
|
60855
60885
|
}
|
|
60856
60886
|
const date = Date.now();
|
|
60857
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
60887
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf2.EVENTS_RESEND_INTERVAL;
|
|
60858
60888
|
if (!isTimeToSendPendingEvent) {
|
|
60859
60889
|
return;
|
|
60860
60890
|
}
|
|
60861
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
60891
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf2.EVENTS_RESEND_INTERVAL * 5;
|
|
60862
60892
|
if (isProbablyLostConnection) {
|
|
60863
60893
|
board.presence.clear();
|
|
60864
|
-
|
|
60894
|
+
conf2.connection?.notifyAboutLostConnection();
|
|
60865
60895
|
}
|
|
60866
60896
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
60867
60897
|
}
|
|
@@ -60892,12 +60922,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
60892
60922
|
lastKnownOrder: log.getLastIndex()
|
|
60893
60923
|
}
|
|
60894
60924
|
};
|
|
60895
|
-
|
|
60925
|
+
conf2.connection.send({
|
|
60896
60926
|
type: "BoardEvent",
|
|
60897
60927
|
boardId: board.getBoardId(),
|
|
60898
60928
|
event: toSend,
|
|
60899
60929
|
sequenceNumber,
|
|
60900
|
-
userId:
|
|
60930
|
+
userId: conf2.connection.getCurrentUser()
|
|
60901
60931
|
});
|
|
60902
60932
|
const date = Date.now();
|
|
60903
60933
|
log.pendingEvent = {
|
|
@@ -60943,7 +60973,7 @@ function handleConfirmation(msg2, board) {
|
|
|
60943
60973
|
if (!isPendingEventConfirmation) {
|
|
60944
60974
|
return;
|
|
60945
60975
|
}
|
|
60946
|
-
|
|
60976
|
+
conf2.connection?.dismissNotificationAboutLostConnection();
|
|
60947
60977
|
log.currentSequenceNumber++;
|
|
60948
60978
|
log.pendingEvent.event.order = msg2.order;
|
|
60949
60979
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -60955,7 +60985,7 @@ function handleConfirmation(msg2, board) {
|
|
|
60955
60985
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
60956
60986
|
function handleCreateSnapshotRequestMessage(msg2, board) {
|
|
60957
60987
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
60958
|
-
|
|
60988
|
+
conf2.connection.send({
|
|
60959
60989
|
type: "BoardSnapshot",
|
|
60960
60990
|
boardId,
|
|
60961
60991
|
snapshot,
|
|
@@ -60986,9 +61016,9 @@ function handleModeMessage(message, board) {
|
|
|
60986
61016
|
if (isTemplateView()) {
|
|
60987
61017
|
return;
|
|
60988
61018
|
}
|
|
60989
|
-
|
|
60990
|
-
header:
|
|
60991
|
-
body: message.mode === "edit" ?
|
|
61019
|
+
conf2.notify({
|
|
61020
|
+
header: conf2.i18n.t("sharing.settingsChanged.heading"),
|
|
61021
|
+
body: message.mode === "edit" ? conf2.i18n.t("sharing.settingsChanged.bodyEdit") : conf2.i18n.t("sharing.settingsChanged.bodyView"),
|
|
60992
61022
|
duration: 5000
|
|
60993
61023
|
});
|
|
60994
61024
|
}
|
|
@@ -61025,7 +61055,7 @@ messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
|
61025
61055
|
// src/api/getMeasureCtx.ts
|
|
61026
61056
|
function getMeasureCtx() {
|
|
61027
61057
|
if (typeof document !== "undefined") {
|
|
61028
|
-
const measureCanvas =
|
|
61058
|
+
const measureCanvas = conf2.documentFactory.createElement("canvas");
|
|
61029
61059
|
const measureCtx = measureCanvas.getContext("2d");
|
|
61030
61060
|
if (!measureCtx) {
|
|
61031
61061
|
throw new Error("Failde to create canvas and get 2d context");
|
|
@@ -64079,20 +64109,20 @@ var resources = {
|
|
|
64079
64109
|
};
|
|
64080
64110
|
function initI18N(isNode = false) {
|
|
64081
64111
|
instance.use(initReactI18next).use(Browser).init({
|
|
64082
|
-
debug:
|
|
64112
|
+
debug: conf2.debug,
|
|
64083
64113
|
detection: {
|
|
64084
64114
|
order: ["navigator"]
|
|
64085
64115
|
},
|
|
64086
64116
|
supportedLngs: ["en", "ru"],
|
|
64087
64117
|
defaultNS,
|
|
64088
64118
|
resources,
|
|
64089
|
-
fallbackLng:
|
|
64119
|
+
fallbackLng: conf2.FALLBACK_LNG,
|
|
64090
64120
|
interpolation: {
|
|
64091
64121
|
escapeValue: false
|
|
64092
64122
|
}
|
|
64093
64123
|
});
|
|
64094
|
-
|
|
64095
|
-
|
|
64124
|
+
conf2.i18n = instance;
|
|
64125
|
+
conf2.planNames = {
|
|
64096
64126
|
basic: instance.t("userPlan.plans.basic.name"),
|
|
64097
64127
|
plus: instance.t("userPlan.plans.plus.name")
|
|
64098
64128
|
};
|
|
@@ -64106,7 +64136,7 @@ function getBrowserDOMParser() {
|
|
|
64106
64136
|
|
|
64107
64137
|
// src/api/initPaths.ts
|
|
64108
64138
|
function initPaths(path2D) {
|
|
64109
|
-
|
|
64139
|
+
conf2.EXPORT_FRAME_DECORATIONS = {
|
|
64110
64140
|
"top-left": {
|
|
64111
64141
|
path: new path2D("M13 1H1V13"),
|
|
64112
64142
|
lineWidth: 2,
|
|
@@ -64148,23 +64178,23 @@ function initPaths(path2D) {
|
|
|
64148
64178
|
|
|
64149
64179
|
// src/api/initBrowserSettings.ts
|
|
64150
64180
|
function initBrowserSettings() {
|
|
64151
|
-
|
|
64152
|
-
|
|
64153
|
-
|
|
64154
|
-
|
|
64155
|
-
|
|
64156
|
-
|
|
64157
|
-
|
|
64181
|
+
conf2.documentFactory = new BrowserDocumentFactory;
|
|
64182
|
+
conf2.path2DFactory = BrowserPath2D;
|
|
64183
|
+
conf2.measureCtx = getMeasureCtx();
|
|
64184
|
+
conf2.getDocumentWidth = () => document.documentElement.clientWidth;
|
|
64185
|
+
conf2.getDocumentHeight = () => document.documentElement.clientHeight;
|
|
64186
|
+
conf2.getDPI = () => window.devicePixelRatio;
|
|
64187
|
+
conf2.getDOMParser = getBrowserDOMParser;
|
|
64158
64188
|
initI18N();
|
|
64159
64189
|
initPaths(BrowserPath2D);
|
|
64160
|
-
|
|
64190
|
+
conf2.reactEditorFocus = (editor) => {
|
|
64161
64191
|
try {
|
|
64162
64192
|
ReactEditor.focus(editor);
|
|
64163
64193
|
} catch (e) {
|
|
64164
64194
|
console.warn("Failed to focus editor:", e);
|
|
64165
64195
|
}
|
|
64166
64196
|
};
|
|
64167
|
-
|
|
64197
|
+
conf2.reactEditorToSlatePoint = (editor, domNode, offset, options) => {
|
|
64168
64198
|
try {
|
|
64169
64199
|
return ReactEditor.toSlatePoint(editor, [domNode, offset], options);
|
|
64170
64200
|
} catch (e) {
|
|
@@ -64172,7 +64202,7 @@ function initBrowserSettings() {
|
|
|
64172
64202
|
return null;
|
|
64173
64203
|
}
|
|
64174
64204
|
};
|
|
64175
|
-
return
|
|
64205
|
+
return conf2;
|
|
64176
64206
|
}
|
|
64177
64207
|
|
|
64178
64208
|
// src/browser.ts
|