microboard-temp 0.1.11 → 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/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,
|
|
@@ -5223,7 +5223,7 @@ var ExportQuality;
|
|
|
5223
5223
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
5224
5224
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
5225
5225
|
})(ExportQuality ||= {});
|
|
5226
|
-
var
|
|
5226
|
+
var conf2 = {
|
|
5227
5227
|
connection: undefined,
|
|
5228
5228
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
5229
5229
|
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : undefined,
|
|
@@ -5543,7 +5543,11 @@ var conf = {
|
|
|
5543
5543
|
overline: false,
|
|
5544
5544
|
subscript: false,
|
|
5545
5545
|
superscript: false
|
|
5546
|
-
}
|
|
5546
|
+
},
|
|
5547
|
+
LOG_HOTKEYS: false,
|
|
5548
|
+
FORCE_HOTKEYS: "auto",
|
|
5549
|
+
debug: false,
|
|
5550
|
+
FALLBACK_LNG: "en"
|
|
5547
5551
|
};
|
|
5548
5552
|
|
|
5549
5553
|
// src/Items/Transformation/Matrix.ts
|
|
@@ -6265,7 +6269,7 @@ class DrawingContext {
|
|
|
6265
6269
|
this.setCamera(camera);
|
|
6266
6270
|
}
|
|
6267
6271
|
dpi() {
|
|
6268
|
-
return
|
|
6272
|
+
return conf2.getDPI();
|
|
6269
6273
|
}
|
|
6270
6274
|
setCamera(camera) {
|
|
6271
6275
|
this.camera = camera;
|
|
@@ -6275,7 +6279,7 @@ class DrawingContext {
|
|
|
6275
6279
|
}
|
|
6276
6280
|
clear() {
|
|
6277
6281
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
6278
|
-
this.ctx.clearRect(0, 0,
|
|
6282
|
+
this.ctx.clearRect(0, 0, conf2.getDocumentWidth(), conf2.getDocumentHeight());
|
|
6279
6283
|
this.matrix.applyToContext(this.ctx);
|
|
6280
6284
|
}
|
|
6281
6285
|
clearCursor() {
|
|
@@ -6283,7 +6287,7 @@ class DrawingContext {
|
|
|
6283
6287
|
return;
|
|
6284
6288
|
}
|
|
6285
6289
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
6286
|
-
this.cursorCtx.clearRect(0, 0,
|
|
6290
|
+
this.cursorCtx.clearRect(0, 0, conf2.getDocumentWidth(), conf2.getDocumentHeight());
|
|
6287
6291
|
this.matrix.applyToContext(this.cursorCtx);
|
|
6288
6292
|
}
|
|
6289
6293
|
applyChanges() {
|
|
@@ -6386,7 +6390,7 @@ class Path {
|
|
|
6386
6390
|
this.width = this.getMbr().getWidth();
|
|
6387
6391
|
this.height = this.getMbr().getHeight();
|
|
6388
6392
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
6389
|
-
this.path2d = new
|
|
6393
|
+
this.path2d = new conf2.path2DFactory;
|
|
6390
6394
|
this.updateCache();
|
|
6391
6395
|
}
|
|
6392
6396
|
getBackgroundColor() {
|
|
@@ -6463,7 +6467,7 @@ class Path {
|
|
|
6463
6467
|
this.y = top - this.paddingTop;
|
|
6464
6468
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
6465
6469
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
6466
|
-
const path2d = new
|
|
6470
|
+
const path2d = new conf2.path2DFactory;
|
|
6467
6471
|
if (this.segments.length === 0) {
|
|
6468
6472
|
return;
|
|
6469
6473
|
}
|
|
@@ -7529,7 +7533,7 @@ var parsersHTML = {
|
|
|
7529
7533
|
"comment-item": parseHTMLComment
|
|
7530
7534
|
};
|
|
7531
7535
|
var decodeHtml = (htmlString) => {
|
|
7532
|
-
const parser =
|
|
7536
|
+
const parser = conf2.getDOMParser();
|
|
7533
7537
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
7534
7538
|
return doc.documentElement.textContent || "";
|
|
7535
7539
|
};
|
|
@@ -7558,10 +7562,10 @@ function parseHTMLRichText(el, options) {
|
|
|
7558
7562
|
italic: node.style.fontStyle === "italic",
|
|
7559
7563
|
underline: node.style.textDecoration.includes("underline"),
|
|
7560
7564
|
"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 ||
|
|
7565
|
+
fontColor: node.style.color || conf2.DEFAULT_TEXT_STYLES.fontColor,
|
|
7566
|
+
fontHighlight: node.style.backgroundColor || conf2.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
7567
|
+
fontSize: parseFloat(node.style.fontSize) || conf2.DEFAULT_TEXT_STYLES.fontSize,
|
|
7568
|
+
fontFamily: node.style.fontFamily || conf2.DEFAULT_TEXT_STYLES.fontFamily,
|
|
7565
7569
|
overline: false,
|
|
7566
7570
|
subscript: false,
|
|
7567
7571
|
superscript: false
|
|
@@ -7626,7 +7630,7 @@ function parseHTMLRichText(el, options) {
|
|
|
7626
7630
|
return {
|
|
7627
7631
|
type: "paragraph",
|
|
7628
7632
|
...extractCommonProps(),
|
|
7629
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
7633
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf2.DEFAULT_TEXT_STYLES.lineHeight,
|
|
7630
7634
|
children: children2
|
|
7631
7635
|
};
|
|
7632
7636
|
default:
|
|
@@ -14106,8 +14110,8 @@ class LinkTo {
|
|
|
14106
14110
|
const ctx = context.ctx;
|
|
14107
14111
|
ctx.save();
|
|
14108
14112
|
ctx.globalCompositeOperation = "destination-out";
|
|
14109
|
-
const size =
|
|
14110
|
-
const offset =
|
|
14113
|
+
const size = conf2.LINK_BTN_SIZE / scale;
|
|
14114
|
+
const offset = conf2.LINK_BTN_OFFSET / scale;
|
|
14111
14115
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
14112
14116
|
ctx.restore();
|
|
14113
14117
|
}
|
|
@@ -14258,7 +14262,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
14258
14262
|
} else if (node3.type === "ul_list" && !listData) {
|
|
14259
14263
|
listData = { level: 0, isNumberedList: false };
|
|
14260
14264
|
}
|
|
14261
|
-
const listMarks =
|
|
14265
|
+
const listMarks = conf2[getListMarkType((listData?.level || 0) + 1)];
|
|
14262
14266
|
for (let i = 0;i < data.children.length; i++) {
|
|
14263
14267
|
const child = structuredClone(data.children[i]);
|
|
14264
14268
|
switch (child.type) {
|
|
@@ -14663,8 +14667,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
14663
14667
|
rect2.height += paddingTop;
|
|
14664
14668
|
}
|
|
14665
14669
|
}
|
|
14666
|
-
|
|
14667
|
-
const measure =
|
|
14670
|
+
conf2.measureCtx.font = style.font;
|
|
14671
|
+
const measure = conf2.measureCtx.measureText(text);
|
|
14668
14672
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
14669
14673
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
14670
14674
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -23786,7 +23790,7 @@ var convertLinkNodeToTextNode = (node4) => {
|
|
|
23786
23790
|
const link = node4.link;
|
|
23787
23791
|
const text3 = node4.children.map((child) => child.text).join("");
|
|
23788
23792
|
return {
|
|
23789
|
-
...
|
|
23793
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
23790
23794
|
type: "text",
|
|
23791
23795
|
text: text3,
|
|
23792
23796
|
link,
|
|
@@ -23802,9 +23806,9 @@ function setNodeChildrenStyles({
|
|
|
23802
23806
|
horisontalAlignment,
|
|
23803
23807
|
node: node4
|
|
23804
23808
|
}) {
|
|
23805
|
-
let fontStyles =
|
|
23809
|
+
let fontStyles = conf2.DEFAULT_TEXT_STYLES;
|
|
23806
23810
|
if (editor) {
|
|
23807
|
-
fontStyles = Editor.marks(editor) ||
|
|
23811
|
+
fontStyles = Editor.marks(editor) || conf2.DEFAULT_TEXT_STYLES;
|
|
23808
23812
|
}
|
|
23809
23813
|
switch (node4.type) {
|
|
23810
23814
|
case "heading_one":
|
|
@@ -23836,7 +23840,7 @@ function setNodeChildrenStyles({
|
|
|
23836
23840
|
children.text += " ";
|
|
23837
23841
|
}
|
|
23838
23842
|
let fontColor = fontStyles.fontColor;
|
|
23839
|
-
if (fontColor ===
|
|
23843
|
+
if (fontColor === conf2.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
23840
23844
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
23841
23845
|
}
|
|
23842
23846
|
return {
|
|
@@ -23876,7 +23880,7 @@ function setNodeStyles({
|
|
|
23876
23880
|
}
|
|
23877
23881
|
|
|
23878
23882
|
// src/Items/RichText/editorHelpers/markdown/markdownProcessor.ts
|
|
23879
|
-
var { i18n: i18n2 } =
|
|
23883
|
+
var { i18n: i18n2 } = conf2;
|
|
23880
23884
|
|
|
23881
23885
|
class MarkdownProcessor {
|
|
23882
23886
|
chunksQueue = [];
|
|
@@ -24856,7 +24860,7 @@ function setEditorFocus(editor, selectionContext) {
|
|
|
24856
24860
|
}
|
|
24857
24861
|
|
|
24858
24862
|
// src/Items/RichText/RichText.ts
|
|
24859
|
-
var { i18n: i18n3 } =
|
|
24863
|
+
var { i18n: i18n3 } = conf2;
|
|
24860
24864
|
var isEditInProcessValue = false;
|
|
24861
24865
|
var counter = 0;
|
|
24862
24866
|
|
|
@@ -24879,7 +24883,7 @@ class RichText extends Mbr {
|
|
|
24879
24883
|
isContainerSet = false;
|
|
24880
24884
|
isRenderEnabled = true;
|
|
24881
24885
|
layoutNodes;
|
|
24882
|
-
clipPath = new
|
|
24886
|
+
clipPath = new conf2.path2DFactory;
|
|
24883
24887
|
updateRequired = false;
|
|
24884
24888
|
autoSizeScale = 1;
|
|
24885
24889
|
containerMaxWidth;
|
|
@@ -24894,7 +24898,7 @@ class RichText extends Mbr {
|
|
|
24894
24898
|
shrinkWidth = false;
|
|
24895
24899
|
prevMbr = null;
|
|
24896
24900
|
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 =
|
|
24901
|
+
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
24902
|
super();
|
|
24899
24903
|
this.board = board;
|
|
24900
24904
|
this.container = container;
|
|
@@ -25027,11 +25031,11 @@ class RichText extends Mbr {
|
|
|
25027
25031
|
return;
|
|
25028
25032
|
}
|
|
25029
25033
|
try {
|
|
25030
|
-
|
|
25034
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
25031
25035
|
} catch {}
|
|
25032
25036
|
};
|
|
25033
25037
|
updateElement = () => {
|
|
25034
|
-
if (
|
|
25038
|
+
if (conf2.isNode()) {
|
|
25035
25039
|
return;
|
|
25036
25040
|
}
|
|
25037
25041
|
if (this.updateRequired) {
|
|
@@ -25160,7 +25164,7 @@ class RichText extends Mbr {
|
|
|
25160
25164
|
const container = this.getTransformedContainer();
|
|
25161
25165
|
const width = container.getWidth();
|
|
25162
25166
|
const height = container.getHeight();
|
|
25163
|
-
this.clipPath = new
|
|
25167
|
+
this.clipPath = new conf2.path2DFactory;
|
|
25164
25168
|
this.clipPath.rect(0, 0, width, height);
|
|
25165
25169
|
}
|
|
25166
25170
|
setContainer(container) {
|
|
@@ -25437,24 +25441,24 @@ class RichText extends Mbr {
|
|
|
25437
25441
|
this.clearLastClickPoint();
|
|
25438
25442
|
const domMbr = ref.getBoundingClientRect();
|
|
25439
25443
|
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 =
|
|
25444
|
+
if (refMbr.isInside(point5) && (conf2.documentFactory.caretPositionFromPoint || conf2.documentFactory.caretRangeFromPoint)) {
|
|
25445
|
+
const domRange = conf2.documentFactory.caretPositionFromPoint ? conf2.documentFactory.caretPositionFromPoint(point5.x, point5.y) : conf2.documentFactory.caretRangeFromPoint(point5.x, point5.y);
|
|
25446
|
+
const textNode = conf2.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
25447
|
+
const offset = conf2.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
25448
|
+
const slatePoint = conf2.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
25445
25449
|
exactMatch: false,
|
|
25446
25450
|
suppressThrow: false
|
|
25447
25451
|
});
|
|
25448
25452
|
if (slatePoint) {
|
|
25449
25453
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
25450
25454
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
25451
|
-
|
|
25455
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
25452
25456
|
}
|
|
25453
25457
|
} else {
|
|
25454
|
-
if (!(
|
|
25458
|
+
if (!(conf2.documentFactory.caretPositionFromPoint || conf2.documentFactory.caretRangeFromPoint)) {
|
|
25455
25459
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
25456
25460
|
}
|
|
25457
|
-
|
|
25461
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
25458
25462
|
}
|
|
25459
25463
|
}
|
|
25460
25464
|
}
|
|
@@ -25561,11 +25565,11 @@ class RichText extends Mbr {
|
|
|
25561
25565
|
if (node4.type === "text" || "text" in node4) {
|
|
25562
25566
|
node4 = node4;
|
|
25563
25567
|
const text3 = node4.text.trim() !== "" ? decodeHtml(escapeHtml2(node4.text)) : " ";
|
|
25564
|
-
const textElement = node4.link ? Object.assign(
|
|
25568
|
+
const textElement = node4.link ? Object.assign(conf2.documentFactory.createElement("a"), {
|
|
25565
25569
|
href: node4.link,
|
|
25566
25570
|
target: "_blank",
|
|
25567
25571
|
rel: "noreferrer"
|
|
25568
|
-
}) :
|
|
25572
|
+
}) : conf2.documentFactory.createElement("span");
|
|
25569
25573
|
Object.assign(textElement.style, {
|
|
25570
25574
|
fontWeight: node4.bold ? "700" : "400",
|
|
25571
25575
|
fontStyle: node4.italic ? "italic" : "",
|
|
@@ -25573,10 +25577,10 @@ class RichText extends Mbr {
|
|
|
25573
25577
|
node4.underline ? "underline" : "",
|
|
25574
25578
|
node4["line-through"] ? "line-through" : ""
|
|
25575
25579
|
].filter(Boolean).join(" "),
|
|
25576
|
-
color: node4.fontColor ||
|
|
25577
|
-
backgroundColor: node4.fontHighlight ||
|
|
25578
|
-
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${
|
|
25579
|
-
fontFamily: node4.fontFamily ||
|
|
25580
|
+
color: node4.fontColor || conf2.DEFAULT_TEXT_STYLES.fontColor,
|
|
25581
|
+
backgroundColor: node4.fontHighlight || conf2.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
25582
|
+
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${conf2.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
25583
|
+
fontFamily: node4.fontFamily || conf2.DEFAULT_TEXT_STYLES.fontFamily
|
|
25580
25584
|
});
|
|
25581
25585
|
if (this.insideOf === "Frame") {
|
|
25582
25586
|
Object.assign(textElement.style, {
|
|
@@ -25611,14 +25615,14 @@ class RichText extends Mbr {
|
|
|
25611
25615
|
four: 4,
|
|
25612
25616
|
five: 5
|
|
25613
25617
|
};
|
|
25614
|
-
const header =
|
|
25618
|
+
const header = conf2.documentFactory.createElement(`h${levels2[level]}`);
|
|
25615
25619
|
applyCommonStyles(header);
|
|
25616
25620
|
header.append(...children);
|
|
25617
25621
|
return header;
|
|
25618
25622
|
}
|
|
25619
25623
|
case "code_block": {
|
|
25620
|
-
const pre =
|
|
25621
|
-
const code =
|
|
25624
|
+
const pre = conf2.documentFactory.createElement("pre");
|
|
25625
|
+
const code = conf2.documentFactory.createElement("code");
|
|
25622
25626
|
applyCommonStyles(pre);
|
|
25623
25627
|
if (node4.language) {
|
|
25624
25628
|
code.classList.add(`language-${node4.language}`);
|
|
@@ -25632,35 +25636,35 @@ class RichText extends Mbr {
|
|
|
25632
25636
|
return pre;
|
|
25633
25637
|
}
|
|
25634
25638
|
case "block-quote": {
|
|
25635
|
-
const blockquote =
|
|
25639
|
+
const blockquote = conf2.documentFactory.createElement("blockquote");
|
|
25636
25640
|
applyCommonStyles(blockquote);
|
|
25637
25641
|
blockquote.append(...children);
|
|
25638
25642
|
return blockquote;
|
|
25639
25643
|
}
|
|
25640
25644
|
case "ul_list": {
|
|
25641
|
-
const ul =
|
|
25645
|
+
const ul = conf2.documentFactory.createElement("ul");
|
|
25642
25646
|
applyCommonStyles(ul);
|
|
25643
25647
|
ul.append(...children);
|
|
25644
25648
|
return ul;
|
|
25645
25649
|
}
|
|
25646
25650
|
case "ol_list": {
|
|
25647
|
-
const ol =
|
|
25651
|
+
const ol = conf2.documentFactory.createElement("ol");
|
|
25648
25652
|
applyCommonStyles(ol);
|
|
25649
25653
|
ol.append(...children);
|
|
25650
25654
|
return ol;
|
|
25651
25655
|
}
|
|
25652
25656
|
case "list_item": {
|
|
25653
|
-
const li =
|
|
25657
|
+
const li = conf2.documentFactory.createElement("li");
|
|
25654
25658
|
applyCommonStyles(li);
|
|
25655
25659
|
li.append(...children);
|
|
25656
25660
|
return li;
|
|
25657
25661
|
}
|
|
25658
25662
|
case "paragraph":
|
|
25659
25663
|
default: {
|
|
25660
|
-
const par =
|
|
25664
|
+
const par = conf2.documentFactory.createElement("p");
|
|
25661
25665
|
applyCommonStyles(par);
|
|
25662
25666
|
Object.assign(par.style, {
|
|
25663
|
-
lineHeight: node4.lineHeight ? `${node4.lineHeight}` :
|
|
25667
|
+
lineHeight: node4.lineHeight ? `${node4.lineHeight}` : conf2.DEFAULT_TEXT_STYLES.lineHeight,
|
|
25664
25668
|
margin: "0"
|
|
25665
25669
|
});
|
|
25666
25670
|
par.append(...children);
|
|
@@ -25668,7 +25672,7 @@ class RichText extends Mbr {
|
|
|
25668
25672
|
}
|
|
25669
25673
|
}
|
|
25670
25674
|
}
|
|
25671
|
-
return
|
|
25675
|
+
return conf2.documentFactory.createElement("div");
|
|
25672
25676
|
};
|
|
25673
25677
|
const escapeHtml2 = (unsafe) => {
|
|
25674
25678
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -38731,7 +38735,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
38731
38735
|
markdownString = String(file).trim();
|
|
38732
38736
|
}
|
|
38733
38737
|
let slateNodes = [];
|
|
38734
|
-
if (
|
|
38738
|
+
if (conf2.URL_REGEX.test(text5)) {
|
|
38735
38739
|
slateNodes = [createLinkNode(text5)];
|
|
38736
38740
|
} else {
|
|
38737
38741
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -38747,7 +38751,7 @@ function createLinkNode(link2) {
|
|
|
38747
38751
|
type: "text",
|
|
38748
38752
|
link: link2,
|
|
38749
38753
|
text: link2,
|
|
38750
|
-
...
|
|
38754
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
38751
38755
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
38752
38756
|
};
|
|
38753
38757
|
}
|
|
@@ -38859,7 +38863,7 @@ class AINode {
|
|
|
38859
38863
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
38860
38864
|
this.board = board;
|
|
38861
38865
|
this.id = id;
|
|
38862
|
-
this.buttonIcon =
|
|
38866
|
+
this.buttonIcon = conf2.documentFactory.createElement("img");
|
|
38863
38867
|
this.buttonIcon.src = ICON_SRC;
|
|
38864
38868
|
this.contextItems = contextItems;
|
|
38865
38869
|
this.isUserRequest = isUserRequest;
|
|
@@ -40031,7 +40035,7 @@ function getLine(lineStyle, start2, end2, middle) {
|
|
|
40031
40035
|
}
|
|
40032
40036
|
|
|
40033
40037
|
// src/Items/Connector/Connector.ts
|
|
40034
|
-
var { i18n: i18n4 } =
|
|
40038
|
+
var { i18n: i18n4 } = conf2;
|
|
40035
40039
|
var ConnectionLineWidths = [1, 2, 3, 4, 5, 6, 7, 8, 12];
|
|
40036
40040
|
var CONNECTOR_COLOR = "rgb(20, 21, 26)";
|
|
40037
40041
|
var CONNECTOR_LINE_WIDTH = 1;
|
|
@@ -40091,9 +40095,9 @@ class Connector {
|
|
|
40091
40095
|
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, i18n4.t("connector.textPlaceholder", {
|
|
40092
40096
|
ns: "default"
|
|
40093
40097
|
}), 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") :
|
|
40098
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
40099
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf2.DEFAULT_TEXT_STYLES.fontSize,
|
|
40100
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf2.DEFAULT_TEXT_STYLES.fontColor
|
|
40097
40101
|
});
|
|
40098
40102
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
40099
40103
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -40543,7 +40547,7 @@ class Connector {
|
|
|
40543
40547
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
40544
40548
|
this.text.render(context);
|
|
40545
40549
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
40546
|
-
ctx.strokeStyle =
|
|
40550
|
+
ctx.strokeStyle = conf2.SELECTION_COLOR;
|
|
40547
40551
|
ctx.lineWidth = 1;
|
|
40548
40552
|
ctx.beginPath();
|
|
40549
40553
|
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 +40774,7 @@ class Connector {
|
|
|
40770
40774
|
}
|
|
40771
40775
|
}
|
|
40772
40776
|
updatePaths() {
|
|
40773
|
-
if (
|
|
40777
|
+
if (conf2.isNode()) {
|
|
40774
40778
|
return;
|
|
40775
40779
|
}
|
|
40776
40780
|
const startPoint = this.startPoint;
|
|
@@ -41581,7 +41585,7 @@ class DefaultShapeData {
|
|
|
41581
41585
|
text;
|
|
41582
41586
|
linkTo;
|
|
41583
41587
|
itemType = "Shape";
|
|
41584
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
41588
|
+
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
41589
|
this.shapeType = shapeType;
|
|
41586
41590
|
this.backgroundColor = backgroundColor;
|
|
41587
41591
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -42868,7 +42872,7 @@ class Shape {
|
|
|
42868
42872
|
this.text.updateElement();
|
|
42869
42873
|
}
|
|
42870
42874
|
transformPath() {
|
|
42871
|
-
if (
|
|
42875
|
+
if (conf2.isNode()) {
|
|
42872
42876
|
return;
|
|
42873
42877
|
}
|
|
42874
42878
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -43097,7 +43101,7 @@ class Sticker {
|
|
|
43097
43101
|
return this;
|
|
43098
43102
|
}
|
|
43099
43103
|
transformPath() {
|
|
43100
|
-
if (
|
|
43104
|
+
if (conf2.isNode()) {
|
|
43101
43105
|
return;
|
|
43102
43106
|
}
|
|
43103
43107
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -43648,7 +43652,7 @@ class Frame {
|
|
|
43648
43652
|
this.path = Frames[this.shapeType].path.copy();
|
|
43649
43653
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
43650
43654
|
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", { ...
|
|
43655
|
+
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
43656
|
this.text.setSelectionHorisontalAlignment("left");
|
|
43653
43657
|
this.transformation.subject.subscribe(() => {
|
|
43654
43658
|
this.transformPath();
|
|
@@ -44210,10 +44214,10 @@ class VideoCommand {
|
|
|
44210
44214
|
|
|
44211
44215
|
// src/Items/Video/Video.ts
|
|
44212
44216
|
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 =
|
|
44217
|
+
var videoIcon = conf2.documentFactory.createElement("img");
|
|
44214
44218
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
44215
44219
|
var createPlaceholderImage = (width2, height2) => {
|
|
44216
|
-
const canvas =
|
|
44220
|
+
const canvas = conf2.documentFactory.createElement("canvas");
|
|
44217
44221
|
canvas.width = width2;
|
|
44218
44222
|
canvas.height = height2;
|
|
44219
44223
|
const ctx = canvas.getContext("2d");
|
|
@@ -44257,7 +44261,7 @@ class VideoItem extends Mbr {
|
|
|
44257
44261
|
this.events = events2;
|
|
44258
44262
|
this.id = id;
|
|
44259
44263
|
this.extension = extension2;
|
|
44260
|
-
this.isStorageUrl = !
|
|
44264
|
+
this.isStorageUrl = !conf2.getYouTubeId(url);
|
|
44261
44265
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
44262
44266
|
this.linkTo = new LinkTo(this.id, events2);
|
|
44263
44267
|
this.board = board;
|
|
@@ -44627,59 +44631,59 @@ async function fileTosha256(file) {
|
|
|
44627
44631
|
var catchErrorResponse = async (response, mediaType) => {
|
|
44628
44632
|
if (response.status === 403) {
|
|
44629
44633
|
const data = await response.json();
|
|
44630
|
-
let errorBody =
|
|
44634
|
+
let errorBody = conf2.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
44631
44635
|
if (!data.isOwnerRequest) {
|
|
44632
|
-
errorBody =
|
|
44636
|
+
errorBody = conf2.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
44633
44637
|
} else if (data.currentUsage && data.storageLimit) {
|
|
44634
|
-
errorBody =
|
|
44638
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
44635
44639
|
}
|
|
44636
|
-
|
|
44640
|
+
conf2.notify({
|
|
44637
44641
|
variant: "warning",
|
|
44638
|
-
header:
|
|
44642
|
+
header: conf2.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
44639
44643
|
body: errorBody,
|
|
44640
44644
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
44641
|
-
text:
|
|
44642
|
-
onClick: () =>
|
|
44645
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44646
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44643
44647
|
} : undefined,
|
|
44644
44648
|
duration: 8000
|
|
44645
44649
|
});
|
|
44646
44650
|
} else if (response.status === 413) {
|
|
44647
44651
|
const data = await response.json();
|
|
44648
|
-
let errorBody =
|
|
44652
|
+
let errorBody = conf2.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
44649
44653
|
let isBasicPlan = false;
|
|
44650
44654
|
if (data.fileSizeLimit && data.fileSize) {
|
|
44651
44655
|
if (mediaType === "image") {
|
|
44652
44656
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
44653
|
-
errorBody =
|
|
44657
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44654
44658
|
} else {
|
|
44655
44659
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
44656
|
-
errorBody =
|
|
44660
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44657
44661
|
}
|
|
44658
44662
|
}
|
|
44659
|
-
|
|
44663
|
+
conf2.notify({
|
|
44660
44664
|
variant: "warning",
|
|
44661
|
-
header:
|
|
44665
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44662
44666
|
body: errorBody,
|
|
44663
44667
|
button: isBasicPlan ? {
|
|
44664
|
-
text:
|
|
44665
|
-
onClick: () =>
|
|
44668
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44669
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44666
44670
|
} : undefined,
|
|
44667
44671
|
duration: 4000
|
|
44668
44672
|
});
|
|
44669
44673
|
} else if (response.status === 401) {
|
|
44670
|
-
|
|
44674
|
+
conf2.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
44671
44675
|
} else if (response.status === 415) {
|
|
44672
|
-
|
|
44676
|
+
conf2.notify({
|
|
44673
44677
|
variant: "warning",
|
|
44674
|
-
header:
|
|
44675
|
-
body:
|
|
44678
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
44679
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
44676
44680
|
duration: 4000
|
|
44677
44681
|
});
|
|
44678
44682
|
} else {
|
|
44679
|
-
|
|
44683
|
+
conf2.notify({
|
|
44680
44684
|
variant: "error",
|
|
44681
|
-
header:
|
|
44682
|
-
body:
|
|
44685
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
44686
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
44683
44687
|
duration: 4000
|
|
44684
44688
|
});
|
|
44685
44689
|
}
|
|
@@ -44687,17 +44691,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
44687
44691
|
};
|
|
44688
44692
|
var catchDuplicateErrorResponse = async (response) => {
|
|
44689
44693
|
if (response.status === 403) {
|
|
44690
|
-
|
|
44694
|
+
conf2.notify({
|
|
44691
44695
|
variant: "warning",
|
|
44692
|
-
header:
|
|
44693
|
-
body:
|
|
44696
|
+
header: conf2.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
44697
|
+
body: conf2.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
44694
44698
|
duration: 4000
|
|
44695
44699
|
});
|
|
44696
44700
|
} else {
|
|
44697
|
-
|
|
44701
|
+
conf2.notify({
|
|
44698
44702
|
variant: "error",
|
|
44699
|
-
header:
|
|
44700
|
-
body:
|
|
44703
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
44704
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
44701
44705
|
duration: 4000
|
|
44702
44706
|
});
|
|
44703
44707
|
}
|
|
@@ -44705,40 +44709,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
44705
44709
|
};
|
|
44706
44710
|
var validateMediaFile = (file, account2) => {
|
|
44707
44711
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
44708
|
-
if (!file.type.startsWith("image") && !
|
|
44709
|
-
|
|
44712
|
+
if (!file.type.startsWith("image") && !conf2.AUDIO_FORMATS.includes(fileExtension) && !conf2.VIDEO_FORMATS.includes(fileExtension)) {
|
|
44713
|
+
conf2.notify({
|
|
44710
44714
|
variant: "warning",
|
|
44711
|
-
header:
|
|
44712
|
-
body:
|
|
44715
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
44716
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
44713
44717
|
duration: 4000
|
|
44714
44718
|
});
|
|
44715
44719
|
return false;
|
|
44716
44720
|
}
|
|
44717
44721
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
44718
|
-
let errorBody =
|
|
44719
|
-
if (
|
|
44720
|
-
errorBody =
|
|
44722
|
+
let errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44723
|
+
if (conf2.AUDIO_FORMATS.includes(fileExtension) || conf2.VIDEO_FORMATS.includes(fileExtension)) {
|
|
44724
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
44721
44725
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
44722
|
-
|
|
44726
|
+
conf2.notify({
|
|
44723
44727
|
variant: "warning",
|
|
44724
|
-
header:
|
|
44728
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44725
44729
|
body: errorBody,
|
|
44726
44730
|
button: isBasicPlan ? {
|
|
44727
|
-
text:
|
|
44728
|
-
onClick: () =>
|
|
44731
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44732
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44729
44733
|
} : undefined,
|
|
44730
44734
|
duration: 4000
|
|
44731
44735
|
});
|
|
44732
44736
|
return false;
|
|
44733
44737
|
}
|
|
44734
44738
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
44735
|
-
|
|
44739
|
+
conf2.notify({
|
|
44736
44740
|
variant: "warning",
|
|
44737
|
-
header:
|
|
44741
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
44738
44742
|
body: errorBody,
|
|
44739
44743
|
button: isBasicPlan ? {
|
|
44740
|
-
text:
|
|
44741
|
-
onClick: () =>
|
|
44744
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
44745
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
44742
44746
|
} : undefined,
|
|
44743
44747
|
duration: 4000
|
|
44744
44748
|
});
|
|
@@ -44817,7 +44821,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
44817
44821
|
};
|
|
44818
44822
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
44819
44823
|
image2.onload = async () => {
|
|
44820
|
-
const parser =
|
|
44824
|
+
const parser = conf2.getDOMParser();
|
|
44821
44825
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
44822
44826
|
const svgElement = svgDoc.documentElement;
|
|
44823
44827
|
svgElement.removeAttribute("width");
|
|
@@ -45048,8 +45052,8 @@ class AudioItem extends Mbr {
|
|
|
45048
45052
|
this.subject.publish(this);
|
|
45049
45053
|
});
|
|
45050
45054
|
this.transformation.subject.subscribe(this.onTransform);
|
|
45051
|
-
this.right = this.left +
|
|
45052
|
-
this.bottom = this.top +
|
|
45055
|
+
this.right = this.left + conf2.AUDIO_DIMENSIONS.width;
|
|
45056
|
+
this.bottom = this.top + conf2.AUDIO_DIMENSIONS.height;
|
|
45053
45057
|
}
|
|
45054
45058
|
setCurrentTime(time2) {
|
|
45055
45059
|
this.currentTime = time2;
|
|
@@ -45116,8 +45120,8 @@ class AudioItem extends Mbr {
|
|
|
45116
45120
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
45117
45121
|
this.left = translateX;
|
|
45118
45122
|
this.top = translateY;
|
|
45119
|
-
this.right = this.left +
|
|
45120
|
-
this.bottom = this.top +
|
|
45123
|
+
this.right = this.left + conf2.AUDIO_DIMENSIONS.width * scaleX;
|
|
45124
|
+
this.bottom = this.top + conf2.AUDIO_DIMENSIONS.height * scaleY;
|
|
45121
45125
|
}
|
|
45122
45126
|
render(context) {
|
|
45123
45127
|
if (this.transformationRenderBlock) {
|
|
@@ -45146,8 +45150,8 @@ class AudioItem extends Mbr {
|
|
|
45146
45150
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
45147
45151
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
45148
45152
|
div.id = this.getId();
|
|
45149
|
-
div.style.width = `${
|
|
45150
|
-
div.style.height = `${
|
|
45153
|
+
div.style.width = `${conf2.AUDIO_DIMENSIONS.width}px`;
|
|
45154
|
+
div.style.height = `${conf2.AUDIO_DIMENSIONS.height}px`;
|
|
45151
45155
|
div.style.transformOrigin = "top left";
|
|
45152
45156
|
div.style.transform = transform;
|
|
45153
45157
|
div.style.position = "absolute";
|
|
@@ -45266,7 +45270,7 @@ class AudioItem extends Mbr {
|
|
|
45266
45270
|
}
|
|
45267
45271
|
download() {
|
|
45268
45272
|
if (this.extension) {
|
|
45269
|
-
const linkElem =
|
|
45273
|
+
const linkElem = conf2.documentFactory.createElement("a");
|
|
45270
45274
|
linkElem.href = this.url;
|
|
45271
45275
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
45272
45276
|
linkElem.click();
|
|
@@ -45668,7 +45672,7 @@ class ImageCommand {
|
|
|
45668
45672
|
|
|
45669
45673
|
// src/Items/Image/Image.ts
|
|
45670
45674
|
function getPlaceholderImage(board, imageDimension) {
|
|
45671
|
-
const placeholderCanvas =
|
|
45675
|
+
const placeholderCanvas = conf2.documentFactory.createElement("canvas");
|
|
45672
45676
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
45673
45677
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
45674
45678
|
const placeholder = new Placeholder;
|
|
@@ -46019,7 +46023,7 @@ class Drawing extends Mbr {
|
|
|
46019
46023
|
itemType = "Drawing";
|
|
46020
46024
|
parent = "Board";
|
|
46021
46025
|
transformation;
|
|
46022
|
-
path2d = new
|
|
46026
|
+
path2d = new conf2.path2DFactory;
|
|
46023
46027
|
subject = new Subject;
|
|
46024
46028
|
untransformedMbr = new Mbr;
|
|
46025
46029
|
lines = [];
|
|
@@ -46096,7 +46100,7 @@ class Drawing extends Mbr {
|
|
|
46096
46100
|
this.bottom = mbr.bottom;
|
|
46097
46101
|
}
|
|
46098
46102
|
updatePath2d() {
|
|
46099
|
-
this.path2d = new
|
|
46103
|
+
this.path2d = new conf2.path2DFactory;
|
|
46100
46104
|
const context = this.path2d;
|
|
46101
46105
|
const points = this.points;
|
|
46102
46106
|
if (points.length < 3) {
|
|
@@ -47269,9 +47273,9 @@ class Camera {
|
|
|
47269
47273
|
matrix = new Matrix2;
|
|
47270
47274
|
pointer = new Point;
|
|
47271
47275
|
window = {
|
|
47272
|
-
width:
|
|
47273
|
-
height:
|
|
47274
|
-
dpi:
|
|
47276
|
+
width: conf2.getDocumentWidth(),
|
|
47277
|
+
height: conf2.getDocumentHeight(),
|
|
47278
|
+
dpi: conf2.getDPI(),
|
|
47275
47279
|
getMbr: () => {
|
|
47276
47280
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
47277
47281
|
}
|
|
@@ -47647,9 +47651,9 @@ class Camera {
|
|
|
47647
47651
|
this.updateBoardPointer();
|
|
47648
47652
|
}
|
|
47649
47653
|
onWindowResize() {
|
|
47650
|
-
this.window.width =
|
|
47651
|
-
this.window.height =
|
|
47652
|
-
this.window.dpi =
|
|
47654
|
+
this.window.width = conf2.getDocumentWidth();
|
|
47655
|
+
this.window.height = conf2.getDocumentHeight();
|
|
47656
|
+
this.window.dpi = conf2.getDPI();
|
|
47653
47657
|
this.resizeSubject.publish(this);
|
|
47654
47658
|
this.subject.publish(this);
|
|
47655
47659
|
}
|
|
@@ -47662,10 +47666,10 @@ class Camera {
|
|
|
47662
47666
|
let y = 0;
|
|
47663
47667
|
const { activeKeys } = keyboard;
|
|
47664
47668
|
const directions = {
|
|
47665
|
-
ArrowRight: [-
|
|
47666
|
-
ArrowLeft: [
|
|
47667
|
-
ArrowDown: [0, -
|
|
47668
|
-
ArrowUp: [0,
|
|
47669
|
+
ArrowRight: [-conf2.NAVIGATION_STEP, 0],
|
|
47670
|
+
ArrowLeft: [conf2.NAVIGATION_STEP, 0],
|
|
47671
|
+
ArrowDown: [0, -conf2.NAVIGATION_STEP],
|
|
47672
|
+
ArrowUp: [0, conf2.NAVIGATION_STEP]
|
|
47669
47673
|
};
|
|
47670
47674
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
47671
47675
|
if (activeArrowKeys.length === 2) {
|
|
@@ -48198,7 +48202,7 @@ var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
|
48198
48202
|
|
|
48199
48203
|
// src/Keyboard/logHotkey.ts
|
|
48200
48204
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
48201
|
-
if (!
|
|
48205
|
+
if (!conf.LOG_HOTKEYS) {
|
|
48202
48206
|
return;
|
|
48203
48207
|
}
|
|
48204
48208
|
const isFunction = typeof hotkeyConfig === "function";
|
|
@@ -48290,7 +48294,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
48290
48294
|
// src/Keyboard/getHotkeyLabel.ts
|
|
48291
48295
|
function getHotkeyLabel(hotkey) {
|
|
48292
48296
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
48293
|
-
switch (
|
|
48297
|
+
switch (conf2.FORCE_HOTKEYS || "auto") {
|
|
48294
48298
|
case "windows":
|
|
48295
48299
|
return hotkeyLabel.windows;
|
|
48296
48300
|
case "macos":
|
|
@@ -50267,7 +50271,7 @@ class SpatialIndex {
|
|
|
50267
50271
|
this.itemsArray.push(item);
|
|
50268
50272
|
this.itemsIndex.insert(item);
|
|
50269
50273
|
}
|
|
50270
|
-
if (
|
|
50274
|
+
if (conf2.isNode()) {
|
|
50271
50275
|
return;
|
|
50272
50276
|
}
|
|
50273
50277
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -50834,8 +50838,8 @@ class Tool {
|
|
|
50834
50838
|
|
|
50835
50839
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
50836
50840
|
function getDecorationResizeType(point7, mbr, tolerance = 10) {
|
|
50837
|
-
for (const key in
|
|
50838
|
-
const decoration =
|
|
50841
|
+
for (const key in conf2.EXPORT_FRAME_DECORATIONS) {
|
|
50842
|
+
const decoration = conf2.EXPORT_FRAME_DECORATIONS[key];
|
|
50839
50843
|
const decorationBounds = {
|
|
50840
50844
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
50841
50845
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -50876,7 +50880,7 @@ class ExportSnapshot extends Tool {
|
|
|
50876
50880
|
super();
|
|
50877
50881
|
this.board = board;
|
|
50878
50882
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
50879
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
50883
|
+
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
50884
|
this.board.selection.disable();
|
|
50881
50885
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
50882
50886
|
}
|
|
@@ -50888,11 +50892,11 @@ class ExportSnapshot extends Tool {
|
|
|
50888
50892
|
resize() {
|
|
50889
50893
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
50890
50894
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
50891
|
-
if (resize.mbr.getWidth() >
|
|
50895
|
+
if (resize.mbr.getWidth() > conf2.EXPORT_MIN_WIDTH) {
|
|
50892
50896
|
this.mbr.left = resize.mbr.left;
|
|
50893
50897
|
this.mbr.right = resize.mbr.right;
|
|
50894
50898
|
}
|
|
50895
|
-
if (resize.mbr.getHeight() >
|
|
50899
|
+
if (resize.mbr.getHeight() > conf2.EXPORT_MIN_HEIGHT) {
|
|
50896
50900
|
this.mbr.top = resize.mbr.top;
|
|
50897
50901
|
this.mbr.bottom = resize.mbr.bottom;
|
|
50898
50902
|
}
|
|
@@ -50981,7 +50985,7 @@ class ExportSnapshot extends Tool {
|
|
|
50981
50985
|
}
|
|
50982
50986
|
const res = await exportBoardSnapshot({
|
|
50983
50987
|
board: this.board,
|
|
50984
|
-
bgColor:
|
|
50988
|
+
bgColor: conf2.CANVAS_BG_COLOR,
|
|
50985
50989
|
selection: this.mbr,
|
|
50986
50990
|
upscaleTo: 4000,
|
|
50987
50991
|
nameToExport: this.board.getName()
|
|
@@ -51005,18 +51009,18 @@ class ExportSnapshot extends Tool {
|
|
|
51005
51009
|
const cameraMbr = context.camera.getMbr();
|
|
51006
51010
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
51007
51011
|
this.tempDrawingContext.clear();
|
|
51008
|
-
cameraMbr.backgroundColor =
|
|
51012
|
+
cameraMbr.backgroundColor = conf2.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
51009
51013
|
cameraMbr.strokeWidth = 0;
|
|
51010
51014
|
cameraMbr.render(this.tempDrawingContext);
|
|
51011
51015
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
51012
|
-
if (
|
|
51013
|
-
const topLeft =
|
|
51016
|
+
if (conf2.EXPORT_FRAME_DECORATIONS) {
|
|
51017
|
+
const topLeft = conf2.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
51014
51018
|
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 =
|
|
51019
|
+
const topRight = conf2.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
51016
51020
|
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 =
|
|
51021
|
+
const bottomLeft = conf2.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
51018
51022
|
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 =
|
|
51023
|
+
const bottomRight = conf2.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
51020
51024
|
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
51025
|
}
|
|
51022
51026
|
}
|
|
@@ -51525,14 +51529,14 @@ class AddConnector extends BoardTool {
|
|
|
51525
51529
|
class AddDrawing extends BoardTool {
|
|
51526
51530
|
drawing = null;
|
|
51527
51531
|
isDown = false;
|
|
51528
|
-
strokeWidth =
|
|
51529
|
-
strokeColor =
|
|
51530
|
-
strokeStyle =
|
|
51532
|
+
strokeWidth = conf2.PEN_INITIAL_STROKE_WIDTH;
|
|
51533
|
+
strokeColor = conf2.PEN_DEFAULT_COLOR;
|
|
51534
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
51531
51535
|
constructor(board) {
|
|
51532
51536
|
super(board);
|
|
51533
51537
|
this.setCursor();
|
|
51534
|
-
if (
|
|
51535
|
-
const drawingSettings = localStorage.getItem(
|
|
51538
|
+
if (conf2.PEN_SETTINGS_KEY) {
|
|
51539
|
+
const drawingSettings = localStorage.getItem(conf2.PEN_SETTINGS_KEY);
|
|
51536
51540
|
if (drawingSettings) {
|
|
51537
51541
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
51538
51542
|
this.strokeWidth = strokeWidth;
|
|
@@ -51542,7 +51546,7 @@ class AddDrawing extends BoardTool {
|
|
|
51542
51546
|
}
|
|
51543
51547
|
}
|
|
51544
51548
|
updateSettings() {
|
|
51545
|
-
localStorage.setItem(
|
|
51549
|
+
localStorage.setItem(conf2.PEN_SETTINGS_KEY, JSON.stringify({
|
|
51546
51550
|
strokeWidth: this.strokeWidth,
|
|
51547
51551
|
strokeColor: this.strokeColor,
|
|
51548
51552
|
strokeStyle: this.strokeStyle
|
|
@@ -51572,7 +51576,7 @@ class AddDrawing extends BoardTool {
|
|
|
51572
51576
|
ctx.beginPath();
|
|
51573
51577
|
ctx.arc(point7.x, point7.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
51574
51578
|
ctx.lineWidth = 1;
|
|
51575
|
-
ctx.strokeStyle =
|
|
51579
|
+
ctx.strokeStyle = conf2.PEN_POINTER_CIRCLE_COLOR;
|
|
51576
51580
|
ctx.stroke();
|
|
51577
51581
|
}
|
|
51578
51582
|
setCursor() {
|
|
@@ -51654,7 +51658,7 @@ class AddDrawing extends BoardTool {
|
|
|
51654
51658
|
this.setCursor();
|
|
51655
51659
|
};
|
|
51656
51660
|
render(context) {
|
|
51657
|
-
if (
|
|
51661
|
+
if (conf2.PEN_RENDER_POINTER_CIRCLE) {
|
|
51658
51662
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
51659
51663
|
}
|
|
51660
51664
|
if (!this.drawing) {
|
|
@@ -51669,14 +51673,14 @@ class AddDrawing extends BoardTool {
|
|
|
51669
51673
|
}
|
|
51670
51674
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
51671
51675
|
class AddHighlighter extends AddDrawing {
|
|
51672
|
-
strokeWidth =
|
|
51673
|
-
strokeColor =
|
|
51674
|
-
strokeStyle =
|
|
51676
|
+
strokeWidth = conf2.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
51677
|
+
strokeColor = conf2.HIGHLIGHTER_DEFAULT_COLOR;
|
|
51678
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
51675
51679
|
constructor(board) {
|
|
51676
51680
|
super(board);
|
|
51677
51681
|
this.setCursor();
|
|
51678
|
-
if (
|
|
51679
|
-
const highlighterSettings = localStorage.getItem(
|
|
51682
|
+
if (conf2.HIGHLIGHTER_SETTINGS_KEY) {
|
|
51683
|
+
const highlighterSettings = localStorage.getItem(conf2.HIGHLIGHTER_SETTINGS_KEY);
|
|
51680
51684
|
if (highlighterSettings) {
|
|
51681
51685
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
51682
51686
|
this.strokeWidth = strokeWidth;
|
|
@@ -51689,7 +51693,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
51689
51693
|
return true;
|
|
51690
51694
|
}
|
|
51691
51695
|
updateSettings() {
|
|
51692
|
-
localStorage.setItem(
|
|
51696
|
+
localStorage.setItem(conf2.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
51693
51697
|
strokeWidth: this.strokeWidth,
|
|
51694
51698
|
strokeColor: this.strokeColor,
|
|
51695
51699
|
strokeStyle: this.strokeStyle
|
|
@@ -52013,7 +52017,7 @@ class AddShape extends BoardTool {
|
|
|
52013
52017
|
const point7 = this.board.pointer.point;
|
|
52014
52018
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52015
52019
|
this.bounds = this.line.getMbr();
|
|
52016
|
-
this.bounds.borderColor =
|
|
52020
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52017
52021
|
this.shape.apply({
|
|
52018
52022
|
class: "Shape",
|
|
52019
52023
|
method: "setShapeType",
|
|
@@ -52037,7 +52041,7 @@ class AddShape extends BoardTool {
|
|
|
52037
52041
|
}
|
|
52038
52042
|
this.line = new Line(startPoint, endPoint);
|
|
52039
52043
|
this.bounds = this.line.getMbr();
|
|
52040
|
-
this.bounds.borderColor =
|
|
52044
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52041
52045
|
this.initTransformation();
|
|
52042
52046
|
this.board.tools.publish();
|
|
52043
52047
|
return true;
|
|
@@ -52109,7 +52113,7 @@ class AddShape extends BoardTool {
|
|
|
52109
52113
|
const y = (top + bottom) / 2 - 50;
|
|
52110
52114
|
this.bounds = new Mbr(x, y, x, y);
|
|
52111
52115
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
52112
|
-
this.bounds.borderColor =
|
|
52116
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52113
52117
|
this.shape.apply({
|
|
52114
52118
|
class: "Shape",
|
|
52115
52119
|
method: "setShapeType",
|
|
@@ -52142,8 +52146,8 @@ class AddSticker extends BoardTool {
|
|
|
52142
52146
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
52143
52147
|
}
|
|
52144
52148
|
setCursor(color2) {
|
|
52145
|
-
if (
|
|
52146
|
-
const colorName = color2 ?
|
|
52149
|
+
if (conf2.STICKER_COLOR_NAMES) {
|
|
52150
|
+
const colorName = color2 ? conf2.STICKER_COLOR_NAMES[conf2.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
52147
52151
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
52148
52152
|
} else {
|
|
52149
52153
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -52167,7 +52171,7 @@ class AddSticker extends BoardTool {
|
|
|
52167
52171
|
const point7 = this.board.pointer.point;
|
|
52168
52172
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52169
52173
|
this.bounds = this.line.getMbr();
|
|
52170
|
-
this.bounds.borderColor =
|
|
52174
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52171
52175
|
this.board.tools.publish();
|
|
52172
52176
|
return true;
|
|
52173
52177
|
}
|
|
@@ -52176,7 +52180,7 @@ class AddSticker extends BoardTool {
|
|
|
52176
52180
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
52177
52181
|
this.sticker.applyDiagonal(this.line);
|
|
52178
52182
|
this.bounds = this.sticker.getMbr();
|
|
52179
|
-
this.bounds.borderColor =
|
|
52183
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52180
52184
|
this.board.tools.publish();
|
|
52181
52185
|
return true;
|
|
52182
52186
|
}
|
|
@@ -52276,7 +52280,7 @@ class AddText extends BoardTool {
|
|
|
52276
52280
|
const point7 = this.board.pointer.point;
|
|
52277
52281
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52278
52282
|
this.bounds = this.line.getMbr();
|
|
52279
|
-
this.bounds.borderColor =
|
|
52283
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52280
52284
|
this.board.tools.publish();
|
|
52281
52285
|
return true;
|
|
52282
52286
|
}
|
|
@@ -52287,7 +52291,7 @@ class AddText extends BoardTool {
|
|
|
52287
52291
|
const end2 = new Point(cursorPoint.x, start2.y + height2);
|
|
52288
52292
|
this.line = new Line(start2, end2);
|
|
52289
52293
|
this.bounds = this.line.getMbr();
|
|
52290
|
-
this.bounds.borderColor =
|
|
52294
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
52291
52295
|
this.board.tools.publish();
|
|
52292
52296
|
return true;
|
|
52293
52297
|
}
|
|
@@ -52352,11 +52356,11 @@ class AddText extends BoardTool {
|
|
|
52352
52356
|
class Eraser extends BoardTool {
|
|
52353
52357
|
itemType = "Eraser";
|
|
52354
52358
|
isDown = false;
|
|
52355
|
-
strokeWidth =
|
|
52356
|
-
strokeColor =
|
|
52357
|
-
strokeStyle =
|
|
52359
|
+
strokeWidth = conf2.ERASER_STROKE_WIDTH;
|
|
52360
|
+
strokeColor = conf2.ERASER_DEFAULT_COLOR;
|
|
52361
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
52358
52362
|
drawing = new Drawing(this.board, []);
|
|
52359
|
-
maxPointsInLine =
|
|
52363
|
+
maxPointsInLine = conf2.ERASER_MAX_LINE_LENGTH;
|
|
52360
52364
|
constructor(board) {
|
|
52361
52365
|
super(board);
|
|
52362
52366
|
this.setCursor();
|
|
@@ -52518,7 +52522,7 @@ function createCanvasDrawer(board) {
|
|
|
52518
52522
|
borderDiv.id = "canvasBorder";
|
|
52519
52523
|
borderDiv.style.position = "absolute";
|
|
52520
52524
|
borderDiv.style.transformOrigin = "left top";
|
|
52521
|
-
borderDiv.style.border = `1px solid ${
|
|
52525
|
+
borderDiv.style.border = `1px solid ${conf2.SELECTION_COLOR}`;
|
|
52522
52526
|
borderDiv.style.boxSizing = "border-box";
|
|
52523
52527
|
borderDiv.style.left = `${leftOffset}px`;
|
|
52524
52528
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -52528,7 +52532,7 @@ function createCanvasDrawer(board) {
|
|
|
52528
52532
|
canvas.style.boxSizing = "border-box";
|
|
52529
52533
|
container.appendChild(borderDiv);
|
|
52530
52534
|
} else {
|
|
52531
|
-
canvas.style.border = `1px solid ${
|
|
52535
|
+
canvas.style.border = `1px solid ${conf2.SELECTION_COLOR}`;
|
|
52532
52536
|
canvas.style.boxSizing = "border-box";
|
|
52533
52537
|
}
|
|
52534
52538
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -52536,8 +52540,8 @@ function createCanvasDrawer(board) {
|
|
|
52536
52540
|
anchorDiv.style.position = "absolute";
|
|
52537
52541
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
52538
52542
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
52539
|
-
anchorDiv.style.backgroundColor = `${
|
|
52540
|
-
anchorDiv.style.border = `${
|
|
52543
|
+
anchorDiv.style.backgroundColor = `${conf2.SELECTION_ANCHOR_COLOR}`;
|
|
52544
|
+
anchorDiv.style.border = `${conf2.SELECTION_ANCHOR_WIDTH}px solid ${conf2.SELECTION_COLOR}`;
|
|
52541
52545
|
anchorDiv.style.borderRadius = "2px";
|
|
52542
52546
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
52543
52547
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -52545,10 +52549,10 @@ function createCanvasDrawer(board) {
|
|
|
52545
52549
|
return anchorDiv;
|
|
52546
52550
|
};
|
|
52547
52551
|
const anchors = [
|
|
52548
|
-
createAnchorDiv("0%", "0%",
|
|
52549
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
52550
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
52551
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
52552
|
+
createAnchorDiv("0%", "0%", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52553
|
+
createAnchorDiv("100% + 1px", "0%", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52554
|
+
createAnchorDiv("0%", "100% + 1px", conf2.SELECTION_ANCHOR_RADIUS),
|
|
52555
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf2.SELECTION_ANCHOR_RADIUS)
|
|
52552
52556
|
];
|
|
52553
52557
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
52554
52558
|
for (const anchor of anchors) {
|
|
@@ -53890,8 +53894,8 @@ class Select extends Tool {
|
|
|
53890
53894
|
const { x, y } = pointer.point;
|
|
53891
53895
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
53892
53896
|
this.rect = this.line.getMbr();
|
|
53893
|
-
this.rect.borderColor =
|
|
53894
|
-
this.rect.backgroundColor =
|
|
53897
|
+
this.rect.borderColor = conf2.SELECTION_COLOR;
|
|
53898
|
+
this.rect.backgroundColor = conf2.SELECTION_BACKGROUND;
|
|
53895
53899
|
this.board.tools.publish();
|
|
53896
53900
|
this.board.presence.throttledEmit({
|
|
53897
53901
|
method: "DrawSelect",
|
|
@@ -53976,8 +53980,8 @@ class Select extends Tool {
|
|
|
53976
53980
|
const point7 = this.board.pointer.point.copy();
|
|
53977
53981
|
this.line = new Line(this.line.start, point7);
|
|
53978
53982
|
this.rect = this.line.getMbr();
|
|
53979
|
-
this.rect.borderColor =
|
|
53980
|
-
this.rect.backgroundColor =
|
|
53983
|
+
this.rect.borderColor = conf2.SELECTION_COLOR;
|
|
53984
|
+
this.rect.backgroundColor = conf2.SELECTION_BACKGROUND;
|
|
53981
53985
|
this.board.tools.publish();
|
|
53982
53986
|
this.board.presence.throttledEmit({
|
|
53983
53987
|
method: "DrawSelect",
|
|
@@ -55111,7 +55115,7 @@ class Board {
|
|
|
55111
55115
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
55112
55116
|
const css = INDEX_CSS;
|
|
55113
55117
|
const boardName = this.getName() || this.getBoardId();
|
|
55114
|
-
const items = this.items.getWholeHTML(
|
|
55118
|
+
const items = this.items.getWholeHTML(conf2.documentFactory);
|
|
55115
55119
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
55116
55120
|
const scripts = `
|
|
55117
55121
|
<script type="module">${customTagsScript}</script>
|
|
@@ -55151,7 +55155,7 @@ class Board {
|
|
|
55151
55155
|
return `${head}${body}`;
|
|
55152
55156
|
}
|
|
55153
55157
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
55154
|
-
const parser =
|
|
55158
|
+
const parser = conf2.getDOMParser();
|
|
55155
55159
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
55156
55160
|
const items = doc.body.querySelector("#items");
|
|
55157
55161
|
if (items) {
|
|
@@ -55203,7 +55207,7 @@ class Board {
|
|
|
55203
55207
|
return [];
|
|
55204
55208
|
}
|
|
55205
55209
|
deserializeHTML(stringedHTML) {
|
|
55206
|
-
const parser =
|
|
55210
|
+
const parser = conf2.getDOMParser();
|
|
55207
55211
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
55208
55212
|
const itemsDiv = doc.body.querySelector("#items");
|
|
55209
55213
|
if (!itemsDiv) {
|
|
@@ -55764,7 +55768,7 @@ class RichTextCommand {
|
|
|
55764
55768
|
item: id,
|
|
55765
55769
|
operation: {
|
|
55766
55770
|
...this.operation,
|
|
55767
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
55771
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf2.DEFAULT_TEXT_STYLES.fontColor
|
|
55768
55772
|
}
|
|
55769
55773
|
}));
|
|
55770
55774
|
case "setBlockType":
|
|
@@ -55788,7 +55792,7 @@ class RichTextCommand {
|
|
|
55788
55792
|
item: id,
|
|
55789
55793
|
operation: {
|
|
55790
55794
|
...this.operation,
|
|
55791
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
55795
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf2.DEFAULT_TEXT_STYLES.fontFamily
|
|
55792
55796
|
}
|
|
55793
55797
|
}));
|
|
55794
55798
|
case "setFontSize":
|
|
@@ -55796,7 +55800,7 @@ class RichTextCommand {
|
|
|
55796
55800
|
item: id,
|
|
55797
55801
|
operation: {
|
|
55798
55802
|
...this.operation,
|
|
55799
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
55803
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf2.DEFAULT_TEXT_STYLES.fontSize
|
|
55800
55804
|
}
|
|
55801
55805
|
}));
|
|
55802
55806
|
case "setFontHighlight":
|
|
@@ -55804,7 +55808,7 @@ class RichTextCommand {
|
|
|
55804
55808
|
item: id,
|
|
55805
55809
|
operation: {
|
|
55806
55810
|
...this.operation,
|
|
55807
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
55811
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf2.DEFAULT_TEXT_STYLES.fontHighlight
|
|
55808
55812
|
}
|
|
55809
55813
|
}));
|
|
55810
55814
|
case "setHorisontalAlignment":
|
|
@@ -57145,7 +57149,7 @@ class Transformer extends Tool {
|
|
|
57145
57149
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
57146
57150
|
if (mbr) {
|
|
57147
57151
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
57148
|
-
const selectionColor = isLockedItems ?
|
|
57152
|
+
const selectionColor = isLockedItems ? conf2.SELECTION_LOCKED_COLOR : conf2.SELECTION_COLOR;
|
|
57149
57153
|
mbr.borderColor = selectionColor;
|
|
57150
57154
|
mbr.render(context);
|
|
57151
57155
|
}
|
|
@@ -57171,7 +57175,7 @@ class Transformer extends Tool {
|
|
|
57171
57175
|
new Point(right, bottom)
|
|
57172
57176
|
];
|
|
57173
57177
|
for (const point7 of points) {
|
|
57174
|
-
const circle = new Anchor(point7.x, point7.y,
|
|
57178
|
+
const circle = new Anchor(point7.x, point7.y, conf2.SELECTION_ANCHOR_RADIUS, conf2.SELECTION_COLOR, conf2.SELECTION_ANCHOR_COLOR, conf2.SELECTION_ANCHOR_WIDTH);
|
|
57175
57179
|
anchors.push(circle);
|
|
57176
57180
|
}
|
|
57177
57181
|
}
|
|
@@ -58374,7 +58378,7 @@ class Selection2 {
|
|
|
58374
58378
|
renderItemMbr(context, item, customScale) {
|
|
58375
58379
|
const mbr = item.getMbr();
|
|
58376
58380
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
58377
|
-
const selectionColor = item.transformation.isLocked ?
|
|
58381
|
+
const selectionColor = item.transformation.isLocked ? conf2.SELECTION_LOCKED_COLOR : conf2.SELECTION_COLOR;
|
|
58378
58382
|
mbr.borderColor = selectionColor;
|
|
58379
58383
|
mbr.render(context);
|
|
58380
58384
|
}
|
|
@@ -59229,19 +59233,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
59229
59233
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
59230
59234
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
59231
59235
|
const transformed = { ...toTransform };
|
|
59232
|
-
const
|
|
59236
|
+
const conf3 = confirmed.path;
|
|
59233
59237
|
const path3 = transformed.path;
|
|
59234
|
-
if (Path3.equals(
|
|
59238
|
+
if (Path3.equals(conf3, path3)) {
|
|
59235
59239
|
return transformed;
|
|
59236
59240
|
}
|
|
59237
|
-
const isDescendant = path3.length >
|
|
59241
|
+
const isDescendant = path3.length > conf3.length && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i]);
|
|
59238
59242
|
if (isDescendant) {
|
|
59239
59243
|
const newPath = [...path3];
|
|
59240
59244
|
newPath[0] = newPath[0] + 1;
|
|
59241
59245
|
transformed.path = newPath;
|
|
59242
59246
|
return transformed;
|
|
59243
59247
|
}
|
|
59244
|
-
if (Path3.isBefore(
|
|
59248
|
+
if (Path3.isBefore(conf3, path3)) {
|
|
59245
59249
|
transformPath(confirmed, transformed);
|
|
59246
59250
|
}
|
|
59247
59251
|
return transformed;
|
|
@@ -59250,23 +59254,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
59250
59254
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
59251
59255
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
59252
59256
|
const transformed = { ...toTransform };
|
|
59253
|
-
const
|
|
59257
|
+
const conf3 = confirmed.path;
|
|
59254
59258
|
const path3 = transformed.path;
|
|
59255
|
-
if (Path3.equals(
|
|
59259
|
+
if (Path3.equals(conf3, path3)) {
|
|
59256
59260
|
return transformed;
|
|
59257
59261
|
}
|
|
59258
|
-
if (path3.length ===
|
|
59262
|
+
if (path3.length === conf3.length + 1 && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i])) {
|
|
59259
59263
|
const newPath = [...path3];
|
|
59260
|
-
if (
|
|
59264
|
+
if (conf3.length === 1) {
|
|
59261
59265
|
newPath[0] = newPath[0] + 1;
|
|
59262
59266
|
} else {
|
|
59263
|
-
newPath[
|
|
59267
|
+
newPath[conf3.length] = newPath[conf3.length] + 1;
|
|
59264
59268
|
}
|
|
59265
59269
|
transformed.path = newPath;
|
|
59266
59270
|
return transformed;
|
|
59267
59271
|
}
|
|
59268
|
-
const isDescendant = path3.length >
|
|
59269
|
-
if (Path3.isBefore(
|
|
59272
|
+
const isDescendant = path3.length > conf3.length && path3.slice(0, conf3.length).every((seg, i) => seg === conf3[i]);
|
|
59273
|
+
if (Path3.isBefore(conf3, path3) && !isDescendant) {
|
|
59270
59274
|
transformPath(confirmed, transformed);
|
|
59271
59275
|
}
|
|
59272
59276
|
return transformed;
|
|
@@ -59846,8 +59850,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
59846
59850
|
const transformed = [];
|
|
59847
59851
|
for (const transf of toTransform) {
|
|
59848
59852
|
let actualyTransformed = { ...transf };
|
|
59849
|
-
for (const
|
|
59850
|
-
const { operation: confOp } =
|
|
59853
|
+
for (const conf3 of confirmed) {
|
|
59854
|
+
const { operation: confOp } = conf3.body;
|
|
59851
59855
|
const { operation: transfOp } = actualyTransformed.body;
|
|
59852
59856
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
59853
59857
|
if (transformedOp) {
|
|
@@ -60479,7 +60483,7 @@ class Events2 {
|
|
|
60479
60483
|
return record !== null;
|
|
60480
60484
|
}
|
|
60481
60485
|
sendPresenceEvent(event) {
|
|
60482
|
-
|
|
60486
|
+
conf2.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
60483
60487
|
}
|
|
60484
60488
|
canUndoEvent(op, byUserId) {
|
|
60485
60489
|
if (op.method === "undo") {
|
|
@@ -60588,7 +60592,7 @@ function handleChatChunk(chunk, board) {
|
|
|
60588
60592
|
if (chunk.isExternalApiError) {
|
|
60589
60593
|
const editor = item2.getRichText().editor;
|
|
60590
60594
|
editor.clearText();
|
|
60591
|
-
editor.insertCopiedText(
|
|
60595
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60592
60596
|
}
|
|
60593
60597
|
}
|
|
60594
60598
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -60596,9 +60600,9 @@ function handleChatChunk(chunk, board) {
|
|
|
60596
60600
|
}
|
|
60597
60601
|
console.log("Error AI generate", chunk.error);
|
|
60598
60602
|
if (!chunk.isExternalApiError) {
|
|
60599
|
-
|
|
60600
|
-
header:
|
|
60601
|
-
body:
|
|
60603
|
+
conf2.notify({
|
|
60604
|
+
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
60605
|
+
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
60602
60606
|
variant: "error",
|
|
60603
60607
|
duration: 4000
|
|
60604
60608
|
});
|
|
@@ -60608,9 +60612,9 @@ function handleChatChunk(chunk, board) {
|
|
|
60608
60612
|
default:
|
|
60609
60613
|
board.camera.unsubscribeFromItem();
|
|
60610
60614
|
if (!chunk.isExternalApiError) {
|
|
60611
|
-
|
|
60612
|
-
header:
|
|
60613
|
-
body:
|
|
60615
|
+
conf2.notify({
|
|
60616
|
+
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
60617
|
+
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
60614
60618
|
variant: "error",
|
|
60615
60619
|
duration: 4000
|
|
60616
60620
|
});
|
|
@@ -60625,7 +60629,7 @@ function handleChatChunk(chunk, board) {
|
|
|
60625
60629
|
if (chunk.isExternalApiError) {
|
|
60626
60630
|
const editor = item2.getRichText().editor;
|
|
60627
60631
|
editor.clearText();
|
|
60628
|
-
editor.insertCopiedText(
|
|
60632
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60629
60633
|
}
|
|
60630
60634
|
}
|
|
60631
60635
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -60652,7 +60656,7 @@ function handleAudioGenerate(response, board) {
|
|
|
60652
60656
|
}
|
|
60653
60657
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
60654
60658
|
const { left, top, right } = placeholderNode.getMbr();
|
|
60655
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
60659
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf2.AUDIO_DIMENSIONS.width) / 2, top);
|
|
60656
60660
|
audio.updateMbr();
|
|
60657
60661
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
60658
60662
|
board.remove(placeholderNode, false);
|
|
@@ -60674,7 +60678,7 @@ function handleAudioGenerate(response, board) {
|
|
|
60674
60678
|
type: "audio/wav"
|
|
60675
60679
|
});
|
|
60676
60680
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
60677
|
-
const linkElem =
|
|
60681
|
+
const linkElem = conf2.documentFactory.createElement("a");
|
|
60678
60682
|
linkElem.href = audioUrl2;
|
|
60679
60683
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
60680
60684
|
linkElem.click();
|
|
@@ -60693,9 +60697,9 @@ function handleAudioGenerate(response, board) {
|
|
|
60693
60697
|
board.selection.add(placeholderNode);
|
|
60694
60698
|
}
|
|
60695
60699
|
console.error("Audio generation error:", response.message);
|
|
60696
|
-
|
|
60697
|
-
header:
|
|
60698
|
-
body:
|
|
60700
|
+
conf2.notify({
|
|
60701
|
+
header: conf2.i18n.t("AIInput.audioGenerationError.header"),
|
|
60702
|
+
body: conf2.i18n.t("AIInput.audioGenerationError.body"),
|
|
60699
60703
|
variant: "error",
|
|
60700
60704
|
duration: 4000
|
|
60701
60705
|
});
|
|
@@ -60758,14 +60762,14 @@ function handleImageGenerate(response, board) {
|
|
|
60758
60762
|
board.selection.add(item);
|
|
60759
60763
|
const editor = item.getRichText()?.editor;
|
|
60760
60764
|
editor?.clearText();
|
|
60761
|
-
editor?.insertCopiedText(
|
|
60765
|
+
editor?.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
60762
60766
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
60763
60767
|
}
|
|
60764
60768
|
}
|
|
60765
60769
|
} else {
|
|
60766
|
-
|
|
60767
|
-
header:
|
|
60768
|
-
body:
|
|
60770
|
+
conf2.notify({
|
|
60771
|
+
header: conf2.i18n.t("AIInput.imageGenerationError.header"),
|
|
60772
|
+
body: conf2.i18n.t("AIInput.imageGenerationError.body"),
|
|
60769
60773
|
variant: "error",
|
|
60770
60774
|
duration: 4000
|
|
60771
60775
|
});
|
|
@@ -60832,10 +60836,10 @@ function startIntervals(board) {
|
|
|
60832
60836
|
}
|
|
60833
60837
|
log.publishIntervalTimer = setInterval(() => {
|
|
60834
60838
|
tryPublishEvent(board);
|
|
60835
|
-
},
|
|
60839
|
+
}, conf2.EVENTS_PUBLISH_INTERVAL);
|
|
60836
60840
|
log.resendIntervalTimer = setInterval(() => {
|
|
60837
60841
|
tryResendEvent(board);
|
|
60838
|
-
},
|
|
60842
|
+
}, conf2.EVENTS_RESEND_INTERVAL);
|
|
60839
60843
|
}
|
|
60840
60844
|
function tryPublishEvent(board) {
|
|
60841
60845
|
const { log } = board.events;
|
|
@@ -60854,14 +60858,14 @@ function tryResendEvent(board) {
|
|
|
60854
60858
|
return;
|
|
60855
60859
|
}
|
|
60856
60860
|
const date = Date.now();
|
|
60857
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
60861
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf2.EVENTS_RESEND_INTERVAL;
|
|
60858
60862
|
if (!isTimeToSendPendingEvent) {
|
|
60859
60863
|
return;
|
|
60860
60864
|
}
|
|
60861
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
60865
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf2.EVENTS_RESEND_INTERVAL * 5;
|
|
60862
60866
|
if (isProbablyLostConnection) {
|
|
60863
60867
|
board.presence.clear();
|
|
60864
|
-
|
|
60868
|
+
conf2.connection?.notifyAboutLostConnection();
|
|
60865
60869
|
}
|
|
60866
60870
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
60867
60871
|
}
|
|
@@ -60892,12 +60896,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
60892
60896
|
lastKnownOrder: log.getLastIndex()
|
|
60893
60897
|
}
|
|
60894
60898
|
};
|
|
60895
|
-
|
|
60899
|
+
conf2.connection.send({
|
|
60896
60900
|
type: "BoardEvent",
|
|
60897
60901
|
boardId: board.getBoardId(),
|
|
60898
60902
|
event: toSend,
|
|
60899
60903
|
sequenceNumber,
|
|
60900
|
-
userId:
|
|
60904
|
+
userId: conf2.connection.getCurrentUser()
|
|
60901
60905
|
});
|
|
60902
60906
|
const date = Date.now();
|
|
60903
60907
|
log.pendingEvent = {
|
|
@@ -60943,7 +60947,7 @@ function handleConfirmation(msg2, board) {
|
|
|
60943
60947
|
if (!isPendingEventConfirmation) {
|
|
60944
60948
|
return;
|
|
60945
60949
|
}
|
|
60946
|
-
|
|
60950
|
+
conf2.connection?.dismissNotificationAboutLostConnection();
|
|
60947
60951
|
log.currentSequenceNumber++;
|
|
60948
60952
|
log.pendingEvent.event.order = msg2.order;
|
|
60949
60953
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -60955,7 +60959,7 @@ function handleConfirmation(msg2, board) {
|
|
|
60955
60959
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
60956
60960
|
function handleCreateSnapshotRequestMessage(msg2, board) {
|
|
60957
60961
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
60958
|
-
|
|
60962
|
+
conf2.connection.send({
|
|
60959
60963
|
type: "BoardSnapshot",
|
|
60960
60964
|
boardId,
|
|
60961
60965
|
snapshot,
|
|
@@ -60986,9 +60990,9 @@ function handleModeMessage(message, board) {
|
|
|
60986
60990
|
if (isTemplateView()) {
|
|
60987
60991
|
return;
|
|
60988
60992
|
}
|
|
60989
|
-
|
|
60990
|
-
header:
|
|
60991
|
-
body: message.mode === "edit" ?
|
|
60993
|
+
conf2.notify({
|
|
60994
|
+
header: conf2.i18n.t("sharing.settingsChanged.heading"),
|
|
60995
|
+
body: message.mode === "edit" ? conf2.i18n.t("sharing.settingsChanged.bodyEdit") : conf2.i18n.t("sharing.settingsChanged.bodyView"),
|
|
60992
60996
|
duration: 5000
|
|
60993
60997
|
});
|
|
60994
60998
|
}
|
|
@@ -61025,7 +61029,7 @@ messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
|
61025
61029
|
// src/api/getMeasureCtx.ts
|
|
61026
61030
|
function getMeasureCtx() {
|
|
61027
61031
|
if (typeof document !== "undefined") {
|
|
61028
|
-
const measureCanvas =
|
|
61032
|
+
const measureCanvas = conf2.documentFactory.createElement("canvas");
|
|
61029
61033
|
const measureCtx = measureCanvas.getContext("2d");
|
|
61030
61034
|
if (!measureCtx) {
|
|
61031
61035
|
throw new Error("Failde to create canvas and get 2d context");
|
|
@@ -64079,20 +64083,20 @@ var resources = {
|
|
|
64079
64083
|
};
|
|
64080
64084
|
function initI18N(isNode = false) {
|
|
64081
64085
|
instance.use(initReactI18next).use(Browser).init({
|
|
64082
|
-
debug:
|
|
64086
|
+
debug: conf2.debug,
|
|
64083
64087
|
detection: {
|
|
64084
64088
|
order: ["navigator"]
|
|
64085
64089
|
},
|
|
64086
64090
|
supportedLngs: ["en", "ru"],
|
|
64087
64091
|
defaultNS,
|
|
64088
64092
|
resources,
|
|
64089
|
-
fallbackLng:
|
|
64093
|
+
fallbackLng: conf2.FALLBACK_LNG,
|
|
64090
64094
|
interpolation: {
|
|
64091
64095
|
escapeValue: false
|
|
64092
64096
|
}
|
|
64093
64097
|
});
|
|
64094
|
-
|
|
64095
|
-
|
|
64098
|
+
conf2.i18n = instance;
|
|
64099
|
+
conf2.planNames = {
|
|
64096
64100
|
basic: instance.t("userPlan.plans.basic.name"),
|
|
64097
64101
|
plus: instance.t("userPlan.plans.plus.name")
|
|
64098
64102
|
};
|
|
@@ -64106,7 +64110,7 @@ function getBrowserDOMParser() {
|
|
|
64106
64110
|
|
|
64107
64111
|
// src/api/initPaths.ts
|
|
64108
64112
|
function initPaths(path2D) {
|
|
64109
|
-
|
|
64113
|
+
conf2.EXPORT_FRAME_DECORATIONS = {
|
|
64110
64114
|
"top-left": {
|
|
64111
64115
|
path: new path2D("M13 1H1V13"),
|
|
64112
64116
|
lineWidth: 2,
|
|
@@ -64148,23 +64152,23 @@ function initPaths(path2D) {
|
|
|
64148
64152
|
|
|
64149
64153
|
// src/api/initBrowserSettings.ts
|
|
64150
64154
|
function initBrowserSettings() {
|
|
64151
|
-
|
|
64152
|
-
|
|
64153
|
-
|
|
64154
|
-
|
|
64155
|
-
|
|
64156
|
-
|
|
64157
|
-
|
|
64155
|
+
conf2.documentFactory = new BrowserDocumentFactory;
|
|
64156
|
+
conf2.path2DFactory = BrowserPath2D;
|
|
64157
|
+
conf2.measureCtx = getMeasureCtx();
|
|
64158
|
+
conf2.getDocumentWidth = () => document.documentElement.clientWidth;
|
|
64159
|
+
conf2.getDocumentHeight = () => document.documentElement.clientHeight;
|
|
64160
|
+
conf2.getDPI = () => window.devicePixelRatio;
|
|
64161
|
+
conf2.getDOMParser = getBrowserDOMParser;
|
|
64158
64162
|
initI18N();
|
|
64159
64163
|
initPaths(BrowserPath2D);
|
|
64160
|
-
|
|
64164
|
+
conf2.reactEditorFocus = (editor) => {
|
|
64161
64165
|
try {
|
|
64162
64166
|
ReactEditor.focus(editor);
|
|
64163
64167
|
} catch (e) {
|
|
64164
64168
|
console.warn("Failed to focus editor:", e);
|
|
64165
64169
|
}
|
|
64166
64170
|
};
|
|
64167
|
-
|
|
64171
|
+
conf2.reactEditorToSlatePoint = (editor, domNode, offset, options) => {
|
|
64168
64172
|
try {
|
|
64169
64173
|
return ReactEditor.toSlatePoint(editor, [domNode, offset], options);
|
|
64170
64174
|
} catch (e) {
|
|
@@ -64172,7 +64176,7 @@ function initBrowserSettings() {
|
|
|
64172
64176
|
return null;
|
|
64173
64177
|
}
|
|
64174
64178
|
};
|
|
64175
|
-
return
|
|
64179
|
+
return conf2;
|
|
64176
64180
|
}
|
|
64177
64181
|
|
|
64178
64182
|
// src/browser.ts
|