microboard-temp 0.1.10 → 0.1.12
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 +260 -256
- package/dist/cjs/index.js +244 -240
- package/dist/cjs/node.js +251 -247
- package/dist/esm/browser.js +260 -256
- package/dist/esm/index.js +244 -240
- package/dist/esm/node.js +251 -247
- package/dist/types/Keyboard/getHotkeyLabel.d.ts +1 -1
- package/dist/types/Keyboard/logHotkey.d.ts +3 -3
- package/dist/types/Settings.d.ts +5 -14
- package/package.json +1 -1
package/dist/esm/browser.js
CHANGED
|
@@ -5064,7 +5064,7 @@ var ExportQuality;
|
|
|
5064
5064
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
5065
5065
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
5066
5066
|
})(ExportQuality ||= {});
|
|
5067
|
-
var
|
|
5067
|
+
var conf2 = {
|
|
5068
5068
|
connection: undefined,
|
|
5069
5069
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
5070
5070
|
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : undefined,
|
|
@@ -5384,7 +5384,11 @@ var conf = {
|
|
|
5384
5384
|
overline: false,
|
|
5385
5385
|
subscript: false,
|
|
5386
5386
|
superscript: false
|
|
5387
|
-
}
|
|
5387
|
+
},
|
|
5388
|
+
LOG_HOTKEYS: false,
|
|
5389
|
+
FORCE_HOTKEYS: "auto",
|
|
5390
|
+
debug: false,
|
|
5391
|
+
FALLBACK_LNG: "en"
|
|
5388
5392
|
};
|
|
5389
5393
|
|
|
5390
5394
|
// src/Items/Transformation/Matrix.ts
|
|
@@ -6106,7 +6110,7 @@ class DrawingContext {
|
|
|
6106
6110
|
this.setCamera(camera);
|
|
6107
6111
|
}
|
|
6108
6112
|
dpi() {
|
|
6109
|
-
return
|
|
6113
|
+
return conf2.getDPI();
|
|
6110
6114
|
}
|
|
6111
6115
|
setCamera(camera) {
|
|
6112
6116
|
this.camera = camera;
|
|
@@ -6116,7 +6120,7 @@ class DrawingContext {
|
|
|
6116
6120
|
}
|
|
6117
6121
|
clear() {
|
|
6118
6122
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
6119
|
-
this.ctx.clearRect(0, 0,
|
|
6123
|
+
this.ctx.clearRect(0, 0, conf2.getDocumentWidth(), conf2.getDocumentHeight());
|
|
6120
6124
|
this.matrix.applyToContext(this.ctx);
|
|
6121
6125
|
}
|
|
6122
6126
|
clearCursor() {
|
|
@@ -6124,7 +6128,7 @@ class DrawingContext {
|
|
|
6124
6128
|
return;
|
|
6125
6129
|
}
|
|
6126
6130
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
6127
|
-
this.cursorCtx.clearRect(0, 0,
|
|
6131
|
+
this.cursorCtx.clearRect(0, 0, conf2.getDocumentWidth(), conf2.getDocumentHeight());
|
|
6128
6132
|
this.matrix.applyToContext(this.cursorCtx);
|
|
6129
6133
|
}
|
|
6130
6134
|
applyChanges() {
|
|
@@ -6227,7 +6231,7 @@ class Path {
|
|
|
6227
6231
|
this.width = this.getMbr().getWidth();
|
|
6228
6232
|
this.height = this.getMbr().getHeight();
|
|
6229
6233
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
6230
|
-
this.path2d = new
|
|
6234
|
+
this.path2d = new conf2.path2DFactory;
|
|
6231
6235
|
this.updateCache();
|
|
6232
6236
|
}
|
|
6233
6237
|
getBackgroundColor() {
|
|
@@ -6304,7 +6308,7 @@ class Path {
|
|
|
6304
6308
|
this.y = top - this.paddingTop;
|
|
6305
6309
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
6306
6310
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
6307
|
-
const path2d = new
|
|
6311
|
+
const path2d = new conf2.path2DFactory;
|
|
6308
6312
|
if (this.segments.length === 0) {
|
|
6309
6313
|
return;
|
|
6310
6314
|
}
|
|
@@ -7370,7 +7374,7 @@ var parsersHTML = {
|
|
|
7370
7374
|
"comment-item": parseHTMLComment
|
|
7371
7375
|
};
|
|
7372
7376
|
var decodeHtml = (htmlString) => {
|
|
7373
|
-
const parser =
|
|
7377
|
+
const parser = conf2.getDOMParser();
|
|
7374
7378
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
7375
7379
|
return doc.documentElement.textContent || "";
|
|
7376
7380
|
};
|
|
@@ -7399,10 +7403,10 @@ function parseHTMLRichText(el, options) {
|
|
|
7399
7403
|
italic: node.style.fontStyle === "italic",
|
|
7400
7404
|
underline: node.style.textDecoration.includes("underline"),
|
|
7401
7405
|
"line-through": node.style.textDecoration.includes("line-through"),
|
|
7402
|
-
fontColor: node.style.color ||
|
|
7403
|
-
fontHighlight: node.style.backgroundColor ||
|
|
7404
|
-
fontSize: parseFloat(node.style.fontSize) ||
|
|
7405
|
-
fontFamily: node.style.fontFamily ||
|
|
7406
|
+
fontColor: node.style.color || conf2.DEFAULT_TEXT_STYLES.fontColor,
|
|
7407
|
+
fontHighlight: node.style.backgroundColor || conf2.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
7408
|
+
fontSize: parseFloat(node.style.fontSize) || conf2.DEFAULT_TEXT_STYLES.fontSize,
|
|
7409
|
+
fontFamily: node.style.fontFamily || conf2.DEFAULT_TEXT_STYLES.fontFamily,
|
|
7406
7410
|
overline: false,
|
|
7407
7411
|
subscript: false,
|
|
7408
7412
|
superscript: false
|
|
@@ -7467,7 +7471,7 @@ function parseHTMLRichText(el, options) {
|
|
|
7467
7471
|
return {
|
|
7468
7472
|
type: "paragraph",
|
|
7469
7473
|
...extractCommonProps(),
|
|
7470
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
7474
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf2.DEFAULT_TEXT_STYLES.lineHeight,
|
|
7471
7475
|
children: children2
|
|
7472
7476
|
};
|
|
7473
7477
|
default:
|
|
@@ -13947,8 +13951,8 @@ class LinkTo {
|
|
|
13947
13951
|
const ctx = context.ctx;
|
|
13948
13952
|
ctx.save();
|
|
13949
13953
|
ctx.globalCompositeOperation = "destination-out";
|
|
13950
|
-
const size =
|
|
13951
|
-
const offset =
|
|
13954
|
+
const size = conf2.LINK_BTN_SIZE / scale;
|
|
13955
|
+
const offset = conf2.LINK_BTN_OFFSET / scale;
|
|
13952
13956
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
13953
13957
|
ctx.restore();
|
|
13954
13958
|
}
|
|
@@ -14099,7 +14103,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
14099
14103
|
} else if (node3.type === "ul_list" && !listData) {
|
|
14100
14104
|
listData = { level: 0, isNumberedList: false };
|
|
14101
14105
|
}
|
|
14102
|
-
const listMarks =
|
|
14106
|
+
const listMarks = conf2[getListMarkType((listData?.level || 0) + 1)];
|
|
14103
14107
|
for (let i = 0;i < data.children.length; i++) {
|
|
14104
14108
|
const child = structuredClone(data.children[i]);
|
|
14105
14109
|
switch (child.type) {
|
|
@@ -14504,8 +14508,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
14504
14508
|
rect2.height += paddingTop;
|
|
14505
14509
|
}
|
|
14506
14510
|
}
|
|
14507
|
-
|
|
14508
|
-
const measure =
|
|
14511
|
+
conf2.measureCtx.font = style.font;
|
|
14512
|
+
const measure = conf2.measureCtx.measureText(text);
|
|
14509
14513
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
14510
14514
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
14511
14515
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -23627,7 +23631,7 @@ var convertLinkNodeToTextNode = (node4) => {
|
|
|
23627
23631
|
const link = node4.link;
|
|
23628
23632
|
const text3 = node4.children.map((child) => child.text).join("");
|
|
23629
23633
|
return {
|
|
23630
|
-
...
|
|
23634
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
23631
23635
|
type: "text",
|
|
23632
23636
|
text: text3,
|
|
23633
23637
|
link,
|
|
@@ -23643,9 +23647,9 @@ function setNodeChildrenStyles({
|
|
|
23643
23647
|
horisontalAlignment,
|
|
23644
23648
|
node: node4
|
|
23645
23649
|
}) {
|
|
23646
|
-
let fontStyles =
|
|
23650
|
+
let fontStyles = conf2.DEFAULT_TEXT_STYLES;
|
|
23647
23651
|
if (editor) {
|
|
23648
|
-
fontStyles = Editor.marks(editor) ||
|
|
23652
|
+
fontStyles = Editor.marks(editor) || conf2.DEFAULT_TEXT_STYLES;
|
|
23649
23653
|
}
|
|
23650
23654
|
switch (node4.type) {
|
|
23651
23655
|
case "heading_one":
|
|
@@ -23677,7 +23681,7 @@ function setNodeChildrenStyles({
|
|
|
23677
23681
|
children.text += " ";
|
|
23678
23682
|
}
|
|
23679
23683
|
let fontColor = fontStyles.fontColor;
|
|
23680
|
-
if (fontColor ===
|
|
23684
|
+
if (fontColor === conf2.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
23681
23685
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
23682
23686
|
}
|
|
23683
23687
|
return {
|
|
@@ -23717,7 +23721,7 @@ function setNodeStyles({
|
|
|
23717
23721
|
}
|
|
23718
23722
|
|
|
23719
23723
|
// src/Items/RichText/editorHelpers/markdown/markdownProcessor.ts
|
|
23720
|
-
var { i18n: i18n2 } =
|
|
23724
|
+
var { i18n: i18n2 } = conf2;
|
|
23721
23725
|
|
|
23722
23726
|
class MarkdownProcessor {
|
|
23723
23727
|
chunksQueue = [];
|
|
@@ -24697,7 +24701,7 @@ function setEditorFocus(editor, selectionContext) {
|
|
|
24697
24701
|
}
|
|
24698
24702
|
|
|
24699
24703
|
// src/Items/RichText/RichText.ts
|
|
24700
|
-
var { i18n: i18n3 } =
|
|
24704
|
+
var { i18n: i18n3 } = conf2;
|
|
24701
24705
|
var isEditInProcessValue = false;
|
|
24702
24706
|
var counter = 0;
|
|
24703
24707
|
|
|
@@ -24720,7 +24724,7 @@ class RichText extends Mbr {
|
|
|
24720
24724
|
isContainerSet = false;
|
|
24721
24725
|
isRenderEnabled = true;
|
|
24722
24726
|
layoutNodes;
|
|
24723
|
-
clipPath = new
|
|
24727
|
+
clipPath = new conf2.path2DFactory;
|
|
24724
24728
|
updateRequired = false;
|
|
24725
24729
|
autoSizeScale = 1;
|
|
24726
24730
|
containerMaxWidth;
|
|
@@ -24735,7 +24739,7 @@ class RichText extends Mbr {
|
|
|
24735
24739
|
shrinkWidth = false;
|
|
24736
24740
|
prevMbr = null;
|
|
24737
24741
|
rtCounter = 0;
|
|
24738
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = i18n3?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles =
|
|
24742
|
+
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) {
|
|
24739
24743
|
super();
|
|
24740
24744
|
this.board = board;
|
|
24741
24745
|
this.container = container;
|
|
@@ -24868,11 +24872,11 @@ class RichText extends Mbr {
|
|
|
24868
24872
|
return;
|
|
24869
24873
|
}
|
|
24870
24874
|
try {
|
|
24871
|
-
|
|
24875
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
24872
24876
|
} catch {}
|
|
24873
24877
|
};
|
|
24874
24878
|
updateElement = () => {
|
|
24875
|
-
if (
|
|
24879
|
+
if (conf2.isNode()) {
|
|
24876
24880
|
return;
|
|
24877
24881
|
}
|
|
24878
24882
|
if (this.updateRequired) {
|
|
@@ -25001,7 +25005,7 @@ class RichText extends Mbr {
|
|
|
25001
25005
|
const container = this.getTransformedContainer();
|
|
25002
25006
|
const width = container.getWidth();
|
|
25003
25007
|
const height = container.getHeight();
|
|
25004
|
-
this.clipPath = new
|
|
25008
|
+
this.clipPath = new conf2.path2DFactory;
|
|
25005
25009
|
this.clipPath.rect(0, 0, width, height);
|
|
25006
25010
|
}
|
|
25007
25011
|
setContainer(container) {
|
|
@@ -25278,24 +25282,24 @@ class RichText extends Mbr {
|
|
|
25278
25282
|
this.clearLastClickPoint();
|
|
25279
25283
|
const domMbr = ref.getBoundingClientRect();
|
|
25280
25284
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
25281
|
-
if (refMbr.isInside(point5) && (
|
|
25282
|
-
const domRange =
|
|
25283
|
-
const textNode =
|
|
25284
|
-
const offset =
|
|
25285
|
-
const slatePoint =
|
|
25285
|
+
if (refMbr.isInside(point5) && (conf2.documentFactory.caretPositionFromPoint || conf2.documentFactory.caretRangeFromPoint)) {
|
|
25286
|
+
const domRange = conf2.documentFactory.caretPositionFromPoint ? conf2.documentFactory.caretPositionFromPoint(point5.x, point5.y) : conf2.documentFactory.caretRangeFromPoint(point5.x, point5.y);
|
|
25287
|
+
const textNode = conf2.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
25288
|
+
const offset = conf2.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
25289
|
+
const slatePoint = conf2.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
25286
25290
|
exactMatch: false,
|
|
25287
25291
|
suppressThrow: false
|
|
25288
25292
|
});
|
|
25289
25293
|
if (slatePoint) {
|
|
25290
25294
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
25291
25295
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
25292
|
-
|
|
25296
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
25293
25297
|
}
|
|
25294
25298
|
} else {
|
|
25295
|
-
if (!(
|
|
25299
|
+
if (!(conf2.documentFactory.caretPositionFromPoint || conf2.documentFactory.caretRangeFromPoint)) {
|
|
25296
25300
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
25297
25301
|
}
|
|
25298
|
-
|
|
25302
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
25299
25303
|
}
|
|
25300
25304
|
}
|
|
25301
25305
|
}
|
|
@@ -25402,11 +25406,11 @@ class RichText extends Mbr {
|
|
|
25402
25406
|
if (node4.type === "text" || "text" in node4) {
|
|
25403
25407
|
node4 = node4;
|
|
25404
25408
|
const text3 = node4.text.trim() !== "" ? decodeHtml(escapeHtml2(node4.text)) : " ";
|
|
25405
|
-
const textElement = node4.link ? Object.assign(
|
|
25409
|
+
const textElement = node4.link ? Object.assign(conf2.documentFactory.createElement("a"), {
|
|
25406
25410
|
href: node4.link,
|
|
25407
25411
|
target: "_blank",
|
|
25408
25412
|
rel: "noreferrer"
|
|
25409
|
-
}) :
|
|
25413
|
+
}) : conf2.documentFactory.createElement("span");
|
|
25410
25414
|
Object.assign(textElement.style, {
|
|
25411
25415
|
fontWeight: node4.bold ? "700" : "400",
|
|
25412
25416
|
fontStyle: node4.italic ? "italic" : "",
|
|
@@ -25414,10 +25418,10 @@ class RichText extends Mbr {
|
|
|
25414
25418
|
node4.underline ? "underline" : "",
|
|
25415
25419
|
node4["line-through"] ? "line-through" : ""
|
|
25416
25420
|
].filter(Boolean).join(" "),
|
|
25417
|
-
color: node4.fontColor ||
|
|
25418
|
-
backgroundColor: node4.fontHighlight ||
|
|
25419
|
-
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${
|
|
25420
|
-
fontFamily: node4.fontFamily ||
|
|
25421
|
+
color: node4.fontColor || conf2.DEFAULT_TEXT_STYLES.fontColor,
|
|
25422
|
+
backgroundColor: node4.fontHighlight || conf2.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
25423
|
+
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${conf2.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
25424
|
+
fontFamily: node4.fontFamily || conf2.DEFAULT_TEXT_STYLES.fontFamily
|
|
25421
25425
|
});
|
|
25422
25426
|
if (this.insideOf === "Frame") {
|
|
25423
25427
|
Object.assign(textElement.style, {
|
|
@@ -25452,14 +25456,14 @@ class RichText extends Mbr {
|
|
|
25452
25456
|
four: 4,
|
|
25453
25457
|
five: 5
|
|
25454
25458
|
};
|
|
25455
|
-
const header =
|
|
25459
|
+
const header = conf2.documentFactory.createElement(`h${levels2[level]}`);
|
|
25456
25460
|
applyCommonStyles(header);
|
|
25457
25461
|
header.append(...children);
|
|
25458
25462
|
return header;
|
|
25459
25463
|
}
|
|
25460
25464
|
case "code_block": {
|
|
25461
|
-
const pre =
|
|
25462
|
-
const code =
|
|
25465
|
+
const pre = conf2.documentFactory.createElement("pre");
|
|
25466
|
+
const code = conf2.documentFactory.createElement("code");
|
|
25463
25467
|
applyCommonStyles(pre);
|
|
25464
25468
|
if (node4.language) {
|
|
25465
25469
|
code.classList.add(`language-${node4.language}`);
|
|
@@ -25473,35 +25477,35 @@ class RichText extends Mbr {
|
|
|
25473
25477
|
return pre;
|
|
25474
25478
|
}
|
|
25475
25479
|
case "block-quote": {
|
|
25476
|
-
const blockquote =
|
|
25480
|
+
const blockquote = conf2.documentFactory.createElement("blockquote");
|
|
25477
25481
|
applyCommonStyles(blockquote);
|
|
25478
25482
|
blockquote.append(...children);
|
|
25479
25483
|
return blockquote;
|
|
25480
25484
|
}
|
|
25481
25485
|
case "ul_list": {
|
|
25482
|
-
const ul =
|
|
25486
|
+
const ul = conf2.documentFactory.createElement("ul");
|
|
25483
25487
|
applyCommonStyles(ul);
|
|
25484
25488
|
ul.append(...children);
|
|
25485
25489
|
return ul;
|
|
25486
25490
|
}
|
|
25487
25491
|
case "ol_list": {
|
|
25488
|
-
const ol =
|
|
25492
|
+
const ol = conf2.documentFactory.createElement("ol");
|
|
25489
25493
|
applyCommonStyles(ol);
|
|
25490
25494
|
ol.append(...children);
|
|
25491
25495
|
return ol;
|
|
25492
25496
|
}
|
|
25493
25497
|
case "list_item": {
|
|
25494
|
-
const li =
|
|
25498
|
+
const li = conf2.documentFactory.createElement("li");
|
|
25495
25499
|
applyCommonStyles(li);
|
|
25496
25500
|
li.append(...children);
|
|
25497
25501
|
return li;
|
|
25498
25502
|
}
|
|
25499
25503
|
case "paragraph":
|
|
25500
25504
|
default: {
|
|
25501
|
-
const par =
|
|
25505
|
+
const par = conf2.documentFactory.createElement("p");
|
|
25502
25506
|
applyCommonStyles(par);
|
|
25503
25507
|
Object.assign(par.style, {
|
|
25504
|
-
lineHeight: node4.lineHeight ? `${node4.lineHeight}` :
|
|
25508
|
+
lineHeight: node4.lineHeight ? `${node4.lineHeight}` : conf2.DEFAULT_TEXT_STYLES.lineHeight,
|
|
25505
25509
|
margin: "0"
|
|
25506
25510
|
});
|
|
25507
25511
|
par.append(...children);
|
|
@@ -25509,7 +25513,7 @@ class RichText extends Mbr {
|
|
|
25509
25513
|
}
|
|
25510
25514
|
}
|
|
25511
25515
|
}
|
|
25512
|
-
return
|
|
25516
|
+
return conf2.documentFactory.createElement("div");
|
|
25513
25517
|
};
|
|
25514
25518
|
const escapeHtml2 = (unsafe) => {
|
|
25515
25519
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -38572,7 +38576,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
38572
38576
|
markdownString = String(file).trim();
|
|
38573
38577
|
}
|
|
38574
38578
|
let slateNodes = [];
|
|
38575
|
-
if (
|
|
38579
|
+
if (conf2.URL_REGEX.test(text5)) {
|
|
38576
38580
|
slateNodes = [createLinkNode(text5)];
|
|
38577
38581
|
} else {
|
|
38578
38582
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -38588,7 +38592,7 @@ function createLinkNode(link2) {
|
|
|
38588
38592
|
type: "text",
|
|
38589
38593
|
link: link2,
|
|
38590
38594
|
text: link2,
|
|
38591
|
-
...
|
|
38595
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
38592
38596
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
38593
38597
|
};
|
|
38594
38598
|
}
|
|
@@ -38700,7 +38704,7 @@ class AINode {
|
|
|
38700
38704
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
38701
38705
|
this.board = board;
|
|
38702
38706
|
this.id = id;
|
|
38703
|
-
this.buttonIcon =
|
|
38707
|
+
this.buttonIcon = conf2.documentFactory.createElement("img");
|
|
38704
38708
|
this.buttonIcon.src = ICON_SRC;
|
|
38705
38709
|
this.contextItems = contextItems;
|
|
38706
38710
|
this.isUserRequest = isUserRequest;
|
|
@@ -39872,7 +39876,7 @@ function getLine(lineStyle, start2, end2, middle) {
|
|
|
39872
39876
|
}
|
|
39873
39877
|
|
|
39874
39878
|
// src/Items/Connector/Connector.ts
|
|
39875
|
-
var { i18n: i18n4 } =
|
|
39879
|
+
var { i18n: i18n4 } = conf2;
|
|
39876
39880
|
var ConnectionLineWidths = [1, 2, 3, 4, 5, 6, 7, 8, 12];
|
|
39877
39881
|
var CONNECTOR_COLOR = "rgb(20, 21, 26)";
|
|
39878
39882
|
var CONNECTOR_LINE_WIDTH = 1;
|
|
@@ -39932,9 +39936,9 @@ class Connector {
|
|
|
39932
39936
|
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, i18n4.t("connector.textPlaceholder", {
|
|
39933
39937
|
ns: "default"
|
|
39934
39938
|
}), true, false, "Connector", {
|
|
39935
|
-
...
|
|
39936
|
-
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) :
|
|
39937
|
-
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") :
|
|
39939
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
39940
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf2.DEFAULT_TEXT_STYLES.fontSize,
|
|
39941
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf2.DEFAULT_TEXT_STYLES.fontColor
|
|
39938
39942
|
});
|
|
39939
39943
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
39940
39944
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -40384,7 +40388,7 @@ class Connector {
|
|
|
40384
40388
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
40385
40389
|
this.text.render(context);
|
|
40386
40390
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
40387
|
-
ctx.strokeStyle =
|
|
40391
|
+
ctx.strokeStyle = conf2.SELECTION_COLOR;
|
|
40388
40392
|
ctx.lineWidth = 1;
|
|
40389
40393
|
ctx.beginPath();
|
|
40390
40394
|
ctx.rect(textMbr.left - TEXT_BORDER_PADDING, textMbr.top - TEXT_BORDER_PADDING, textMbr.getWidth() + TEXT_BORDER_PADDING * 2, textMbr.getHeight() + TEXT_BORDER_PADDING * 2);
|
|
@@ -40611,7 +40615,7 @@ class Connector {
|
|
|
40611
40615
|
}
|
|
40612
40616
|
}
|
|
40613
40617
|
updatePaths() {
|
|
40614
|
-
if (
|
|
40618
|
+
if (conf2.isNode()) {
|
|
40615
40619
|
return;
|
|
40616
40620
|
}
|
|
40617
40621
|
const startPoint = this.startPoint;
|
|
@@ -41422,7 +41426,7 @@ class DefaultShapeData {
|
|
|
41422
41426
|
text;
|
|
41423
41427
|
linkTo;
|
|
41424
41428
|
itemType = "Shape";
|
|
41425
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
41429
|
+
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) {
|
|
41426
41430
|
this.shapeType = shapeType;
|
|
41427
41431
|
this.backgroundColor = backgroundColor;
|
|
41428
41432
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -42709,7 +42713,7 @@ class Shape {
|
|
|
42709
42713
|
this.text.updateElement();
|
|
42710
42714
|
}
|
|
42711
42715
|
transformPath() {
|
|
42712
|
-
if (
|
|
42716
|
+
if (conf2.isNode()) {
|
|
42713
42717
|
return;
|
|
42714
42718
|
}
|
|
42715
42719
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -42938,7 +42942,7 @@ class Sticker {
|
|
|
42938
42942
|
return this;
|
|
42939
42943
|
}
|
|
42940
42944
|
transformPath() {
|
|
42941
|
-
if (
|
|
42945
|
+
if (conf2.isNode()) {
|
|
42942
42946
|
return;
|
|
42943
42947
|
}
|
|
42944
42948
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -43489,7 +43493,7 @@ class Frame {
|
|
|
43489
43493
|
this.path = Frames[this.shapeType].path.copy();
|
|
43490
43494
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
43491
43495
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
43492
|
-
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...
|
|
43496
|
+
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 });
|
|
43493
43497
|
this.text.setSelectionHorisontalAlignment("left");
|
|
43494
43498
|
this.transformation.subject.subscribe(() => {
|
|
43495
43499
|
this.transformPath();
|
|
@@ -44051,10 +44055,10 @@ class VideoCommand {
|
|
|
44051
44055
|
|
|
44052
44056
|
// src/Items/Video/Video.ts
|
|
44053
44057
|
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";
|
|
44054
|
-
var videoIcon =
|
|
44058
|
+
var videoIcon = conf2.documentFactory.createElement("img");
|
|
44055
44059
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
44056
44060
|
var createPlaceholderImage = (width2, height2) => {
|
|
44057
|
-
const canvas =
|
|
44061
|
+
const canvas = conf2.documentFactory.createElement("canvas");
|
|
44058
44062
|
canvas.width = width2;
|
|
44059
44063
|
canvas.height = height2;
|
|
44060
44064
|
const ctx = canvas.getContext("2d");
|
|
@@ -44098,7 +44102,7 @@ class VideoItem extends Mbr {
|
|
|
44098
44102
|
this.events = events2;
|
|
44099
44103
|
this.id = id;
|
|
44100
44104
|
this.extension = extension2;
|
|
44101
|
-
this.isStorageUrl = !
|
|
44105
|
+
this.isStorageUrl = !conf2.getYouTubeId(url);
|
|
44102
44106
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
44103
44107
|
this.linkTo = new LinkTo(this.id, events2);
|
|
44104
44108
|
this.board = board;
|
|
@@ -44468,59 +44472,59 @@ async function fileTosha256(file) {
|
|
|
44468
44472
|
var catchErrorResponse = async (response, mediaType) => {
|
|
44469
44473
|
if (response.status === 403) {
|
|
44470
44474
|
const data = await response.json();
|
|
44471
|
-
let errorBody =
|
|
44475
|
+
let errorBody = conf2.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
44472
44476
|
if (!data.isOwnerRequest) {
|
|
44473
|
-
errorBody =
|
|
44477
|
+
errorBody = conf2.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
44474
44478
|
} else if (data.currentUsage && data.storageLimit) {
|
|
44475
|
-
errorBody =
|
|
44479
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
44476
44480
|
}
|
|
44477
|
-
|
|
44481
|
+
conf2.notify({
|
|
44478
44482
|
variant: "warning",
|
|
44479
|
-
header:
|
|
44483
|
+
header: conf2.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
44480
44484
|
body: errorBody,
|
|
44481
44485
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
44482
|
-
text:
|
|
44483
|
-
onClick: () =>
|
|
44486
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44487
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44484
44488
|
} : undefined,
|
|
44485
44489
|
duration: 8000
|
|
44486
44490
|
});
|
|
44487
44491
|
} else if (response.status === 413) {
|
|
44488
44492
|
const data = await response.json();
|
|
44489
|
-
let errorBody =
|
|
44493
|
+
let errorBody = conf2.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
44490
44494
|
let isBasicPlan = false;
|
|
44491
44495
|
if (data.fileSizeLimit && data.fileSize) {
|
|
44492
44496
|
if (mediaType === "image") {
|
|
44493
44497
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
44494
|
-
errorBody =
|
|
44498
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44495
44499
|
} else {
|
|
44496
44500
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
44497
|
-
errorBody =
|
|
44501
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44498
44502
|
}
|
|
44499
44503
|
}
|
|
44500
|
-
|
|
44504
|
+
conf2.notify({
|
|
44501
44505
|
variant: "warning",
|
|
44502
|
-
header:
|
|
44506
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44503
44507
|
body: errorBody,
|
|
44504
44508
|
button: isBasicPlan ? {
|
|
44505
|
-
text:
|
|
44506
|
-
onClick: () =>
|
|
44509
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44510
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44507
44511
|
} : undefined,
|
|
44508
44512
|
duration: 4000
|
|
44509
44513
|
});
|
|
44510
44514
|
} else if (response.status === 401) {
|
|
44511
|
-
|
|
44515
|
+
conf2.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
44512
44516
|
} else if (response.status === 415) {
|
|
44513
|
-
|
|
44517
|
+
conf2.notify({
|
|
44514
44518
|
variant: "warning",
|
|
44515
|
-
header:
|
|
44516
|
-
body:
|
|
44519
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
44520
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
44517
44521
|
duration: 4000
|
|
44518
44522
|
});
|
|
44519
44523
|
} else {
|
|
44520
|
-
|
|
44524
|
+
conf2.notify({
|
|
44521
44525
|
variant: "error",
|
|
44522
|
-
header:
|
|
44523
|
-
body:
|
|
44526
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
44527
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
44524
44528
|
duration: 4000
|
|
44525
44529
|
});
|
|
44526
44530
|
}
|
|
@@ -44528,17 +44532,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
44528
44532
|
};
|
|
44529
44533
|
var catchDuplicateErrorResponse = async (response) => {
|
|
44530
44534
|
if (response.status === 403) {
|
|
44531
|
-
|
|
44535
|
+
conf2.notify({
|
|
44532
44536
|
variant: "warning",
|
|
44533
|
-
header:
|
|
44534
|
-
body:
|
|
44537
|
+
header: conf2.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
44538
|
+
body: conf2.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
44535
44539
|
duration: 4000
|
|
44536
44540
|
});
|
|
44537
44541
|
} else {
|
|
44538
|
-
|
|
44542
|
+
conf2.notify({
|
|
44539
44543
|
variant: "error",
|
|
44540
|
-
header:
|
|
44541
|
-
body:
|
|
44544
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
44545
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
44542
44546
|
duration: 4000
|
|
44543
44547
|
});
|
|
44544
44548
|
}
|
|
@@ -44546,40 +44550,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
44546
44550
|
};
|
|
44547
44551
|
var validateMediaFile = (file, account2) => {
|
|
44548
44552
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
44549
|
-
if (!file.type.startsWith("image") && !
|
|
44550
|
-
|
|
44553
|
+
if (!file.type.startsWith("image") && !conf2.AUDIO_FORMATS.includes(fileExtension) && !conf2.VIDEO_FORMATS.includes(fileExtension)) {
|
|
44554
|
+
conf2.notify({
|
|
44551
44555
|
variant: "warning",
|
|
44552
|
-
header:
|
|
44553
|
-
body:
|
|
44556
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
44557
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
44554
44558
|
duration: 4000
|
|
44555
44559
|
});
|
|
44556
44560
|
return false;
|
|
44557
44561
|
}
|
|
44558
44562
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
44559
|
-
let errorBody =
|
|
44560
|
-
if (
|
|
44561
|
-
errorBody =
|
|
44563
|
+
let errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44564
|
+
if (conf2.AUDIO_FORMATS.includes(fileExtension) || conf2.VIDEO_FORMATS.includes(fileExtension)) {
|
|
44565
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44562
44566
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
44563
|
-
|
|
44567
|
+
conf2.notify({
|
|
44564
44568
|
variant: "warning",
|
|
44565
|
-
header:
|
|
44569
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44566
44570
|
body: errorBody,
|
|
44567
44571
|
button: isBasicPlan ? {
|
|
44568
|
-
text:
|
|
44569
|
-
onClick: () =>
|
|
44572
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44573
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44570
44574
|
} : undefined,
|
|
44571
44575
|
duration: 4000
|
|
44572
44576
|
});
|
|
44573
44577
|
return false;
|
|
44574
44578
|
}
|
|
44575
44579
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
44576
|
-
|
|
44580
|
+
conf2.notify({
|
|
44577
44581
|
variant: "warning",
|
|
44578
|
-
header:
|
|
44582
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44579
44583
|
body: errorBody,
|
|
44580
44584
|
button: isBasicPlan ? {
|
|
44581
|
-
text:
|
|
44582
|
-
onClick: () =>
|
|
44585
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44586
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44583
44587
|
} : undefined,
|
|
44584
44588
|
duration: 4000
|
|
44585
44589
|
});
|
|
@@ -44658,7 +44662,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
44658
44662
|
};
|
|
44659
44663
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
44660
44664
|
image2.onload = async () => {
|
|
44661
|
-
const parser =
|
|
44665
|
+
const parser = conf2.getDOMParser();
|
|
44662
44666
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
44663
44667
|
const svgElement = svgDoc.documentElement;
|
|
44664
44668
|
svgElement.removeAttribute("width");
|
|
@@ -44889,8 +44893,8 @@ class AudioItem extends Mbr {
|
|
|
44889
44893
|
this.subject.publish(this);
|
|
44890
44894
|
});
|
|
44891
44895
|
this.transformation.subject.subscribe(this.onTransform);
|
|
44892
|
-
this.right = this.left +
|
|
44893
|
-
this.bottom = this.top +
|
|
44896
|
+
this.right = this.left + conf2.AUDIO_DIMENSIONS.width;
|
|
44897
|
+
this.bottom = this.top + conf2.AUDIO_DIMENSIONS.height;
|
|
44894
44898
|
}
|
|
44895
44899
|
setCurrentTime(time2) {
|
|
44896
44900
|
this.currentTime = time2;
|
|
@@ -44957,8 +44961,8 @@ class AudioItem extends Mbr {
|
|
|
44957
44961
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
44958
44962
|
this.left = translateX;
|
|
44959
44963
|
this.top = translateY;
|
|
44960
|
-
this.right = this.left +
|
|
44961
|
-
this.bottom = this.top +
|
|
44964
|
+
this.right = this.left + conf2.AUDIO_DIMENSIONS.width * scaleX;
|
|
44965
|
+
this.bottom = this.top + conf2.AUDIO_DIMENSIONS.height * scaleY;
|
|
44962
44966
|
}
|
|
44963
44967
|
render(context) {
|
|
44964
44968
|
if (this.transformationRenderBlock) {
|
|
@@ -44987,8 +44991,8 @@ class AudioItem extends Mbr {
|
|
|
44987
44991
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
44988
44992
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
44989
44993
|
div.id = this.getId();
|
|
44990
|
-
div.style.width = `${
|
|
44991
|
-
div.style.height = `${
|
|
44994
|
+
div.style.width = `${conf2.AUDIO_DIMENSIONS.width}px`;
|
|
44995
|
+
div.style.height = `${conf2.AUDIO_DIMENSIONS.height}px`;
|
|
44992
44996
|
div.style.transformOrigin = "top left";
|
|
44993
44997
|
div.style.transform = transform;
|
|
44994
44998
|
div.style.position = "absolute";
|
|
@@ -45107,7 +45111,7 @@ class AudioItem extends Mbr {
|
|
|
45107
45111
|
}
|
|
45108
45112
|
download() {
|
|
45109
45113
|
if (this.extension) {
|
|
45110
|
-
const linkElem =
|
|
45114
|
+
const linkElem = conf2.documentFactory.createElement("a");
|
|
45111
45115
|
linkElem.href = this.url;
|
|
45112
45116
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
45113
45117
|
linkElem.click();
|
|
@@ -45509,7 +45513,7 @@ class ImageCommand {
|
|
|
45509
45513
|
|
|
45510
45514
|
// src/Items/Image/Image.ts
|
|
45511
45515
|
function getPlaceholderImage(board, imageDimension) {
|
|
45512
|
-
const placeholderCanvas =
|
|
45516
|
+
const placeholderCanvas = conf2.documentFactory.createElement("canvas");
|
|
45513
45517
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
45514
45518
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
45515
45519
|
const placeholder = new Placeholder;
|
|
@@ -45860,7 +45864,7 @@ class Drawing extends Mbr {
|
|
|
45860
45864
|
itemType = "Drawing";
|
|
45861
45865
|
parent = "Board";
|
|
45862
45866
|
transformation;
|
|
45863
|
-
path2d = new
|
|
45867
|
+
path2d = new conf2.path2DFactory;
|
|
45864
45868
|
subject = new Subject;
|
|
45865
45869
|
untransformedMbr = new Mbr;
|
|
45866
45870
|
lines = [];
|
|
@@ -45937,7 +45941,7 @@ class Drawing extends Mbr {
|
|
|
45937
45941
|
this.bottom = mbr.bottom;
|
|
45938
45942
|
}
|
|
45939
45943
|
updatePath2d() {
|
|
45940
|
-
this.path2d = new
|
|
45944
|
+
this.path2d = new conf2.path2DFactory;
|
|
45941
45945
|
const context = this.path2d;
|
|
45942
45946
|
const points = this.points;
|
|
45943
45947
|
if (points.length < 3) {
|
|
@@ -47110,9 +47114,9 @@ class Camera {
|
|
|
47110
47114
|
matrix = new Matrix2;
|
|
47111
47115
|
pointer = new Point;
|
|
47112
47116
|
window = {
|
|
47113
|
-
width:
|
|
47114
|
-
height:
|
|
47115
|
-
dpi:
|
|
47117
|
+
width: conf2.getDocumentWidth(),
|
|
47118
|
+
height: conf2.getDocumentHeight(),
|
|
47119
|
+
dpi: conf2.getDPI(),
|
|
47116
47120
|
getMbr: () => {
|
|
47117
47121
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
47118
47122
|
}
|
|
@@ -47488,9 +47492,9 @@ class Camera {
|
|
|
47488
47492
|
this.updateBoardPointer();
|
|
47489
47493
|
}
|
|
47490
47494
|
onWindowResize() {
|
|
47491
|
-
this.window.width =
|
|
47492
|
-
this.window.height =
|
|
47493
|
-
this.window.dpi =
|
|
47495
|
+
this.window.width = conf2.getDocumentWidth();
|
|
47496
|
+
this.window.height = conf2.getDocumentHeight();
|
|
47497
|
+
this.window.dpi = conf2.getDPI();
|
|
47494
47498
|
this.resizeSubject.publish(this);
|
|
47495
47499
|
this.subject.publish(this);
|
|
47496
47500
|
}
|
|
@@ -47503,10 +47507,10 @@ class Camera {
|
|
|
47503
47507
|
let y = 0;
|
|
47504
47508
|
const { activeKeys } = keyboard;
|
|
47505
47509
|
const directions = {
|
|
47506
|
-
ArrowRight: [-
|
|
47507
|
-
ArrowLeft: [
|
|
47508
|
-
ArrowDown: [0, -
|
|
47509
|
-
ArrowUp: [0,
|
|
47510
|
+
ArrowRight: [-conf2.NAVIGATION_STEP, 0],
|
|
47511
|
+
ArrowLeft: [conf2.NAVIGATION_STEP, 0],
|
|
47512
|
+
ArrowDown: [0, -conf2.NAVIGATION_STEP],
|
|
47513
|
+
ArrowUp: [0, conf2.NAVIGATION_STEP]
|
|
47510
47514
|
};
|
|
47511
47515
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
47512
47516
|
if (activeArrowKeys.length === 2) {
|
|
@@ -48039,7 +48043,7 @@ var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
|
48039
48043
|
|
|
48040
48044
|
// src/Keyboard/logHotkey.ts
|
|
48041
48045
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
48042
|
-
if (!
|
|
48046
|
+
if (!conf.LOG_HOTKEYS) {
|
|
48043
48047
|
return;
|
|
48044
48048
|
}
|
|
48045
48049
|
const isFunction = typeof hotkeyConfig === "function";
|
|
@@ -48131,7 +48135,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
48131
48135
|
// src/Keyboard/getHotkeyLabel.ts
|
|
48132
48136
|
function getHotkeyLabel(hotkey) {
|
|
48133
48137
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
48134
|
-
switch (
|
|
48138
|
+
switch (conf2.FORCE_HOTKEYS || "auto") {
|
|
48135
48139
|
case "windows":
|
|
48136
48140
|
return hotkeyLabel.windows;
|
|
48137
48141
|
case "macos":
|
|
@@ -50108,7 +50112,7 @@ class SpatialIndex {
|
|
|
50108
50112
|
this.itemsArray.push(item);
|
|
50109
50113
|
this.itemsIndex.insert(item);
|
|
50110
50114
|
}
|
|
50111
|
-
if (
|
|
50115
|
+
if (conf2.isNode()) {
|
|
50112
50116
|
return;
|
|
50113
50117
|
}
|
|
50114
50118
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -50675,8 +50679,8 @@ class Tool {
|
|
|
50675
50679
|
|
|
50676
50680
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
50677
50681
|
function getDecorationResizeType(point7, mbr, tolerance = 10) {
|
|
50678
|
-
for (const key in
|
|
50679
|
-
const decoration =
|
|
50682
|
+
for (const key in conf2.EXPORT_FRAME_DECORATIONS) {
|
|
50683
|
+
const decoration = conf2.EXPORT_FRAME_DECORATIONS[key];
|
|
50680
50684
|
const decorationBounds = {
|
|
50681
50685
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
50682
50686
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -50717,7 +50721,7 @@ class ExportSnapshot extends Tool {
|
|
|
50717
50721
|
super();
|
|
50718
50722
|
this.board = board;
|
|
50719
50723
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
50720
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
50724
|
+
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);
|
|
50721
50725
|
this.board.selection.disable();
|
|
50722
50726
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
50723
50727
|
}
|
|
@@ -50729,11 +50733,11 @@ class ExportSnapshot extends Tool {
|
|
|
50729
50733
|
resize() {
|
|
50730
50734
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
50731
50735
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
50732
|
-
if (resize.mbr.getWidth() >
|
|
50736
|
+
if (resize.mbr.getWidth() > conf2.EXPORT_MIN_WIDTH) {
|
|
50733
50737
|
this.mbr.left = resize.mbr.left;
|
|
50734
50738
|
this.mbr.right = resize.mbr.right;
|
|
50735
50739
|
}
|
|
50736
|
-
if (resize.mbr.getHeight() >
|
|
50740
|
+
if (resize.mbr.getHeight() > conf2.EXPORT_MIN_HEIGHT) {
|
|
50737
50741
|
this.mbr.top = resize.mbr.top;
|
|
50738
50742
|
this.mbr.bottom = resize.mbr.bottom;
|
|
50739
50743
|
}
|
|
@@ -50822,7 +50826,7 @@ class ExportSnapshot extends Tool {
|
|
|
50822
50826
|
}
|
|
50823
50827
|
const res = await exportBoardSnapshot({
|
|
50824
50828
|
board: this.board,
|
|
50825
|
-
bgColor:
|
|
50829
|
+
bgColor: conf2.CANVAS_BG_COLOR,
|
|
50826
50830
|
selection: this.mbr,
|
|
50827
50831
|
upscaleTo: 4000,
|
|
50828
50832
|
nameToExport: this.board.getName()
|
|
@@ -50846,18 +50850,18 @@ class ExportSnapshot extends Tool {
|
|
|
50846
50850
|
const cameraMbr = context.camera.getMbr();
|
|
50847
50851
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
50848
50852
|
this.tempDrawingContext.clear();
|
|
50849
|
-
cameraMbr.backgroundColor =
|
|
50853
|
+
cameraMbr.backgroundColor = conf2.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
50850
50854
|
cameraMbr.strokeWidth = 0;
|
|
50851
50855
|
cameraMbr.render(this.tempDrawingContext);
|
|
50852
50856
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
50853
|
-
if (
|
|
50854
|
-
const topLeft =
|
|
50857
|
+
if (conf2.EXPORT_FRAME_DECORATIONS) {
|
|
50858
|
+
const topLeft = conf2.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
50855
50859
|
this.renderDecoration(this.tempDrawingContext, topLeft.path, this.mbr.left + (topLeft.offsetX ?? 0), this.mbr.top + (topLeft.offsetY ?? 0), topLeft.color, topLeft.lineWidth);
|
|
50856
|
-
const topRight =
|
|
50860
|
+
const topRight = conf2.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
50857
50861
|
this.renderDecoration(this.tempDrawingContext, topRight.path, this.mbr.right + (topRight.offsetX ?? 0), this.mbr.top + (topRight.offsetY ?? 0), topRight.color, topRight.lineWidth);
|
|
50858
|
-
const bottomLeft =
|
|
50862
|
+
const bottomLeft = conf2.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
50859
50863
|
this.renderDecoration(this.tempDrawingContext, bottomLeft.path, this.mbr.left + (bottomLeft.offsetX ?? 0), this.mbr.bottom + (bottomLeft.offsetY ?? 0), bottomLeft.color, bottomLeft.lineWidth);
|
|
50860
|
-
const bottomRight =
|
|
50864
|
+
const bottomRight = conf2.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
50861
50865
|
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);
|
|
50862
50866
|
}
|
|
50863
50867
|
}
|
|
@@ -51366,14 +51370,14 @@ class AddConnector extends BoardTool {
|
|
|
51366
51370
|
class AddDrawing extends BoardTool {
|
|
51367
51371
|
drawing = null;
|
|
51368
51372
|
isDown = false;
|
|
51369
|
-
strokeWidth =
|
|
51370
|
-
strokeColor =
|
|
51371
|
-
strokeStyle =
|
|
51373
|
+
strokeWidth = conf2.PEN_INITIAL_STROKE_WIDTH;
|
|
51374
|
+
strokeColor = conf2.PEN_DEFAULT_COLOR;
|
|
51375
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
51372
51376
|
constructor(board) {
|
|
51373
51377
|
super(board);
|
|
51374
51378
|
this.setCursor();
|
|
51375
|
-
if (
|
|
51376
|
-
const drawingSettings = localStorage.getItem(
|
|
51379
|
+
if (conf2.PEN_SETTINGS_KEY) {
|
|
51380
|
+
const drawingSettings = localStorage.getItem(conf2.PEN_SETTINGS_KEY);
|
|
51377
51381
|
if (drawingSettings) {
|
|
51378
51382
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
51379
51383
|
this.strokeWidth = strokeWidth;
|
|
@@ -51383,7 +51387,7 @@ class AddDrawing extends BoardTool {
|
|
|
51383
51387
|
}
|
|
51384
51388
|
}
|
|
51385
51389
|
updateSettings() {
|
|
51386
|
-
localStorage.setItem(
|
|
51390
|
+
localStorage.setItem(conf2.PEN_SETTINGS_KEY, JSON.stringify({
|
|
51387
51391
|
strokeWidth: this.strokeWidth,
|
|
51388
51392
|
strokeColor: this.strokeColor,
|
|
51389
51393
|
strokeStyle: this.strokeStyle
|
|
@@ -51413,7 +51417,7 @@ class AddDrawing extends BoardTool {
|
|
|
51413
51417
|
ctx.beginPath();
|
|
51414
51418
|
ctx.arc(point7.x, point7.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
51415
51419
|
ctx.lineWidth = 1;
|
|
51416
|
-
ctx.strokeStyle =
|
|
51420
|
+
ctx.strokeStyle = conf2.PEN_POINTER_CIRCLE_COLOR;
|
|
51417
51421
|
ctx.stroke();
|
|
51418
51422
|
}
|
|
51419
51423
|
setCursor() {
|
|
@@ -51495,7 +51499,7 @@ class AddDrawing extends BoardTool {
|
|
|
51495
51499
|
this.setCursor();
|
|
51496
51500
|
};
|
|
51497
51501
|
render(context) {
|
|
51498
|
-
if (
|
|
51502
|
+
if (conf2.PEN_RENDER_POINTER_CIRCLE) {
|
|
51499
51503
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
51500
51504
|
}
|
|
51501
51505
|
if (!this.drawing) {
|
|
@@ -51510,14 +51514,14 @@ class AddDrawing extends BoardTool {
|
|
|
51510
51514
|
}
|
|
51511
51515
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
51512
51516
|
class AddHighlighter extends AddDrawing {
|
|
51513
|
-
strokeWidth =
|
|
51514
|
-
strokeColor =
|
|
51515
|
-
strokeStyle =
|
|
51517
|
+
strokeWidth = conf2.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
51518
|
+
strokeColor = conf2.HIGHLIGHTER_DEFAULT_COLOR;
|
|
51519
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
51516
51520
|
constructor(board) {
|
|
51517
51521
|
super(board);
|
|
51518
51522
|
this.setCursor();
|
|
51519
|
-
if (
|
|
51520
|
-
const highlighterSettings = localStorage.getItem(
|
|
51523
|
+
if (conf2.HIGHLIGHTER_SETTINGS_KEY) {
|
|
51524
|
+
const highlighterSettings = localStorage.getItem(conf2.HIGHLIGHTER_SETTINGS_KEY);
|
|
51521
51525
|
if (highlighterSettings) {
|
|
51522
51526
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
51523
51527
|
this.strokeWidth = strokeWidth;
|
|
@@ -51530,7 +51534,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
51530
51534
|
return true;
|
|
51531
51535
|
}
|
|
51532
51536
|
updateSettings() {
|
|
51533
|
-
localStorage.setItem(
|
|
51537
|
+
localStorage.setItem(conf2.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
51534
51538
|
strokeWidth: this.strokeWidth,
|
|
51535
51539
|
strokeColor: this.strokeColor,
|
|
51536
51540
|
strokeStyle: this.strokeStyle
|
|
@@ -51854,7 +51858,7 @@ class AddShape extends BoardTool {
|
|
|
51854
51858
|
const point7 = this.board.pointer.point;
|
|
51855
51859
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51856
51860
|
this.bounds = this.line.getMbr();
|
|
51857
|
-
this.bounds.borderColor =
|
|
51861
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
51858
51862
|
this.shape.apply({
|
|
51859
51863
|
class: "Shape",
|
|
51860
51864
|
method: "setShapeType",
|
|
@@ -51878,7 +51882,7 @@ class AddShape extends BoardTool {
|
|
|
51878
51882
|
}
|
|
51879
51883
|
this.line = new Line(startPoint, endPoint);
|
|
51880
51884
|
this.bounds = this.line.getMbr();
|
|
51881
|
-
this.bounds.borderColor =
|
|
51885
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
51882
51886
|
this.initTransformation();
|
|
51883
51887
|
this.board.tools.publish();
|
|
51884
51888
|
return true;
|
|
@@ -51950,7 +51954,7 @@ class AddShape extends BoardTool {
|
|
|
51950
51954
|
const y = (top + bottom) / 2 - 50;
|
|
51951
51955
|
this.bounds = new Mbr(x, y, x, y);
|
|
51952
51956
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
51953
|
-
this.bounds.borderColor =
|
|
51957
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
51954
51958
|
this.shape.apply({
|
|
51955
51959
|
class: "Shape",
|
|
51956
51960
|
method: "setShapeType",
|
|
@@ -51983,8 +51987,8 @@ class AddSticker extends BoardTool {
|
|
|
51983
51987
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
51984
51988
|
}
|
|
51985
51989
|
setCursor(color2) {
|
|
51986
|
-
if (
|
|
51987
|
-
const colorName = color2 ?
|
|
51990
|
+
if (conf2.STICKER_COLOR_NAMES) {
|
|
51991
|
+
const colorName = color2 ? conf2.STICKER_COLOR_NAMES[conf2.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
51988
51992
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
51989
51993
|
} else {
|
|
51990
51994
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -52008,7 +52012,7 @@ class AddSticker extends BoardTool {
|
|
|
52008
52012
|
const point7 = this.board.pointer.point;
|
|
52009
52013
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52010
52014
|
this.bounds = this.line.getMbr();
|
|
52011
|
-
this.bounds.borderColor =
|
|
52015
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52012
52016
|
this.board.tools.publish();
|
|
52013
52017
|
return true;
|
|
52014
52018
|
}
|
|
@@ -52017,7 +52021,7 @@ class AddSticker extends BoardTool {
|
|
|
52017
52021
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
52018
52022
|
this.sticker.applyDiagonal(this.line);
|
|
52019
52023
|
this.bounds = this.sticker.getMbr();
|
|
52020
|
-
this.bounds.borderColor =
|
|
52024
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52021
52025
|
this.board.tools.publish();
|
|
52022
52026
|
return true;
|
|
52023
52027
|
}
|
|
@@ -52117,7 +52121,7 @@ class AddText extends BoardTool {
|
|
|
52117
52121
|
const point7 = this.board.pointer.point;
|
|
52118
52122
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52119
52123
|
this.bounds = this.line.getMbr();
|
|
52120
|
-
this.bounds.borderColor =
|
|
52124
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52121
52125
|
this.board.tools.publish();
|
|
52122
52126
|
return true;
|
|
52123
52127
|
}
|
|
@@ -52128,7 +52132,7 @@ class AddText extends BoardTool {
|
|
|
52128
52132
|
const end2 = new Point(cursorPoint.x, start2.y + height2);
|
|
52129
52133
|
this.line = new Line(start2, end2);
|
|
52130
52134
|
this.bounds = this.line.getMbr();
|
|
52131
|
-
this.bounds.borderColor =
|
|
52135
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52132
52136
|
this.board.tools.publish();
|
|
52133
52137
|
return true;
|
|
52134
52138
|
}
|
|
@@ -52193,11 +52197,11 @@ class AddText extends BoardTool {
|
|
|
52193
52197
|
class Eraser extends BoardTool {
|
|
52194
52198
|
itemType = "Eraser";
|
|
52195
52199
|
isDown = false;
|
|
52196
|
-
strokeWidth =
|
|
52197
|
-
strokeColor =
|
|
52198
|
-
strokeStyle =
|
|
52200
|
+
strokeWidth = conf2.ERASER_STROKE_WIDTH;
|
|
52201
|
+
strokeColor = conf2.ERASER_DEFAULT_COLOR;
|
|
52202
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
52199
52203
|
drawing = new Drawing(this.board, []);
|
|
52200
|
-
maxPointsInLine =
|
|
52204
|
+
maxPointsInLine = conf2.ERASER_MAX_LINE_LENGTH;
|
|
52201
52205
|
constructor(board) {
|
|
52202
52206
|
super(board);
|
|
52203
52207
|
this.setCursor();
|
|
@@ -52359,7 +52363,7 @@ function createCanvasDrawer(board) {
|
|
|
52359
52363
|
borderDiv.id = "canvasBorder";
|
|
52360
52364
|
borderDiv.style.position = "absolute";
|
|
52361
52365
|
borderDiv.style.transformOrigin = "left top";
|
|
52362
|
-
borderDiv.style.border = `1px solid ${
|
|
52366
|
+
borderDiv.style.border = `1px solid ${conf2.SELECTION_COLOR}`;
|
|
52363
52367
|
borderDiv.style.boxSizing = "border-box";
|
|
52364
52368
|
borderDiv.style.left = `${leftOffset}px`;
|
|
52365
52369
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -52369,7 +52373,7 @@ function createCanvasDrawer(board) {
|
|
|
52369
52373
|
canvas.style.boxSizing = "border-box";
|
|
52370
52374
|
container.appendChild(borderDiv);
|
|
52371
52375
|
} else {
|
|
52372
|
-
canvas.style.border = `1px solid ${
|
|
52376
|
+
canvas.style.border = `1px solid ${conf2.SELECTION_COLOR}`;
|
|
52373
52377
|
canvas.style.boxSizing = "border-box";
|
|
52374
52378
|
}
|
|
52375
52379
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -52377,8 +52381,8 @@ function createCanvasDrawer(board) {
|
|
|
52377
52381
|
anchorDiv.style.position = "absolute";
|
|
52378
52382
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
52379
52383
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
52380
|
-
anchorDiv.style.backgroundColor = `${
|
|
52381
|
-
anchorDiv.style.border = `${
|
|
52384
|
+
anchorDiv.style.backgroundColor = `${conf2.SELECTION_ANCHOR_COLOR}`;
|
|
52385
|
+
anchorDiv.style.border = `${conf2.SELECTION_ANCHOR_WIDTH}px solid ${conf2.SELECTION_COLOR}`;
|
|
52382
52386
|
anchorDiv.style.borderRadius = "2px";
|
|
52383
52387
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
52384
52388
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -52386,10 +52390,10 @@ function createCanvasDrawer(board) {
|
|
|
52386
52390
|
return anchorDiv;
|
|
52387
52391
|
};
|
|
52388
52392
|
const anchors = [
|
|
52389
|
-
createAnchorDiv("0%", "0%",
|
|
52390
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
52391
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
52392
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
52393
|
+
createAnchorDiv("0%", "0%", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52394
|
+
createAnchorDiv("100% + 1px", "0%", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52395
|
+
createAnchorDiv("0%", "100% + 1px", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52396
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf2.SELECTION_ANCHOR_RADIUS)
|
|
52393
52397
|
];
|
|
52394
52398
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
52395
52399
|
for (const anchor of anchors) {
|
|
@@ -53731,8 +53735,8 @@ class Select extends Tool {
|
|
|
53731
53735
|
const { x, y } = pointer.point;
|
|
53732
53736
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
53733
53737
|
this.rect = this.line.getMbr();
|
|
53734
|
-
this.rect.borderColor =
|
|
53735
|
-
this.rect.backgroundColor =
|
|
53738
|
+
this.rect.borderColor = conf2.SELECTION_COLOR;
|
|
53739
|
+
this.rect.backgroundColor = conf2.SELECTION_BACKGROUND;
|
|
53736
53740
|
this.board.tools.publish();
|
|
53737
53741
|
this.board.presence.throttledEmit({
|
|
53738
53742
|
method: "DrawSelect",
|
|
@@ -53817,8 +53821,8 @@ class Select extends Tool {
|
|
|
53817
53821
|
const point7 = this.board.pointer.point.copy();
|
|
53818
53822
|
this.line = new Line(this.line.start, point7);
|
|
53819
53823
|
this.rect = this.line.getMbr();
|
|
53820
|
-
this.rect.borderColor =
|
|
53821
|
-
this.rect.backgroundColor =
|
|
53824
|
+
this.rect.borderColor = conf2.SELECTION_COLOR;
|
|
53825
|
+
this.rect.backgroundColor = conf2.SELECTION_BACKGROUND;
|
|
53822
53826
|
this.board.tools.publish();
|
|
53823
53827
|
this.board.presence.throttledEmit({
|
|
53824
53828
|
method: "DrawSelect",
|
|
@@ -54952,7 +54956,7 @@ class Board {
|
|
|
54952
54956
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
54953
54957
|
const css = INDEX_CSS;
|
|
54954
54958
|
const boardName = this.getName() || this.getBoardId();
|
|
54955
|
-
const items = this.items.getWholeHTML(
|
|
54959
|
+
const items = this.items.getWholeHTML(conf2.documentFactory);
|
|
54956
54960
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
54957
54961
|
const scripts = `
|
|
54958
54962
|
<script type="module">${customTagsScript}</script>
|
|
@@ -54992,7 +54996,7 @@ class Board {
|
|
|
54992
54996
|
return `${head}${body}`;
|
|
54993
54997
|
}
|
|
54994
54998
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
54995
|
-
const parser =
|
|
54999
|
+
const parser = conf2.getDOMParser();
|
|
54996
55000
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
54997
55001
|
const items = doc.body.querySelector("#items");
|
|
54998
55002
|
if (items) {
|
|
@@ -55044,7 +55048,7 @@ class Board {
|
|
|
55044
55048
|
return [];
|
|
55045
55049
|
}
|
|
55046
55050
|
deserializeHTML(stringedHTML) {
|
|
55047
|
-
const parser =
|
|
55051
|
+
const parser = conf2.getDOMParser();
|
|
55048
55052
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
55049
55053
|
const itemsDiv = doc.body.querySelector("#items");
|
|
55050
55054
|
if (!itemsDiv) {
|
|
@@ -55605,7 +55609,7 @@ class RichTextCommand {
|
|
|
55605
55609
|
item: id,
|
|
55606
55610
|
operation: {
|
|
55607
55611
|
...this.operation,
|
|
55608
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
55612
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf2.DEFAULT_TEXT_STYLES.fontColor
|
|
55609
55613
|
}
|
|
55610
55614
|
}));
|
|
55611
55615
|
case "setBlockType":
|
|
@@ -55629,7 +55633,7 @@ class RichTextCommand {
|
|
|
55629
55633
|
item: id,
|
|
55630
55634
|
operation: {
|
|
55631
55635
|
...this.operation,
|
|
55632
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
55636
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf2.DEFAULT_TEXT_STYLES.fontFamily
|
|
55633
55637
|
}
|
|
55634
55638
|
}));
|
|
55635
55639
|
case "setFontSize":
|
|
@@ -55637,7 +55641,7 @@ class RichTextCommand {
|
|
|
55637
55641
|
item: id,
|
|
55638
55642
|
operation: {
|
|
55639
55643
|
...this.operation,
|
|
55640
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
55644
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf2.DEFAULT_TEXT_STYLES.fontSize
|
|
55641
55645
|
}
|
|
55642
55646
|
}));
|
|
55643
55647
|
case "setFontHighlight":
|
|
@@ -55645,7 +55649,7 @@ class RichTextCommand {
|
|
|
55645
55649
|
item: id,
|
|
55646
55650
|
operation: {
|
|
55647
55651
|
...this.operation,
|
|
55648
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
55652
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf2.DEFAULT_TEXT_STYLES.fontHighlight
|
|
55649
55653
|
}
|
|
55650
55654
|
}));
|
|
55651
55655
|
case "setHorisontalAlignment":
|
|
@@ -56986,7 +56990,7 @@ class Transformer extends Tool {
|
|
|
56986
56990
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
56987
56991
|
if (mbr) {
|
|
56988
56992
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
56989
|
-
const selectionColor = isLockedItems ?
|
|
56993
|
+
const selectionColor = isLockedItems ? conf2.SELECTION_LOCKED_COLOR : conf2.SELECTION_COLOR;
|
|
56990
56994
|
mbr.borderColor = selectionColor;
|
|
56991
56995
|
mbr.render(context);
|
|
56992
56996
|
}
|
|
@@ -57012,7 +57016,7 @@ class Transformer extends Tool {
|
|
|
57012
57016
|
new Point(right, bottom)
|
|
57013
57017
|
];
|
|
57014
57018
|
for (const point7 of points) {
|
|
57015
|
-
const circle = new Anchor(point7.x, point7.y,
|
|
57019
|
+
const circle = new Anchor(point7.x, point7.y, conf2.SELECTION_ANCHOR_RADIUS, conf2.SELECTION_COLOR, conf2.SELECTION_ANCHOR_COLOR, conf2.SELECTION_ANCHOR_WIDTH);
|
|
57016
57020
|
anchors.push(circle);
|
|
57017
57021
|
}
|
|
57018
57022
|
}
|
|
@@ -58215,7 +58219,7 @@ class Selection2 {
|
|
|
58215
58219
|
renderItemMbr(context, item, customScale) {
|
|
58216
58220
|
const mbr = item.getMbr();
|
|
58217
58221
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
58218
|
-
const selectionColor = item.transformation.isLocked ?
|
|
58222
|
+
const selectionColor = item.transformation.isLocked ? conf2.SELECTION_LOCKED_COLOR : conf2.SELECTION_COLOR;
|
|
58219
58223
|
mbr.borderColor = selectionColor;
|
|
58220
58224
|
mbr.render(context);
|
|
58221
58225
|
}
|
|
@@ -59070,19 +59074,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
59070
59074
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
59071
59075
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
59072
59076
|
const transformed = { ...toTransform };
|
|
59073
|
-
const
|
|
59077
|
+
const conf3 = confirmed.path;
|
|
59074
59078
|
const path3 = transformed.path;
|
|
59075
|
-
if (Path3.equals(
|
|
59079
|
+
if (Path3.equals(conf3, path3)) {
|
|
59076
59080
|
return transformed;
|
|
59077
59081
|
}
|
|
59078
|
-
const isDescendant = path3.length >
|
|
59082
|
+
const isDescendant = path3.length > conf3.length && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i]);
|
|
59079
59083
|
if (isDescendant) {
|
|
59080
59084
|
const newPath = [...path3];
|
|
59081
59085
|
newPath[0] = newPath[0] + 1;
|
|
59082
59086
|
transformed.path = newPath;
|
|
59083
59087
|
return transformed;
|
|
59084
59088
|
}
|
|
59085
|
-
if (Path3.isBefore(
|
|
59089
|
+
if (Path3.isBefore(conf3, path3)) {
|
|
59086
59090
|
transformPath(confirmed, transformed);
|
|
59087
59091
|
}
|
|
59088
59092
|
return transformed;
|
|
@@ -59091,23 +59095,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
59091
59095
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
59092
59096
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
59093
59097
|
const transformed = { ...toTransform };
|
|
59094
|
-
const
|
|
59098
|
+
const conf3 = confirmed.path;
|
|
59095
59099
|
const path3 = transformed.path;
|
|
59096
|
-
if (Path3.equals(
|
|
59100
|
+
if (Path3.equals(conf3, path3)) {
|
|
59097
59101
|
return transformed;
|
|
59098
59102
|
}
|
|
59099
|
-
if (path3.length ===
|
|
59103
|
+
if (path3.length === conf3.length + 1 && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i])) {
|
|
59100
59104
|
const newPath = [...path3];
|
|
59101
|
-
if (
|
|
59105
|
+
if (conf3.length === 1) {
|
|
59102
59106
|
newPath[0] = newPath[0] + 1;
|
|
59103
59107
|
} else {
|
|
59104
|
-
newPath[
|
|
59108
|
+
newPath[conf3.length] = newPath[conf3.length] + 1;
|
|
59105
59109
|
}
|
|
59106
59110
|
transformed.path = newPath;
|
|
59107
59111
|
return transformed;
|
|
59108
59112
|
}
|
|
59109
|
-
const isDescendant = path3.length >
|
|
59110
|
-
if (Path3.isBefore(
|
|
59113
|
+
const isDescendant = path3.length > conf3.length && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i]);
|
|
59114
|
+
if (Path3.isBefore(conf3, path3) && !isDescendant) {
|
|
59111
59115
|
transformPath(confirmed, transformed);
|
|
59112
59116
|
}
|
|
59113
59117
|
return transformed;
|
|
@@ -59687,8 +59691,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
59687
59691
|
const transformed = [];
|
|
59688
59692
|
for (const transf of toTransform) {
|
|
59689
59693
|
let actualyTransformed = { ...transf };
|
|
59690
|
-
for (const
|
|
59691
|
-
const { operation: confOp } =
|
|
59694
|
+
for (const conf3 of confirmed) {
|
|
59695
|
+
const { operation: confOp } = conf3.body;
|
|
59692
59696
|
const { operation: transfOp } = actualyTransformed.body;
|
|
59693
59697
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
59694
59698
|
if (transformedOp) {
|
|
@@ -60320,7 +60324,7 @@ class Events2 {
|
|
|
60320
60324
|
return record !== null;
|
|
60321
60325
|
}
|
|
60322
60326
|
sendPresenceEvent(event) {
|
|
60323
|
-
|
|
60327
|
+
conf2.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
60324
60328
|
}
|
|
60325
60329
|
canUndoEvent(op, byUserId) {
|
|
60326
60330
|
if (op.method === "undo") {
|
|
@@ -60429,7 +60433,7 @@ function handleChatChunk(chunk, board) {
|
|
|
60429
60433
|
if (chunk.isExternalApiError) {
|
|
60430
60434
|
const editor = item2.getRichText().editor;
|
|
60431
60435
|
editor.clearText();
|
|
60432
|
-
editor.insertCopiedText(
|
|
60436
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60433
60437
|
}
|
|
60434
60438
|
}
|
|
60435
60439
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -60437,9 +60441,9 @@ function handleChatChunk(chunk, board) {
|
|
|
60437
60441
|
}
|
|
60438
60442
|
console.log("Error AI generate", chunk.error);
|
|
60439
60443
|
if (!chunk.isExternalApiError) {
|
|
60440
|
-
|
|
60441
|
-
header:
|
|
60442
|
-
body:
|
|
60444
|
+
conf2.notify({
|
|
60445
|
+
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
60446
|
+
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
60443
60447
|
variant: "error",
|
|
60444
60448
|
duration: 4000
|
|
60445
60449
|
});
|
|
@@ -60449,9 +60453,9 @@ function handleChatChunk(chunk, board) {
|
|
|
60449
60453
|
default:
|
|
60450
60454
|
board.camera.unsubscribeFromItem();
|
|
60451
60455
|
if (!chunk.isExternalApiError) {
|
|
60452
|
-
|
|
60453
|
-
header:
|
|
60454
|
-
body:
|
|
60456
|
+
conf2.notify({
|
|
60457
|
+
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
60458
|
+
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
60455
60459
|
variant: "error",
|
|
60456
60460
|
duration: 4000
|
|
60457
60461
|
});
|
|
@@ -60466,7 +60470,7 @@ function handleChatChunk(chunk, board) {
|
|
|
60466
60470
|
if (chunk.isExternalApiError) {
|
|
60467
60471
|
const editor = item2.getRichText().editor;
|
|
60468
60472
|
editor.clearText();
|
|
60469
|
-
editor.insertCopiedText(
|
|
60473
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60470
60474
|
}
|
|
60471
60475
|
}
|
|
60472
60476
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -60493,7 +60497,7 @@ function handleAudioGenerate(response, board) {
|
|
|
60493
60497
|
}
|
|
60494
60498
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
60495
60499
|
const { left, top, right } = placeholderNode.getMbr();
|
|
60496
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
60500
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf2.AUDIO_DIMENSIONS.width) / 2, top);
|
|
60497
60501
|
audio.updateMbr();
|
|
60498
60502
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
60499
60503
|
board.remove(placeholderNode, false);
|
|
@@ -60515,7 +60519,7 @@ function handleAudioGenerate(response, board) {
|
|
|
60515
60519
|
type: "audio/wav"
|
|
60516
60520
|
});
|
|
60517
60521
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
60518
|
-
const linkElem =
|
|
60522
|
+
const linkElem = conf2.documentFactory.createElement("a");
|
|
60519
60523
|
linkElem.href = audioUrl2;
|
|
60520
60524
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
60521
60525
|
linkElem.click();
|
|
@@ -60534,9 +60538,9 @@ function handleAudioGenerate(response, board) {
|
|
|
60534
60538
|
board.selection.add(placeholderNode);
|
|
60535
60539
|
}
|
|
60536
60540
|
console.error("Audio generation error:", response.message);
|
|
60537
|
-
|
|
60538
|
-
header:
|
|
60539
|
-
body:
|
|
60541
|
+
conf2.notify({
|
|
60542
|
+
header: conf2.i18n.t("AIInput.audioGenerationError.header"),
|
|
60543
|
+
body: conf2.i18n.t("AIInput.audioGenerationError.body"),
|
|
60540
60544
|
variant: "error",
|
|
60541
60545
|
duration: 4000
|
|
60542
60546
|
});
|
|
@@ -60599,14 +60603,14 @@ function handleImageGenerate(response, board) {
|
|
|
60599
60603
|
board.selection.add(item);
|
|
60600
60604
|
const editor = item.getRichText()?.editor;
|
|
60601
60605
|
editor?.clearText();
|
|
60602
|
-
editor?.insertCopiedText(
|
|
60606
|
+
editor?.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60603
60607
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
60604
60608
|
}
|
|
60605
60609
|
}
|
|
60606
60610
|
} else {
|
|
60607
|
-
|
|
60608
|
-
header:
|
|
60609
|
-
body:
|
|
60611
|
+
conf2.notify({
|
|
60612
|
+
header: conf2.i18n.t("AIInput.imageGenerationError.header"),
|
|
60613
|
+
body: conf2.i18n.t("AIInput.imageGenerationError.body"),
|
|
60610
60614
|
variant: "error",
|
|
60611
60615
|
duration: 4000
|
|
60612
60616
|
});
|
|
@@ -60673,10 +60677,10 @@ function startIntervals(board) {
|
|
|
60673
60677
|
}
|
|
60674
60678
|
log.publishIntervalTimer = setInterval(() => {
|
|
60675
60679
|
tryPublishEvent(board);
|
|
60676
|
-
},
|
|
60680
|
+
}, conf2.EVENTS_PUBLISH_INTERVAL);
|
|
60677
60681
|
log.resendIntervalTimer = setInterval(() => {
|
|
60678
60682
|
tryResendEvent(board);
|
|
60679
|
-
},
|
|
60683
|
+
}, conf2.EVENTS_RESEND_INTERVAL);
|
|
60680
60684
|
}
|
|
60681
60685
|
function tryPublishEvent(board) {
|
|
60682
60686
|
const { log } = board.events;
|
|
@@ -60695,14 +60699,14 @@ function tryResendEvent(board) {
|
|
|
60695
60699
|
return;
|
|
60696
60700
|
}
|
|
60697
60701
|
const date = Date.now();
|
|
60698
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
60702
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf2.EVENTS_RESEND_INTERVAL;
|
|
60699
60703
|
if (!isTimeToSendPendingEvent) {
|
|
60700
60704
|
return;
|
|
60701
60705
|
}
|
|
60702
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
60706
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf2.EVENTS_RESEND_INTERVAL * 5;
|
|
60703
60707
|
if (isProbablyLostConnection) {
|
|
60704
60708
|
board.presence.clear();
|
|
60705
|
-
|
|
60709
|
+
conf2.connection?.notifyAboutLostConnection();
|
|
60706
60710
|
}
|
|
60707
60711
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
60708
60712
|
}
|
|
@@ -60733,12 +60737,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
60733
60737
|
lastKnownOrder: log.getLastIndex()
|
|
60734
60738
|
}
|
|
60735
60739
|
};
|
|
60736
|
-
|
|
60740
|
+
conf2.connection.send({
|
|
60737
60741
|
type: "BoardEvent",
|
|
60738
60742
|
boardId: board.getBoardId(),
|
|
60739
60743
|
event: toSend,
|
|
60740
60744
|
sequenceNumber,
|
|
60741
|
-
userId:
|
|
60745
|
+
userId: conf2.connection.getCurrentUser()
|
|
60742
60746
|
});
|
|
60743
60747
|
const date = Date.now();
|
|
60744
60748
|
log.pendingEvent = {
|
|
@@ -60784,7 +60788,7 @@ function handleConfirmation(msg2, board) {
|
|
|
60784
60788
|
if (!isPendingEventConfirmation) {
|
|
60785
60789
|
return;
|
|
60786
60790
|
}
|
|
60787
|
-
|
|
60791
|
+
conf2.connection?.dismissNotificationAboutLostConnection();
|
|
60788
60792
|
log.currentSequenceNumber++;
|
|
60789
60793
|
log.pendingEvent.event.order = msg2.order;
|
|
60790
60794
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -60796,7 +60800,7 @@ function handleConfirmation(msg2, board) {
|
|
|
60796
60800
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
60797
60801
|
function handleCreateSnapshotRequestMessage(msg2, board) {
|
|
60798
60802
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
60799
|
-
|
|
60803
|
+
conf2.connection.send({
|
|
60800
60804
|
type: "BoardSnapshot",
|
|
60801
60805
|
boardId,
|
|
60802
60806
|
snapshot,
|
|
@@ -60827,9 +60831,9 @@ function handleModeMessage(message, board) {
|
|
|
60827
60831
|
if (isTemplateView()) {
|
|
60828
60832
|
return;
|
|
60829
60833
|
}
|
|
60830
|
-
|
|
60831
|
-
header:
|
|
60832
|
-
body: message.mode === "edit" ?
|
|
60834
|
+
conf2.notify({
|
|
60835
|
+
header: conf2.i18n.t("sharing.settingsChanged.heading"),
|
|
60836
|
+
body: message.mode === "edit" ? conf2.i18n.t("sharing.settingsChanged.bodyEdit") : conf2.i18n.t("sharing.settingsChanged.bodyView"),
|
|
60833
60837
|
duration: 5000
|
|
60834
60838
|
});
|
|
60835
60839
|
}
|
|
@@ -60866,7 +60870,7 @@ messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
|
60866
60870
|
// src/api/getMeasureCtx.ts
|
|
60867
60871
|
function getMeasureCtx() {
|
|
60868
60872
|
if (typeof document !== "undefined") {
|
|
60869
|
-
const measureCanvas =
|
|
60873
|
+
const measureCanvas = conf2.documentFactory.createElement("canvas");
|
|
60870
60874
|
const measureCtx = measureCanvas.getContext("2d");
|
|
60871
60875
|
if (!measureCtx) {
|
|
60872
60876
|
throw new Error("Failde to create canvas and get 2d context");
|
|
@@ -63920,20 +63924,20 @@ var resources = {
|
|
|
63920
63924
|
};
|
|
63921
63925
|
function initI18N(isNode = false) {
|
|
63922
63926
|
instance.use(initReactI18next).use(Browser).init({
|
|
63923
|
-
debug:
|
|
63927
|
+
debug: conf2.debug,
|
|
63924
63928
|
detection: {
|
|
63925
63929
|
order: ["navigator"]
|
|
63926
63930
|
},
|
|
63927
63931
|
supportedLngs: ["en", "ru"],
|
|
63928
63932
|
defaultNS,
|
|
63929
63933
|
resources,
|
|
63930
|
-
fallbackLng:
|
|
63934
|
+
fallbackLng: conf2.FALLBACK_LNG,
|
|
63931
63935
|
interpolation: {
|
|
63932
63936
|
escapeValue: false
|
|
63933
63937
|
}
|
|
63934
63938
|
});
|
|
63935
|
-
|
|
63936
|
-
|
|
63939
|
+
conf2.i18n = instance;
|
|
63940
|
+
conf2.planNames = {
|
|
63937
63941
|
basic: instance.t("userPlan.plans.basic.name"),
|
|
63938
63942
|
plus: instance.t("userPlan.plans.plus.name")
|
|
63939
63943
|
};
|
|
@@ -63947,7 +63951,7 @@ function getBrowserDOMParser() {
|
|
|
63947
63951
|
|
|
63948
63952
|
// src/api/initPaths.ts
|
|
63949
63953
|
function initPaths(path2D) {
|
|
63950
|
-
|
|
63954
|
+
conf2.EXPORT_FRAME_DECORATIONS = {
|
|
63951
63955
|
"top-left": {
|
|
63952
63956
|
path: new path2D("M13 1H1V13"),
|
|
63953
63957
|
lineWidth: 2,
|
|
@@ -63989,23 +63993,23 @@ function initPaths(path2D) {
|
|
|
63989
63993
|
|
|
63990
63994
|
// src/api/initBrowserSettings.ts
|
|
63991
63995
|
function initBrowserSettings() {
|
|
63992
|
-
|
|
63993
|
-
|
|
63994
|
-
|
|
63995
|
-
|
|
63996
|
-
|
|
63997
|
-
|
|
63998
|
-
|
|
63996
|
+
conf2.documentFactory = new BrowserDocumentFactory;
|
|
63997
|
+
conf2.path2DFactory = BrowserPath2D;
|
|
63998
|
+
conf2.measureCtx = getMeasureCtx();
|
|
63999
|
+
conf2.getDocumentWidth = () => document.documentElement.clientWidth;
|
|
64000
|
+
conf2.getDocumentHeight = () => document.documentElement.clientHeight;
|
|
64001
|
+
conf2.getDPI = () => window.devicePixelRatio;
|
|
64002
|
+
conf2.getDOMParser = getBrowserDOMParser;
|
|
63999
64003
|
initI18N();
|
|
64000
64004
|
initPaths(BrowserPath2D);
|
|
64001
|
-
|
|
64005
|
+
conf2.reactEditorFocus = (editor) => {
|
|
64002
64006
|
try {
|
|
64003
64007
|
ReactEditor.focus(editor);
|
|
64004
64008
|
} catch (e) {
|
|
64005
64009
|
console.warn("Failed to focus editor:", e);
|
|
64006
64010
|
}
|
|
64007
64011
|
};
|
|
64008
|
-
|
|
64012
|
+
conf2.reactEditorToSlatePoint = (editor, domNode, offset, options) => {
|
|
64009
64013
|
try {
|
|
64010
64014
|
return ReactEditor.toSlatePoint(editor, [domNode, offset], options);
|
|
64011
64015
|
} catch (e) {
|
|
@@ -64013,7 +64017,7 @@ function initBrowserSettings() {
|
|
|
64013
64017
|
return null;
|
|
64014
64018
|
}
|
|
64015
64019
|
};
|
|
64016
|
-
return
|
|
64020
|
+
return conf2;
|
|
64017
64021
|
}
|
|
64018
64022
|
|
|
64019
64023
|
// src/browser.ts
|
|
@@ -64076,7 +64080,7 @@ export {
|
|
|
64076
64080
|
defaultCursors as cursors,
|
|
64077
64081
|
createVideoItem,
|
|
64078
64082
|
createEvents,
|
|
64079
|
-
conf,
|
|
64083
|
+
conf2 as conf,
|
|
64080
64084
|
checkHotkeys,
|
|
64081
64085
|
catmullRomInterpolate,
|
|
64082
64086
|
catchErrorResponse,
|