microboard-temp 0.1.22 → 0.1.23
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 +572 -256
- package/dist/cjs/index.js +560 -244
- package/dist/cjs/node.js +568 -252
- package/dist/esm/browser.js +572 -256
- package/dist/esm/index.js +560 -244
- package/dist/esm/node.js +568 -252
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -7998,20 +7998,20 @@ var resources = {
|
|
|
7998
7998
|
};
|
|
7999
7999
|
function initDefaultI18N() {
|
|
8000
8000
|
instance.use(Browser).init({
|
|
8001
|
-
debug:
|
|
8001
|
+
debug: conf.debug,
|
|
8002
8002
|
detection: {
|
|
8003
8003
|
order: ["navigator"]
|
|
8004
8004
|
},
|
|
8005
8005
|
supportedLngs: ["en", "ru"],
|
|
8006
8006
|
defaultNS,
|
|
8007
8007
|
resources,
|
|
8008
|
-
fallbackLng:
|
|
8008
|
+
fallbackLng: conf.FALLBACK_LNG,
|
|
8009
8009
|
interpolation: {
|
|
8010
8010
|
escapeValue: false
|
|
8011
8011
|
}
|
|
8012
8012
|
});
|
|
8013
|
-
|
|
8014
|
-
|
|
8013
|
+
conf.i18n = instance;
|
|
8014
|
+
conf.planNames = {
|
|
8015
8015
|
basic: instance.t("userPlan.plans.basic.name"),
|
|
8016
8016
|
plus: instance.t("userPlan.plans.plus.name")
|
|
8017
8017
|
};
|
|
@@ -8026,7 +8026,7 @@ var ExportQuality;
|
|
|
8026
8026
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
8027
8027
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
8028
8028
|
})(ExportQuality ||= {});
|
|
8029
|
-
var
|
|
8029
|
+
var conf = {
|
|
8030
8030
|
connection: undefined,
|
|
8031
8031
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
8032
8032
|
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
@@ -9074,7 +9074,7 @@ class DrawingContext {
|
|
|
9074
9074
|
this.setCamera(camera);
|
|
9075
9075
|
}
|
|
9076
9076
|
dpi() {
|
|
9077
|
-
return
|
|
9077
|
+
return conf.getDPI();
|
|
9078
9078
|
}
|
|
9079
9079
|
setCamera(camera) {
|
|
9080
9080
|
this.camera = camera;
|
|
@@ -9084,7 +9084,7 @@ class DrawingContext {
|
|
|
9084
9084
|
}
|
|
9085
9085
|
clear() {
|
|
9086
9086
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
9087
|
-
this.ctx.clearRect(0, 0,
|
|
9087
|
+
this.ctx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
9088
9088
|
this.matrix.applyToContext(this.ctx);
|
|
9089
9089
|
}
|
|
9090
9090
|
clearCursor() {
|
|
@@ -9092,7 +9092,7 @@ class DrawingContext {
|
|
|
9092
9092
|
return;
|
|
9093
9093
|
}
|
|
9094
9094
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
9095
|
-
this.cursorCtx.clearRect(0, 0,
|
|
9095
|
+
this.cursorCtx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
9096
9096
|
this.matrix.applyToContext(this.cursorCtx);
|
|
9097
9097
|
}
|
|
9098
9098
|
applyChanges() {
|
|
@@ -9195,7 +9195,7 @@ class Path {
|
|
|
9195
9195
|
this.width = this.getMbr().getWidth();
|
|
9196
9196
|
this.height = this.getMbr().getHeight();
|
|
9197
9197
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
9198
|
-
this.path2d = new
|
|
9198
|
+
this.path2d = new conf.path2DFactory;
|
|
9199
9199
|
this.updateCache();
|
|
9200
9200
|
}
|
|
9201
9201
|
getBackgroundColor() {
|
|
@@ -9272,7 +9272,7 @@ class Path {
|
|
|
9272
9272
|
this.y = top - this.paddingTop;
|
|
9273
9273
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
9274
9274
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
9275
|
-
const path2d = new
|
|
9275
|
+
const path2d = new conf.path2DFactory;
|
|
9276
9276
|
if (this.segments.length === 0) {
|
|
9277
9277
|
return;
|
|
9278
9278
|
}
|
|
@@ -10316,7 +10316,7 @@ var parsersHTML = {
|
|
|
10316
10316
|
"comment-item": parseHTMLComment
|
|
10317
10317
|
};
|
|
10318
10318
|
var decodeHtml = (htmlString) => {
|
|
10319
|
-
const parser =
|
|
10319
|
+
const parser = conf.getDOMParser();
|
|
10320
10320
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
10321
10321
|
return doc.documentElement.textContent || "";
|
|
10322
10322
|
};
|
|
@@ -10345,10 +10345,10 @@ function parseHTMLRichText(el, options) {
|
|
|
10345
10345
|
italic: node.style.fontStyle === "italic",
|
|
10346
10346
|
underline: node.style.textDecoration.includes("underline"),
|
|
10347
10347
|
"line-through": node.style.textDecoration.includes("line-through"),
|
|
10348
|
-
fontColor: node.style.color ||
|
|
10349
|
-
fontHighlight: node.style.backgroundColor ||
|
|
10350
|
-
fontSize: parseFloat(node.style.fontSize) ||
|
|
10351
|
-
fontFamily: node.style.fontFamily ||
|
|
10348
|
+
fontColor: node.style.color || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
10349
|
+
fontHighlight: node.style.backgroundColor || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
10350
|
+
fontSize: parseFloat(node.style.fontSize) || conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
10351
|
+
fontFamily: node.style.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily,
|
|
10352
10352
|
overline: false,
|
|
10353
10353
|
subscript: false,
|
|
10354
10354
|
superscript: false
|
|
@@ -10413,7 +10413,7 @@ function parseHTMLRichText(el, options) {
|
|
|
10413
10413
|
return {
|
|
10414
10414
|
type: "paragraph",
|
|
10415
10415
|
...extractCommonProps(),
|
|
10416
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
10416
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
10417
10417
|
children: children2
|
|
10418
10418
|
};
|
|
10419
10419
|
default:
|
|
@@ -16893,8 +16893,8 @@ class LinkTo {
|
|
|
16893
16893
|
const ctx = context.ctx;
|
|
16894
16894
|
ctx.save();
|
|
16895
16895
|
ctx.globalCompositeOperation = "destination-out";
|
|
16896
|
-
const size =
|
|
16897
|
-
const offset =
|
|
16896
|
+
const size = conf.LINK_BTN_SIZE / scale;
|
|
16897
|
+
const offset = conf.LINK_BTN_OFFSET / scale;
|
|
16898
16898
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
16899
16899
|
ctx.restore();
|
|
16900
16900
|
}
|
|
@@ -17045,7 +17045,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
17045
17045
|
} else if (node3.type === "ul_list" && !listData) {
|
|
17046
17046
|
listData = { level: 0, isNumberedList: false };
|
|
17047
17047
|
}
|
|
17048
|
-
const listMarks =
|
|
17048
|
+
const listMarks = conf[getListMarkType((listData?.level || 0) + 1)];
|
|
17049
17049
|
for (let i = 0;i < data.children.length; i++) {
|
|
17050
17050
|
const child = structuredClone(data.children[i]);
|
|
17051
17051
|
switch (child.type) {
|
|
@@ -17450,8 +17450,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
17450
17450
|
rect2.height += paddingTop;
|
|
17451
17451
|
}
|
|
17452
17452
|
}
|
|
17453
|
-
|
|
17454
|
-
const measure =
|
|
17453
|
+
conf.measureCtx.font = style.font;
|
|
17454
|
+
const measure = conf.measureCtx.measureText(text);
|
|
17455
17455
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
17456
17456
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
17457
17457
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -19181,7 +19181,7 @@ var create2 = (key) => {
|
|
|
19181
19181
|
return false;
|
|
19182
19182
|
};
|
|
19183
19183
|
};
|
|
19184
|
-
var
|
|
19184
|
+
var hotkeys = {
|
|
19185
19185
|
isBold: create2("bold"),
|
|
19186
19186
|
isCompose: create2("compose"),
|
|
19187
19187
|
isMoveBackward: create2("moveBackward"),
|
|
@@ -26573,7 +26573,7 @@ var convertLinkNodeToTextNode = (node4) => {
|
|
|
26573
26573
|
const link = node4.link;
|
|
26574
26574
|
const text3 = node4.children.map((child) => child.text).join("");
|
|
26575
26575
|
return {
|
|
26576
|
-
...
|
|
26576
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
26577
26577
|
type: "text",
|
|
26578
26578
|
text: text3,
|
|
26579
26579
|
link,
|
|
@@ -26589,9 +26589,9 @@ function setNodeChildrenStyles({
|
|
|
26589
26589
|
horisontalAlignment,
|
|
26590
26590
|
node: node4
|
|
26591
26591
|
}) {
|
|
26592
|
-
let fontStyles =
|
|
26592
|
+
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
26593
26593
|
if (editor) {
|
|
26594
|
-
fontStyles = Editor.marks(editor) ||
|
|
26594
|
+
fontStyles = Editor.marks(editor) || conf.DEFAULT_TEXT_STYLES;
|
|
26595
26595
|
}
|
|
26596
26596
|
switch (node4.type) {
|
|
26597
26597
|
case "heading_one":
|
|
@@ -26623,7 +26623,7 @@ function setNodeChildrenStyles({
|
|
|
26623
26623
|
children.text += " ";
|
|
26624
26624
|
}
|
|
26625
26625
|
let fontColor = fontStyles.fontColor;
|
|
26626
|
-
if (fontColor ===
|
|
26626
|
+
if (fontColor === conf.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
26627
26627
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
26628
26628
|
}
|
|
26629
26629
|
return {
|
|
@@ -26693,7 +26693,7 @@ class MarkdownProcessor {
|
|
|
26693
26693
|
this.subject.publish(this);
|
|
26694
26694
|
return true;
|
|
26695
26695
|
}
|
|
26696
|
-
if (text3.startsWith(
|
|
26696
|
+
if (text3.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
26697
26697
|
return true;
|
|
26698
26698
|
}
|
|
26699
26699
|
const isPrevTextEmpty = isTextEmpty(this.editor.children);
|
|
@@ -26751,7 +26751,7 @@ class MarkdownProcessor {
|
|
|
26751
26751
|
return;
|
|
26752
26752
|
}
|
|
26753
26753
|
const prevText = this.getText()?.[this.getText().length - 1]?.children[0]?.text;
|
|
26754
|
-
if (prevText?.startsWith(
|
|
26754
|
+
if (prevText?.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
26755
26755
|
clearText(this.editor);
|
|
26756
26756
|
}
|
|
26757
26757
|
if (chunk.includes(`
|
|
@@ -27777,7 +27777,7 @@ class RichTextCommand {
|
|
|
27777
27777
|
item: id,
|
|
27778
27778
|
operation: {
|
|
27779
27779
|
...this.operation,
|
|
27780
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
27780
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
27781
27781
|
}
|
|
27782
27782
|
}));
|
|
27783
27783
|
case "setBlockType":
|
|
@@ -27801,7 +27801,7 @@ class RichTextCommand {
|
|
|
27801
27801
|
item: id,
|
|
27802
27802
|
operation: {
|
|
27803
27803
|
...this.operation,
|
|
27804
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
27804
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
27805
27805
|
}
|
|
27806
27806
|
}));
|
|
27807
27807
|
case "setFontSize":
|
|
@@ -27809,7 +27809,7 @@ class RichTextCommand {
|
|
|
27809
27809
|
item: id,
|
|
27810
27810
|
operation: {
|
|
27811
27811
|
...this.operation,
|
|
27812
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
27812
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf.DEFAULT_TEXT_STYLES.fontSize
|
|
27813
27813
|
}
|
|
27814
27814
|
}));
|
|
27815
27815
|
case "setFontHighlight":
|
|
@@ -27817,7 +27817,7 @@ class RichTextCommand {
|
|
|
27817
27817
|
item: id,
|
|
27818
27818
|
operation: {
|
|
27819
27819
|
...this.operation,
|
|
27820
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
27820
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf.DEFAULT_TEXT_STYLES.fontHighlight
|
|
27821
27821
|
}
|
|
27822
27822
|
}));
|
|
27823
27823
|
case "setHorisontalAlignment":
|
|
@@ -29056,7 +29056,7 @@ class RichText extends BaseItem {
|
|
|
29056
29056
|
isContainerSet = false;
|
|
29057
29057
|
isRenderEnabled = true;
|
|
29058
29058
|
layoutNodes;
|
|
29059
|
-
clipPath = new
|
|
29059
|
+
clipPath = new conf.path2DFactory;
|
|
29060
29060
|
updateRequired = false;
|
|
29061
29061
|
autoSizeScale = 1;
|
|
29062
29062
|
containerMaxWidth;
|
|
@@ -29071,7 +29071,7 @@ class RichText extends BaseItem {
|
|
|
29071
29071
|
shrinkWidth = false;
|
|
29072
29072
|
prevMbr = null;
|
|
29073
29073
|
rtCounter = 0;
|
|
29074
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText =
|
|
29074
|
+
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText = conf.i18n?.t("board.textPlaceholder"), isInShape = false, autoSize = false, insideOf, initialTextStyles = conf.DEFAULT_TEXT_STYLES) {
|
|
29075
29075
|
super(board, id);
|
|
29076
29076
|
this.container = container;
|
|
29077
29077
|
this.transformation = transformation;
|
|
@@ -29205,11 +29205,11 @@ class RichText extends BaseItem {
|
|
|
29205
29205
|
return;
|
|
29206
29206
|
}
|
|
29207
29207
|
try {
|
|
29208
|
-
|
|
29208
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29209
29209
|
} catch {}
|
|
29210
29210
|
};
|
|
29211
29211
|
updateElement = () => {
|
|
29212
|
-
if (
|
|
29212
|
+
if (conf.isNode()) {
|
|
29213
29213
|
return;
|
|
29214
29214
|
}
|
|
29215
29215
|
if (this.updateRequired) {
|
|
@@ -29338,7 +29338,7 @@ class RichText extends BaseItem {
|
|
|
29338
29338
|
const container = this.getTransformedContainer();
|
|
29339
29339
|
const width = container.getWidth();
|
|
29340
29340
|
const height = container.getHeight();
|
|
29341
|
-
this.clipPath = new
|
|
29341
|
+
this.clipPath = new conf.path2DFactory;
|
|
29342
29342
|
this.clipPath.rect(0, 0, width, height);
|
|
29343
29343
|
}
|
|
29344
29344
|
setContainer(container) {
|
|
@@ -29615,24 +29615,24 @@ class RichText extends BaseItem {
|
|
|
29615
29615
|
this.clearLastClickPoint();
|
|
29616
29616
|
const domMbr = ref.getBoundingClientRect();
|
|
29617
29617
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
29618
|
-
if (refMbr.isInside(point5) && (
|
|
29619
|
-
const domRange =
|
|
29620
|
-
const textNode =
|
|
29621
|
-
const offset =
|
|
29622
|
-
const slatePoint =
|
|
29618
|
+
if (refMbr.isInside(point5) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
29619
|
+
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point5.x, point5.y) : conf.documentFactory.caretRangeFromPoint(point5.x, point5.y);
|
|
29620
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
29621
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
29622
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
29623
29623
|
exactMatch: false,
|
|
29624
29624
|
suppressThrow: false
|
|
29625
29625
|
});
|
|
29626
29626
|
if (slatePoint) {
|
|
29627
29627
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
29628
29628
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
29629
|
-
|
|
29629
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29630
29630
|
}
|
|
29631
29631
|
} else {
|
|
29632
|
-
if (!(
|
|
29632
|
+
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
29633
29633
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
29634
29634
|
}
|
|
29635
|
-
|
|
29635
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29636
29636
|
}
|
|
29637
29637
|
}
|
|
29638
29638
|
}
|
|
@@ -29739,11 +29739,11 @@ class RichText extends BaseItem {
|
|
|
29739
29739
|
if (node4.type === "text" || "text" in node4) {
|
|
29740
29740
|
node4 = node4;
|
|
29741
29741
|
const text3 = node4.text.trim() !== "" ? decodeHtml(escapeHtml2(node4.text)) : " ";
|
|
29742
|
-
const textElement = node4.link ? Object.assign(
|
|
29742
|
+
const textElement = node4.link ? Object.assign(conf.documentFactory.createElement("a"), {
|
|
29743
29743
|
href: node4.link,
|
|
29744
29744
|
target: "_blank",
|
|
29745
29745
|
rel: "noreferrer"
|
|
29746
|
-
}) :
|
|
29746
|
+
}) : conf.documentFactory.createElement("span");
|
|
29747
29747
|
Object.assign(textElement.style, {
|
|
29748
29748
|
fontWeight: node4.bold ? "700" : "400",
|
|
29749
29749
|
fontStyle: node4.italic ? "italic" : "",
|
|
@@ -29751,10 +29751,10 @@ class RichText extends BaseItem {
|
|
|
29751
29751
|
node4.underline ? "underline" : "",
|
|
29752
29752
|
node4["line-through"] ? "line-through" : ""
|
|
29753
29753
|
].filter(Boolean).join(" "),
|
|
29754
|
-
color: node4.fontColor ||
|
|
29755
|
-
backgroundColor: node4.fontHighlight ||
|
|
29756
|
-
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${
|
|
29757
|
-
fontFamily: node4.fontFamily ||
|
|
29754
|
+
color: node4.fontColor || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
29755
|
+
backgroundColor: node4.fontHighlight || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
29756
|
+
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${conf.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
29757
|
+
fontFamily: node4.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
29758
29758
|
});
|
|
29759
29759
|
if (this.insideOf === "Frame") {
|
|
29760
29760
|
Object.assign(textElement.style, {
|
|
@@ -29789,14 +29789,14 @@ class RichText extends BaseItem {
|
|
|
29789
29789
|
four: 4,
|
|
29790
29790
|
five: 5
|
|
29791
29791
|
};
|
|
29792
|
-
const header =
|
|
29792
|
+
const header = conf.documentFactory.createElement(`h${levels2[level]}`);
|
|
29793
29793
|
applyCommonStyles(header);
|
|
29794
29794
|
header.append(...children);
|
|
29795
29795
|
return header;
|
|
29796
29796
|
}
|
|
29797
29797
|
case "code_block": {
|
|
29798
|
-
const pre =
|
|
29799
|
-
const code =
|
|
29798
|
+
const pre = conf.documentFactory.createElement("pre");
|
|
29799
|
+
const code = conf.documentFactory.createElement("code");
|
|
29800
29800
|
applyCommonStyles(pre);
|
|
29801
29801
|
if (node4.language) {
|
|
29802
29802
|
code.classList.add(`language-${node4.language}`);
|
|
@@ -29810,35 +29810,35 @@ class RichText extends BaseItem {
|
|
|
29810
29810
|
return pre;
|
|
29811
29811
|
}
|
|
29812
29812
|
case "block-quote": {
|
|
29813
|
-
const blockquote =
|
|
29813
|
+
const blockquote = conf.documentFactory.createElement("blockquote");
|
|
29814
29814
|
applyCommonStyles(blockquote);
|
|
29815
29815
|
blockquote.append(...children);
|
|
29816
29816
|
return blockquote;
|
|
29817
29817
|
}
|
|
29818
29818
|
case "ul_list": {
|
|
29819
|
-
const ul =
|
|
29819
|
+
const ul = conf.documentFactory.createElement("ul");
|
|
29820
29820
|
applyCommonStyles(ul);
|
|
29821
29821
|
ul.append(...children);
|
|
29822
29822
|
return ul;
|
|
29823
29823
|
}
|
|
29824
29824
|
case "ol_list": {
|
|
29825
|
-
const ol =
|
|
29825
|
+
const ol = conf.documentFactory.createElement("ol");
|
|
29826
29826
|
applyCommonStyles(ol);
|
|
29827
29827
|
ol.append(...children);
|
|
29828
29828
|
return ol;
|
|
29829
29829
|
}
|
|
29830
29830
|
case "list_item": {
|
|
29831
|
-
const li =
|
|
29831
|
+
const li = conf.documentFactory.createElement("li");
|
|
29832
29832
|
applyCommonStyles(li);
|
|
29833
29833
|
li.append(...children);
|
|
29834
29834
|
return li;
|
|
29835
29835
|
}
|
|
29836
29836
|
case "paragraph":
|
|
29837
29837
|
default: {
|
|
29838
|
-
const par =
|
|
29838
|
+
const par = conf.documentFactory.createElement("p");
|
|
29839
29839
|
applyCommonStyles(par);
|
|
29840
29840
|
Object.assign(par.style, {
|
|
29841
|
-
lineHeight: node4.lineHeight ? `${node4.lineHeight}` :
|
|
29841
|
+
lineHeight: node4.lineHeight ? `${node4.lineHeight}` : conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
29842
29842
|
margin: "0"
|
|
29843
29843
|
});
|
|
29844
29844
|
par.append(...children);
|
|
@@ -29846,7 +29846,7 @@ class RichText extends BaseItem {
|
|
|
29846
29846
|
}
|
|
29847
29847
|
}
|
|
29848
29848
|
}
|
|
29849
|
-
return
|
|
29849
|
+
return conf.documentFactory.createElement("div");
|
|
29850
29850
|
};
|
|
29851
29851
|
const escapeHtml2 = (unsafe) => {
|
|
29852
29852
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -42909,7 +42909,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
42909
42909
|
markdownString = String(file).trim();
|
|
42910
42910
|
}
|
|
42911
42911
|
let slateNodes = [];
|
|
42912
|
-
if (
|
|
42912
|
+
if (conf.URL_REGEX.test(text5)) {
|
|
42913
42913
|
slateNodes = [createLinkNode(text5)];
|
|
42914
42914
|
} else {
|
|
42915
42915
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -42925,7 +42925,7 @@ function createLinkNode(link2) {
|
|
|
42925
42925
|
type: "text",
|
|
42926
42926
|
link: link2,
|
|
42927
42927
|
text: link2,
|
|
42928
|
-
...
|
|
42928
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
42929
42929
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
42930
42930
|
};
|
|
42931
42931
|
}
|
|
@@ -43036,7 +43036,7 @@ class AINode extends BaseItem {
|
|
|
43036
43036
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
43037
43037
|
super(board, id);
|
|
43038
43038
|
this.id = id;
|
|
43039
|
-
this.buttonIcon =
|
|
43039
|
+
this.buttonIcon = conf.documentFactory.createElement("img");
|
|
43040
43040
|
this.buttonIcon.src = ICON_SRC;
|
|
43041
43041
|
this.contextItems = contextItems;
|
|
43042
43042
|
this.isUserRequest = isUserRequest;
|
|
@@ -44261,12 +44261,12 @@ class Connector2 extends BaseItem {
|
|
|
44261
44261
|
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
44262
44262
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
44263
44263
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
44264
|
-
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo,
|
|
44264
|
+
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf.i18n.t("connector.textPlaceholder", {
|
|
44265
44265
|
ns: "default"
|
|
44266
44266
|
}), true, false, "Connector", {
|
|
44267
|
-
...
|
|
44268
|
-
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) :
|
|
44269
|
-
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") :
|
|
44267
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
44268
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
44269
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf.DEFAULT_TEXT_STYLES.fontColor
|
|
44270
44270
|
});
|
|
44271
44271
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
44272
44272
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -44716,7 +44716,7 @@ class Connector2 extends BaseItem {
|
|
|
44716
44716
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
44717
44717
|
this.text.render(context);
|
|
44718
44718
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
44719
|
-
ctx.strokeStyle =
|
|
44719
|
+
ctx.strokeStyle = conf.SELECTION_COLOR;
|
|
44720
44720
|
ctx.lineWidth = 1;
|
|
44721
44721
|
ctx.beginPath();
|
|
44722
44722
|
ctx.rect(textMbr.left - TEXT_BORDER_PADDING, textMbr.top - TEXT_BORDER_PADDING, textMbr.getWidth() + TEXT_BORDER_PADDING * 2, textMbr.getHeight() + TEXT_BORDER_PADDING * 2);
|
|
@@ -44943,7 +44943,7 @@ class Connector2 extends BaseItem {
|
|
|
44943
44943
|
}
|
|
44944
44944
|
}
|
|
44945
44945
|
updatePaths() {
|
|
44946
|
-
if (
|
|
44946
|
+
if (conf.isNode()) {
|
|
44947
44947
|
return;
|
|
44948
44948
|
}
|
|
44949
44949
|
const startPoint = this.startPoint;
|
|
@@ -45754,7 +45754,7 @@ class DefaultShapeData {
|
|
|
45754
45754
|
text;
|
|
45755
45755
|
linkTo;
|
|
45756
45756
|
itemType = "Shape";
|
|
45757
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
45757
|
+
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor = conf.SHAPE_DEFAULT_STROKE_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 1, transformation = new DefaultTransformationData, text5 = new DefaultRichTextData, linkTo) {
|
|
45758
45758
|
this.shapeType = shapeType;
|
|
45759
45759
|
this.backgroundColor = backgroundColor;
|
|
45760
45760
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -46952,7 +46952,7 @@ class Shape extends BaseItem {
|
|
|
46952
46952
|
this.text.updateElement();
|
|
46953
46953
|
}
|
|
46954
46954
|
transformPath() {
|
|
46955
|
-
if (
|
|
46955
|
+
if (conf.isNode()) {
|
|
46956
46956
|
return;
|
|
46957
46957
|
}
|
|
46958
46958
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -47145,7 +47145,7 @@ class Sticker extends BaseItem {
|
|
|
47145
47145
|
return this;
|
|
47146
47146
|
}
|
|
47147
47147
|
transformPath() {
|
|
47148
|
-
if (
|
|
47148
|
+
if (conf.isNode()) {
|
|
47149
47149
|
return;
|
|
47150
47150
|
}
|
|
47151
47151
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -47631,7 +47631,7 @@ class Frame extends BaseItem {
|
|
|
47631
47631
|
this.path = Frames[this.shapeType].path.copy();
|
|
47632
47632
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
47633
47633
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
47634
|
-
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...
|
|
47634
|
+
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...conf.DEFAULT_TEXT_STYLES, fontColor: FRAME_TITLE_COLOR });
|
|
47635
47635
|
this.text.setSelectionHorisontalAlignment("left");
|
|
47636
47636
|
this.transformation.subject.subscribe(() => {
|
|
47637
47637
|
this.transformPath();
|
|
@@ -48177,10 +48177,10 @@ class Frame extends BaseItem {
|
|
|
48177
48177
|
}
|
|
48178
48178
|
// src/Items/Video/Video.ts
|
|
48179
48179
|
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";
|
|
48180
|
-
var videoIcon =
|
|
48180
|
+
var videoIcon = conf.documentFactory.createElement("img");
|
|
48181
48181
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
48182
48182
|
var createPlaceholderImage = (width2, height2) => {
|
|
48183
|
-
const canvas =
|
|
48183
|
+
const canvas = conf.documentFactory.createElement("canvas");
|
|
48184
48184
|
canvas.width = width2;
|
|
48185
48185
|
canvas.height = height2;
|
|
48186
48186
|
const ctx = canvas.getContext("2d");
|
|
@@ -48222,7 +48222,7 @@ class VideoItem extends BaseItem {
|
|
|
48222
48222
|
super(board, id);
|
|
48223
48223
|
this.events = events2;
|
|
48224
48224
|
this.extension = extension2;
|
|
48225
|
-
this.isStorageUrl = !
|
|
48225
|
+
this.isStorageUrl = !conf.getYouTubeId(url);
|
|
48226
48226
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
48227
48227
|
this.linkTo = new LinkTo(this.id, events2);
|
|
48228
48228
|
this.board = board;
|
|
@@ -48592,59 +48592,59 @@ async function fileTosha256(file) {
|
|
|
48592
48592
|
var catchErrorResponse = async (response, mediaType) => {
|
|
48593
48593
|
if (response.status === 403) {
|
|
48594
48594
|
const data = await response.json();
|
|
48595
|
-
let errorBody =
|
|
48595
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
48596
48596
|
if (!data.isOwnerRequest) {
|
|
48597
|
-
errorBody =
|
|
48597
|
+
errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
48598
48598
|
} else if (data.currentUsage && data.storageLimit) {
|
|
48599
|
-
errorBody =
|
|
48599
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
48600
48600
|
}
|
|
48601
|
-
|
|
48601
|
+
conf.notify({
|
|
48602
48602
|
variant: "warning",
|
|
48603
|
-
header:
|
|
48603
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
48604
48604
|
body: errorBody,
|
|
48605
48605
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
48606
|
-
text:
|
|
48607
|
-
onClick: () =>
|
|
48606
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48607
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48608
48608
|
} : undefined,
|
|
48609
48609
|
duration: 8000
|
|
48610
48610
|
});
|
|
48611
48611
|
} else if (response.status === 413) {
|
|
48612
48612
|
const data = await response.json();
|
|
48613
|
-
let errorBody =
|
|
48613
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
48614
48614
|
let isBasicPlan = false;
|
|
48615
48615
|
if (data.fileSizeLimit && data.fileSize) {
|
|
48616
48616
|
if (mediaType === "image") {
|
|
48617
48617
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
48618
|
-
errorBody =
|
|
48618
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48619
48619
|
} else {
|
|
48620
48620
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
48621
|
-
errorBody =
|
|
48621
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48622
48622
|
}
|
|
48623
48623
|
}
|
|
48624
|
-
|
|
48624
|
+
conf.notify({
|
|
48625
48625
|
variant: "warning",
|
|
48626
|
-
header:
|
|
48626
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48627
48627
|
body: errorBody,
|
|
48628
48628
|
button: isBasicPlan ? {
|
|
48629
|
-
text:
|
|
48630
|
-
onClick: () =>
|
|
48629
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48630
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48631
48631
|
} : undefined,
|
|
48632
48632
|
duration: 4000
|
|
48633
48633
|
});
|
|
48634
48634
|
} else if (response.status === 401) {
|
|
48635
|
-
|
|
48635
|
+
conf.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
48636
48636
|
} else if (response.status === 415) {
|
|
48637
|
-
|
|
48637
|
+
conf.notify({
|
|
48638
48638
|
variant: "warning",
|
|
48639
|
-
header:
|
|
48640
|
-
body:
|
|
48639
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
48640
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
48641
48641
|
duration: 4000
|
|
48642
48642
|
});
|
|
48643
48643
|
} else {
|
|
48644
|
-
|
|
48644
|
+
conf.notify({
|
|
48645
48645
|
variant: "error",
|
|
48646
|
-
header:
|
|
48647
|
-
body:
|
|
48646
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
48647
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
48648
48648
|
duration: 4000
|
|
48649
48649
|
});
|
|
48650
48650
|
}
|
|
@@ -48652,17 +48652,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
48652
48652
|
};
|
|
48653
48653
|
var catchDuplicateErrorResponse = async (response) => {
|
|
48654
48654
|
if (response.status === 403) {
|
|
48655
|
-
|
|
48655
|
+
conf.notify({
|
|
48656
48656
|
variant: "warning",
|
|
48657
|
-
header:
|
|
48658
|
-
body:
|
|
48657
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
48658
|
+
body: conf.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
48659
48659
|
duration: 4000
|
|
48660
48660
|
});
|
|
48661
48661
|
} else {
|
|
48662
|
-
|
|
48662
|
+
conf.notify({
|
|
48663
48663
|
variant: "error",
|
|
48664
|
-
header:
|
|
48665
|
-
body:
|
|
48664
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
48665
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
48666
48666
|
duration: 4000
|
|
48667
48667
|
});
|
|
48668
48668
|
}
|
|
@@ -48670,40 +48670,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
48670
48670
|
};
|
|
48671
48671
|
var validateMediaFile = (file, account2) => {
|
|
48672
48672
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
48673
|
-
if (!file.type.startsWith("image") && !
|
|
48674
|
-
|
|
48673
|
+
if (!file.type.startsWith("image") && !conf.AUDIO_FORMATS.includes(fileExtension) && !conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
48674
|
+
conf.notify({
|
|
48675
48675
|
variant: "warning",
|
|
48676
|
-
header:
|
|
48677
|
-
body:
|
|
48676
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
48677
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
48678
48678
|
duration: 4000
|
|
48679
48679
|
});
|
|
48680
48680
|
return false;
|
|
48681
48681
|
}
|
|
48682
48682
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
48683
|
-
let errorBody =
|
|
48684
|
-
if (
|
|
48685
|
-
errorBody =
|
|
48683
|
+
let errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48684
|
+
if (conf.AUDIO_FORMATS.includes(fileExtension) || conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
48685
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48686
48686
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
48687
|
-
|
|
48687
|
+
conf.notify({
|
|
48688
48688
|
variant: "warning",
|
|
48689
|
-
header:
|
|
48689
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48690
48690
|
body: errorBody,
|
|
48691
48691
|
button: isBasicPlan ? {
|
|
48692
|
-
text:
|
|
48693
|
-
onClick: () =>
|
|
48692
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48693
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48694
48694
|
} : undefined,
|
|
48695
48695
|
duration: 4000
|
|
48696
48696
|
});
|
|
48697
48697
|
return false;
|
|
48698
48698
|
}
|
|
48699
48699
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
48700
|
-
|
|
48700
|
+
conf.notify({
|
|
48701
48701
|
variant: "warning",
|
|
48702
|
-
header:
|
|
48702
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48703
48703
|
body: errorBody,
|
|
48704
48704
|
button: isBasicPlan ? {
|
|
48705
|
-
text:
|
|
48706
|
-
onClick: () =>
|
|
48705
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48706
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48707
48707
|
} : undefined,
|
|
48708
48708
|
duration: 4000
|
|
48709
48709
|
});
|
|
@@ -48782,7 +48782,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
48782
48782
|
};
|
|
48783
48783
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
48784
48784
|
image2.onload = async () => {
|
|
48785
|
-
const parser =
|
|
48785
|
+
const parser = conf.getDOMParser();
|
|
48786
48786
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
48787
48787
|
const svgElement = svgDoc.documentElement;
|
|
48788
48788
|
svgElement.removeAttribute("width");
|
|
@@ -48994,8 +48994,8 @@ class AudioItem extends BaseItem {
|
|
|
48994
48994
|
this.subject.publish(this);
|
|
48995
48995
|
});
|
|
48996
48996
|
this.transformation.subject.subscribe(this.onTransform);
|
|
48997
|
-
this.right = this.left +
|
|
48998
|
-
this.bottom = this.top +
|
|
48997
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width;
|
|
48998
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height;
|
|
48999
48999
|
this.shouldUseCustomRender = true;
|
|
49000
49000
|
}
|
|
49001
49001
|
setCurrentTime(time2) {
|
|
@@ -49064,8 +49064,8 @@ class AudioItem extends BaseItem {
|
|
|
49064
49064
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
49065
49065
|
this.left = translateX;
|
|
49066
49066
|
this.top = translateY;
|
|
49067
|
-
this.right = this.left +
|
|
49068
|
-
this.bottom = this.top +
|
|
49067
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width * scaleX;
|
|
49068
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height * scaleY;
|
|
49069
49069
|
}
|
|
49070
49070
|
render(context) {
|
|
49071
49071
|
if (this.transformationRenderBlock) {
|
|
@@ -49094,8 +49094,8 @@ class AudioItem extends BaseItem {
|
|
|
49094
49094
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
49095
49095
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
49096
49096
|
div.id = this.getId();
|
|
49097
|
-
div.style.width = `${
|
|
49098
|
-
div.style.height = `${
|
|
49097
|
+
div.style.width = `${conf.AUDIO_DIMENSIONS.width}px`;
|
|
49098
|
+
div.style.height = `${conf.AUDIO_DIMENSIONS.height}px`;
|
|
49099
49099
|
div.style.transformOrigin = "top left";
|
|
49100
49100
|
div.style.transform = transform;
|
|
49101
49101
|
div.style.position = "absolute";
|
|
@@ -49214,7 +49214,7 @@ class AudioItem extends BaseItem {
|
|
|
49214
49214
|
}
|
|
49215
49215
|
download() {
|
|
49216
49216
|
if (this.extension) {
|
|
49217
|
-
const linkElem =
|
|
49217
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
49218
49218
|
linkElem.href = this.url;
|
|
49219
49219
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
49220
49220
|
linkElem.click();
|
|
@@ -49555,7 +49555,7 @@ class Placeholder extends BaseItem {
|
|
|
49555
49555
|
}
|
|
49556
49556
|
// src/Items/Image/Image.ts
|
|
49557
49557
|
function getPlaceholderImage(board, imageDimension) {
|
|
49558
|
-
const placeholderCanvas =
|
|
49558
|
+
const placeholderCanvas = conf.documentFactory.createElement("canvas");
|
|
49559
49559
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
49560
49560
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
49561
49561
|
const placeholder = new Placeholder;
|
|
@@ -49836,7 +49836,7 @@ class Drawing extends BaseItem {
|
|
|
49836
49836
|
itemType = "Drawing";
|
|
49837
49837
|
parent = "Board";
|
|
49838
49838
|
transformation;
|
|
49839
|
-
path2d = new
|
|
49839
|
+
path2d = new conf.path2DFactory;
|
|
49840
49840
|
subject = new Subject;
|
|
49841
49841
|
untransformedMbr = new Mbr;
|
|
49842
49842
|
lines = [];
|
|
@@ -49911,7 +49911,7 @@ class Drawing extends BaseItem {
|
|
|
49911
49911
|
this.bottom = mbr.bottom;
|
|
49912
49912
|
}
|
|
49913
49913
|
updatePath2d() {
|
|
49914
|
-
this.path2d = new
|
|
49914
|
+
this.path2d = new conf.path2DFactory;
|
|
49915
49915
|
const context = this.path2d;
|
|
49916
49916
|
const points = this.points;
|
|
49917
49917
|
if (points.length < 3) {
|
|
@@ -51163,14 +51163,14 @@ class AddConnector extends BoardTool {
|
|
|
51163
51163
|
class AddDrawing extends BoardTool {
|
|
51164
51164
|
drawing = null;
|
|
51165
51165
|
isDown = false;
|
|
51166
|
-
strokeWidth =
|
|
51167
|
-
strokeColor =
|
|
51168
|
-
strokeStyle =
|
|
51166
|
+
strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
|
|
51167
|
+
strokeColor = conf.PEN_DEFAULT_COLOR;
|
|
51168
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
51169
51169
|
constructor(board) {
|
|
51170
51170
|
super(board);
|
|
51171
51171
|
this.setCursor();
|
|
51172
|
-
if (
|
|
51173
|
-
const drawingSettings = localStorage.getItem(
|
|
51172
|
+
if (conf.PEN_SETTINGS_KEY) {
|
|
51173
|
+
const drawingSettings = localStorage.getItem(conf.PEN_SETTINGS_KEY);
|
|
51174
51174
|
if (drawingSettings) {
|
|
51175
51175
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
51176
51176
|
this.strokeWidth = strokeWidth;
|
|
@@ -51180,7 +51180,7 @@ class AddDrawing extends BoardTool {
|
|
|
51180
51180
|
}
|
|
51181
51181
|
}
|
|
51182
51182
|
updateSettings() {
|
|
51183
|
-
localStorage.setItem(
|
|
51183
|
+
localStorage.setItem(conf.PEN_SETTINGS_KEY, JSON.stringify({
|
|
51184
51184
|
strokeWidth: this.strokeWidth,
|
|
51185
51185
|
strokeColor: this.strokeColor,
|
|
51186
51186
|
strokeStyle: this.strokeStyle
|
|
@@ -51210,7 +51210,7 @@ class AddDrawing extends BoardTool {
|
|
|
51210
51210
|
ctx.beginPath();
|
|
51211
51211
|
ctx.arc(point7.x, point7.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
51212
51212
|
ctx.lineWidth = 1;
|
|
51213
|
-
ctx.strokeStyle =
|
|
51213
|
+
ctx.strokeStyle = conf.PEN_POINTER_CIRCLE_COLOR;
|
|
51214
51214
|
ctx.stroke();
|
|
51215
51215
|
}
|
|
51216
51216
|
setCursor() {
|
|
@@ -51292,7 +51292,7 @@ class AddDrawing extends BoardTool {
|
|
|
51292
51292
|
this.setCursor();
|
|
51293
51293
|
};
|
|
51294
51294
|
render(context) {
|
|
51295
|
-
if (
|
|
51295
|
+
if (conf.PEN_RENDER_POINTER_CIRCLE) {
|
|
51296
51296
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
51297
51297
|
}
|
|
51298
51298
|
if (!this.drawing) {
|
|
@@ -51307,14 +51307,14 @@ class AddDrawing extends BoardTool {
|
|
|
51307
51307
|
}
|
|
51308
51308
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
51309
51309
|
class AddHighlighter extends AddDrawing {
|
|
51310
|
-
strokeWidth =
|
|
51311
|
-
strokeColor =
|
|
51312
|
-
strokeStyle =
|
|
51310
|
+
strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
51311
|
+
strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
|
|
51312
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
51313
51313
|
constructor(board) {
|
|
51314
51314
|
super(board);
|
|
51315
51315
|
this.setCursor();
|
|
51316
|
-
if (
|
|
51317
|
-
const highlighterSettings = localStorage.getItem(
|
|
51316
|
+
if (conf.HIGHLIGHTER_SETTINGS_KEY) {
|
|
51317
|
+
const highlighterSettings = localStorage.getItem(conf.HIGHLIGHTER_SETTINGS_KEY);
|
|
51318
51318
|
if (highlighterSettings) {
|
|
51319
51319
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
51320
51320
|
this.strokeWidth = strokeWidth;
|
|
@@ -51327,7 +51327,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
51327
51327
|
return true;
|
|
51328
51328
|
}
|
|
51329
51329
|
updateSettings() {
|
|
51330
|
-
localStorage.setItem(
|
|
51330
|
+
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
51331
51331
|
strokeWidth: this.strokeWidth,
|
|
51332
51332
|
strokeColor: this.strokeColor,
|
|
51333
51333
|
strokeStyle: this.strokeStyle
|
|
@@ -51651,7 +51651,7 @@ class AddShape extends BoardTool {
|
|
|
51651
51651
|
const point7 = this.board.pointer.point;
|
|
51652
51652
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51653
51653
|
this.bounds = this.line.getMbr();
|
|
51654
|
-
this.bounds.borderColor =
|
|
51654
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51655
51655
|
this.shape.apply({
|
|
51656
51656
|
class: "Shape",
|
|
51657
51657
|
method: "setShapeType",
|
|
@@ -51675,7 +51675,7 @@ class AddShape extends BoardTool {
|
|
|
51675
51675
|
}
|
|
51676
51676
|
this.line = new Line(startPoint, endPoint);
|
|
51677
51677
|
this.bounds = this.line.getMbr();
|
|
51678
|
-
this.bounds.borderColor =
|
|
51678
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51679
51679
|
this.initTransformation();
|
|
51680
51680
|
this.board.tools.publish();
|
|
51681
51681
|
return true;
|
|
@@ -51747,7 +51747,7 @@ class AddShape extends BoardTool {
|
|
|
51747
51747
|
const y = (top + bottom) / 2 - 50;
|
|
51748
51748
|
this.bounds = new Mbr(x, y, x, y);
|
|
51749
51749
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
51750
|
-
this.bounds.borderColor =
|
|
51750
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51751
51751
|
this.shape.apply({
|
|
51752
51752
|
class: "Shape",
|
|
51753
51753
|
method: "setShapeType",
|
|
@@ -51780,8 +51780,8 @@ class AddSticker extends BoardTool {
|
|
|
51780
51780
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
51781
51781
|
}
|
|
51782
51782
|
setCursor(color2) {
|
|
51783
|
-
if (
|
|
51784
|
-
const colorName = color2 ?
|
|
51783
|
+
if (conf.STICKER_COLOR_NAMES) {
|
|
51784
|
+
const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
51785
51785
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
51786
51786
|
} else {
|
|
51787
51787
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -51805,7 +51805,7 @@ class AddSticker extends BoardTool {
|
|
|
51805
51805
|
const point7 = this.board.pointer.point;
|
|
51806
51806
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51807
51807
|
this.bounds = this.line.getMbr();
|
|
51808
|
-
this.bounds.borderColor =
|
|
51808
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51809
51809
|
this.board.tools.publish();
|
|
51810
51810
|
return true;
|
|
51811
51811
|
}
|
|
@@ -51814,7 +51814,7 @@ class AddSticker extends BoardTool {
|
|
|
51814
51814
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
51815
51815
|
this.sticker.applyDiagonal(this.line);
|
|
51816
51816
|
this.bounds = this.sticker.getMbr();
|
|
51817
|
-
this.bounds.borderColor =
|
|
51817
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51818
51818
|
this.board.tools.publish();
|
|
51819
51819
|
return true;
|
|
51820
51820
|
}
|
|
@@ -51914,7 +51914,7 @@ class AddText extends BoardTool {
|
|
|
51914
51914
|
const point7 = this.board.pointer.point;
|
|
51915
51915
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51916
51916
|
this.bounds = this.line.getMbr();
|
|
51917
|
-
this.bounds.borderColor =
|
|
51917
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51918
51918
|
this.board.tools.publish();
|
|
51919
51919
|
return true;
|
|
51920
51920
|
}
|
|
@@ -51925,7 +51925,7 @@ class AddText extends BoardTool {
|
|
|
51925
51925
|
const end2 = new Point(cursorPoint.x, start2.y + height2);
|
|
51926
51926
|
this.line = new Line(start2, end2);
|
|
51927
51927
|
this.bounds = this.line.getMbr();
|
|
51928
|
-
this.bounds.borderColor =
|
|
51928
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51929
51929
|
this.board.tools.publish();
|
|
51930
51930
|
return true;
|
|
51931
51931
|
}
|
|
@@ -51990,11 +51990,11 @@ class AddText extends BoardTool {
|
|
|
51990
51990
|
class Eraser extends BoardTool {
|
|
51991
51991
|
itemType = "Eraser";
|
|
51992
51992
|
isDown = false;
|
|
51993
|
-
strokeWidth =
|
|
51994
|
-
strokeColor =
|
|
51995
|
-
strokeStyle =
|
|
51993
|
+
strokeWidth = conf.ERASER_STROKE_WIDTH;
|
|
51994
|
+
strokeColor = conf.ERASER_DEFAULT_COLOR;
|
|
51995
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
51996
51996
|
drawing = new Drawing(this.board, []);
|
|
51997
|
-
maxPointsInLine =
|
|
51997
|
+
maxPointsInLine = conf.ERASER_MAX_LINE_LENGTH;
|
|
51998
51998
|
constructor(board) {
|
|
51999
51999
|
super(board);
|
|
52000
52000
|
this.setCursor();
|
|
@@ -52130,8 +52130,8 @@ function getResizeType(cursorPoint, cameraScale, mbr, anchorDistance = 5) {
|
|
|
52130
52130
|
|
|
52131
52131
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
52132
52132
|
function getDecorationResizeType(point7, mbr, tolerance = 10) {
|
|
52133
|
-
for (const key in
|
|
52134
|
-
const decoration =
|
|
52133
|
+
for (const key in conf.EXPORT_FRAME_DECORATIONS) {
|
|
52134
|
+
const decoration = conf.EXPORT_FRAME_DECORATIONS[key];
|
|
52135
52135
|
const decorationBounds = {
|
|
52136
52136
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
52137
52137
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -52172,7 +52172,7 @@ class ExportSnapshot extends Tool {
|
|
|
52172
52172
|
super();
|
|
52173
52173
|
this.board = board;
|
|
52174
52174
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
52175
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
52175
|
+
this.mbr = new Mbr(cameraCenter.x - conf.EXPORT_SELECTION_BOX_WIDTH / 2, cameraCenter.y - conf.EXPORT_SELECTION_BOX_HEIGHT / 2, cameraCenter.x + conf.EXPORT_SELECTION_BOX_WIDTH / 2, cameraCenter.y + conf.EXPORT_SELECTION_BOX_HEIGHT / 2, "transparent", "transparent", 1);
|
|
52176
52176
|
this.board.selection.disable();
|
|
52177
52177
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
52178
52178
|
}
|
|
@@ -52184,11 +52184,11 @@ class ExportSnapshot extends Tool {
|
|
|
52184
52184
|
resize() {
|
|
52185
52185
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
52186
52186
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
52187
|
-
if (resize.mbr.getWidth() >
|
|
52187
|
+
if (resize.mbr.getWidth() > conf.EXPORT_MIN_WIDTH) {
|
|
52188
52188
|
this.mbr.left = resize.mbr.left;
|
|
52189
52189
|
this.mbr.right = resize.mbr.right;
|
|
52190
52190
|
}
|
|
52191
|
-
if (resize.mbr.getHeight() >
|
|
52191
|
+
if (resize.mbr.getHeight() > conf.EXPORT_MIN_HEIGHT) {
|
|
52192
52192
|
this.mbr.top = resize.mbr.top;
|
|
52193
52193
|
this.mbr.bottom = resize.mbr.bottom;
|
|
52194
52194
|
}
|
|
@@ -52277,7 +52277,7 @@ class ExportSnapshot extends Tool {
|
|
|
52277
52277
|
}
|
|
52278
52278
|
const res = await exportBoardSnapshot({
|
|
52279
52279
|
board: this.board,
|
|
52280
|
-
bgColor:
|
|
52280
|
+
bgColor: conf.CANVAS_BG_COLOR,
|
|
52281
52281
|
selection: this.mbr,
|
|
52282
52282
|
upscaleTo: 4000,
|
|
52283
52283
|
nameToExport: this.board.getName()
|
|
@@ -52301,18 +52301,18 @@ class ExportSnapshot extends Tool {
|
|
|
52301
52301
|
const cameraMbr = context.camera.getMbr();
|
|
52302
52302
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
52303
52303
|
this.tempDrawingContext.clear();
|
|
52304
|
-
cameraMbr.backgroundColor =
|
|
52304
|
+
cameraMbr.backgroundColor = conf.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
52305
52305
|
cameraMbr.strokeWidth = 0;
|
|
52306
52306
|
cameraMbr.render(this.tempDrawingContext);
|
|
52307
52307
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
52308
|
-
if (
|
|
52309
|
-
const topLeft =
|
|
52308
|
+
if (conf.EXPORT_FRAME_DECORATIONS) {
|
|
52309
|
+
const topLeft = conf.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
52310
52310
|
this.renderDecoration(this.tempDrawingContext, topLeft.path, this.mbr.left + (topLeft.offsetX ?? 0), this.mbr.top + (topLeft.offsetY ?? 0), topLeft.color, topLeft.lineWidth);
|
|
52311
|
-
const topRight =
|
|
52311
|
+
const topRight = conf.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
52312
52312
|
this.renderDecoration(this.tempDrawingContext, topRight.path, this.mbr.right + (topRight.offsetX ?? 0), this.mbr.top + (topRight.offsetY ?? 0), topRight.color, topRight.lineWidth);
|
|
52313
|
-
const bottomLeft =
|
|
52313
|
+
const bottomLeft = conf.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
52314
52314
|
this.renderDecoration(this.tempDrawingContext, bottomLeft.path, this.mbr.left + (bottomLeft.offsetX ?? 0), this.mbr.bottom + (bottomLeft.offsetY ?? 0), bottomLeft.color, bottomLeft.lineWidth);
|
|
52315
|
-
const bottomRight =
|
|
52315
|
+
const bottomRight = conf.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
52316
52316
|
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);
|
|
52317
52317
|
}
|
|
52318
52318
|
}
|
|
@@ -52414,7 +52414,7 @@ function createCanvasDrawer(board) {
|
|
|
52414
52414
|
borderDiv.id = "canvasBorder";
|
|
52415
52415
|
borderDiv.style.position = "absolute";
|
|
52416
52416
|
borderDiv.style.transformOrigin = "left top";
|
|
52417
|
-
borderDiv.style.border = `1px solid ${
|
|
52417
|
+
borderDiv.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
52418
52418
|
borderDiv.style.boxSizing = "border-box";
|
|
52419
52419
|
borderDiv.style.left = `${leftOffset}px`;
|
|
52420
52420
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -52424,7 +52424,7 @@ function createCanvasDrawer(board) {
|
|
|
52424
52424
|
canvas.style.boxSizing = "border-box";
|
|
52425
52425
|
container.appendChild(borderDiv);
|
|
52426
52426
|
} else {
|
|
52427
|
-
canvas.style.border = `1px solid ${
|
|
52427
|
+
canvas.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
52428
52428
|
canvas.style.boxSizing = "border-box";
|
|
52429
52429
|
}
|
|
52430
52430
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -52432,8 +52432,8 @@ function createCanvasDrawer(board) {
|
|
|
52432
52432
|
anchorDiv.style.position = "absolute";
|
|
52433
52433
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
52434
52434
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
52435
|
-
anchorDiv.style.backgroundColor = `${
|
|
52436
|
-
anchorDiv.style.border = `${
|
|
52435
|
+
anchorDiv.style.backgroundColor = `${conf.SELECTION_ANCHOR_COLOR}`;
|
|
52436
|
+
anchorDiv.style.border = `${conf.SELECTION_ANCHOR_WIDTH}px solid ${conf.SELECTION_COLOR}`;
|
|
52437
52437
|
anchorDiv.style.borderRadius = "2px";
|
|
52438
52438
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
52439
52439
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -52441,10 +52441,10 @@ function createCanvasDrawer(board) {
|
|
|
52441
52441
|
return anchorDiv;
|
|
52442
52442
|
};
|
|
52443
52443
|
const anchors = [
|
|
52444
|
-
createAnchorDiv("0%", "0%",
|
|
52445
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
52446
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
52447
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
52444
|
+
createAnchorDiv("0%", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
52445
|
+
createAnchorDiv("100% + 1px", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
52446
|
+
createAnchorDiv("0%", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS),
|
|
52447
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS)
|
|
52448
52448
|
];
|
|
52449
52449
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
52450
52450
|
for (const anchor of anchors) {
|
|
@@ -53797,8 +53797,8 @@ class Select extends Tool {
|
|
|
53797
53797
|
const { x, y } = pointer.point;
|
|
53798
53798
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
53799
53799
|
this.rect = this.line.getMbr();
|
|
53800
|
-
this.rect.borderColor =
|
|
53801
|
-
this.rect.backgroundColor =
|
|
53800
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
53801
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
53802
53802
|
this.board.tools.publish();
|
|
53803
53803
|
this.board.presence.throttledEmit({
|
|
53804
53804
|
method: "DrawSelect",
|
|
@@ -53883,8 +53883,8 @@ class Select extends Tool {
|
|
|
53883
53883
|
const point7 = this.board.pointer.point.copy();
|
|
53884
53884
|
this.line = new Line(this.line.start, point7);
|
|
53885
53885
|
this.rect = this.line.getMbr();
|
|
53886
|
-
this.rect.borderColor =
|
|
53887
|
-
this.rect.backgroundColor =
|
|
53886
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
53887
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
53888
53888
|
this.board.tools.publish();
|
|
53889
53889
|
this.board.presence.throttledEmit({
|
|
53890
53890
|
method: "DrawSelect",
|
|
@@ -54395,7 +54395,7 @@ class ShapeTool extends CustomTool {
|
|
|
54395
54395
|
const point7 = this.board.pointer.point;
|
|
54396
54396
|
this.line = new Line(point7.copy(), point7.copy());
|
|
54397
54397
|
this.bounds = this.line.getMbr();
|
|
54398
|
-
this.bounds.borderColor =
|
|
54398
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
54399
54399
|
this.initTransformation();
|
|
54400
54400
|
this.board.tools.publish();
|
|
54401
54401
|
return true;
|
|
@@ -54413,7 +54413,7 @@ class ShapeTool extends CustomTool {
|
|
|
54413
54413
|
}
|
|
54414
54414
|
this.line = new Line(startPoint, endPoint);
|
|
54415
54415
|
this.bounds = this.line.getMbr();
|
|
54416
|
-
this.bounds.borderColor =
|
|
54416
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
54417
54417
|
this.initTransformation();
|
|
54418
54418
|
this.board.tools.publish();
|
|
54419
54419
|
return true;
|
|
@@ -55382,9 +55382,9 @@ class Camera {
|
|
|
55382
55382
|
matrix = new Matrix2;
|
|
55383
55383
|
pointer = new Point;
|
|
55384
55384
|
window = {
|
|
55385
|
-
width:
|
|
55386
|
-
height:
|
|
55387
|
-
dpi:
|
|
55385
|
+
width: conf.getDocumentWidth(),
|
|
55386
|
+
height: conf.getDocumentHeight(),
|
|
55387
|
+
dpi: conf.getDPI(),
|
|
55388
55388
|
getMbr: () => {
|
|
55389
55389
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
55390
55390
|
}
|
|
@@ -55760,9 +55760,9 @@ class Camera {
|
|
|
55760
55760
|
this.updateBoardPointer();
|
|
55761
55761
|
}
|
|
55762
55762
|
onWindowResize() {
|
|
55763
|
-
this.window.width =
|
|
55764
|
-
this.window.height =
|
|
55765
|
-
this.window.dpi =
|
|
55763
|
+
this.window.width = conf.getDocumentWidth();
|
|
55764
|
+
this.window.height = conf.getDocumentHeight();
|
|
55765
|
+
this.window.dpi = conf.getDPI();
|
|
55766
55766
|
this.resizeSubject.publish(this);
|
|
55767
55767
|
this.subject.publish(this);
|
|
55768
55768
|
}
|
|
@@ -55775,10 +55775,10 @@ class Camera {
|
|
|
55775
55775
|
let y = 0;
|
|
55776
55776
|
const { activeKeys } = keyboard;
|
|
55777
55777
|
const directions = {
|
|
55778
|
-
ArrowRight: [-
|
|
55779
|
-
ArrowLeft: [
|
|
55780
|
-
ArrowDown: [0, -
|
|
55781
|
-
ArrowUp: [0,
|
|
55778
|
+
ArrowRight: [-conf.NAVIGATION_STEP, 0],
|
|
55779
|
+
ArrowLeft: [conf.NAVIGATION_STEP, 0],
|
|
55780
|
+
ArrowDown: [0, -conf.NAVIGATION_STEP],
|
|
55781
|
+
ArrowUp: [0, conf.NAVIGATION_STEP]
|
|
55782
55782
|
};
|
|
55783
55783
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
55784
55784
|
if (activeArrowKeys.length === 2) {
|
|
@@ -56161,6 +56161,322 @@ function isHotkeyPushed(hotkey, event) {
|
|
|
56161
56161
|
}
|
|
56162
56162
|
// src/isMacos.ts
|
|
56163
56163
|
var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
56164
|
+
// src/Keyboard/hotkeys.json
|
|
56165
|
+
var hotkeys_default2 = {
|
|
56166
|
+
select: {
|
|
56167
|
+
key: {
|
|
56168
|
+
button: "KeyV"
|
|
56169
|
+
},
|
|
56170
|
+
label: {
|
|
56171
|
+
windows: "V",
|
|
56172
|
+
mac: "V"
|
|
56173
|
+
}
|
|
56174
|
+
},
|
|
56175
|
+
navigateMode: {
|
|
56176
|
+
key: {
|
|
56177
|
+
button: "Space"
|
|
56178
|
+
},
|
|
56179
|
+
label: {
|
|
56180
|
+
windows: "Space",
|
|
56181
|
+
mac: "Space"
|
|
56182
|
+
}
|
|
56183
|
+
},
|
|
56184
|
+
text: {
|
|
56185
|
+
key: {
|
|
56186
|
+
button: "KeyT"
|
|
56187
|
+
},
|
|
56188
|
+
label: {
|
|
56189
|
+
windows: "T",
|
|
56190
|
+
mac: "T"
|
|
56191
|
+
}
|
|
56192
|
+
},
|
|
56193
|
+
sticker: {
|
|
56194
|
+
key: {
|
|
56195
|
+
button: "KeyN"
|
|
56196
|
+
},
|
|
56197
|
+
label: {
|
|
56198
|
+
mac: "N",
|
|
56199
|
+
windows: "N"
|
|
56200
|
+
}
|
|
56201
|
+
},
|
|
56202
|
+
shape: {
|
|
56203
|
+
key: {
|
|
56204
|
+
button: "KeyS"
|
|
56205
|
+
},
|
|
56206
|
+
label: {
|
|
56207
|
+
mac: "S",
|
|
56208
|
+
windows: "S"
|
|
56209
|
+
}
|
|
56210
|
+
},
|
|
56211
|
+
connector: {
|
|
56212
|
+
key: {
|
|
56213
|
+
button: "KeyL"
|
|
56214
|
+
},
|
|
56215
|
+
label: {
|
|
56216
|
+
mac: "L",
|
|
56217
|
+
windows: "L"
|
|
56218
|
+
}
|
|
56219
|
+
},
|
|
56220
|
+
pen: {
|
|
56221
|
+
key: {
|
|
56222
|
+
button: "KeyP"
|
|
56223
|
+
},
|
|
56224
|
+
label: {
|
|
56225
|
+
mac: "P",
|
|
56226
|
+
windows: "P"
|
|
56227
|
+
}
|
|
56228
|
+
},
|
|
56229
|
+
eraser: {
|
|
56230
|
+
key: {
|
|
56231
|
+
button: "KeyE"
|
|
56232
|
+
},
|
|
56233
|
+
label: {
|
|
56234
|
+
mac: "E",
|
|
56235
|
+
windows: "E"
|
|
56236
|
+
}
|
|
56237
|
+
},
|
|
56238
|
+
frame: {
|
|
56239
|
+
key: {
|
|
56240
|
+
button: "KeyF"
|
|
56241
|
+
},
|
|
56242
|
+
label: {
|
|
56243
|
+
mac: "F",
|
|
56244
|
+
windows: "F"
|
|
56245
|
+
}
|
|
56246
|
+
},
|
|
56247
|
+
undo: {
|
|
56248
|
+
key: {
|
|
56249
|
+
button: "KeyZ",
|
|
56250
|
+
ctrl: true
|
|
56251
|
+
},
|
|
56252
|
+
label: {
|
|
56253
|
+
mac: "⌘Z",
|
|
56254
|
+
windows: "Ctrl + Z"
|
|
56255
|
+
}
|
|
56256
|
+
},
|
|
56257
|
+
redo: {
|
|
56258
|
+
key: {
|
|
56259
|
+
button: "KeyZ",
|
|
56260
|
+
ctrl: true,
|
|
56261
|
+
shift: true
|
|
56262
|
+
},
|
|
56263
|
+
label: {
|
|
56264
|
+
mac: "⌘⇧Z",
|
|
56265
|
+
windows: "Ctrl + Shift + Z"
|
|
56266
|
+
}
|
|
56267
|
+
},
|
|
56268
|
+
textBold: {
|
|
56269
|
+
key: {
|
|
56270
|
+
button: "KeyB",
|
|
56271
|
+
ctrl: true
|
|
56272
|
+
},
|
|
56273
|
+
label: {
|
|
56274
|
+
mac: "⌘B",
|
|
56275
|
+
windows: "Ctrl + B"
|
|
56276
|
+
}
|
|
56277
|
+
},
|
|
56278
|
+
textStrike: {
|
|
56279
|
+
key: {
|
|
56280
|
+
button: "KeyS",
|
|
56281
|
+
ctrl: true
|
|
56282
|
+
},
|
|
56283
|
+
label: {
|
|
56284
|
+
mac: "⌘S",
|
|
56285
|
+
windows: "Ctrl + S"
|
|
56286
|
+
}
|
|
56287
|
+
},
|
|
56288
|
+
textUnderline: {
|
|
56289
|
+
key: {
|
|
56290
|
+
button: "KeyU",
|
|
56291
|
+
ctrl: true
|
|
56292
|
+
},
|
|
56293
|
+
label: {
|
|
56294
|
+
mac: "⌘U",
|
|
56295
|
+
windows: "Ctrl + U"
|
|
56296
|
+
}
|
|
56297
|
+
},
|
|
56298
|
+
textItalic: {
|
|
56299
|
+
key: {
|
|
56300
|
+
button: "KeyI",
|
|
56301
|
+
ctrl: true
|
|
56302
|
+
},
|
|
56303
|
+
label: {
|
|
56304
|
+
mac: "⌘I",
|
|
56305
|
+
windows: "Ctrl + I"
|
|
56306
|
+
}
|
|
56307
|
+
},
|
|
56308
|
+
zoomOut: {
|
|
56309
|
+
key: {
|
|
56310
|
+
button: "Minus",
|
|
56311
|
+
ctrl: true
|
|
56312
|
+
},
|
|
56313
|
+
label: {
|
|
56314
|
+
mac: "⌘-",
|
|
56315
|
+
windows: "Ctrl + -"
|
|
56316
|
+
}
|
|
56317
|
+
},
|
|
56318
|
+
zoomIn: {
|
|
56319
|
+
key: {
|
|
56320
|
+
button: "Equal",
|
|
56321
|
+
ctrl: true
|
|
56322
|
+
},
|
|
56323
|
+
label: {
|
|
56324
|
+
mac: "⌘+",
|
|
56325
|
+
windows: "Ctrl + +"
|
|
56326
|
+
}
|
|
56327
|
+
},
|
|
56328
|
+
zoomDefault: {
|
|
56329
|
+
key: {
|
|
56330
|
+
button: "Digit0",
|
|
56331
|
+
ctrl: true
|
|
56332
|
+
},
|
|
56333
|
+
label: {
|
|
56334
|
+
mac: "⌘0",
|
|
56335
|
+
windows: "Ctrl + 0"
|
|
56336
|
+
}
|
|
56337
|
+
},
|
|
56338
|
+
duplicate: {
|
|
56339
|
+
key: {
|
|
56340
|
+
button: "KeyD",
|
|
56341
|
+
ctrl: true
|
|
56342
|
+
},
|
|
56343
|
+
label: {
|
|
56344
|
+
mac: "⌘D",
|
|
56345
|
+
windows: "Ctrl + D"
|
|
56346
|
+
}
|
|
56347
|
+
},
|
|
56348
|
+
bringToFront: {
|
|
56349
|
+
key: {
|
|
56350
|
+
button: "PageUp"
|
|
56351
|
+
},
|
|
56352
|
+
label: {
|
|
56353
|
+
mac: "fn↑ (PgUp)",
|
|
56354
|
+
windows: "PgUp"
|
|
56355
|
+
}
|
|
56356
|
+
},
|
|
56357
|
+
sendToBack: {
|
|
56358
|
+
key: {
|
|
56359
|
+
button: "PageDown"
|
|
56360
|
+
},
|
|
56361
|
+
label: {
|
|
56362
|
+
mac: "fn↓ (PgDn)",
|
|
56363
|
+
windows: "PgDn"
|
|
56364
|
+
}
|
|
56365
|
+
},
|
|
56366
|
+
delete: {
|
|
56367
|
+
key: {
|
|
56368
|
+
button: ["Delete", "Backspace"]
|
|
56369
|
+
},
|
|
56370
|
+
label: {
|
|
56371
|
+
mac: "Delete",
|
|
56372
|
+
windows: "Delete"
|
|
56373
|
+
}
|
|
56374
|
+
},
|
|
56375
|
+
cancel: {
|
|
56376
|
+
key: {
|
|
56377
|
+
button: "Escape"
|
|
56378
|
+
},
|
|
56379
|
+
label: {
|
|
56380
|
+
mac: "Esc",
|
|
56381
|
+
windows: "Esc"
|
|
56382
|
+
}
|
|
56383
|
+
},
|
|
56384
|
+
selectAll: {
|
|
56385
|
+
key: {
|
|
56386
|
+
button: "KeyA",
|
|
56387
|
+
ctrl: true
|
|
56388
|
+
},
|
|
56389
|
+
label: {
|
|
56390
|
+
mac: "⌘A",
|
|
56391
|
+
windows: "Ctrl + A"
|
|
56392
|
+
}
|
|
56393
|
+
},
|
|
56394
|
+
copy: {
|
|
56395
|
+
key: {
|
|
56396
|
+
button: "KeyC",
|
|
56397
|
+
ctrl: true
|
|
56398
|
+
},
|
|
56399
|
+
label: {
|
|
56400
|
+
mac: "⌘C",
|
|
56401
|
+
windows: "Ctrl + C"
|
|
56402
|
+
}
|
|
56403
|
+
},
|
|
56404
|
+
paste: {
|
|
56405
|
+
key: {
|
|
56406
|
+
button: "KeyV",
|
|
56407
|
+
ctrl: true
|
|
56408
|
+
},
|
|
56409
|
+
label: {
|
|
56410
|
+
mac: "⌘V",
|
|
56411
|
+
windows: "Ctrl + V"
|
|
56412
|
+
}
|
|
56413
|
+
},
|
|
56414
|
+
confirm: {
|
|
56415
|
+
key: {
|
|
56416
|
+
button: "Enter"
|
|
56417
|
+
},
|
|
56418
|
+
label: {
|
|
56419
|
+
mac: "⏎",
|
|
56420
|
+
windows: "⏎"
|
|
56421
|
+
}
|
|
56422
|
+
},
|
|
56423
|
+
frameNavigationNext: {
|
|
56424
|
+
key: {
|
|
56425
|
+
button: "ArrowRight",
|
|
56426
|
+
ctrl: true
|
|
56427
|
+
},
|
|
56428
|
+
label: {
|
|
56429
|
+
mac: "⌘→",
|
|
56430
|
+
windows: "Ctrl→"
|
|
56431
|
+
}
|
|
56432
|
+
},
|
|
56433
|
+
frameNavigationPrev: {
|
|
56434
|
+
key: {
|
|
56435
|
+
button: "ArrowLeft",
|
|
56436
|
+
ctrl: true
|
|
56437
|
+
},
|
|
56438
|
+
label: {
|
|
56439
|
+
mac: "⌘←",
|
|
56440
|
+
windows: "Ctrl←"
|
|
56441
|
+
}
|
|
56442
|
+
},
|
|
56443
|
+
navigationRight: {
|
|
56444
|
+
key: {
|
|
56445
|
+
button: "ArrowRight"
|
|
56446
|
+
},
|
|
56447
|
+
label: {
|
|
56448
|
+
mac: "→",
|
|
56449
|
+
windows: "→"
|
|
56450
|
+
}
|
|
56451
|
+
},
|
|
56452
|
+
navigationLeft: {
|
|
56453
|
+
key: {
|
|
56454
|
+
button: "ArrowLeft"
|
|
56455
|
+
},
|
|
56456
|
+
label: {
|
|
56457
|
+
mac: "←",
|
|
56458
|
+
windows: "←"
|
|
56459
|
+
}
|
|
56460
|
+
},
|
|
56461
|
+
navigationUp: {
|
|
56462
|
+
key: {
|
|
56463
|
+
button: "ArrowUp"
|
|
56464
|
+
},
|
|
56465
|
+
label: {
|
|
56466
|
+
mac: "↑",
|
|
56467
|
+
windows: "↑"
|
|
56468
|
+
}
|
|
56469
|
+
},
|
|
56470
|
+
navigationDown: {
|
|
56471
|
+
key: {
|
|
56472
|
+
button: "ArrowDown"
|
|
56473
|
+
},
|
|
56474
|
+
label: {
|
|
56475
|
+
mac: "↓",
|
|
56476
|
+
windows: "↓"
|
|
56477
|
+
}
|
|
56478
|
+
}
|
|
56479
|
+
};
|
|
56164
56480
|
|
|
56165
56481
|
// src/Keyboard/logHotkey.ts
|
|
56166
56482
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
@@ -56168,7 +56484,7 @@ function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
|
56168
56484
|
return;
|
|
56169
56485
|
}
|
|
56170
56486
|
const isFunction = typeof hotkeyConfig === "function";
|
|
56171
|
-
const hotkeyData =
|
|
56487
|
+
const hotkeyData = hotkeys_default2[hotkeyName];
|
|
56172
56488
|
switch (status) {
|
|
56173
56489
|
case "triggered":
|
|
56174
56490
|
console.groupCollapsed(`%cDebug%c Triggered hotkey%c ${hotkeyName}`, "color: #00f; font-size: 16px; display: inline-block; padding: 2px 5px; border-radius: 5px; background-color: #f0f0f0; margin-left: 8px", "font-size: 14px; display: inline-block; color: #808080; font-weight: 500;", "font-size: 14px; display: inline-block; color: #ffd800; font-weight: 700;");
|
|
@@ -56256,7 +56572,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
56256
56572
|
// src/Keyboard/getHotkeyLabel.ts
|
|
56257
56573
|
function getHotkeyLabel(hotkey) {
|
|
56258
56574
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
56259
|
-
switch (
|
|
56575
|
+
switch (conf.FORCE_HOTKEYS || "auto") {
|
|
56260
56576
|
case "windows":
|
|
56261
56577
|
return hotkeyLabel.windows;
|
|
56262
56578
|
case "macos":
|
|
@@ -58233,7 +58549,7 @@ class SpatialIndex {
|
|
|
58233
58549
|
this.itemsArray.push(item);
|
|
58234
58550
|
this.itemsIndex.insert(item);
|
|
58235
58551
|
}
|
|
58236
|
-
if (
|
|
58552
|
+
if (conf.isNode()) {
|
|
58237
58553
|
return;
|
|
58238
58554
|
}
|
|
58239
58555
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -59762,7 +60078,7 @@ class Transformer extends Tool {
|
|
|
59762
60078
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
59763
60079
|
if (mbr) {
|
|
59764
60080
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
59765
|
-
const selectionColor = isLockedItems ?
|
|
60081
|
+
const selectionColor = isLockedItems ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
59766
60082
|
mbr.borderColor = selectionColor;
|
|
59767
60083
|
mbr.render(context);
|
|
59768
60084
|
}
|
|
@@ -59788,7 +60104,7 @@ class Transformer extends Tool {
|
|
|
59788
60104
|
new Point(right, bottom)
|
|
59789
60105
|
];
|
|
59790
60106
|
for (const point7 of points) {
|
|
59791
|
-
const circle = new Anchor(point7.x, point7.y,
|
|
60107
|
+
const circle = new Anchor(point7.x, point7.y, conf.SELECTION_ANCHOR_RADIUS, conf.SELECTION_COLOR, conf.SELECTION_ANCHOR_COLOR, conf.SELECTION_ANCHOR_WIDTH);
|
|
59792
60108
|
anchors.push(circle);
|
|
59793
60109
|
}
|
|
59794
60110
|
}
|
|
@@ -60989,7 +61305,7 @@ class BoardSelection {
|
|
|
60989
61305
|
renderItemMbr(context, item, customScale) {
|
|
60990
61306
|
const mbr = item.getMbr();
|
|
60991
61307
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
60992
|
-
const selectionColor = item.transformation.isLocked ?
|
|
61308
|
+
const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
60993
61309
|
mbr.borderColor = selectionColor;
|
|
60994
61310
|
mbr.render(context);
|
|
60995
61311
|
}
|
|
@@ -61436,7 +61752,7 @@ class Board {
|
|
|
61436
61752
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
61437
61753
|
const css = INDEX_CSS;
|
|
61438
61754
|
const boardName = this.getName() || this.getBoardId();
|
|
61439
|
-
const items = this.items.getWholeHTML(
|
|
61755
|
+
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
61440
61756
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
61441
61757
|
const scripts = `
|
|
61442
61758
|
<script type="module">${customTagsScript}</script>
|
|
@@ -61476,7 +61792,7 @@ class Board {
|
|
|
61476
61792
|
return `${head}${body}`;
|
|
61477
61793
|
}
|
|
61478
61794
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
61479
|
-
const parser =
|
|
61795
|
+
const parser = conf.getDOMParser();
|
|
61480
61796
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
61481
61797
|
const items = doc.body.querySelector("#items");
|
|
61482
61798
|
if (items) {
|
|
@@ -61528,7 +61844,7 @@ class Board {
|
|
|
61528
61844
|
return [];
|
|
61529
61845
|
}
|
|
61530
61846
|
deserializeHTML(stringedHTML) {
|
|
61531
|
-
const parser =
|
|
61847
|
+
const parser = conf.getDOMParser();
|
|
61532
61848
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
61533
61849
|
const itemsDiv = doc.body.querySelector("#items");
|
|
61534
61850
|
if (!itemsDiv) {
|
|
@@ -62667,19 +62983,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
62667
62983
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
62668
62984
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
62669
62985
|
const transformed = { ...toTransform };
|
|
62670
|
-
const
|
|
62986
|
+
const conf2 = confirmed.path;
|
|
62671
62987
|
const path4 = transformed.path;
|
|
62672
|
-
if (Path3.equals(
|
|
62988
|
+
if (Path3.equals(conf2, path4)) {
|
|
62673
62989
|
return transformed;
|
|
62674
62990
|
}
|
|
62675
|
-
const isDescendant = path4.length >
|
|
62991
|
+
const isDescendant = path4.length > conf2.length && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
62676
62992
|
if (isDescendant) {
|
|
62677
62993
|
const newPath = [...path4];
|
|
62678
62994
|
newPath[0] = newPath[0] + 1;
|
|
62679
62995
|
transformed.path = newPath;
|
|
62680
62996
|
return transformed;
|
|
62681
62997
|
}
|
|
62682
|
-
if (Path3.isBefore(
|
|
62998
|
+
if (Path3.isBefore(conf2, path4)) {
|
|
62683
62999
|
transformPath(confirmed, transformed);
|
|
62684
63000
|
}
|
|
62685
63001
|
return transformed;
|
|
@@ -62688,23 +63004,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
62688
63004
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
62689
63005
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
62690
63006
|
const transformed = { ...toTransform };
|
|
62691
|
-
const
|
|
63007
|
+
const conf2 = confirmed.path;
|
|
62692
63008
|
const path4 = transformed.path;
|
|
62693
|
-
if (Path3.equals(
|
|
63009
|
+
if (Path3.equals(conf2, path4)) {
|
|
62694
63010
|
return transformed;
|
|
62695
63011
|
}
|
|
62696
|
-
if (path4.length ===
|
|
63012
|
+
if (path4.length === conf2.length + 1 && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
62697
63013
|
const newPath = [...path4];
|
|
62698
|
-
if (
|
|
63014
|
+
if (conf2.length === 1) {
|
|
62699
63015
|
newPath[0] = newPath[0] + 1;
|
|
62700
63016
|
} else {
|
|
62701
|
-
newPath[
|
|
63017
|
+
newPath[conf2.length] = newPath[conf2.length] + 1;
|
|
62702
63018
|
}
|
|
62703
63019
|
transformed.path = newPath;
|
|
62704
63020
|
return transformed;
|
|
62705
63021
|
}
|
|
62706
|
-
const isDescendant = path4.length >
|
|
62707
|
-
if (Path3.isBefore(
|
|
63022
|
+
const isDescendant = path4.length > conf2.length && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
63023
|
+
if (Path3.isBefore(conf2, path4) && !isDescendant) {
|
|
62708
63024
|
transformPath(confirmed, transformed);
|
|
62709
63025
|
}
|
|
62710
63026
|
return transformed;
|
|
@@ -63284,8 +63600,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
63284
63600
|
const transformed = [];
|
|
63285
63601
|
for (const transf of toTransform) {
|
|
63286
63602
|
let actualyTransformed = { ...transf };
|
|
63287
|
-
for (const
|
|
63288
|
-
const { operation: confOp } =
|
|
63603
|
+
for (const conf2 of confirmed) {
|
|
63604
|
+
const { operation: confOp } = conf2.body;
|
|
63289
63605
|
const { operation: transfOp } = actualyTransformed.body;
|
|
63290
63606
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
63291
63607
|
if (transformedOp) {
|
|
@@ -63917,7 +64233,7 @@ class Events2 {
|
|
|
63917
64233
|
return record !== null;
|
|
63918
64234
|
}
|
|
63919
64235
|
sendPresenceEvent(event) {
|
|
63920
|
-
|
|
64236
|
+
conf.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
63921
64237
|
}
|
|
63922
64238
|
canUndoEvent(op, byUserId) {
|
|
63923
64239
|
if (op.method === "undo") {
|
|
@@ -64018,9 +64334,9 @@ function handleChatChunk(chunk, board) {
|
|
|
64018
64334
|
default:
|
|
64019
64335
|
board.camera.unsubscribeFromItem();
|
|
64020
64336
|
if (!chunk.isExternalApiError) {
|
|
64021
|
-
|
|
64022
|
-
header:
|
|
64023
|
-
body:
|
|
64337
|
+
conf.notify({
|
|
64338
|
+
header: conf.i18n.t("AIInput.textGenerationError.header"),
|
|
64339
|
+
body: conf.i18n.t("AIInput.textGenerationError.body"),
|
|
64024
64340
|
variant: "error",
|
|
64025
64341
|
duration: 4000
|
|
64026
64342
|
});
|
|
@@ -64035,7 +64351,7 @@ function handleChatChunk(chunk, board) {
|
|
|
64035
64351
|
editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
64036
64352
|
if (chunk.isExternalApiError) {
|
|
64037
64353
|
editor.clearText();
|
|
64038
|
-
editor.insertCopiedText(
|
|
64354
|
+
editor.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
64039
64355
|
}
|
|
64040
64356
|
}
|
|
64041
64357
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -64062,7 +64378,7 @@ function handleAudioGenerate(response, board) {
|
|
|
64062
64378
|
}
|
|
64063
64379
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
64064
64380
|
const { left, top, right } = placeholderNode.getMbr();
|
|
64065
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
64381
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf.AUDIO_DIMENSIONS.width) / 2, top);
|
|
64066
64382
|
audio.updateMbr();
|
|
64067
64383
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
64068
64384
|
board.remove(placeholderNode, false);
|
|
@@ -64084,7 +64400,7 @@ function handleAudioGenerate(response, board) {
|
|
|
64084
64400
|
type: "audio/wav"
|
|
64085
64401
|
});
|
|
64086
64402
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
64087
|
-
const linkElem =
|
|
64403
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
64088
64404
|
linkElem.href = audioUrl2;
|
|
64089
64405
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
64090
64406
|
linkElem.click();
|
|
@@ -64103,9 +64419,9 @@ function handleAudioGenerate(response, board) {
|
|
|
64103
64419
|
board.selection.add(placeholderNode);
|
|
64104
64420
|
}
|
|
64105
64421
|
console.error("Audio generation error:", response.message);
|
|
64106
|
-
|
|
64107
|
-
header:
|
|
64108
|
-
body:
|
|
64422
|
+
conf.notify({
|
|
64423
|
+
header: conf.i18n.t("AIInput.audioGenerationError.header"),
|
|
64424
|
+
body: conf.i18n.t("AIInput.audioGenerationError.body"),
|
|
64109
64425
|
variant: "error",
|
|
64110
64426
|
duration: 4000
|
|
64111
64427
|
});
|
|
@@ -64168,14 +64484,14 @@ function handleImageGenerate(response, board) {
|
|
|
64168
64484
|
board.selection.add(item);
|
|
64169
64485
|
const editor = item.getRichText()?.editor;
|
|
64170
64486
|
editor?.clearText();
|
|
64171
|
-
editor?.insertCopiedText(
|
|
64487
|
+
editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
64172
64488
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
64173
64489
|
}
|
|
64174
64490
|
}
|
|
64175
64491
|
} else {
|
|
64176
|
-
|
|
64177
|
-
header:
|
|
64178
|
-
body:
|
|
64492
|
+
conf.notify({
|
|
64493
|
+
header: conf.i18n.t("AIInput.imageGenerationError.header"),
|
|
64494
|
+
body: conf.i18n.t("AIInput.imageGenerationError.body"),
|
|
64179
64495
|
variant: "error",
|
|
64180
64496
|
duration: 4000
|
|
64181
64497
|
});
|
|
@@ -64242,10 +64558,10 @@ function startIntervals(board) {
|
|
|
64242
64558
|
}
|
|
64243
64559
|
log.publishIntervalTimer = setInterval(() => {
|
|
64244
64560
|
tryPublishEvent(board);
|
|
64245
|
-
},
|
|
64561
|
+
}, conf.EVENTS_PUBLISH_INTERVAL);
|
|
64246
64562
|
log.resendIntervalTimer = setInterval(() => {
|
|
64247
64563
|
tryResendEvent(board);
|
|
64248
|
-
},
|
|
64564
|
+
}, conf.EVENTS_RESEND_INTERVAL);
|
|
64249
64565
|
}
|
|
64250
64566
|
function tryPublishEvent(board) {
|
|
64251
64567
|
const { log } = board.events;
|
|
@@ -64264,14 +64580,14 @@ function tryResendEvent(board) {
|
|
|
64264
64580
|
return;
|
|
64265
64581
|
}
|
|
64266
64582
|
const date = Date.now();
|
|
64267
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
64583
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf.EVENTS_RESEND_INTERVAL;
|
|
64268
64584
|
if (!isTimeToSendPendingEvent) {
|
|
64269
64585
|
return;
|
|
64270
64586
|
}
|
|
64271
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
64587
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf.EVENTS_RESEND_INTERVAL * 5;
|
|
64272
64588
|
if (isProbablyLostConnection) {
|
|
64273
64589
|
board.presence.clear();
|
|
64274
|
-
|
|
64590
|
+
conf.connection?.notifyAboutLostConnection();
|
|
64275
64591
|
}
|
|
64276
64592
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
64277
64593
|
}
|
|
@@ -64302,12 +64618,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
64302
64618
|
lastKnownOrder: log.getLastIndex()
|
|
64303
64619
|
}
|
|
64304
64620
|
};
|
|
64305
|
-
|
|
64621
|
+
conf.connection.send({
|
|
64306
64622
|
type: "BoardEvent",
|
|
64307
64623
|
boardId: board.getBoardId(),
|
|
64308
64624
|
event: toSend,
|
|
64309
64625
|
sequenceNumber,
|
|
64310
|
-
userId:
|
|
64626
|
+
userId: conf.connection.getCurrentUser()
|
|
64311
64627
|
});
|
|
64312
64628
|
const date = Date.now();
|
|
64313
64629
|
log.pendingEvent = {
|
|
@@ -64353,7 +64669,7 @@ function handleConfirmation(msg2, board) {
|
|
|
64353
64669
|
if (!isPendingEventConfirmation) {
|
|
64354
64670
|
return;
|
|
64355
64671
|
}
|
|
64356
|
-
|
|
64672
|
+
conf.connection?.dismissNotificationAboutLostConnection();
|
|
64357
64673
|
log.currentSequenceNumber++;
|
|
64358
64674
|
log.pendingEvent.event.order = msg2.order;
|
|
64359
64675
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -64365,7 +64681,7 @@ function handleConfirmation(msg2, board) {
|
|
|
64365
64681
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
64366
64682
|
function handleCreateSnapshotRequestMessage(msg2, board) {
|
|
64367
64683
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
64368
|
-
|
|
64684
|
+
conf.connection.send({
|
|
64369
64685
|
type: "BoardSnapshot",
|
|
64370
64686
|
boardId,
|
|
64371
64687
|
snapshot,
|
|
@@ -64396,9 +64712,9 @@ function handleModeMessage(message, board) {
|
|
|
64396
64712
|
if (isTemplateView()) {
|
|
64397
64713
|
return;
|
|
64398
64714
|
}
|
|
64399
|
-
|
|
64400
|
-
header:
|
|
64401
|
-
body: message.mode === "edit" ?
|
|
64715
|
+
conf.notify({
|
|
64716
|
+
header: conf.i18n.t("sharing.settingsChanged.heading"),
|
|
64717
|
+
body: message.mode === "edit" ? conf.i18n.t("sharing.settingsChanged.bodyEdit") : conf.i18n.t("sharing.settingsChanged.bodyView"),
|
|
64402
64718
|
duration: 5000
|
|
64403
64719
|
});
|
|
64404
64720
|
}
|
|
@@ -64434,8 +64750,8 @@ messageRouter.addHandler("PresenceEvent", handlePresenceEventMessage);
|
|
|
64434
64750
|
messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
64435
64751
|
// src/api/initI18N.ts
|
|
64436
64752
|
function initI18N(i18nInstance) {
|
|
64437
|
-
|
|
64438
|
-
|
|
64753
|
+
conf.i18n = i18nInstance;
|
|
64754
|
+
conf.planNames = {
|
|
64439
64755
|
basic: i18nInstance.t("userPlan.plans.basic.name"),
|
|
64440
64756
|
plus: i18nInstance.t("userPlan.plans.plus.name")
|
|
64441
64757
|
};
|
|
@@ -64502,7 +64818,7 @@ export {
|
|
|
64502
64818
|
defaultCursors as cursors,
|
|
64503
64819
|
createVideoItem,
|
|
64504
64820
|
createEvents,
|
|
64505
|
-
|
|
64821
|
+
conf,
|
|
64506
64822
|
checkHotkeys,
|
|
64507
64823
|
catmullRomInterpolate,
|
|
64508
64824
|
catchErrorResponse,
|