microboard-temp 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser.js +287 -257
- package/dist/cjs/index.js +271 -241
- package/dist/cjs/node.js +278 -248
- package/dist/esm/browser.js +287 -257
- package/dist/esm/index.js +271 -241
- package/dist/esm/node.js +278 -248
- package/dist/types/Keyboard/getHotkeyLabel.d.ts +1 -1
- package/dist/types/Keyboard/logHotkey.d.ts +3 -3
- package/dist/types/Settings.d.ts +8 -16
- package/dist/types/api/MockDocumentFactory.d.ts +8 -0
- package/package.json +1 -1
package/dist/cjs/node.js
CHANGED
|
@@ -141380,7 +141380,7 @@ __export(exports_node, {
|
|
|
141380
141380
|
cursors: () => defaultCursors,
|
|
141381
141381
|
createVideoItem: () => createVideoItem,
|
|
141382
141382
|
createEvents: () => createEvents,
|
|
141383
|
-
conf: () =>
|
|
141383
|
+
conf: () => conf2,
|
|
141384
141384
|
checkHotkeys: () => checkHotkeys,
|
|
141385
141385
|
catmullRomInterpolate: () => catmullRomInterpolate,
|
|
141386
141386
|
catchErrorResponse: () => catchErrorResponse,
|
|
@@ -144238,6 +144238,32 @@ class BrowserPath2D {
|
|
|
144238
144238
|
}
|
|
144239
144239
|
}
|
|
144240
144240
|
|
|
144241
|
+
// src/api/MockDocumentFactory.ts
|
|
144242
|
+
class MockDocumentFactory {
|
|
144243
|
+
logPreInitializationCall(methodName) {
|
|
144244
|
+
console.warn(`WARNING: DocumentFactory.${methodName} was called before initialization.`, `
|
|
144245
|
+
Please make sure to initialize DocumentFactory properly before using it.`, `
|
|
144246
|
+
The application will continue but may not work as expected.`);
|
|
144247
|
+
console.trace(`Stack trace for DocumentFactory.${methodName} call:`);
|
|
144248
|
+
}
|
|
144249
|
+
createElement(tagName) {
|
|
144250
|
+
this.logPreInitializationCall("createElement");
|
|
144251
|
+
return {};
|
|
144252
|
+
}
|
|
144253
|
+
createElementNS(namespace, tagName) {
|
|
144254
|
+
this.logPreInitializationCall("createElementNS");
|
|
144255
|
+
return {};
|
|
144256
|
+
}
|
|
144257
|
+
caretPositionFromPoint(x, y, options) {
|
|
144258
|
+
this.logPreInitializationCall("caretPositionFromPoint");
|
|
144259
|
+
return null;
|
|
144260
|
+
}
|
|
144261
|
+
caretRangeFromPoint(x, y) {
|
|
144262
|
+
this.logPreInitializationCall("caretRangeFromPoint");
|
|
144263
|
+
return null;
|
|
144264
|
+
}
|
|
144265
|
+
}
|
|
144266
|
+
|
|
144241
144267
|
// src/api/MockPath2D.ts
|
|
144242
144268
|
class MockPath2D {
|
|
144243
144269
|
nativePath = null;
|
|
@@ -144337,10 +144363,10 @@ var ExportQuality;
|
|
|
144337
144363
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
144338
144364
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
144339
144365
|
})(ExportQuality ||= {});
|
|
144340
|
-
var
|
|
144366
|
+
var conf2 = {
|
|
144341
144367
|
connection: undefined,
|
|
144342
144368
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
144343
|
-
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory :
|
|
144369
|
+
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
144344
144370
|
getDOMParser: undefined,
|
|
144345
144371
|
measureCtx: undefined,
|
|
144346
144372
|
i18n: {},
|
|
@@ -144657,7 +144683,11 @@ var conf = {
|
|
|
144657
144683
|
overline: false,
|
|
144658
144684
|
subscript: false,
|
|
144659
144685
|
superscript: false
|
|
144660
|
-
}
|
|
144686
|
+
},
|
|
144687
|
+
LOG_HOTKEYS: false,
|
|
144688
|
+
FORCE_HOTKEYS: "auto",
|
|
144689
|
+
debug: false,
|
|
144690
|
+
FALLBACK_LNG: "en"
|
|
144661
144691
|
};
|
|
144662
144692
|
|
|
144663
144693
|
// src/Items/Transformation/Matrix.ts
|
|
@@ -145379,7 +145409,7 @@ class DrawingContext {
|
|
|
145379
145409
|
this.setCamera(camera);
|
|
145380
145410
|
}
|
|
145381
145411
|
dpi() {
|
|
145382
|
-
return
|
|
145412
|
+
return conf2.getDPI();
|
|
145383
145413
|
}
|
|
145384
145414
|
setCamera(camera) {
|
|
145385
145415
|
this.camera = camera;
|
|
@@ -145389,7 +145419,7 @@ class DrawingContext {
|
|
|
145389
145419
|
}
|
|
145390
145420
|
clear() {
|
|
145391
145421
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
145392
|
-
this.ctx.clearRect(0, 0,
|
|
145422
|
+
this.ctx.clearRect(0, 0, conf2.getDocumentWidth(), conf2.getDocumentHeight());
|
|
145393
145423
|
this.matrix.applyToContext(this.ctx);
|
|
145394
145424
|
}
|
|
145395
145425
|
clearCursor() {
|
|
@@ -145397,7 +145427,7 @@ class DrawingContext {
|
|
|
145397
145427
|
return;
|
|
145398
145428
|
}
|
|
145399
145429
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
145400
|
-
this.cursorCtx.clearRect(0, 0,
|
|
145430
|
+
this.cursorCtx.clearRect(0, 0, conf2.getDocumentWidth(), conf2.getDocumentHeight());
|
|
145401
145431
|
this.matrix.applyToContext(this.cursorCtx);
|
|
145402
145432
|
}
|
|
145403
145433
|
applyChanges() {
|
|
@@ -145500,7 +145530,7 @@ class Path {
|
|
|
145500
145530
|
this.width = this.getMbr().getWidth();
|
|
145501
145531
|
this.height = this.getMbr().getHeight();
|
|
145502
145532
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
145503
|
-
this.path2d = new
|
|
145533
|
+
this.path2d = new conf2.path2DFactory;
|
|
145504
145534
|
this.updateCache();
|
|
145505
145535
|
}
|
|
145506
145536
|
getBackgroundColor() {
|
|
@@ -145577,7 +145607,7 @@ class Path {
|
|
|
145577
145607
|
this.y = top - this.paddingTop;
|
|
145578
145608
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
145579
145609
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
145580
|
-
const path2d = new
|
|
145610
|
+
const path2d = new conf2.path2DFactory;
|
|
145581
145611
|
if (this.segments.length === 0) {
|
|
145582
145612
|
return;
|
|
145583
145613
|
}
|
|
@@ -146643,7 +146673,7 @@ var parsersHTML = {
|
|
|
146643
146673
|
"comment-item": parseHTMLComment
|
|
146644
146674
|
};
|
|
146645
146675
|
var decodeHtml = (htmlString) => {
|
|
146646
|
-
const parser =
|
|
146676
|
+
const parser = conf2.getDOMParser();
|
|
146647
146677
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
146648
146678
|
return doc.documentElement.textContent || "";
|
|
146649
146679
|
};
|
|
@@ -146672,10 +146702,10 @@ function parseHTMLRichText(el, options) {
|
|
|
146672
146702
|
italic: node.style.fontStyle === "italic",
|
|
146673
146703
|
underline: node.style.textDecoration.includes("underline"),
|
|
146674
146704
|
"line-through": node.style.textDecoration.includes("line-through"),
|
|
146675
|
-
fontColor: node.style.color ||
|
|
146676
|
-
fontHighlight: node.style.backgroundColor ||
|
|
146677
|
-
fontSize: parseFloat(node.style.fontSize) ||
|
|
146678
|
-
fontFamily: node.style.fontFamily ||
|
|
146705
|
+
fontColor: node.style.color || conf2.DEFAULT_TEXT_STYLES.fontColor,
|
|
146706
|
+
fontHighlight: node.style.backgroundColor || conf2.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
146707
|
+
fontSize: parseFloat(node.style.fontSize) || conf2.DEFAULT_TEXT_STYLES.fontSize,
|
|
146708
|
+
fontFamily: node.style.fontFamily || conf2.DEFAULT_TEXT_STYLES.fontFamily,
|
|
146679
146709
|
overline: false,
|
|
146680
146710
|
subscript: false,
|
|
146681
146711
|
superscript: false
|
|
@@ -146740,7 +146770,7 @@ function parseHTMLRichText(el, options) {
|
|
|
146740
146770
|
return {
|
|
146741
146771
|
type: "paragraph",
|
|
146742
146772
|
...extractCommonProps(),
|
|
146743
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
146773
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf2.DEFAULT_TEXT_STYLES.lineHeight,
|
|
146744
146774
|
children: children2
|
|
146745
146775
|
};
|
|
146746
146776
|
default:
|
|
@@ -147113,8 +147143,8 @@ class LinkTo {
|
|
|
147113
147143
|
const ctx = context.ctx;
|
|
147114
147144
|
ctx.save();
|
|
147115
147145
|
ctx.globalCompositeOperation = "destination-out";
|
|
147116
|
-
const size =
|
|
147117
|
-
const offset =
|
|
147146
|
+
const size = conf2.LINK_BTN_SIZE / scale;
|
|
147147
|
+
const offset = conf2.LINK_BTN_OFFSET / scale;
|
|
147118
147148
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
147119
147149
|
ctx.restore();
|
|
147120
147150
|
}
|
|
@@ -147265,7 +147295,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
147265
147295
|
} else if (node.type === "ul_list" && !listData) {
|
|
147266
147296
|
listData = { level: 0, isNumberedList: false };
|
|
147267
147297
|
}
|
|
147268
|
-
const listMarks =
|
|
147298
|
+
const listMarks = conf2[getListMarkType((listData?.level || 0) + 1)];
|
|
147269
147299
|
for (let i = 0;i < data.children.length; i++) {
|
|
147270
147300
|
const child = structuredClone(data.children[i]);
|
|
147271
147301
|
switch (child.type) {
|
|
@@ -147670,8 +147700,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
147670
147700
|
rect2.height += paddingTop;
|
|
147671
147701
|
}
|
|
147672
147702
|
}
|
|
147673
|
-
|
|
147674
|
-
const measure =
|
|
147703
|
+
conf2.measureCtx.font = style.font;
|
|
147704
|
+
const measure = conf2.measureCtx.measureText(text);
|
|
147675
147705
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
147676
147706
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
147677
147707
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -156311,7 +156341,7 @@ var convertLinkNodeToTextNode = (node2) => {
|
|
|
156311
156341
|
const link = node2.link;
|
|
156312
156342
|
const text3 = node2.children.map((child) => child.text).join("");
|
|
156313
156343
|
return {
|
|
156314
|
-
...
|
|
156344
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
156315
156345
|
type: "text",
|
|
156316
156346
|
text: text3,
|
|
156317
156347
|
link,
|
|
@@ -156327,9 +156357,9 @@ function setNodeChildrenStyles({
|
|
|
156327
156357
|
horisontalAlignment,
|
|
156328
156358
|
node: node2
|
|
156329
156359
|
}) {
|
|
156330
|
-
let fontStyles =
|
|
156360
|
+
let fontStyles = conf2.DEFAULT_TEXT_STYLES;
|
|
156331
156361
|
if (editor) {
|
|
156332
|
-
fontStyles = import_slate18.Editor.marks(editor) ||
|
|
156362
|
+
fontStyles = import_slate18.Editor.marks(editor) || conf2.DEFAULT_TEXT_STYLES;
|
|
156333
156363
|
}
|
|
156334
156364
|
switch (node2.type) {
|
|
156335
156365
|
case "heading_one":
|
|
@@ -156361,7 +156391,7 @@ function setNodeChildrenStyles({
|
|
|
156361
156391
|
children.text += " ";
|
|
156362
156392
|
}
|
|
156363
156393
|
let fontColor = fontStyles.fontColor;
|
|
156364
|
-
if (fontColor ===
|
|
156394
|
+
if (fontColor === conf2.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
156365
156395
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
156366
156396
|
}
|
|
156367
156397
|
return {
|
|
@@ -156401,7 +156431,7 @@ function setNodeStyles({
|
|
|
156401
156431
|
}
|
|
156402
156432
|
|
|
156403
156433
|
// src/Items/RichText/editorHelpers/markdown/markdownProcessor.ts
|
|
156404
|
-
var { i18n: i18n2 } =
|
|
156434
|
+
var { i18n: i18n2 } = conf2;
|
|
156405
156435
|
|
|
156406
156436
|
class MarkdownProcessor {
|
|
156407
156437
|
chunksQueue = [];
|
|
@@ -157404,7 +157434,7 @@ function setEditorFocus(editor, selectionContext) {
|
|
|
157404
157434
|
}
|
|
157405
157435
|
|
|
157406
157436
|
// src/Items/RichText/RichText.ts
|
|
157407
|
-
var { i18n: i18n3 } =
|
|
157437
|
+
var { i18n: i18n3 } = conf2;
|
|
157408
157438
|
var isEditInProcessValue = false;
|
|
157409
157439
|
var counter = 0;
|
|
157410
157440
|
|
|
@@ -157427,7 +157457,7 @@ class RichText extends Mbr {
|
|
|
157427
157457
|
isContainerSet = false;
|
|
157428
157458
|
isRenderEnabled = true;
|
|
157429
157459
|
layoutNodes;
|
|
157430
|
-
clipPath = new
|
|
157460
|
+
clipPath = new conf2.path2DFactory;
|
|
157431
157461
|
updateRequired = false;
|
|
157432
157462
|
autoSizeScale = 1;
|
|
157433
157463
|
containerMaxWidth;
|
|
@@ -157442,7 +157472,7 @@ class RichText extends Mbr {
|
|
|
157442
157472
|
shrinkWidth = false;
|
|
157443
157473
|
prevMbr = null;
|
|
157444
157474
|
rtCounter = 0;
|
|
157445
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = i18n3?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles =
|
|
157475
|
+
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) {
|
|
157446
157476
|
super();
|
|
157447
157477
|
this.board = board;
|
|
157448
157478
|
this.container = container;
|
|
@@ -157575,11 +157605,11 @@ class RichText extends Mbr {
|
|
|
157575
157605
|
return;
|
|
157576
157606
|
}
|
|
157577
157607
|
try {
|
|
157578
|
-
|
|
157608
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
157579
157609
|
} catch {}
|
|
157580
157610
|
};
|
|
157581
157611
|
updateElement = () => {
|
|
157582
|
-
if (
|
|
157612
|
+
if (conf2.isNode()) {
|
|
157583
157613
|
return;
|
|
157584
157614
|
}
|
|
157585
157615
|
if (this.updateRequired) {
|
|
@@ -157708,7 +157738,7 @@ class RichText extends Mbr {
|
|
|
157708
157738
|
const container = this.getTransformedContainer();
|
|
157709
157739
|
const width = container.getWidth();
|
|
157710
157740
|
const height = container.getHeight();
|
|
157711
|
-
this.clipPath = new
|
|
157741
|
+
this.clipPath = new conf2.path2DFactory;
|
|
157712
157742
|
this.clipPath.rect(0, 0, width, height);
|
|
157713
157743
|
}
|
|
157714
157744
|
setContainer(container) {
|
|
@@ -157985,24 +158015,24 @@ class RichText extends Mbr {
|
|
|
157985
158015
|
this.clearLastClickPoint();
|
|
157986
158016
|
const domMbr = ref.getBoundingClientRect();
|
|
157987
158017
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
157988
|
-
if (refMbr.isInside(point3) && (
|
|
157989
|
-
const domRange =
|
|
157990
|
-
const textNode =
|
|
157991
|
-
const offset =
|
|
157992
|
-
const slatePoint =
|
|
158018
|
+
if (refMbr.isInside(point3) && (conf2.documentFactory.caretPositionFromPoint || conf2.documentFactory.caretRangeFromPoint)) {
|
|
158019
|
+
const domRange = conf2.documentFactory.caretPositionFromPoint ? conf2.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf2.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
158020
|
+
const textNode = conf2.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
158021
|
+
const offset = conf2.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
158022
|
+
const slatePoint = conf2.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
157993
158023
|
exactMatch: false,
|
|
157994
158024
|
suppressThrow: false
|
|
157995
158025
|
});
|
|
157996
158026
|
if (slatePoint) {
|
|
157997
158027
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
157998
158028
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
157999
|
-
|
|
158029
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
158000
158030
|
}
|
|
158001
158031
|
} else {
|
|
158002
|
-
if (!(
|
|
158032
|
+
if (!(conf2.documentFactory.caretPositionFromPoint || conf2.documentFactory.caretRangeFromPoint)) {
|
|
158003
158033
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
158004
158034
|
}
|
|
158005
|
-
|
|
158035
|
+
conf2.reactEditorFocus(this.editor.editor);
|
|
158006
158036
|
}
|
|
158007
158037
|
}
|
|
158008
158038
|
}
|
|
@@ -158109,11 +158139,11 @@ class RichText extends Mbr {
|
|
|
158109
158139
|
if (node2.type === "text" || "text" in node2) {
|
|
158110
158140
|
node2 = node2;
|
|
158111
158141
|
const text3 = node2.text.trim() !== "" ? decodeHtml(escapeHtml(node2.text)) : " ";
|
|
158112
|
-
const textElement = node2.link ? Object.assign(
|
|
158142
|
+
const textElement = node2.link ? Object.assign(conf2.documentFactory.createElement("a"), {
|
|
158113
158143
|
href: node2.link,
|
|
158114
158144
|
target: "_blank",
|
|
158115
158145
|
rel: "noreferrer"
|
|
158116
|
-
}) :
|
|
158146
|
+
}) : conf2.documentFactory.createElement("span");
|
|
158117
158147
|
Object.assign(textElement.style, {
|
|
158118
158148
|
fontWeight: node2.bold ? "700" : "400",
|
|
158119
158149
|
fontStyle: node2.italic ? "italic" : "",
|
|
@@ -158121,10 +158151,10 @@ class RichText extends Mbr {
|
|
|
158121
158151
|
node2.underline ? "underline" : "",
|
|
158122
158152
|
node2["line-through"] ? "line-through" : ""
|
|
158123
158153
|
].filter(Boolean).join(" "),
|
|
158124
|
-
color: node2.fontColor ||
|
|
158125
|
-
backgroundColor: node2.fontHighlight ||
|
|
158126
|
-
fontSize: node2.fontSize ? `${node2.fontSize}px` : `${
|
|
158127
|
-
fontFamily: node2.fontFamily ||
|
|
158154
|
+
color: node2.fontColor || conf2.DEFAULT_TEXT_STYLES.fontColor,
|
|
158155
|
+
backgroundColor: node2.fontHighlight || conf2.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
158156
|
+
fontSize: node2.fontSize ? `${node2.fontSize}px` : `${conf2.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
158157
|
+
fontFamily: node2.fontFamily || conf2.DEFAULT_TEXT_STYLES.fontFamily
|
|
158128
158158
|
});
|
|
158129
158159
|
if (this.insideOf === "Frame") {
|
|
158130
158160
|
Object.assign(textElement.style, {
|
|
@@ -158159,14 +158189,14 @@ class RichText extends Mbr {
|
|
|
158159
158189
|
four: 4,
|
|
158160
158190
|
five: 5
|
|
158161
158191
|
};
|
|
158162
|
-
const header =
|
|
158192
|
+
const header = conf2.documentFactory.createElement(`h${levels[level]}`);
|
|
158163
158193
|
applyCommonStyles(header);
|
|
158164
158194
|
header.append(...children);
|
|
158165
158195
|
return header;
|
|
158166
158196
|
}
|
|
158167
158197
|
case "code_block": {
|
|
158168
|
-
const pre =
|
|
158169
|
-
const code =
|
|
158198
|
+
const pre = conf2.documentFactory.createElement("pre");
|
|
158199
|
+
const code = conf2.documentFactory.createElement("code");
|
|
158170
158200
|
applyCommonStyles(pre);
|
|
158171
158201
|
if (node2.language) {
|
|
158172
158202
|
code.classList.add(`language-${node2.language}`);
|
|
@@ -158180,35 +158210,35 @@ class RichText extends Mbr {
|
|
|
158180
158210
|
return pre;
|
|
158181
158211
|
}
|
|
158182
158212
|
case "block-quote": {
|
|
158183
|
-
const blockquote =
|
|
158213
|
+
const blockquote = conf2.documentFactory.createElement("blockquote");
|
|
158184
158214
|
applyCommonStyles(blockquote);
|
|
158185
158215
|
blockquote.append(...children);
|
|
158186
158216
|
return blockquote;
|
|
158187
158217
|
}
|
|
158188
158218
|
case "ul_list": {
|
|
158189
|
-
const ul =
|
|
158219
|
+
const ul = conf2.documentFactory.createElement("ul");
|
|
158190
158220
|
applyCommonStyles(ul);
|
|
158191
158221
|
ul.append(...children);
|
|
158192
158222
|
return ul;
|
|
158193
158223
|
}
|
|
158194
158224
|
case "ol_list": {
|
|
158195
|
-
const ol =
|
|
158225
|
+
const ol = conf2.documentFactory.createElement("ol");
|
|
158196
158226
|
applyCommonStyles(ol);
|
|
158197
158227
|
ol.append(...children);
|
|
158198
158228
|
return ol;
|
|
158199
158229
|
}
|
|
158200
158230
|
case "list_item": {
|
|
158201
|
-
const li =
|
|
158231
|
+
const li = conf2.documentFactory.createElement("li");
|
|
158202
158232
|
applyCommonStyles(li);
|
|
158203
158233
|
li.append(...children);
|
|
158204
158234
|
return li;
|
|
158205
158235
|
}
|
|
158206
158236
|
case "paragraph":
|
|
158207
158237
|
default: {
|
|
158208
|
-
const par =
|
|
158238
|
+
const par = conf2.documentFactory.createElement("p");
|
|
158209
158239
|
applyCommonStyles(par);
|
|
158210
158240
|
Object.assign(par.style, {
|
|
158211
|
-
lineHeight: node2.lineHeight ? `${node2.lineHeight}` :
|
|
158241
|
+
lineHeight: node2.lineHeight ? `${node2.lineHeight}` : conf2.DEFAULT_TEXT_STYLES.lineHeight,
|
|
158212
158242
|
margin: "0"
|
|
158213
158243
|
});
|
|
158214
158244
|
par.append(...children);
|
|
@@ -158216,7 +158246,7 @@ class RichText extends Mbr {
|
|
|
158216
158246
|
}
|
|
158217
158247
|
}
|
|
158218
158248
|
}
|
|
158219
|
-
return
|
|
158249
|
+
return conf2.documentFactory.createElement("div");
|
|
158220
158250
|
};
|
|
158221
158251
|
const escapeHtml = (unsafe) => {
|
|
158222
158252
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -171280,7 +171310,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
171280
171310
|
markdownString = String(file).trim();
|
|
171281
171311
|
}
|
|
171282
171312
|
let slateNodes = [];
|
|
171283
|
-
if (
|
|
171313
|
+
if (conf2.URL_REGEX.test(text5)) {
|
|
171284
171314
|
slateNodes = [createLinkNode(text5)];
|
|
171285
171315
|
} else {
|
|
171286
171316
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -171296,7 +171326,7 @@ function createLinkNode(link2) {
|
|
|
171296
171326
|
type: "text",
|
|
171297
171327
|
link: link2,
|
|
171298
171328
|
text: link2,
|
|
171299
|
-
...
|
|
171329
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
171300
171330
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
171301
171331
|
};
|
|
171302
171332
|
}
|
|
@@ -171408,7 +171438,7 @@ class AINode {
|
|
|
171408
171438
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
171409
171439
|
this.board = board;
|
|
171410
171440
|
this.id = id;
|
|
171411
|
-
this.buttonIcon =
|
|
171441
|
+
this.buttonIcon = conf2.documentFactory.createElement("img");
|
|
171412
171442
|
this.buttonIcon.src = ICON_SRC;
|
|
171413
171443
|
this.contextItems = contextItems;
|
|
171414
171444
|
this.isUserRequest = isUserRequest;
|
|
@@ -172580,7 +172610,7 @@ function getLine(lineStyle, start, end, middle) {
|
|
|
172580
172610
|
}
|
|
172581
172611
|
|
|
172582
172612
|
// src/Items/Connector/Connector.ts
|
|
172583
|
-
var { i18n: i18n4 } =
|
|
172613
|
+
var { i18n: i18n4 } = conf2;
|
|
172584
172614
|
var ConnectionLineWidths = [1, 2, 3, 4, 5, 6, 7, 8, 12];
|
|
172585
172615
|
var CONNECTOR_COLOR = "rgb(20, 21, 26)";
|
|
172586
172616
|
var CONNECTOR_LINE_WIDTH = 1;
|
|
@@ -172640,9 +172670,9 @@ class Connector {
|
|
|
172640
172670
|
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, i18n4.t("connector.textPlaceholder", {
|
|
172641
172671
|
ns: "default"
|
|
172642
172672
|
}), true, false, "Connector", {
|
|
172643
|
-
...
|
|
172644
|
-
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) :
|
|
172645
|
-
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") :
|
|
172673
|
+
...conf2.DEFAULT_TEXT_STYLES,
|
|
172674
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf2.DEFAULT_TEXT_STYLES.fontSize,
|
|
172675
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf2.DEFAULT_TEXT_STYLES.fontColor
|
|
172646
172676
|
});
|
|
172647
172677
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
172648
172678
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -173092,7 +173122,7 @@ class Connector {
|
|
|
173092
173122
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
173093
173123
|
this.text.render(context);
|
|
173094
173124
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
173095
|
-
ctx.strokeStyle =
|
|
173125
|
+
ctx.strokeStyle = conf2.SELECTION_COLOR;
|
|
173096
173126
|
ctx.lineWidth = 1;
|
|
173097
173127
|
ctx.beginPath();
|
|
173098
173128
|
ctx.rect(textMbr.left - TEXT_BORDER_PADDING, textMbr.top - TEXT_BORDER_PADDING, textMbr.getWidth() + TEXT_BORDER_PADDING * 2, textMbr.getHeight() + TEXT_BORDER_PADDING * 2);
|
|
@@ -173319,7 +173349,7 @@ class Connector {
|
|
|
173319
173349
|
}
|
|
173320
173350
|
}
|
|
173321
173351
|
updatePaths() {
|
|
173322
|
-
if (
|
|
173352
|
+
if (conf2.isNode()) {
|
|
173323
173353
|
return;
|
|
173324
173354
|
}
|
|
173325
173355
|
const startPoint = this.startPoint;
|
|
@@ -174130,7 +174160,7 @@ class DefaultShapeData {
|
|
|
174130
174160
|
text;
|
|
174131
174161
|
linkTo;
|
|
174132
174162
|
itemType = "Shape";
|
|
174133
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
174163
|
+
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) {
|
|
174134
174164
|
this.shapeType = shapeType;
|
|
174135
174165
|
this.backgroundColor = backgroundColor;
|
|
174136
174166
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -175417,7 +175447,7 @@ class Shape {
|
|
|
175417
175447
|
this.text.updateElement();
|
|
175418
175448
|
}
|
|
175419
175449
|
transformPath() {
|
|
175420
|
-
if (
|
|
175450
|
+
if (conf2.isNode()) {
|
|
175421
175451
|
return;
|
|
175422
175452
|
}
|
|
175423
175453
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -175646,7 +175676,7 @@ class Sticker {
|
|
|
175646
175676
|
return this;
|
|
175647
175677
|
}
|
|
175648
175678
|
transformPath() {
|
|
175649
|
-
if (
|
|
175679
|
+
if (conf2.isNode()) {
|
|
175650
175680
|
return;
|
|
175651
175681
|
}
|
|
175652
175682
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -176197,7 +176227,7 @@ class Frame {
|
|
|
176197
176227
|
this.path = Frames[this.shapeType].path.copy();
|
|
176198
176228
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
176199
176229
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
176200
|
-
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...
|
|
176230
|
+
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 });
|
|
176201
176231
|
this.text.setSelectionHorisontalAlignment("left");
|
|
176202
176232
|
this.transformation.subject.subscribe(() => {
|
|
176203
176233
|
this.transformPath();
|
|
@@ -176759,10 +176789,10 @@ class VideoCommand {
|
|
|
176759
176789
|
|
|
176760
176790
|
// src/Items/Video/Video.ts
|
|
176761
176791
|
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";
|
|
176762
|
-
var videoIcon =
|
|
176792
|
+
var videoIcon = conf2.documentFactory.createElement("img");
|
|
176763
176793
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
176764
176794
|
var createPlaceholderImage = (width2, height2) => {
|
|
176765
|
-
const canvas =
|
|
176795
|
+
const canvas = conf2.documentFactory.createElement("canvas");
|
|
176766
176796
|
canvas.width = width2;
|
|
176767
176797
|
canvas.height = height2;
|
|
176768
176798
|
const ctx = canvas.getContext("2d");
|
|
@@ -176806,7 +176836,7 @@ class VideoItem extends Mbr {
|
|
|
176806
176836
|
this.events = events;
|
|
176807
176837
|
this.id = id;
|
|
176808
176838
|
this.extension = extension2;
|
|
176809
|
-
this.isStorageUrl = !
|
|
176839
|
+
this.isStorageUrl = !conf2.getYouTubeId(url);
|
|
176810
176840
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
176811
176841
|
this.linkTo = new LinkTo(this.id, events);
|
|
176812
176842
|
this.board = board;
|
|
@@ -177176,59 +177206,59 @@ async function fileTosha256(file) {
|
|
|
177176
177206
|
var catchErrorResponse = async (response, mediaType) => {
|
|
177177
177207
|
if (response.status === 403) {
|
|
177178
177208
|
const data = await response.json();
|
|
177179
|
-
let errorBody =
|
|
177209
|
+
let errorBody = conf2.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
177180
177210
|
if (!data.isOwnerRequest) {
|
|
177181
|
-
errorBody =
|
|
177211
|
+
errorBody = conf2.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
177182
177212
|
} else if (data.currentUsage && data.storageLimit) {
|
|
177183
|
-
errorBody =
|
|
177213
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
177184
177214
|
}
|
|
177185
|
-
|
|
177215
|
+
conf2.notify({
|
|
177186
177216
|
variant: "warning",
|
|
177187
|
-
header:
|
|
177217
|
+
header: conf2.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
177188
177218
|
body: errorBody,
|
|
177189
177219
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
177190
|
-
text:
|
|
177191
|
-
onClick: () =>
|
|
177220
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
177221
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
177192
177222
|
} : undefined,
|
|
177193
177223
|
duration: 8000
|
|
177194
177224
|
});
|
|
177195
177225
|
} else if (response.status === 413) {
|
|
177196
177226
|
const data = await response.json();
|
|
177197
|
-
let errorBody =
|
|
177227
|
+
let errorBody = conf2.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
177198
177228
|
let isBasicPlan = false;
|
|
177199
177229
|
if (data.fileSizeLimit && data.fileSize) {
|
|
177200
177230
|
if (mediaType === "image") {
|
|
177201
177231
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
177202
|
-
errorBody =
|
|
177232
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
177203
177233
|
} else {
|
|
177204
177234
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
177205
|
-
errorBody =
|
|
177235
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
177206
177236
|
}
|
|
177207
177237
|
}
|
|
177208
|
-
|
|
177238
|
+
conf2.notify({
|
|
177209
177239
|
variant: "warning",
|
|
177210
|
-
header:
|
|
177240
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
177211
177241
|
body: errorBody,
|
|
177212
177242
|
button: isBasicPlan ? {
|
|
177213
|
-
text:
|
|
177214
|
-
onClick: () =>
|
|
177243
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
177244
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
177215
177245
|
} : undefined,
|
|
177216
177246
|
duration: 4000
|
|
177217
177247
|
});
|
|
177218
177248
|
} else if (response.status === 401) {
|
|
177219
|
-
|
|
177249
|
+
conf2.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
177220
177250
|
} else if (response.status === 415) {
|
|
177221
|
-
|
|
177251
|
+
conf2.notify({
|
|
177222
177252
|
variant: "warning",
|
|
177223
|
-
header:
|
|
177224
|
-
body:
|
|
177253
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
177254
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
177225
177255
|
duration: 4000
|
|
177226
177256
|
});
|
|
177227
177257
|
} else {
|
|
177228
|
-
|
|
177258
|
+
conf2.notify({
|
|
177229
177259
|
variant: "error",
|
|
177230
|
-
header:
|
|
177231
|
-
body:
|
|
177260
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
177261
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
177232
177262
|
duration: 4000
|
|
177233
177263
|
});
|
|
177234
177264
|
}
|
|
@@ -177236,17 +177266,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
177236
177266
|
};
|
|
177237
177267
|
var catchDuplicateErrorResponse = async (response) => {
|
|
177238
177268
|
if (response.status === 403) {
|
|
177239
|
-
|
|
177269
|
+
conf2.notify({
|
|
177240
177270
|
variant: "warning",
|
|
177241
|
-
header:
|
|
177242
|
-
body:
|
|
177271
|
+
header: conf2.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
177272
|
+
body: conf2.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
177243
177273
|
duration: 4000
|
|
177244
177274
|
});
|
|
177245
177275
|
} else {
|
|
177246
|
-
|
|
177276
|
+
conf2.notify({
|
|
177247
177277
|
variant: "error",
|
|
177248
|
-
header:
|
|
177249
|
-
body:
|
|
177278
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
177279
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
177250
177280
|
duration: 4000
|
|
177251
177281
|
});
|
|
177252
177282
|
}
|
|
@@ -177254,40 +177284,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
177254
177284
|
};
|
|
177255
177285
|
var validateMediaFile = (file, account2) => {
|
|
177256
177286
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
177257
|
-
if (!file.type.startsWith("image") && !
|
|
177258
|
-
|
|
177287
|
+
if (!file.type.startsWith("image") && !conf2.AUDIO_FORMATS.includes(fileExtension) && !conf2.VIDEO_FORMATS.includes(fileExtension)) {
|
|
177288
|
+
conf2.notify({
|
|
177259
177289
|
variant: "warning",
|
|
177260
|
-
header:
|
|
177261
|
-
body:
|
|
177290
|
+
header: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
177291
|
+
body: conf2.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
177262
177292
|
duration: 4000
|
|
177263
177293
|
});
|
|
177264
177294
|
return false;
|
|
177265
177295
|
}
|
|
177266
177296
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
177267
|
-
let errorBody =
|
|
177268
|
-
if (
|
|
177269
|
-
errorBody =
|
|
177297
|
+
let errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
177298
|
+
if (conf2.AUDIO_FORMATS.includes(fileExtension) || conf2.VIDEO_FORMATS.includes(fileExtension)) {
|
|
177299
|
+
errorBody = conf2.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
177270
177300
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
177271
|
-
|
|
177301
|
+
conf2.notify({
|
|
177272
177302
|
variant: "warning",
|
|
177273
|
-
header:
|
|
177303
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
177274
177304
|
body: errorBody,
|
|
177275
177305
|
button: isBasicPlan ? {
|
|
177276
|
-
text:
|
|
177277
|
-
onClick: () =>
|
|
177306
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
177307
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
177278
177308
|
} : undefined,
|
|
177279
177309
|
duration: 4000
|
|
177280
177310
|
});
|
|
177281
177311
|
return false;
|
|
177282
177312
|
}
|
|
177283
177313
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
177284
|
-
|
|
177314
|
+
conf2.notify({
|
|
177285
177315
|
variant: "warning",
|
|
177286
|
-
header:
|
|
177316
|
+
header: conf2.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
177287
177317
|
body: errorBody,
|
|
177288
177318
|
button: isBasicPlan ? {
|
|
177289
|
-
text:
|
|
177290
|
-
onClick: () =>
|
|
177319
|
+
text: conf2.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
177320
|
+
onClick: () => conf2.openModal("USER_PLAN_MODAL_ID")
|
|
177291
177321
|
} : undefined,
|
|
177292
177322
|
duration: 4000
|
|
177293
177323
|
});
|
|
@@ -177366,7 +177396,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
177366
177396
|
};
|
|
177367
177397
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
177368
177398
|
image2.onload = async () => {
|
|
177369
|
-
const parser =
|
|
177399
|
+
const parser = conf2.getDOMParser();
|
|
177370
177400
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
177371
177401
|
const svgElement = svgDoc.documentElement;
|
|
177372
177402
|
svgElement.removeAttribute("width");
|
|
@@ -177597,8 +177627,8 @@ class AudioItem extends Mbr {
|
|
|
177597
177627
|
this.subject.publish(this);
|
|
177598
177628
|
});
|
|
177599
177629
|
this.transformation.subject.subscribe(this.onTransform);
|
|
177600
|
-
this.right = this.left +
|
|
177601
|
-
this.bottom = this.top +
|
|
177630
|
+
this.right = this.left + conf2.AUDIO_DIMENSIONS.width;
|
|
177631
|
+
this.bottom = this.top + conf2.AUDIO_DIMENSIONS.height;
|
|
177602
177632
|
}
|
|
177603
177633
|
setCurrentTime(time) {
|
|
177604
177634
|
this.currentTime = time;
|
|
@@ -177665,8 +177695,8 @@ class AudioItem extends Mbr {
|
|
|
177665
177695
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
177666
177696
|
this.left = translateX;
|
|
177667
177697
|
this.top = translateY;
|
|
177668
|
-
this.right = this.left +
|
|
177669
|
-
this.bottom = this.top +
|
|
177698
|
+
this.right = this.left + conf2.AUDIO_DIMENSIONS.width * scaleX;
|
|
177699
|
+
this.bottom = this.top + conf2.AUDIO_DIMENSIONS.height * scaleY;
|
|
177670
177700
|
}
|
|
177671
177701
|
render(context) {
|
|
177672
177702
|
if (this.transformationRenderBlock) {
|
|
@@ -177695,8 +177725,8 @@ class AudioItem extends Mbr {
|
|
|
177695
177725
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
177696
177726
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
177697
177727
|
div.id = this.getId();
|
|
177698
|
-
div.style.width = `${
|
|
177699
|
-
div.style.height = `${
|
|
177728
|
+
div.style.width = `${conf2.AUDIO_DIMENSIONS.width}px`;
|
|
177729
|
+
div.style.height = `${conf2.AUDIO_DIMENSIONS.height}px`;
|
|
177700
177730
|
div.style.transformOrigin = "top left";
|
|
177701
177731
|
div.style.transform = transform;
|
|
177702
177732
|
div.style.position = "absolute";
|
|
@@ -177815,7 +177845,7 @@ class AudioItem extends Mbr {
|
|
|
177815
177845
|
}
|
|
177816
177846
|
download() {
|
|
177817
177847
|
if (this.extension) {
|
|
177818
|
-
const linkElem =
|
|
177848
|
+
const linkElem = conf2.documentFactory.createElement("a");
|
|
177819
177849
|
linkElem.href = this.url;
|
|
177820
177850
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
177821
177851
|
linkElem.click();
|
|
@@ -178217,7 +178247,7 @@ class ImageCommand {
|
|
|
178217
178247
|
|
|
178218
178248
|
// src/Items/Image/Image.ts
|
|
178219
178249
|
function getPlaceholderImage(board, imageDimension) {
|
|
178220
|
-
const placeholderCanvas =
|
|
178250
|
+
const placeholderCanvas = conf2.documentFactory.createElement("canvas");
|
|
178221
178251
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
178222
178252
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
178223
178253
|
const placeholder = new Placeholder;
|
|
@@ -178568,7 +178598,7 @@ class Drawing extends Mbr {
|
|
|
178568
178598
|
itemType = "Drawing";
|
|
178569
178599
|
parent = "Board";
|
|
178570
178600
|
transformation;
|
|
178571
|
-
path2d = new
|
|
178601
|
+
path2d = new conf2.path2DFactory;
|
|
178572
178602
|
subject = new Subject;
|
|
178573
178603
|
untransformedMbr = new Mbr;
|
|
178574
178604
|
lines = [];
|
|
@@ -178645,7 +178675,7 @@ class Drawing extends Mbr {
|
|
|
178645
178675
|
this.bottom = mbr.bottom;
|
|
178646
178676
|
}
|
|
178647
178677
|
updatePath2d() {
|
|
178648
|
-
this.path2d = new
|
|
178678
|
+
this.path2d = new conf2.path2DFactory;
|
|
178649
178679
|
const context = this.path2d;
|
|
178650
178680
|
const points = this.points;
|
|
178651
178681
|
if (points.length < 3) {
|
|
@@ -179817,9 +179847,9 @@ class Camera {
|
|
|
179817
179847
|
matrix = new Matrix2;
|
|
179818
179848
|
pointer = new Point;
|
|
179819
179849
|
window = {
|
|
179820
|
-
width:
|
|
179821
|
-
height:
|
|
179822
|
-
dpi:
|
|
179850
|
+
width: conf2.getDocumentWidth(),
|
|
179851
|
+
height: conf2.getDocumentHeight(),
|
|
179852
|
+
dpi: conf2.getDPI(),
|
|
179823
179853
|
getMbr: () => {
|
|
179824
179854
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
179825
179855
|
}
|
|
@@ -180195,9 +180225,9 @@ class Camera {
|
|
|
180195
180225
|
this.updateBoardPointer();
|
|
180196
180226
|
}
|
|
180197
180227
|
onWindowResize() {
|
|
180198
|
-
this.window.width =
|
|
180199
|
-
this.window.height =
|
|
180200
|
-
this.window.dpi =
|
|
180228
|
+
this.window.width = conf2.getDocumentWidth();
|
|
180229
|
+
this.window.height = conf2.getDocumentHeight();
|
|
180230
|
+
this.window.dpi = conf2.getDPI();
|
|
180201
180231
|
this.resizeSubject.publish(this);
|
|
180202
180232
|
this.subject.publish(this);
|
|
180203
180233
|
}
|
|
@@ -180210,10 +180240,10 @@ class Camera {
|
|
|
180210
180240
|
let y = 0;
|
|
180211
180241
|
const { activeKeys } = keyboard;
|
|
180212
180242
|
const directions = {
|
|
180213
|
-
ArrowRight: [-
|
|
180214
|
-
ArrowLeft: [
|
|
180215
|
-
ArrowDown: [0, -
|
|
180216
|
-
ArrowUp: [0,
|
|
180243
|
+
ArrowRight: [-conf2.NAVIGATION_STEP, 0],
|
|
180244
|
+
ArrowLeft: [conf2.NAVIGATION_STEP, 0],
|
|
180245
|
+
ArrowDown: [0, -conf2.NAVIGATION_STEP],
|
|
180246
|
+
ArrowUp: [0, conf2.NAVIGATION_STEP]
|
|
180217
180247
|
};
|
|
180218
180248
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
180219
180249
|
if (activeArrowKeys.length === 2) {
|
|
@@ -180746,7 +180776,7 @@ var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
|
180746
180776
|
|
|
180747
180777
|
// src/Keyboard/logHotkey.ts
|
|
180748
180778
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
180749
|
-
if (!
|
|
180779
|
+
if (!conf.LOG_HOTKEYS) {
|
|
180750
180780
|
return;
|
|
180751
180781
|
}
|
|
180752
180782
|
const isFunction = typeof hotkeyConfig === "function";
|
|
@@ -180838,7 +180868,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
180838
180868
|
// src/Keyboard/getHotkeyLabel.ts
|
|
180839
180869
|
function getHotkeyLabel(hotkey) {
|
|
180840
180870
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
180841
|
-
switch (
|
|
180871
|
+
switch (conf2.FORCE_HOTKEYS || "auto") {
|
|
180842
180872
|
case "windows":
|
|
180843
180873
|
return hotkeyLabel.windows;
|
|
180844
180874
|
case "macos":
|
|
@@ -182748,7 +182778,7 @@ class SpatialIndex {
|
|
|
182748
182778
|
this.itemsArray.push(item);
|
|
182749
182779
|
this.itemsIndex.insert(item);
|
|
182750
182780
|
}
|
|
182751
|
-
if (
|
|
182781
|
+
if (conf2.isNode()) {
|
|
182752
182782
|
return;
|
|
182753
182783
|
}
|
|
182754
182784
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -183315,8 +183345,8 @@ class Tool {
|
|
|
183315
183345
|
|
|
183316
183346
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
183317
183347
|
function getDecorationResizeType(point5, mbr, tolerance = 10) {
|
|
183318
|
-
for (const key in
|
|
183319
|
-
const decoration =
|
|
183348
|
+
for (const key in conf2.EXPORT_FRAME_DECORATIONS) {
|
|
183349
|
+
const decoration = conf2.EXPORT_FRAME_DECORATIONS[key];
|
|
183320
183350
|
const decorationBounds = {
|
|
183321
183351
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
183322
183352
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -183357,7 +183387,7 @@ class ExportSnapshot extends Tool {
|
|
|
183357
183387
|
super();
|
|
183358
183388
|
this.board = board;
|
|
183359
183389
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
183360
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
183390
|
+
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);
|
|
183361
183391
|
this.board.selection.disable();
|
|
183362
183392
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
183363
183393
|
}
|
|
@@ -183369,11 +183399,11 @@ class ExportSnapshot extends Tool {
|
|
|
183369
183399
|
resize() {
|
|
183370
183400
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
183371
183401
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
183372
|
-
if (resize.mbr.getWidth() >
|
|
183402
|
+
if (resize.mbr.getWidth() > conf2.EXPORT_MIN_WIDTH) {
|
|
183373
183403
|
this.mbr.left = resize.mbr.left;
|
|
183374
183404
|
this.mbr.right = resize.mbr.right;
|
|
183375
183405
|
}
|
|
183376
|
-
if (resize.mbr.getHeight() >
|
|
183406
|
+
if (resize.mbr.getHeight() > conf2.EXPORT_MIN_HEIGHT) {
|
|
183377
183407
|
this.mbr.top = resize.mbr.top;
|
|
183378
183408
|
this.mbr.bottom = resize.mbr.bottom;
|
|
183379
183409
|
}
|
|
@@ -183462,7 +183492,7 @@ class ExportSnapshot extends Tool {
|
|
|
183462
183492
|
}
|
|
183463
183493
|
const res = await exportBoardSnapshot({
|
|
183464
183494
|
board: this.board,
|
|
183465
|
-
bgColor:
|
|
183495
|
+
bgColor: conf2.CANVAS_BG_COLOR,
|
|
183466
183496
|
selection: this.mbr,
|
|
183467
183497
|
upscaleTo: 4000,
|
|
183468
183498
|
nameToExport: this.board.getName()
|
|
@@ -183486,18 +183516,18 @@ class ExportSnapshot extends Tool {
|
|
|
183486
183516
|
const cameraMbr = context.camera.getMbr();
|
|
183487
183517
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
183488
183518
|
this.tempDrawingContext.clear();
|
|
183489
|
-
cameraMbr.backgroundColor =
|
|
183519
|
+
cameraMbr.backgroundColor = conf2.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
183490
183520
|
cameraMbr.strokeWidth = 0;
|
|
183491
183521
|
cameraMbr.render(this.tempDrawingContext);
|
|
183492
183522
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
183493
|
-
if (
|
|
183494
|
-
const topLeft =
|
|
183523
|
+
if (conf2.EXPORT_FRAME_DECORATIONS) {
|
|
183524
|
+
const topLeft = conf2.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
183495
183525
|
this.renderDecoration(this.tempDrawingContext, topLeft.path, this.mbr.left + (topLeft.offsetX ?? 0), this.mbr.top + (topLeft.offsetY ?? 0), topLeft.color, topLeft.lineWidth);
|
|
183496
|
-
const topRight =
|
|
183526
|
+
const topRight = conf2.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
183497
183527
|
this.renderDecoration(this.tempDrawingContext, topRight.path, this.mbr.right + (topRight.offsetX ?? 0), this.mbr.top + (topRight.offsetY ?? 0), topRight.color, topRight.lineWidth);
|
|
183498
|
-
const bottomLeft =
|
|
183528
|
+
const bottomLeft = conf2.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
183499
183529
|
this.renderDecoration(this.tempDrawingContext, bottomLeft.path, this.mbr.left + (bottomLeft.offsetX ?? 0), this.mbr.bottom + (bottomLeft.offsetY ?? 0), bottomLeft.color, bottomLeft.lineWidth);
|
|
183500
|
-
const bottomRight =
|
|
183530
|
+
const bottomRight = conf2.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
183501
183531
|
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);
|
|
183502
183532
|
}
|
|
183503
183533
|
}
|
|
@@ -184006,14 +184036,14 @@ class AddConnector extends BoardTool {
|
|
|
184006
184036
|
class AddDrawing extends BoardTool {
|
|
184007
184037
|
drawing = null;
|
|
184008
184038
|
isDown = false;
|
|
184009
|
-
strokeWidth =
|
|
184010
|
-
strokeColor =
|
|
184011
|
-
strokeStyle =
|
|
184039
|
+
strokeWidth = conf2.PEN_INITIAL_STROKE_WIDTH;
|
|
184040
|
+
strokeColor = conf2.PEN_DEFAULT_COLOR;
|
|
184041
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
184012
184042
|
constructor(board) {
|
|
184013
184043
|
super(board);
|
|
184014
184044
|
this.setCursor();
|
|
184015
|
-
if (
|
|
184016
|
-
const drawingSettings = localStorage.getItem(
|
|
184045
|
+
if (conf2.PEN_SETTINGS_KEY) {
|
|
184046
|
+
const drawingSettings = localStorage.getItem(conf2.PEN_SETTINGS_KEY);
|
|
184017
184047
|
if (drawingSettings) {
|
|
184018
184048
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
184019
184049
|
this.strokeWidth = strokeWidth;
|
|
@@ -184023,7 +184053,7 @@ class AddDrawing extends BoardTool {
|
|
|
184023
184053
|
}
|
|
184024
184054
|
}
|
|
184025
184055
|
updateSettings() {
|
|
184026
|
-
localStorage.setItem(
|
|
184056
|
+
localStorage.setItem(conf2.PEN_SETTINGS_KEY, JSON.stringify({
|
|
184027
184057
|
strokeWidth: this.strokeWidth,
|
|
184028
184058
|
strokeColor: this.strokeColor,
|
|
184029
184059
|
strokeStyle: this.strokeStyle
|
|
@@ -184053,7 +184083,7 @@ class AddDrawing extends BoardTool {
|
|
|
184053
184083
|
ctx.beginPath();
|
|
184054
184084
|
ctx.arc(point5.x, point5.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
184055
184085
|
ctx.lineWidth = 1;
|
|
184056
|
-
ctx.strokeStyle =
|
|
184086
|
+
ctx.strokeStyle = conf2.PEN_POINTER_CIRCLE_COLOR;
|
|
184057
184087
|
ctx.stroke();
|
|
184058
184088
|
}
|
|
184059
184089
|
setCursor() {
|
|
@@ -184135,7 +184165,7 @@ class AddDrawing extends BoardTool {
|
|
|
184135
184165
|
this.setCursor();
|
|
184136
184166
|
};
|
|
184137
184167
|
render(context) {
|
|
184138
|
-
if (
|
|
184168
|
+
if (conf2.PEN_RENDER_POINTER_CIRCLE) {
|
|
184139
184169
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
184140
184170
|
}
|
|
184141
184171
|
if (!this.drawing) {
|
|
@@ -184150,14 +184180,14 @@ class AddDrawing extends BoardTool {
|
|
|
184150
184180
|
}
|
|
184151
184181
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
184152
184182
|
class AddHighlighter extends AddDrawing {
|
|
184153
|
-
strokeWidth =
|
|
184154
|
-
strokeColor =
|
|
184155
|
-
strokeStyle =
|
|
184183
|
+
strokeWidth = conf2.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
184184
|
+
strokeColor = conf2.HIGHLIGHTER_DEFAULT_COLOR;
|
|
184185
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
184156
184186
|
constructor(board) {
|
|
184157
184187
|
super(board);
|
|
184158
184188
|
this.setCursor();
|
|
184159
|
-
if (
|
|
184160
|
-
const highlighterSettings = localStorage.getItem(
|
|
184189
|
+
if (conf2.HIGHLIGHTER_SETTINGS_KEY) {
|
|
184190
|
+
const highlighterSettings = localStorage.getItem(conf2.HIGHLIGHTER_SETTINGS_KEY);
|
|
184161
184191
|
if (highlighterSettings) {
|
|
184162
184192
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
184163
184193
|
this.strokeWidth = strokeWidth;
|
|
@@ -184170,7 +184200,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
184170
184200
|
return true;
|
|
184171
184201
|
}
|
|
184172
184202
|
updateSettings() {
|
|
184173
|
-
localStorage.setItem(
|
|
184203
|
+
localStorage.setItem(conf2.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
184174
184204
|
strokeWidth: this.strokeWidth,
|
|
184175
184205
|
strokeColor: this.strokeColor,
|
|
184176
184206
|
strokeStyle: this.strokeStyle
|
|
@@ -184494,7 +184524,7 @@ class AddShape extends BoardTool {
|
|
|
184494
184524
|
const point5 = this.board.pointer.point;
|
|
184495
184525
|
this.line = new Line(point5.copy(), point5.copy());
|
|
184496
184526
|
this.bounds = this.line.getMbr();
|
|
184497
|
-
this.bounds.borderColor =
|
|
184527
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
184498
184528
|
this.shape.apply({
|
|
184499
184529
|
class: "Shape",
|
|
184500
184530
|
method: "setShapeType",
|
|
@@ -184518,7 +184548,7 @@ class AddShape extends BoardTool {
|
|
|
184518
184548
|
}
|
|
184519
184549
|
this.line = new Line(startPoint, endPoint);
|
|
184520
184550
|
this.bounds = this.line.getMbr();
|
|
184521
|
-
this.bounds.borderColor =
|
|
184551
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
184522
184552
|
this.initTransformation();
|
|
184523
184553
|
this.board.tools.publish();
|
|
184524
184554
|
return true;
|
|
@@ -184590,7 +184620,7 @@ class AddShape extends BoardTool {
|
|
|
184590
184620
|
const y = (top + bottom) / 2 - 50;
|
|
184591
184621
|
this.bounds = new Mbr(x, y, x, y);
|
|
184592
184622
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
184593
|
-
this.bounds.borderColor =
|
|
184623
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
184594
184624
|
this.shape.apply({
|
|
184595
184625
|
class: "Shape",
|
|
184596
184626
|
method: "setShapeType",
|
|
@@ -184623,8 +184653,8 @@ class AddSticker extends BoardTool {
|
|
|
184623
184653
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
184624
184654
|
}
|
|
184625
184655
|
setCursor(color2) {
|
|
184626
|
-
if (
|
|
184627
|
-
const colorName = color2 ?
|
|
184656
|
+
if (conf2.STICKER_COLOR_NAMES) {
|
|
184657
|
+
const colorName = color2 ? conf2.STICKER_COLOR_NAMES[conf2.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
184628
184658
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
184629
184659
|
} else {
|
|
184630
184660
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -184648,7 +184678,7 @@ class AddSticker extends BoardTool {
|
|
|
184648
184678
|
const point5 = this.board.pointer.point;
|
|
184649
184679
|
this.line = new Line(point5.copy(), point5.copy());
|
|
184650
184680
|
this.bounds = this.line.getMbr();
|
|
184651
|
-
this.bounds.borderColor =
|
|
184681
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
184652
184682
|
this.board.tools.publish();
|
|
184653
184683
|
return true;
|
|
184654
184684
|
}
|
|
@@ -184657,7 +184687,7 @@ class AddSticker extends BoardTool {
|
|
|
184657
184687
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
184658
184688
|
this.sticker.applyDiagonal(this.line);
|
|
184659
184689
|
this.bounds = this.sticker.getMbr();
|
|
184660
|
-
this.bounds.borderColor =
|
|
184690
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
184661
184691
|
this.board.tools.publish();
|
|
184662
184692
|
return true;
|
|
184663
184693
|
}
|
|
@@ -184757,7 +184787,7 @@ class AddText extends BoardTool {
|
|
|
184757
184787
|
const point5 = this.board.pointer.point;
|
|
184758
184788
|
this.line = new Line(point5.copy(), point5.copy());
|
|
184759
184789
|
this.bounds = this.line.getMbr();
|
|
184760
|
-
this.bounds.borderColor =
|
|
184790
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
184761
184791
|
this.board.tools.publish();
|
|
184762
184792
|
return true;
|
|
184763
184793
|
}
|
|
@@ -184768,7 +184798,7 @@ class AddText extends BoardTool {
|
|
|
184768
184798
|
const end = new Point(cursorPoint.x, start.y + height2);
|
|
184769
184799
|
this.line = new Line(start, end);
|
|
184770
184800
|
this.bounds = this.line.getMbr();
|
|
184771
|
-
this.bounds.borderColor =
|
|
184801
|
+
this.bounds.borderColor = conf2.SELECTION_COLOR;
|
|
184772
184802
|
this.board.tools.publish();
|
|
184773
184803
|
return true;
|
|
184774
184804
|
}
|
|
@@ -184833,11 +184863,11 @@ class AddText extends BoardTool {
|
|
|
184833
184863
|
class Eraser extends BoardTool {
|
|
184834
184864
|
itemType = "Eraser";
|
|
184835
184865
|
isDown = false;
|
|
184836
|
-
strokeWidth =
|
|
184837
|
-
strokeColor =
|
|
184838
|
-
strokeStyle =
|
|
184866
|
+
strokeWidth = conf2.ERASER_STROKE_WIDTH;
|
|
184867
|
+
strokeColor = conf2.ERASER_DEFAULT_COLOR;
|
|
184868
|
+
strokeStyle = conf2.PEN_STROKE_STYLE;
|
|
184839
184869
|
drawing = new Drawing(this.board, []);
|
|
184840
|
-
maxPointsInLine =
|
|
184870
|
+
maxPointsInLine = conf2.ERASER_MAX_LINE_LENGTH;
|
|
184841
184871
|
constructor(board) {
|
|
184842
184872
|
super(board);
|
|
184843
184873
|
this.setCursor();
|
|
@@ -184999,7 +185029,7 @@ function createCanvasDrawer(board) {
|
|
|
184999
185029
|
borderDiv.id = "canvasBorder";
|
|
185000
185030
|
borderDiv.style.position = "absolute";
|
|
185001
185031
|
borderDiv.style.transformOrigin = "left top";
|
|
185002
|
-
borderDiv.style.border = `1px solid ${
|
|
185032
|
+
borderDiv.style.border = `1px solid ${conf2.SELECTION_COLOR}`;
|
|
185003
185033
|
borderDiv.style.boxSizing = "border-box";
|
|
185004
185034
|
borderDiv.style.left = `${leftOffset}px`;
|
|
185005
185035
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -185009,7 +185039,7 @@ function createCanvasDrawer(board) {
|
|
|
185009
185039
|
canvas.style.boxSizing = "border-box";
|
|
185010
185040
|
container.appendChild(borderDiv);
|
|
185011
185041
|
} else {
|
|
185012
|
-
canvas.style.border = `1px solid ${
|
|
185042
|
+
canvas.style.border = `1px solid ${conf2.SELECTION_COLOR}`;
|
|
185013
185043
|
canvas.style.boxSizing = "border-box";
|
|
185014
185044
|
}
|
|
185015
185045
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -185017,8 +185047,8 @@ function createCanvasDrawer(board) {
|
|
|
185017
185047
|
anchorDiv.style.position = "absolute";
|
|
185018
185048
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
185019
185049
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
185020
|
-
anchorDiv.style.backgroundColor = `${
|
|
185021
|
-
anchorDiv.style.border = `${
|
|
185050
|
+
anchorDiv.style.backgroundColor = `${conf2.SELECTION_ANCHOR_COLOR}`;
|
|
185051
|
+
anchorDiv.style.border = `${conf2.SELECTION_ANCHOR_WIDTH}px solid ${conf2.SELECTION_COLOR}`;
|
|
185022
185052
|
anchorDiv.style.borderRadius = "2px";
|
|
185023
185053
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
185024
185054
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -185026,10 +185056,10 @@ function createCanvasDrawer(board) {
|
|
|
185026
185056
|
return anchorDiv;
|
|
185027
185057
|
};
|
|
185028
185058
|
const anchors = [
|
|
185029
|
-
createAnchorDiv("0%", "0%",
|
|
185030
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
185031
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
185032
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
185059
|
+
createAnchorDiv("0%", "0%", conf2.SELECTION_ANCHOR_RADIUS),
|
|
185060
|
+
createAnchorDiv("100% + 1px", "0%", conf2.SELECTION_ANCHOR_RADIUS),
|
|
185061
|
+
createAnchorDiv("0%", "100% + 1px", conf2.SELECTION_ANCHOR_RADIUS),
|
|
185062
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf2.SELECTION_ANCHOR_RADIUS)
|
|
185033
185063
|
];
|
|
185034
185064
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
185035
185065
|
for (const anchor of anchors) {
|
|
@@ -186371,8 +186401,8 @@ class Select extends Tool {
|
|
|
186371
186401
|
const { x, y } = pointer.point;
|
|
186372
186402
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
186373
186403
|
this.rect = this.line.getMbr();
|
|
186374
|
-
this.rect.borderColor =
|
|
186375
|
-
this.rect.backgroundColor =
|
|
186404
|
+
this.rect.borderColor = conf2.SELECTION_COLOR;
|
|
186405
|
+
this.rect.backgroundColor = conf2.SELECTION_BACKGROUND;
|
|
186376
186406
|
this.board.tools.publish();
|
|
186377
186407
|
this.board.presence.throttledEmit({
|
|
186378
186408
|
method: "DrawSelect",
|
|
@@ -186457,8 +186487,8 @@ class Select extends Tool {
|
|
|
186457
186487
|
const point5 = this.board.pointer.point.copy();
|
|
186458
186488
|
this.line = new Line(this.line.start, point5);
|
|
186459
186489
|
this.rect = this.line.getMbr();
|
|
186460
|
-
this.rect.borderColor =
|
|
186461
|
-
this.rect.backgroundColor =
|
|
186490
|
+
this.rect.borderColor = conf2.SELECTION_COLOR;
|
|
186491
|
+
this.rect.backgroundColor = conf2.SELECTION_BACKGROUND;
|
|
186462
186492
|
this.board.tools.publish();
|
|
186463
186493
|
this.board.presence.throttledEmit({
|
|
186464
186494
|
method: "DrawSelect",
|
|
@@ -187592,7 +187622,7 @@ class Board {
|
|
|
187592
187622
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
187593
187623
|
const css = INDEX_CSS;
|
|
187594
187624
|
const boardName = this.getName() || this.getBoardId();
|
|
187595
|
-
const items = this.items.getWholeHTML(
|
|
187625
|
+
const items = this.items.getWholeHTML(conf2.documentFactory);
|
|
187596
187626
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
187597
187627
|
const scripts = `
|
|
187598
187628
|
<script type="module">${customTagsScript}</script>
|
|
@@ -187632,7 +187662,7 @@ class Board {
|
|
|
187632
187662
|
return `${head}${body}`;
|
|
187633
187663
|
}
|
|
187634
187664
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
187635
|
-
const parser =
|
|
187665
|
+
const parser = conf2.getDOMParser();
|
|
187636
187666
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
187637
187667
|
const items = doc.body.querySelector("#items");
|
|
187638
187668
|
if (items) {
|
|
@@ -187684,7 +187714,7 @@ class Board {
|
|
|
187684
187714
|
return [];
|
|
187685
187715
|
}
|
|
187686
187716
|
deserializeHTML(stringedHTML) {
|
|
187687
|
-
const parser =
|
|
187717
|
+
const parser = conf2.getDOMParser();
|
|
187688
187718
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
187689
187719
|
const itemsDiv = doc.body.querySelector("#items");
|
|
187690
187720
|
if (!itemsDiv) {
|
|
@@ -188246,7 +188276,7 @@ class RichTextCommand {
|
|
|
188246
188276
|
item: id,
|
|
188247
188277
|
operation: {
|
|
188248
188278
|
...this.operation,
|
|
188249
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
188279
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf2.DEFAULT_TEXT_STYLES.fontColor
|
|
188250
188280
|
}
|
|
188251
188281
|
}));
|
|
188252
188282
|
case "setBlockType":
|
|
@@ -188270,7 +188300,7 @@ class RichTextCommand {
|
|
|
188270
188300
|
item: id,
|
|
188271
188301
|
operation: {
|
|
188272
188302
|
...this.operation,
|
|
188273
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
188303
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf2.DEFAULT_TEXT_STYLES.fontFamily
|
|
188274
188304
|
}
|
|
188275
188305
|
}));
|
|
188276
188306
|
case "setFontSize":
|
|
@@ -188278,7 +188308,7 @@ class RichTextCommand {
|
|
|
188278
188308
|
item: id,
|
|
188279
188309
|
operation: {
|
|
188280
188310
|
...this.operation,
|
|
188281
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
188311
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf2.DEFAULT_TEXT_STYLES.fontSize
|
|
188282
188312
|
}
|
|
188283
188313
|
}));
|
|
188284
188314
|
case "setFontHighlight":
|
|
@@ -188286,7 +188316,7 @@ class RichTextCommand {
|
|
|
188286
188316
|
item: id,
|
|
188287
188317
|
operation: {
|
|
188288
188318
|
...this.operation,
|
|
188289
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
188319
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf2.DEFAULT_TEXT_STYLES.fontHighlight
|
|
188290
188320
|
}
|
|
188291
188321
|
}));
|
|
188292
188322
|
case "setHorisontalAlignment":
|
|
@@ -189627,7 +189657,7 @@ class Transformer extends Tool {
|
|
|
189627
189657
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
189628
189658
|
if (mbr) {
|
|
189629
189659
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
189630
|
-
const selectionColor = isLockedItems ?
|
|
189660
|
+
const selectionColor = isLockedItems ? conf2.SELECTION_LOCKED_COLOR : conf2.SELECTION_COLOR;
|
|
189631
189661
|
mbr.borderColor = selectionColor;
|
|
189632
189662
|
mbr.render(context);
|
|
189633
189663
|
}
|
|
@@ -189653,7 +189683,7 @@ class Transformer extends Tool {
|
|
|
189653
189683
|
new Point(right, bottom)
|
|
189654
189684
|
];
|
|
189655
189685
|
for (const point5 of points) {
|
|
189656
|
-
const circle = new Anchor(point5.x, point5.y,
|
|
189686
|
+
const circle = new Anchor(point5.x, point5.y, conf2.SELECTION_ANCHOR_RADIUS, conf2.SELECTION_COLOR, conf2.SELECTION_ANCHOR_COLOR, conf2.SELECTION_ANCHOR_WIDTH);
|
|
189657
189687
|
anchors.push(circle);
|
|
189658
189688
|
}
|
|
189659
189689
|
}
|
|
@@ -190857,7 +190887,7 @@ class Selection2 {
|
|
|
190857
190887
|
renderItemMbr(context, item, customScale) {
|
|
190858
190888
|
const mbr = item.getMbr();
|
|
190859
190889
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
190860
|
-
const selectionColor = item.transformation.isLocked ?
|
|
190890
|
+
const selectionColor = item.transformation.isLocked ? conf2.SELECTION_LOCKED_COLOR : conf2.SELECTION_COLOR;
|
|
190861
190891
|
mbr.borderColor = selectionColor;
|
|
190862
190892
|
mbr.render(context);
|
|
190863
190893
|
}
|
|
@@ -191725,19 +191755,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
191725
191755
|
var import_slate45 = __toESM(require_dist());
|
|
191726
191756
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
191727
191757
|
const transformed = { ...toTransform };
|
|
191728
|
-
const
|
|
191758
|
+
const conf3 = confirmed.path;
|
|
191729
191759
|
const path = transformed.path;
|
|
191730
|
-
if (import_slate45.Path.equals(
|
|
191760
|
+
if (import_slate45.Path.equals(conf3, path)) {
|
|
191731
191761
|
return transformed;
|
|
191732
191762
|
}
|
|
191733
|
-
const isDescendant = path.length >
|
|
191763
|
+
const isDescendant = path.length > conf3.length && path.slice(0, conf3.length).every((seg, i) => seg === conf3[i]);
|
|
191734
191764
|
if (isDescendant) {
|
|
191735
191765
|
const newPath = [...path];
|
|
191736
191766
|
newPath[0] = newPath[0] + 1;
|
|
191737
191767
|
transformed.path = newPath;
|
|
191738
191768
|
return transformed;
|
|
191739
191769
|
}
|
|
191740
|
-
if (import_slate45.Path.isBefore(
|
|
191770
|
+
if (import_slate45.Path.isBefore(conf3, path)) {
|
|
191741
191771
|
transformPath(confirmed, transformed);
|
|
191742
191772
|
}
|
|
191743
191773
|
return transformed;
|
|
@@ -191747,23 +191777,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
191747
191777
|
var import_slate46 = __toESM(require_dist());
|
|
191748
191778
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
191749
191779
|
const transformed = { ...toTransform };
|
|
191750
|
-
const
|
|
191780
|
+
const conf3 = confirmed.path;
|
|
191751
191781
|
const path = transformed.path;
|
|
191752
|
-
if (import_slate46.Path.equals(
|
|
191782
|
+
if (import_slate46.Path.equals(conf3, path)) {
|
|
191753
191783
|
return transformed;
|
|
191754
191784
|
}
|
|
191755
|
-
if (path.length ===
|
|
191785
|
+
if (path.length === conf3.length + 1 && path.slice(0, conf3.length).every((seg, i) => seg === conf3[i])) {
|
|
191756
191786
|
const newPath = [...path];
|
|
191757
|
-
if (
|
|
191787
|
+
if (conf3.length === 1) {
|
|
191758
191788
|
newPath[0] = newPath[0] + 1;
|
|
191759
191789
|
} else {
|
|
191760
|
-
newPath[
|
|
191790
|
+
newPath[conf3.length] = newPath[conf3.length] + 1;
|
|
191761
191791
|
}
|
|
191762
191792
|
transformed.path = newPath;
|
|
191763
191793
|
return transformed;
|
|
191764
191794
|
}
|
|
191765
|
-
const isDescendant = path.length >
|
|
191766
|
-
if (import_slate46.Path.isBefore(
|
|
191795
|
+
const isDescendant = path.length > conf3.length && path.slice(0, conf3.length).every((seg, i) => seg === conf3[i]);
|
|
191796
|
+
if (import_slate46.Path.isBefore(conf3, path) && !isDescendant) {
|
|
191767
191797
|
transformPath(confirmed, transformed);
|
|
191768
191798
|
}
|
|
191769
191799
|
return transformed;
|
|
@@ -192356,8 +192386,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
192356
192386
|
const transformed = [];
|
|
192357
192387
|
for (const transf of toTransform) {
|
|
192358
192388
|
let actualyTransformed = { ...transf };
|
|
192359
|
-
for (const
|
|
192360
|
-
const { operation: confOp } =
|
|
192389
|
+
for (const conf3 of confirmed) {
|
|
192390
|
+
const { operation: confOp } = conf3.body;
|
|
192361
192391
|
const { operation: transfOp } = actualyTransformed.body;
|
|
192362
192392
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
192363
192393
|
if (transformedOp) {
|
|
@@ -192989,7 +193019,7 @@ class Events2 {
|
|
|
192989
193019
|
return record !== null;
|
|
192990
193020
|
}
|
|
192991
193021
|
sendPresenceEvent(event) {
|
|
192992
|
-
|
|
193022
|
+
conf2.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
192993
193023
|
}
|
|
192994
193024
|
canUndoEvent(op, byUserId) {
|
|
192995
193025
|
if (op.method === "undo") {
|
|
@@ -193098,7 +193128,7 @@ function handleChatChunk(chunk, board) {
|
|
|
193098
193128
|
if (chunk.isExternalApiError) {
|
|
193099
193129
|
const editor = item2.getRichText().editor;
|
|
193100
193130
|
editor.clearText();
|
|
193101
|
-
editor.insertCopiedText(
|
|
193131
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
193102
193132
|
}
|
|
193103
193133
|
}
|
|
193104
193134
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -193106,9 +193136,9 @@ function handleChatChunk(chunk, board) {
|
|
|
193106
193136
|
}
|
|
193107
193137
|
console.log("Error AI generate", chunk.error);
|
|
193108
193138
|
if (!chunk.isExternalApiError) {
|
|
193109
|
-
|
|
193110
|
-
header:
|
|
193111
|
-
body:
|
|
193139
|
+
conf2.notify({
|
|
193140
|
+
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
193141
|
+
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
193112
193142
|
variant: "error",
|
|
193113
193143
|
duration: 4000
|
|
193114
193144
|
});
|
|
@@ -193118,9 +193148,9 @@ function handleChatChunk(chunk, board) {
|
|
|
193118
193148
|
default:
|
|
193119
193149
|
board.camera.unsubscribeFromItem();
|
|
193120
193150
|
if (!chunk.isExternalApiError) {
|
|
193121
|
-
|
|
193122
|
-
header:
|
|
193123
|
-
body:
|
|
193151
|
+
conf2.notify({
|
|
193152
|
+
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
193153
|
+
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
193124
193154
|
variant: "error",
|
|
193125
193155
|
duration: 4000
|
|
193126
193156
|
});
|
|
@@ -193135,7 +193165,7 @@ function handleChatChunk(chunk, board) {
|
|
|
193135
193165
|
if (chunk.isExternalApiError) {
|
|
193136
193166
|
const editor = item2.getRichText().editor;
|
|
193137
193167
|
editor.clearText();
|
|
193138
|
-
editor.insertCopiedText(
|
|
193168
|
+
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
193139
193169
|
}
|
|
193140
193170
|
}
|
|
193141
193171
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -193162,7 +193192,7 @@ function handleAudioGenerate(response, board) {
|
|
|
193162
193192
|
}
|
|
193163
193193
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
193164
193194
|
const { left, top, right } = placeholderNode.getMbr();
|
|
193165
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
193195
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf2.AUDIO_DIMENSIONS.width) / 2, top);
|
|
193166
193196
|
audio.updateMbr();
|
|
193167
193197
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
193168
193198
|
board.remove(placeholderNode, false);
|
|
@@ -193184,7 +193214,7 @@ function handleAudioGenerate(response, board) {
|
|
|
193184
193214
|
type: "audio/wav"
|
|
193185
193215
|
});
|
|
193186
193216
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
193187
|
-
const linkElem =
|
|
193217
|
+
const linkElem = conf2.documentFactory.createElement("a");
|
|
193188
193218
|
linkElem.href = audioUrl2;
|
|
193189
193219
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
193190
193220
|
linkElem.click();
|
|
@@ -193203,9 +193233,9 @@ function handleAudioGenerate(response, board) {
|
|
|
193203
193233
|
board.selection.add(placeholderNode);
|
|
193204
193234
|
}
|
|
193205
193235
|
console.error("Audio generation error:", response.message);
|
|
193206
|
-
|
|
193207
|
-
header:
|
|
193208
|
-
body:
|
|
193236
|
+
conf2.notify({
|
|
193237
|
+
header: conf2.i18n.t("AIInput.audioGenerationError.header"),
|
|
193238
|
+
body: conf2.i18n.t("AIInput.audioGenerationError.body"),
|
|
193209
193239
|
variant: "error",
|
|
193210
193240
|
duration: 4000
|
|
193211
193241
|
});
|
|
@@ -193268,14 +193298,14 @@ function handleImageGenerate(response, board) {
|
|
|
193268
193298
|
board.selection.add(item);
|
|
193269
193299
|
const editor = item.getRichText()?.editor;
|
|
193270
193300
|
editor?.clearText();
|
|
193271
|
-
editor?.insertCopiedText(
|
|
193301
|
+
editor?.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
193272
193302
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
193273
193303
|
}
|
|
193274
193304
|
}
|
|
193275
193305
|
} else {
|
|
193276
|
-
|
|
193277
|
-
header:
|
|
193278
|
-
body:
|
|
193306
|
+
conf2.notify({
|
|
193307
|
+
header: conf2.i18n.t("AIInput.imageGenerationError.header"),
|
|
193308
|
+
body: conf2.i18n.t("AIInput.imageGenerationError.body"),
|
|
193279
193309
|
variant: "error",
|
|
193280
193310
|
duration: 4000
|
|
193281
193311
|
});
|
|
@@ -193342,10 +193372,10 @@ function startIntervals(board) {
|
|
|
193342
193372
|
}
|
|
193343
193373
|
log.publishIntervalTimer = setInterval(() => {
|
|
193344
193374
|
tryPublishEvent(board);
|
|
193345
|
-
},
|
|
193375
|
+
}, conf2.EVENTS_PUBLISH_INTERVAL);
|
|
193346
193376
|
log.resendIntervalTimer = setInterval(() => {
|
|
193347
193377
|
tryResendEvent(board);
|
|
193348
|
-
},
|
|
193378
|
+
}, conf2.EVENTS_RESEND_INTERVAL);
|
|
193349
193379
|
}
|
|
193350
193380
|
function tryPublishEvent(board) {
|
|
193351
193381
|
const { log } = board.events;
|
|
@@ -193364,14 +193394,14 @@ function tryResendEvent(board) {
|
|
|
193364
193394
|
return;
|
|
193365
193395
|
}
|
|
193366
193396
|
const date = Date.now();
|
|
193367
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
193397
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf2.EVENTS_RESEND_INTERVAL;
|
|
193368
193398
|
if (!isTimeToSendPendingEvent) {
|
|
193369
193399
|
return;
|
|
193370
193400
|
}
|
|
193371
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
193401
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf2.EVENTS_RESEND_INTERVAL * 5;
|
|
193372
193402
|
if (isProbablyLostConnection) {
|
|
193373
193403
|
board.presence.clear();
|
|
193374
|
-
|
|
193404
|
+
conf2.connection?.notifyAboutLostConnection();
|
|
193375
193405
|
}
|
|
193376
193406
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
193377
193407
|
}
|
|
@@ -193402,12 +193432,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
193402
193432
|
lastKnownOrder: log.getLastIndex()
|
|
193403
193433
|
}
|
|
193404
193434
|
};
|
|
193405
|
-
|
|
193435
|
+
conf2.connection.send({
|
|
193406
193436
|
type: "BoardEvent",
|
|
193407
193437
|
boardId: board.getBoardId(),
|
|
193408
193438
|
event: toSend,
|
|
193409
193439
|
sequenceNumber,
|
|
193410
|
-
userId:
|
|
193440
|
+
userId: conf2.connection.getCurrentUser()
|
|
193411
193441
|
});
|
|
193412
193442
|
const date = Date.now();
|
|
193413
193443
|
log.pendingEvent = {
|
|
@@ -193453,7 +193483,7 @@ function handleConfirmation(msg, board) {
|
|
|
193453
193483
|
if (!isPendingEventConfirmation) {
|
|
193454
193484
|
return;
|
|
193455
193485
|
}
|
|
193456
|
-
|
|
193486
|
+
conf2.connection?.dismissNotificationAboutLostConnection();
|
|
193457
193487
|
log.currentSequenceNumber++;
|
|
193458
193488
|
log.pendingEvent.event.order = msg.order;
|
|
193459
193489
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -193465,7 +193495,7 @@ function handleConfirmation(msg, board) {
|
|
|
193465
193495
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
193466
193496
|
function handleCreateSnapshotRequestMessage(msg, board) {
|
|
193467
193497
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
193468
|
-
|
|
193498
|
+
conf2.connection.send({
|
|
193469
193499
|
type: "BoardSnapshot",
|
|
193470
193500
|
boardId,
|
|
193471
193501
|
snapshot,
|
|
@@ -193496,9 +193526,9 @@ function handleModeMessage(message, board) {
|
|
|
193496
193526
|
if (isTemplateView()) {
|
|
193497
193527
|
return;
|
|
193498
193528
|
}
|
|
193499
|
-
|
|
193500
|
-
header:
|
|
193501
|
-
body: message.mode === "edit" ?
|
|
193529
|
+
conf2.notify({
|
|
193530
|
+
header: conf2.i18n.t("sharing.settingsChanged.heading"),
|
|
193531
|
+
body: message.mode === "edit" ? conf2.i18n.t("sharing.settingsChanged.bodyEdit") : conf2.i18n.t("sharing.settingsChanged.bodyView"),
|
|
193502
193532
|
duration: 5000
|
|
193503
193533
|
});
|
|
193504
193534
|
}
|
|
@@ -193616,7 +193646,7 @@ class NodePath2D extends Path2DFactory {
|
|
|
193616
193646
|
|
|
193617
193647
|
// src/api/initPaths.ts
|
|
193618
193648
|
function initPaths(path2D) {
|
|
193619
|
-
|
|
193649
|
+
conf2.EXPORT_FRAME_DECORATIONS = {
|
|
193620
193650
|
"top-left": {
|
|
193621
193651
|
path: new path2D("M13 1H1V13"),
|
|
193622
193652
|
lineWidth: 2,
|
|
@@ -193659,7 +193689,7 @@ function initPaths(path2D) {
|
|
|
193659
193689
|
// src/api/getMeasureCtx.ts
|
|
193660
193690
|
function getMeasureCtx() {
|
|
193661
193691
|
if (typeof document !== "undefined") {
|
|
193662
|
-
const measureCanvas =
|
|
193692
|
+
const measureCanvas = conf2.documentFactory.createElement("canvas");
|
|
193663
193693
|
const measureCtx = measureCanvas.getContext("2d");
|
|
193664
193694
|
if (!measureCtx) {
|
|
193665
193695
|
throw new Error("Failde to create canvas and get 2d context");
|
|
@@ -193677,12 +193707,12 @@ function getMeasureCtx() {
|
|
|
193677
193707
|
var import_css = __toESM(require_css_escape());
|
|
193678
193708
|
function initNodeSettings() {
|
|
193679
193709
|
const documentFactory = new NodeDocumentFactory;
|
|
193680
|
-
|
|
193681
|
-
|
|
193682
|
-
|
|
193683
|
-
|
|
193710
|
+
conf2.documentFactory = documentFactory;
|
|
193711
|
+
conf2.path2DFactory = NodePath2D;
|
|
193712
|
+
conf2.measureCtx = getMeasureCtx();
|
|
193713
|
+
conf2.getDOMParser = getNodeDOMParser;
|
|
193684
193714
|
initPaths(NodePath2D);
|
|
193685
|
-
return
|
|
193715
|
+
return conf2;
|
|
193686
193716
|
}
|
|
193687
193717
|
|
|
193688
193718
|
// src/node.ts
|