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/browser.js
CHANGED
|
@@ -8005,20 +8005,20 @@ var resources = {
|
|
|
8005
8005
|
};
|
|
8006
8006
|
function initDefaultI18N() {
|
|
8007
8007
|
instance.use(Browser).init({
|
|
8008
|
-
debug:
|
|
8008
|
+
debug: conf.debug,
|
|
8009
8009
|
detection: {
|
|
8010
8010
|
order: ["navigator"]
|
|
8011
8011
|
},
|
|
8012
8012
|
supportedLngs: ["en", "ru"],
|
|
8013
8013
|
defaultNS,
|
|
8014
8014
|
resources,
|
|
8015
|
-
fallbackLng:
|
|
8015
|
+
fallbackLng: conf.FALLBACK_LNG,
|
|
8016
8016
|
interpolation: {
|
|
8017
8017
|
escapeValue: false
|
|
8018
8018
|
}
|
|
8019
8019
|
});
|
|
8020
|
-
|
|
8021
|
-
|
|
8020
|
+
conf.i18n = instance;
|
|
8021
|
+
conf.planNames = {
|
|
8022
8022
|
basic: instance.t("userPlan.plans.basic.name"),
|
|
8023
8023
|
plus: instance.t("userPlan.plans.plus.name")
|
|
8024
8024
|
};
|
|
@@ -8033,7 +8033,7 @@ var ExportQuality;
|
|
|
8033
8033
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
8034
8034
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
8035
8035
|
})(ExportQuality ||= {});
|
|
8036
|
-
var
|
|
8036
|
+
var conf = {
|
|
8037
8037
|
connection: undefined,
|
|
8038
8038
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
8039
8039
|
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
@@ -9081,7 +9081,7 @@ class DrawingContext {
|
|
|
9081
9081
|
this.setCamera(camera);
|
|
9082
9082
|
}
|
|
9083
9083
|
dpi() {
|
|
9084
|
-
return
|
|
9084
|
+
return conf.getDPI();
|
|
9085
9085
|
}
|
|
9086
9086
|
setCamera(camera) {
|
|
9087
9087
|
this.camera = camera;
|
|
@@ -9091,7 +9091,7 @@ class DrawingContext {
|
|
|
9091
9091
|
}
|
|
9092
9092
|
clear() {
|
|
9093
9093
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
9094
|
-
this.ctx.clearRect(0, 0,
|
|
9094
|
+
this.ctx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
9095
9095
|
this.matrix.applyToContext(this.ctx);
|
|
9096
9096
|
}
|
|
9097
9097
|
clearCursor() {
|
|
@@ -9099,7 +9099,7 @@ class DrawingContext {
|
|
|
9099
9099
|
return;
|
|
9100
9100
|
}
|
|
9101
9101
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
9102
|
-
this.cursorCtx.clearRect(0, 0,
|
|
9102
|
+
this.cursorCtx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
9103
9103
|
this.matrix.applyToContext(this.cursorCtx);
|
|
9104
9104
|
}
|
|
9105
9105
|
applyChanges() {
|
|
@@ -9202,7 +9202,7 @@ class Path {
|
|
|
9202
9202
|
this.width = this.getMbr().getWidth();
|
|
9203
9203
|
this.height = this.getMbr().getHeight();
|
|
9204
9204
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
9205
|
-
this.path2d = new
|
|
9205
|
+
this.path2d = new conf.path2DFactory;
|
|
9206
9206
|
this.updateCache();
|
|
9207
9207
|
}
|
|
9208
9208
|
getBackgroundColor() {
|
|
@@ -9279,7 +9279,7 @@ class Path {
|
|
|
9279
9279
|
this.y = top - this.paddingTop;
|
|
9280
9280
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
9281
9281
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
9282
|
-
const path2d = new
|
|
9282
|
+
const path2d = new conf.path2DFactory;
|
|
9283
9283
|
if (this.segments.length === 0) {
|
|
9284
9284
|
return;
|
|
9285
9285
|
}
|
|
@@ -10323,7 +10323,7 @@ var parsersHTML = {
|
|
|
10323
10323
|
"comment-item": parseHTMLComment
|
|
10324
10324
|
};
|
|
10325
10325
|
var decodeHtml = (htmlString) => {
|
|
10326
|
-
const parser =
|
|
10326
|
+
const parser = conf.getDOMParser();
|
|
10327
10327
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
10328
10328
|
return doc.documentElement.textContent || "";
|
|
10329
10329
|
};
|
|
@@ -10352,10 +10352,10 @@ function parseHTMLRichText(el, options) {
|
|
|
10352
10352
|
italic: node.style.fontStyle === "italic",
|
|
10353
10353
|
underline: node.style.textDecoration.includes("underline"),
|
|
10354
10354
|
"line-through": node.style.textDecoration.includes("line-through"),
|
|
10355
|
-
fontColor: node.style.color ||
|
|
10356
|
-
fontHighlight: node.style.backgroundColor ||
|
|
10357
|
-
fontSize: parseFloat(node.style.fontSize) ||
|
|
10358
|
-
fontFamily: node.style.fontFamily ||
|
|
10355
|
+
fontColor: node.style.color || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
10356
|
+
fontHighlight: node.style.backgroundColor || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
10357
|
+
fontSize: parseFloat(node.style.fontSize) || conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
10358
|
+
fontFamily: node.style.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily,
|
|
10359
10359
|
overline: false,
|
|
10360
10360
|
subscript: false,
|
|
10361
10361
|
superscript: false
|
|
@@ -10420,7 +10420,7 @@ function parseHTMLRichText(el, options) {
|
|
|
10420
10420
|
return {
|
|
10421
10421
|
type: "paragraph",
|
|
10422
10422
|
...extractCommonProps(),
|
|
10423
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
10423
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
10424
10424
|
children: children2
|
|
10425
10425
|
};
|
|
10426
10426
|
default:
|
|
@@ -16900,8 +16900,8 @@ class LinkTo {
|
|
|
16900
16900
|
const ctx = context.ctx;
|
|
16901
16901
|
ctx.save();
|
|
16902
16902
|
ctx.globalCompositeOperation = "destination-out";
|
|
16903
|
-
const size =
|
|
16904
|
-
const offset =
|
|
16903
|
+
const size = conf.LINK_BTN_SIZE / scale;
|
|
16904
|
+
const offset = conf.LINK_BTN_OFFSET / scale;
|
|
16905
16905
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
16906
16906
|
ctx.restore();
|
|
16907
16907
|
}
|
|
@@ -17052,7 +17052,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
17052
17052
|
} else if (node3.type === "ul_list" && !listData) {
|
|
17053
17053
|
listData = { level: 0, isNumberedList: false };
|
|
17054
17054
|
}
|
|
17055
|
-
const listMarks =
|
|
17055
|
+
const listMarks = conf[getListMarkType((listData?.level || 0) + 1)];
|
|
17056
17056
|
for (let i = 0;i < data.children.length; i++) {
|
|
17057
17057
|
const child = structuredClone(data.children[i]);
|
|
17058
17058
|
switch (child.type) {
|
|
@@ -17457,8 +17457,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
17457
17457
|
rect2.height += paddingTop;
|
|
17458
17458
|
}
|
|
17459
17459
|
}
|
|
17460
|
-
|
|
17461
|
-
const measure =
|
|
17460
|
+
conf.measureCtx.font = style.font;
|
|
17461
|
+
const measure = conf.measureCtx.measureText(text);
|
|
17462
17462
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
17463
17463
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
17464
17464
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -19188,7 +19188,7 @@ var create2 = (key) => {
|
|
|
19188
19188
|
return false;
|
|
19189
19189
|
};
|
|
19190
19190
|
};
|
|
19191
|
-
var
|
|
19191
|
+
var hotkeys = {
|
|
19192
19192
|
isBold: create2("bold"),
|
|
19193
19193
|
isCompose: create2("compose"),
|
|
19194
19194
|
isMoveBackward: create2("moveBackward"),
|
|
@@ -26580,7 +26580,7 @@ var convertLinkNodeToTextNode = (node4) => {
|
|
|
26580
26580
|
const link = node4.link;
|
|
26581
26581
|
const text3 = node4.children.map((child) => child.text).join("");
|
|
26582
26582
|
return {
|
|
26583
|
-
...
|
|
26583
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
26584
26584
|
type: "text",
|
|
26585
26585
|
text: text3,
|
|
26586
26586
|
link,
|
|
@@ -26596,9 +26596,9 @@ function setNodeChildrenStyles({
|
|
|
26596
26596
|
horisontalAlignment,
|
|
26597
26597
|
node: node4
|
|
26598
26598
|
}) {
|
|
26599
|
-
let fontStyles =
|
|
26599
|
+
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
26600
26600
|
if (editor) {
|
|
26601
|
-
fontStyles = Editor.marks(editor) ||
|
|
26601
|
+
fontStyles = Editor.marks(editor) || conf.DEFAULT_TEXT_STYLES;
|
|
26602
26602
|
}
|
|
26603
26603
|
switch (node4.type) {
|
|
26604
26604
|
case "heading_one":
|
|
@@ -26630,7 +26630,7 @@ function setNodeChildrenStyles({
|
|
|
26630
26630
|
children.text += " ";
|
|
26631
26631
|
}
|
|
26632
26632
|
let fontColor = fontStyles.fontColor;
|
|
26633
|
-
if (fontColor ===
|
|
26633
|
+
if (fontColor === conf.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
26634
26634
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
26635
26635
|
}
|
|
26636
26636
|
return {
|
|
@@ -26700,7 +26700,7 @@ class MarkdownProcessor {
|
|
|
26700
26700
|
this.subject.publish(this);
|
|
26701
26701
|
return true;
|
|
26702
26702
|
}
|
|
26703
|
-
if (text3.startsWith(
|
|
26703
|
+
if (text3.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
26704
26704
|
return true;
|
|
26705
26705
|
}
|
|
26706
26706
|
const isPrevTextEmpty = isTextEmpty(this.editor.children);
|
|
@@ -26758,7 +26758,7 @@ class MarkdownProcessor {
|
|
|
26758
26758
|
return;
|
|
26759
26759
|
}
|
|
26760
26760
|
const prevText = this.getText()?.[this.getText().length - 1]?.children[0]?.text;
|
|
26761
|
-
if (prevText?.startsWith(
|
|
26761
|
+
if (prevText?.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
26762
26762
|
clearText(this.editor);
|
|
26763
26763
|
}
|
|
26764
26764
|
if (chunk.includes(`
|
|
@@ -27784,7 +27784,7 @@ class RichTextCommand {
|
|
|
27784
27784
|
item: id,
|
|
27785
27785
|
operation: {
|
|
27786
27786
|
...this.operation,
|
|
27787
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
27787
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
27788
27788
|
}
|
|
27789
27789
|
}));
|
|
27790
27790
|
case "setBlockType":
|
|
@@ -27808,7 +27808,7 @@ class RichTextCommand {
|
|
|
27808
27808
|
item: id,
|
|
27809
27809
|
operation: {
|
|
27810
27810
|
...this.operation,
|
|
27811
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
27811
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
27812
27812
|
}
|
|
27813
27813
|
}));
|
|
27814
27814
|
case "setFontSize":
|
|
@@ -27816,7 +27816,7 @@ class RichTextCommand {
|
|
|
27816
27816
|
item: id,
|
|
27817
27817
|
operation: {
|
|
27818
27818
|
...this.operation,
|
|
27819
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
27819
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf.DEFAULT_TEXT_STYLES.fontSize
|
|
27820
27820
|
}
|
|
27821
27821
|
}));
|
|
27822
27822
|
case "setFontHighlight":
|
|
@@ -27824,7 +27824,7 @@ class RichTextCommand {
|
|
|
27824
27824
|
item: id,
|
|
27825
27825
|
operation: {
|
|
27826
27826
|
...this.operation,
|
|
27827
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
27827
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf.DEFAULT_TEXT_STYLES.fontHighlight
|
|
27828
27828
|
}
|
|
27829
27829
|
}));
|
|
27830
27830
|
case "setHorisontalAlignment":
|
|
@@ -29063,7 +29063,7 @@ class RichText extends BaseItem {
|
|
|
29063
29063
|
isContainerSet = false;
|
|
29064
29064
|
isRenderEnabled = true;
|
|
29065
29065
|
layoutNodes;
|
|
29066
|
-
clipPath = new
|
|
29066
|
+
clipPath = new conf.path2DFactory;
|
|
29067
29067
|
updateRequired = false;
|
|
29068
29068
|
autoSizeScale = 1;
|
|
29069
29069
|
containerMaxWidth;
|
|
@@ -29078,7 +29078,7 @@ class RichText extends BaseItem {
|
|
|
29078
29078
|
shrinkWidth = false;
|
|
29079
29079
|
prevMbr = null;
|
|
29080
29080
|
rtCounter = 0;
|
|
29081
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText =
|
|
29081
|
+
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) {
|
|
29082
29082
|
super(board, id);
|
|
29083
29083
|
this.container = container;
|
|
29084
29084
|
this.transformation = transformation;
|
|
@@ -29212,11 +29212,11 @@ class RichText extends BaseItem {
|
|
|
29212
29212
|
return;
|
|
29213
29213
|
}
|
|
29214
29214
|
try {
|
|
29215
|
-
|
|
29215
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29216
29216
|
} catch {}
|
|
29217
29217
|
};
|
|
29218
29218
|
updateElement = () => {
|
|
29219
|
-
if (
|
|
29219
|
+
if (conf.isNode()) {
|
|
29220
29220
|
return;
|
|
29221
29221
|
}
|
|
29222
29222
|
if (this.updateRequired) {
|
|
@@ -29345,7 +29345,7 @@ class RichText extends BaseItem {
|
|
|
29345
29345
|
const container = this.getTransformedContainer();
|
|
29346
29346
|
const width = container.getWidth();
|
|
29347
29347
|
const height = container.getHeight();
|
|
29348
|
-
this.clipPath = new
|
|
29348
|
+
this.clipPath = new conf.path2DFactory;
|
|
29349
29349
|
this.clipPath.rect(0, 0, width, height);
|
|
29350
29350
|
}
|
|
29351
29351
|
setContainer(container) {
|
|
@@ -29622,24 +29622,24 @@ class RichText extends BaseItem {
|
|
|
29622
29622
|
this.clearLastClickPoint();
|
|
29623
29623
|
const domMbr = ref.getBoundingClientRect();
|
|
29624
29624
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
29625
|
-
if (refMbr.isInside(point5) && (
|
|
29626
|
-
const domRange =
|
|
29627
|
-
const textNode =
|
|
29628
|
-
const offset =
|
|
29629
|
-
const slatePoint =
|
|
29625
|
+
if (refMbr.isInside(point5) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
29626
|
+
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point5.x, point5.y) : conf.documentFactory.caretRangeFromPoint(point5.x, point5.y);
|
|
29627
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
29628
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
29629
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
29630
29630
|
exactMatch: false,
|
|
29631
29631
|
suppressThrow: false
|
|
29632
29632
|
});
|
|
29633
29633
|
if (slatePoint) {
|
|
29634
29634
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
29635
29635
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
29636
|
-
|
|
29636
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29637
29637
|
}
|
|
29638
29638
|
} else {
|
|
29639
|
-
if (!(
|
|
29639
|
+
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
29640
29640
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
29641
29641
|
}
|
|
29642
|
-
|
|
29642
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29643
29643
|
}
|
|
29644
29644
|
}
|
|
29645
29645
|
}
|
|
@@ -29746,11 +29746,11 @@ class RichText extends BaseItem {
|
|
|
29746
29746
|
if (node4.type === "text" || "text" in node4) {
|
|
29747
29747
|
node4 = node4;
|
|
29748
29748
|
const text3 = node4.text.trim() !== "" ? decodeHtml(escapeHtml2(node4.text)) : " ";
|
|
29749
|
-
const textElement = node4.link ? Object.assign(
|
|
29749
|
+
const textElement = node4.link ? Object.assign(conf.documentFactory.createElement("a"), {
|
|
29750
29750
|
href: node4.link,
|
|
29751
29751
|
target: "_blank",
|
|
29752
29752
|
rel: "noreferrer"
|
|
29753
|
-
}) :
|
|
29753
|
+
}) : conf.documentFactory.createElement("span");
|
|
29754
29754
|
Object.assign(textElement.style, {
|
|
29755
29755
|
fontWeight: node4.bold ? "700" : "400",
|
|
29756
29756
|
fontStyle: node4.italic ? "italic" : "",
|
|
@@ -29758,10 +29758,10 @@ class RichText extends BaseItem {
|
|
|
29758
29758
|
node4.underline ? "underline" : "",
|
|
29759
29759
|
node4["line-through"] ? "line-through" : ""
|
|
29760
29760
|
].filter(Boolean).join(" "),
|
|
29761
|
-
color: node4.fontColor ||
|
|
29762
|
-
backgroundColor: node4.fontHighlight ||
|
|
29763
|
-
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${
|
|
29764
|
-
fontFamily: node4.fontFamily ||
|
|
29761
|
+
color: node4.fontColor || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
29762
|
+
backgroundColor: node4.fontHighlight || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
29763
|
+
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${conf.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
29764
|
+
fontFamily: node4.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
29765
29765
|
});
|
|
29766
29766
|
if (this.insideOf === "Frame") {
|
|
29767
29767
|
Object.assign(textElement.style, {
|
|
@@ -29796,14 +29796,14 @@ class RichText extends BaseItem {
|
|
|
29796
29796
|
four: 4,
|
|
29797
29797
|
five: 5
|
|
29798
29798
|
};
|
|
29799
|
-
const header =
|
|
29799
|
+
const header = conf.documentFactory.createElement(`h${levels2[level]}`);
|
|
29800
29800
|
applyCommonStyles(header);
|
|
29801
29801
|
header.append(...children);
|
|
29802
29802
|
return header;
|
|
29803
29803
|
}
|
|
29804
29804
|
case "code_block": {
|
|
29805
|
-
const pre =
|
|
29806
|
-
const code =
|
|
29805
|
+
const pre = conf.documentFactory.createElement("pre");
|
|
29806
|
+
const code = conf.documentFactory.createElement("code");
|
|
29807
29807
|
applyCommonStyles(pre);
|
|
29808
29808
|
if (node4.language) {
|
|
29809
29809
|
code.classList.add(`language-${node4.language}`);
|
|
@@ -29817,35 +29817,35 @@ class RichText extends BaseItem {
|
|
|
29817
29817
|
return pre;
|
|
29818
29818
|
}
|
|
29819
29819
|
case "block-quote": {
|
|
29820
|
-
const blockquote =
|
|
29820
|
+
const blockquote = conf.documentFactory.createElement("blockquote");
|
|
29821
29821
|
applyCommonStyles(blockquote);
|
|
29822
29822
|
blockquote.append(...children);
|
|
29823
29823
|
return blockquote;
|
|
29824
29824
|
}
|
|
29825
29825
|
case "ul_list": {
|
|
29826
|
-
const ul =
|
|
29826
|
+
const ul = conf.documentFactory.createElement("ul");
|
|
29827
29827
|
applyCommonStyles(ul);
|
|
29828
29828
|
ul.append(...children);
|
|
29829
29829
|
return ul;
|
|
29830
29830
|
}
|
|
29831
29831
|
case "ol_list": {
|
|
29832
|
-
const ol =
|
|
29832
|
+
const ol = conf.documentFactory.createElement("ol");
|
|
29833
29833
|
applyCommonStyles(ol);
|
|
29834
29834
|
ol.append(...children);
|
|
29835
29835
|
return ol;
|
|
29836
29836
|
}
|
|
29837
29837
|
case "list_item": {
|
|
29838
|
-
const li =
|
|
29838
|
+
const li = conf.documentFactory.createElement("li");
|
|
29839
29839
|
applyCommonStyles(li);
|
|
29840
29840
|
li.append(...children);
|
|
29841
29841
|
return li;
|
|
29842
29842
|
}
|
|
29843
29843
|
case "paragraph":
|
|
29844
29844
|
default: {
|
|
29845
|
-
const par =
|
|
29845
|
+
const par = conf.documentFactory.createElement("p");
|
|
29846
29846
|
applyCommonStyles(par);
|
|
29847
29847
|
Object.assign(par.style, {
|
|
29848
|
-
lineHeight: node4.lineHeight ? `${node4.lineHeight}` :
|
|
29848
|
+
lineHeight: node4.lineHeight ? `${node4.lineHeight}` : conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
29849
29849
|
margin: "0"
|
|
29850
29850
|
});
|
|
29851
29851
|
par.append(...children);
|
|
@@ -29853,7 +29853,7 @@ class RichText extends BaseItem {
|
|
|
29853
29853
|
}
|
|
29854
29854
|
}
|
|
29855
29855
|
}
|
|
29856
|
-
return
|
|
29856
|
+
return conf.documentFactory.createElement("div");
|
|
29857
29857
|
};
|
|
29858
29858
|
const escapeHtml2 = (unsafe) => {
|
|
29859
29859
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -42916,7 +42916,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
42916
42916
|
markdownString = String(file).trim();
|
|
42917
42917
|
}
|
|
42918
42918
|
let slateNodes = [];
|
|
42919
|
-
if (
|
|
42919
|
+
if (conf.URL_REGEX.test(text5)) {
|
|
42920
42920
|
slateNodes = [createLinkNode(text5)];
|
|
42921
42921
|
} else {
|
|
42922
42922
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -42932,7 +42932,7 @@ function createLinkNode(link2) {
|
|
|
42932
42932
|
type: "text",
|
|
42933
42933
|
link: link2,
|
|
42934
42934
|
text: link2,
|
|
42935
|
-
...
|
|
42935
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
42936
42936
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
42937
42937
|
};
|
|
42938
42938
|
}
|
|
@@ -43043,7 +43043,7 @@ class AINode extends BaseItem {
|
|
|
43043
43043
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
43044
43044
|
super(board, id);
|
|
43045
43045
|
this.id = id;
|
|
43046
|
-
this.buttonIcon =
|
|
43046
|
+
this.buttonIcon = conf.documentFactory.createElement("img");
|
|
43047
43047
|
this.buttonIcon.src = ICON_SRC;
|
|
43048
43048
|
this.contextItems = contextItems;
|
|
43049
43049
|
this.isUserRequest = isUserRequest;
|
|
@@ -44268,12 +44268,12 @@ class Connector2 extends BaseItem {
|
|
|
44268
44268
|
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
44269
44269
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
44270
44270
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
44271
|
-
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo,
|
|
44271
|
+
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf.i18n.t("connector.textPlaceholder", {
|
|
44272
44272
|
ns: "default"
|
|
44273
44273
|
}), true, false, "Connector", {
|
|
44274
|
-
...
|
|
44275
|
-
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) :
|
|
44276
|
-
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") :
|
|
44274
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
44275
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
44276
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf.DEFAULT_TEXT_STYLES.fontColor
|
|
44277
44277
|
});
|
|
44278
44278
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
44279
44279
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -44723,7 +44723,7 @@ class Connector2 extends BaseItem {
|
|
|
44723
44723
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
44724
44724
|
this.text.render(context);
|
|
44725
44725
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
44726
|
-
ctx.strokeStyle =
|
|
44726
|
+
ctx.strokeStyle = conf.SELECTION_COLOR;
|
|
44727
44727
|
ctx.lineWidth = 1;
|
|
44728
44728
|
ctx.beginPath();
|
|
44729
44729
|
ctx.rect(textMbr.left - TEXT_BORDER_PADDING, textMbr.top - TEXT_BORDER_PADDING, textMbr.getWidth() + TEXT_BORDER_PADDING * 2, textMbr.getHeight() + TEXT_BORDER_PADDING * 2);
|
|
@@ -44950,7 +44950,7 @@ class Connector2 extends BaseItem {
|
|
|
44950
44950
|
}
|
|
44951
44951
|
}
|
|
44952
44952
|
updatePaths() {
|
|
44953
|
-
if (
|
|
44953
|
+
if (conf.isNode()) {
|
|
44954
44954
|
return;
|
|
44955
44955
|
}
|
|
44956
44956
|
const startPoint = this.startPoint;
|
|
@@ -45761,7 +45761,7 @@ class DefaultShapeData {
|
|
|
45761
45761
|
text;
|
|
45762
45762
|
linkTo;
|
|
45763
45763
|
itemType = "Shape";
|
|
45764
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
45764
|
+
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) {
|
|
45765
45765
|
this.shapeType = shapeType;
|
|
45766
45766
|
this.backgroundColor = backgroundColor;
|
|
45767
45767
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -46959,7 +46959,7 @@ class Shape extends BaseItem {
|
|
|
46959
46959
|
this.text.updateElement();
|
|
46960
46960
|
}
|
|
46961
46961
|
transformPath() {
|
|
46962
|
-
if (
|
|
46962
|
+
if (conf.isNode()) {
|
|
46963
46963
|
return;
|
|
46964
46964
|
}
|
|
46965
46965
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -47152,7 +47152,7 @@ class Sticker extends BaseItem {
|
|
|
47152
47152
|
return this;
|
|
47153
47153
|
}
|
|
47154
47154
|
transformPath() {
|
|
47155
|
-
if (
|
|
47155
|
+
if (conf.isNode()) {
|
|
47156
47156
|
return;
|
|
47157
47157
|
}
|
|
47158
47158
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -47638,7 +47638,7 @@ class Frame extends BaseItem {
|
|
|
47638
47638
|
this.path = Frames[this.shapeType].path.copy();
|
|
47639
47639
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
47640
47640
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
47641
|
-
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...
|
|
47641
|
+
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 });
|
|
47642
47642
|
this.text.setSelectionHorisontalAlignment("left");
|
|
47643
47643
|
this.transformation.subject.subscribe(() => {
|
|
47644
47644
|
this.transformPath();
|
|
@@ -48184,10 +48184,10 @@ class Frame extends BaseItem {
|
|
|
48184
48184
|
}
|
|
48185
48185
|
// src/Items/Video/Video.ts
|
|
48186
48186
|
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";
|
|
48187
|
-
var videoIcon =
|
|
48187
|
+
var videoIcon = conf.documentFactory.createElement("img");
|
|
48188
48188
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
48189
48189
|
var createPlaceholderImage = (width2, height2) => {
|
|
48190
|
-
const canvas =
|
|
48190
|
+
const canvas = conf.documentFactory.createElement("canvas");
|
|
48191
48191
|
canvas.width = width2;
|
|
48192
48192
|
canvas.height = height2;
|
|
48193
48193
|
const ctx = canvas.getContext("2d");
|
|
@@ -48229,7 +48229,7 @@ class VideoItem extends BaseItem {
|
|
|
48229
48229
|
super(board, id);
|
|
48230
48230
|
this.events = events2;
|
|
48231
48231
|
this.extension = extension2;
|
|
48232
|
-
this.isStorageUrl = !
|
|
48232
|
+
this.isStorageUrl = !conf.getYouTubeId(url);
|
|
48233
48233
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
48234
48234
|
this.linkTo = new LinkTo(this.id, events2);
|
|
48235
48235
|
this.board = board;
|
|
@@ -48599,59 +48599,59 @@ async function fileTosha256(file) {
|
|
|
48599
48599
|
var catchErrorResponse = async (response, mediaType) => {
|
|
48600
48600
|
if (response.status === 403) {
|
|
48601
48601
|
const data = await response.json();
|
|
48602
|
-
let errorBody =
|
|
48602
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
48603
48603
|
if (!data.isOwnerRequest) {
|
|
48604
|
-
errorBody =
|
|
48604
|
+
errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
48605
48605
|
} else if (data.currentUsage && data.storageLimit) {
|
|
48606
|
-
errorBody =
|
|
48606
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
48607
48607
|
}
|
|
48608
|
-
|
|
48608
|
+
conf.notify({
|
|
48609
48609
|
variant: "warning",
|
|
48610
|
-
header:
|
|
48610
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
48611
48611
|
body: errorBody,
|
|
48612
48612
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
48613
|
-
text:
|
|
48614
|
-
onClick: () =>
|
|
48613
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48614
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48615
48615
|
} : undefined,
|
|
48616
48616
|
duration: 8000
|
|
48617
48617
|
});
|
|
48618
48618
|
} else if (response.status === 413) {
|
|
48619
48619
|
const data = await response.json();
|
|
48620
|
-
let errorBody =
|
|
48620
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
48621
48621
|
let isBasicPlan = false;
|
|
48622
48622
|
if (data.fileSizeLimit && data.fileSize) {
|
|
48623
48623
|
if (mediaType === "image") {
|
|
48624
48624
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
48625
|
-
errorBody =
|
|
48625
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48626
48626
|
} else {
|
|
48627
48627
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
48628
|
-
errorBody =
|
|
48628
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48629
48629
|
}
|
|
48630
48630
|
}
|
|
48631
|
-
|
|
48631
|
+
conf.notify({
|
|
48632
48632
|
variant: "warning",
|
|
48633
|
-
header:
|
|
48633
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48634
48634
|
body: errorBody,
|
|
48635
48635
|
button: isBasicPlan ? {
|
|
48636
|
-
text:
|
|
48637
|
-
onClick: () =>
|
|
48636
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48637
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48638
48638
|
} : undefined,
|
|
48639
48639
|
duration: 4000
|
|
48640
48640
|
});
|
|
48641
48641
|
} else if (response.status === 401) {
|
|
48642
|
-
|
|
48642
|
+
conf.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
48643
48643
|
} else if (response.status === 415) {
|
|
48644
|
-
|
|
48644
|
+
conf.notify({
|
|
48645
48645
|
variant: "warning",
|
|
48646
|
-
header:
|
|
48647
|
-
body:
|
|
48646
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
48647
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
48648
48648
|
duration: 4000
|
|
48649
48649
|
});
|
|
48650
48650
|
} else {
|
|
48651
|
-
|
|
48651
|
+
conf.notify({
|
|
48652
48652
|
variant: "error",
|
|
48653
|
-
header:
|
|
48654
|
-
body:
|
|
48653
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
48654
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
48655
48655
|
duration: 4000
|
|
48656
48656
|
});
|
|
48657
48657
|
}
|
|
@@ -48659,17 +48659,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
48659
48659
|
};
|
|
48660
48660
|
var catchDuplicateErrorResponse = async (response) => {
|
|
48661
48661
|
if (response.status === 403) {
|
|
48662
|
-
|
|
48662
|
+
conf.notify({
|
|
48663
48663
|
variant: "warning",
|
|
48664
|
-
header:
|
|
48665
|
-
body:
|
|
48664
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
48665
|
+
body: conf.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
48666
48666
|
duration: 4000
|
|
48667
48667
|
});
|
|
48668
48668
|
} else {
|
|
48669
|
-
|
|
48669
|
+
conf.notify({
|
|
48670
48670
|
variant: "error",
|
|
48671
|
-
header:
|
|
48672
|
-
body:
|
|
48671
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
48672
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
48673
48673
|
duration: 4000
|
|
48674
48674
|
});
|
|
48675
48675
|
}
|
|
@@ -48677,40 +48677,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
48677
48677
|
};
|
|
48678
48678
|
var validateMediaFile = (file, account2) => {
|
|
48679
48679
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
48680
|
-
if (!file.type.startsWith("image") && !
|
|
48681
|
-
|
|
48680
|
+
if (!file.type.startsWith("image") && !conf.AUDIO_FORMATS.includes(fileExtension) && !conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
48681
|
+
conf.notify({
|
|
48682
48682
|
variant: "warning",
|
|
48683
|
-
header:
|
|
48684
|
-
body:
|
|
48683
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
48684
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
48685
48685
|
duration: 4000
|
|
48686
48686
|
});
|
|
48687
48687
|
return false;
|
|
48688
48688
|
}
|
|
48689
48689
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
48690
|
-
let errorBody =
|
|
48691
|
-
if (
|
|
48692
|
-
errorBody =
|
|
48690
|
+
let errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48691
|
+
if (conf.AUDIO_FORMATS.includes(fileExtension) || conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
48692
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48693
48693
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
48694
|
-
|
|
48694
|
+
conf.notify({
|
|
48695
48695
|
variant: "warning",
|
|
48696
|
-
header:
|
|
48696
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48697
48697
|
body: errorBody,
|
|
48698
48698
|
button: isBasicPlan ? {
|
|
48699
|
-
text:
|
|
48700
|
-
onClick: () =>
|
|
48699
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48700
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48701
48701
|
} : undefined,
|
|
48702
48702
|
duration: 4000
|
|
48703
48703
|
});
|
|
48704
48704
|
return false;
|
|
48705
48705
|
}
|
|
48706
48706
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
48707
|
-
|
|
48707
|
+
conf.notify({
|
|
48708
48708
|
variant: "warning",
|
|
48709
|
-
header:
|
|
48709
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48710
48710
|
body: errorBody,
|
|
48711
48711
|
button: isBasicPlan ? {
|
|
48712
|
-
text:
|
|
48713
|
-
onClick: () =>
|
|
48712
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48713
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48714
48714
|
} : undefined,
|
|
48715
48715
|
duration: 4000
|
|
48716
48716
|
});
|
|
@@ -48789,7 +48789,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
48789
48789
|
};
|
|
48790
48790
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
48791
48791
|
image2.onload = async () => {
|
|
48792
|
-
const parser =
|
|
48792
|
+
const parser = conf.getDOMParser();
|
|
48793
48793
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
48794
48794
|
const svgElement = svgDoc.documentElement;
|
|
48795
48795
|
svgElement.removeAttribute("width");
|
|
@@ -49001,8 +49001,8 @@ class AudioItem extends BaseItem {
|
|
|
49001
49001
|
this.subject.publish(this);
|
|
49002
49002
|
});
|
|
49003
49003
|
this.transformation.subject.subscribe(this.onTransform);
|
|
49004
|
-
this.right = this.left +
|
|
49005
|
-
this.bottom = this.top +
|
|
49004
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width;
|
|
49005
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height;
|
|
49006
49006
|
this.shouldUseCustomRender = true;
|
|
49007
49007
|
}
|
|
49008
49008
|
setCurrentTime(time2) {
|
|
@@ -49071,8 +49071,8 @@ class AudioItem extends BaseItem {
|
|
|
49071
49071
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
49072
49072
|
this.left = translateX;
|
|
49073
49073
|
this.top = translateY;
|
|
49074
|
-
this.right = this.left +
|
|
49075
|
-
this.bottom = this.top +
|
|
49074
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width * scaleX;
|
|
49075
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height * scaleY;
|
|
49076
49076
|
}
|
|
49077
49077
|
render(context) {
|
|
49078
49078
|
if (this.transformationRenderBlock) {
|
|
@@ -49101,8 +49101,8 @@ class AudioItem extends BaseItem {
|
|
|
49101
49101
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
49102
49102
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
49103
49103
|
div.id = this.getId();
|
|
49104
|
-
div.style.width = `${
|
|
49105
|
-
div.style.height = `${
|
|
49104
|
+
div.style.width = `${conf.AUDIO_DIMENSIONS.width}px`;
|
|
49105
|
+
div.style.height = `${conf.AUDIO_DIMENSIONS.height}px`;
|
|
49106
49106
|
div.style.transformOrigin = "top left";
|
|
49107
49107
|
div.style.transform = transform;
|
|
49108
49108
|
div.style.position = "absolute";
|
|
@@ -49221,7 +49221,7 @@ class AudioItem extends BaseItem {
|
|
|
49221
49221
|
}
|
|
49222
49222
|
download() {
|
|
49223
49223
|
if (this.extension) {
|
|
49224
|
-
const linkElem =
|
|
49224
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
49225
49225
|
linkElem.href = this.url;
|
|
49226
49226
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
49227
49227
|
linkElem.click();
|
|
@@ -49562,7 +49562,7 @@ class Placeholder extends BaseItem {
|
|
|
49562
49562
|
}
|
|
49563
49563
|
// src/Items/Image/Image.ts
|
|
49564
49564
|
function getPlaceholderImage(board, imageDimension) {
|
|
49565
|
-
const placeholderCanvas =
|
|
49565
|
+
const placeholderCanvas = conf.documentFactory.createElement("canvas");
|
|
49566
49566
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
49567
49567
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
49568
49568
|
const placeholder = new Placeholder;
|
|
@@ -49843,7 +49843,7 @@ class Drawing extends BaseItem {
|
|
|
49843
49843
|
itemType = "Drawing";
|
|
49844
49844
|
parent = "Board";
|
|
49845
49845
|
transformation;
|
|
49846
|
-
path2d = new
|
|
49846
|
+
path2d = new conf.path2DFactory;
|
|
49847
49847
|
subject = new Subject;
|
|
49848
49848
|
untransformedMbr = new Mbr;
|
|
49849
49849
|
lines = [];
|
|
@@ -49918,7 +49918,7 @@ class Drawing extends BaseItem {
|
|
|
49918
49918
|
this.bottom = mbr.bottom;
|
|
49919
49919
|
}
|
|
49920
49920
|
updatePath2d() {
|
|
49921
|
-
this.path2d = new
|
|
49921
|
+
this.path2d = new conf.path2DFactory;
|
|
49922
49922
|
const context = this.path2d;
|
|
49923
49923
|
const points = this.points;
|
|
49924
49924
|
if (points.length < 3) {
|
|
@@ -51170,14 +51170,14 @@ class AddConnector extends BoardTool {
|
|
|
51170
51170
|
class AddDrawing extends BoardTool {
|
|
51171
51171
|
drawing = null;
|
|
51172
51172
|
isDown = false;
|
|
51173
|
-
strokeWidth =
|
|
51174
|
-
strokeColor =
|
|
51175
|
-
strokeStyle =
|
|
51173
|
+
strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
|
|
51174
|
+
strokeColor = conf.PEN_DEFAULT_COLOR;
|
|
51175
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
51176
51176
|
constructor(board) {
|
|
51177
51177
|
super(board);
|
|
51178
51178
|
this.setCursor();
|
|
51179
|
-
if (
|
|
51180
|
-
const drawingSettings = localStorage.getItem(
|
|
51179
|
+
if (conf.PEN_SETTINGS_KEY) {
|
|
51180
|
+
const drawingSettings = localStorage.getItem(conf.PEN_SETTINGS_KEY);
|
|
51181
51181
|
if (drawingSettings) {
|
|
51182
51182
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
51183
51183
|
this.strokeWidth = strokeWidth;
|
|
@@ -51187,7 +51187,7 @@ class AddDrawing extends BoardTool {
|
|
|
51187
51187
|
}
|
|
51188
51188
|
}
|
|
51189
51189
|
updateSettings() {
|
|
51190
|
-
localStorage.setItem(
|
|
51190
|
+
localStorage.setItem(conf.PEN_SETTINGS_KEY, JSON.stringify({
|
|
51191
51191
|
strokeWidth: this.strokeWidth,
|
|
51192
51192
|
strokeColor: this.strokeColor,
|
|
51193
51193
|
strokeStyle: this.strokeStyle
|
|
@@ -51217,7 +51217,7 @@ class AddDrawing extends BoardTool {
|
|
|
51217
51217
|
ctx.beginPath();
|
|
51218
51218
|
ctx.arc(point7.x, point7.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
51219
51219
|
ctx.lineWidth = 1;
|
|
51220
|
-
ctx.strokeStyle =
|
|
51220
|
+
ctx.strokeStyle = conf.PEN_POINTER_CIRCLE_COLOR;
|
|
51221
51221
|
ctx.stroke();
|
|
51222
51222
|
}
|
|
51223
51223
|
setCursor() {
|
|
@@ -51299,7 +51299,7 @@ class AddDrawing extends BoardTool {
|
|
|
51299
51299
|
this.setCursor();
|
|
51300
51300
|
};
|
|
51301
51301
|
render(context) {
|
|
51302
|
-
if (
|
|
51302
|
+
if (conf.PEN_RENDER_POINTER_CIRCLE) {
|
|
51303
51303
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
51304
51304
|
}
|
|
51305
51305
|
if (!this.drawing) {
|
|
@@ -51314,14 +51314,14 @@ class AddDrawing extends BoardTool {
|
|
|
51314
51314
|
}
|
|
51315
51315
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
51316
51316
|
class AddHighlighter extends AddDrawing {
|
|
51317
|
-
strokeWidth =
|
|
51318
|
-
strokeColor =
|
|
51319
|
-
strokeStyle =
|
|
51317
|
+
strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
51318
|
+
strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
|
|
51319
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
51320
51320
|
constructor(board) {
|
|
51321
51321
|
super(board);
|
|
51322
51322
|
this.setCursor();
|
|
51323
|
-
if (
|
|
51324
|
-
const highlighterSettings = localStorage.getItem(
|
|
51323
|
+
if (conf.HIGHLIGHTER_SETTINGS_KEY) {
|
|
51324
|
+
const highlighterSettings = localStorage.getItem(conf.HIGHLIGHTER_SETTINGS_KEY);
|
|
51325
51325
|
if (highlighterSettings) {
|
|
51326
51326
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
51327
51327
|
this.strokeWidth = strokeWidth;
|
|
@@ -51334,7 +51334,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
51334
51334
|
return true;
|
|
51335
51335
|
}
|
|
51336
51336
|
updateSettings() {
|
|
51337
|
-
localStorage.setItem(
|
|
51337
|
+
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
51338
51338
|
strokeWidth: this.strokeWidth,
|
|
51339
51339
|
strokeColor: this.strokeColor,
|
|
51340
51340
|
strokeStyle: this.strokeStyle
|
|
@@ -51658,7 +51658,7 @@ class AddShape extends BoardTool {
|
|
|
51658
51658
|
const point7 = this.board.pointer.point;
|
|
51659
51659
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51660
51660
|
this.bounds = this.line.getMbr();
|
|
51661
|
-
this.bounds.borderColor =
|
|
51661
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51662
51662
|
this.shape.apply({
|
|
51663
51663
|
class: "Shape",
|
|
51664
51664
|
method: "setShapeType",
|
|
@@ -51682,7 +51682,7 @@ class AddShape extends BoardTool {
|
|
|
51682
51682
|
}
|
|
51683
51683
|
this.line = new Line(startPoint, endPoint);
|
|
51684
51684
|
this.bounds = this.line.getMbr();
|
|
51685
|
-
this.bounds.borderColor =
|
|
51685
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51686
51686
|
this.initTransformation();
|
|
51687
51687
|
this.board.tools.publish();
|
|
51688
51688
|
return true;
|
|
@@ -51754,7 +51754,7 @@ class AddShape extends BoardTool {
|
|
|
51754
51754
|
const y = (top + bottom) / 2 - 50;
|
|
51755
51755
|
this.bounds = new Mbr(x, y, x, y);
|
|
51756
51756
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
51757
|
-
this.bounds.borderColor =
|
|
51757
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51758
51758
|
this.shape.apply({
|
|
51759
51759
|
class: "Shape",
|
|
51760
51760
|
method: "setShapeType",
|
|
@@ -51787,8 +51787,8 @@ class AddSticker extends BoardTool {
|
|
|
51787
51787
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
51788
51788
|
}
|
|
51789
51789
|
setCursor(color2) {
|
|
51790
|
-
if (
|
|
51791
|
-
const colorName = color2 ?
|
|
51790
|
+
if (conf.STICKER_COLOR_NAMES) {
|
|
51791
|
+
const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
51792
51792
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
51793
51793
|
} else {
|
|
51794
51794
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -51812,7 +51812,7 @@ class AddSticker extends BoardTool {
|
|
|
51812
51812
|
const point7 = this.board.pointer.point;
|
|
51813
51813
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51814
51814
|
this.bounds = this.line.getMbr();
|
|
51815
|
-
this.bounds.borderColor =
|
|
51815
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51816
51816
|
this.board.tools.publish();
|
|
51817
51817
|
return true;
|
|
51818
51818
|
}
|
|
@@ -51821,7 +51821,7 @@ class AddSticker extends BoardTool {
|
|
|
51821
51821
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
51822
51822
|
this.sticker.applyDiagonal(this.line);
|
|
51823
51823
|
this.bounds = this.sticker.getMbr();
|
|
51824
|
-
this.bounds.borderColor =
|
|
51824
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51825
51825
|
this.board.tools.publish();
|
|
51826
51826
|
return true;
|
|
51827
51827
|
}
|
|
@@ -51921,7 +51921,7 @@ class AddText extends BoardTool {
|
|
|
51921
51921
|
const point7 = this.board.pointer.point;
|
|
51922
51922
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51923
51923
|
this.bounds = this.line.getMbr();
|
|
51924
|
-
this.bounds.borderColor =
|
|
51924
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51925
51925
|
this.board.tools.publish();
|
|
51926
51926
|
return true;
|
|
51927
51927
|
}
|
|
@@ -51932,7 +51932,7 @@ class AddText extends BoardTool {
|
|
|
51932
51932
|
const end2 = new Point(cursorPoint.x, start2.y + height2);
|
|
51933
51933
|
this.line = new Line(start2, end2);
|
|
51934
51934
|
this.bounds = this.line.getMbr();
|
|
51935
|
-
this.bounds.borderColor =
|
|
51935
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51936
51936
|
this.board.tools.publish();
|
|
51937
51937
|
return true;
|
|
51938
51938
|
}
|
|
@@ -51997,11 +51997,11 @@ class AddText extends BoardTool {
|
|
|
51997
51997
|
class Eraser extends BoardTool {
|
|
51998
51998
|
itemType = "Eraser";
|
|
51999
51999
|
isDown = false;
|
|
52000
|
-
strokeWidth =
|
|
52001
|
-
strokeColor =
|
|
52002
|
-
strokeStyle =
|
|
52000
|
+
strokeWidth = conf.ERASER_STROKE_WIDTH;
|
|
52001
|
+
strokeColor = conf.ERASER_DEFAULT_COLOR;
|
|
52002
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
52003
52003
|
drawing = new Drawing(this.board, []);
|
|
52004
|
-
maxPointsInLine =
|
|
52004
|
+
maxPointsInLine = conf.ERASER_MAX_LINE_LENGTH;
|
|
52005
52005
|
constructor(board) {
|
|
52006
52006
|
super(board);
|
|
52007
52007
|
this.setCursor();
|
|
@@ -52137,8 +52137,8 @@ function getResizeType(cursorPoint, cameraScale, mbr, anchorDistance = 5) {
|
|
|
52137
52137
|
|
|
52138
52138
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
52139
52139
|
function getDecorationResizeType(point7, mbr, tolerance = 10) {
|
|
52140
|
-
for (const key in
|
|
52141
|
-
const decoration =
|
|
52140
|
+
for (const key in conf.EXPORT_FRAME_DECORATIONS) {
|
|
52141
|
+
const decoration = conf.EXPORT_FRAME_DECORATIONS[key];
|
|
52142
52142
|
const decorationBounds = {
|
|
52143
52143
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
52144
52144
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -52179,7 +52179,7 @@ class ExportSnapshot extends Tool {
|
|
|
52179
52179
|
super();
|
|
52180
52180
|
this.board = board;
|
|
52181
52181
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
52182
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
52182
|
+
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);
|
|
52183
52183
|
this.board.selection.disable();
|
|
52184
52184
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
52185
52185
|
}
|
|
@@ -52191,11 +52191,11 @@ class ExportSnapshot extends Tool {
|
|
|
52191
52191
|
resize() {
|
|
52192
52192
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
52193
52193
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
52194
|
-
if (resize.mbr.getWidth() >
|
|
52194
|
+
if (resize.mbr.getWidth() > conf.EXPORT_MIN_WIDTH) {
|
|
52195
52195
|
this.mbr.left = resize.mbr.left;
|
|
52196
52196
|
this.mbr.right = resize.mbr.right;
|
|
52197
52197
|
}
|
|
52198
|
-
if (resize.mbr.getHeight() >
|
|
52198
|
+
if (resize.mbr.getHeight() > conf.EXPORT_MIN_HEIGHT) {
|
|
52199
52199
|
this.mbr.top = resize.mbr.top;
|
|
52200
52200
|
this.mbr.bottom = resize.mbr.bottom;
|
|
52201
52201
|
}
|
|
@@ -52284,7 +52284,7 @@ class ExportSnapshot extends Tool {
|
|
|
52284
52284
|
}
|
|
52285
52285
|
const res = await exportBoardSnapshot({
|
|
52286
52286
|
board: this.board,
|
|
52287
|
-
bgColor:
|
|
52287
|
+
bgColor: conf.CANVAS_BG_COLOR,
|
|
52288
52288
|
selection: this.mbr,
|
|
52289
52289
|
upscaleTo: 4000,
|
|
52290
52290
|
nameToExport: this.board.getName()
|
|
@@ -52308,18 +52308,18 @@ class ExportSnapshot extends Tool {
|
|
|
52308
52308
|
const cameraMbr = context.camera.getMbr();
|
|
52309
52309
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
52310
52310
|
this.tempDrawingContext.clear();
|
|
52311
|
-
cameraMbr.backgroundColor =
|
|
52311
|
+
cameraMbr.backgroundColor = conf.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
52312
52312
|
cameraMbr.strokeWidth = 0;
|
|
52313
52313
|
cameraMbr.render(this.tempDrawingContext);
|
|
52314
52314
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
52315
|
-
if (
|
|
52316
|
-
const topLeft =
|
|
52315
|
+
if (conf.EXPORT_FRAME_DECORATIONS) {
|
|
52316
|
+
const topLeft = conf.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
52317
52317
|
this.renderDecoration(this.tempDrawingContext, topLeft.path, this.mbr.left + (topLeft.offsetX ?? 0), this.mbr.top + (topLeft.offsetY ?? 0), topLeft.color, topLeft.lineWidth);
|
|
52318
|
-
const topRight =
|
|
52318
|
+
const topRight = conf.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
52319
52319
|
this.renderDecoration(this.tempDrawingContext, topRight.path, this.mbr.right + (topRight.offsetX ?? 0), this.mbr.top + (topRight.offsetY ?? 0), topRight.color, topRight.lineWidth);
|
|
52320
|
-
const bottomLeft =
|
|
52320
|
+
const bottomLeft = conf.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
52321
52321
|
this.renderDecoration(this.tempDrawingContext, bottomLeft.path, this.mbr.left + (bottomLeft.offsetX ?? 0), this.mbr.bottom + (bottomLeft.offsetY ?? 0), bottomLeft.color, bottomLeft.lineWidth);
|
|
52322
|
-
const bottomRight =
|
|
52322
|
+
const bottomRight = conf.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
52323
52323
|
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);
|
|
52324
52324
|
}
|
|
52325
52325
|
}
|
|
@@ -52421,7 +52421,7 @@ function createCanvasDrawer(board) {
|
|
|
52421
52421
|
borderDiv.id = "canvasBorder";
|
|
52422
52422
|
borderDiv.style.position = "absolute";
|
|
52423
52423
|
borderDiv.style.transformOrigin = "left top";
|
|
52424
|
-
borderDiv.style.border = `1px solid ${
|
|
52424
|
+
borderDiv.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
52425
52425
|
borderDiv.style.boxSizing = "border-box";
|
|
52426
52426
|
borderDiv.style.left = `${leftOffset}px`;
|
|
52427
52427
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -52431,7 +52431,7 @@ function createCanvasDrawer(board) {
|
|
|
52431
52431
|
canvas.style.boxSizing = "border-box";
|
|
52432
52432
|
container.appendChild(borderDiv);
|
|
52433
52433
|
} else {
|
|
52434
|
-
canvas.style.border = `1px solid ${
|
|
52434
|
+
canvas.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
52435
52435
|
canvas.style.boxSizing = "border-box";
|
|
52436
52436
|
}
|
|
52437
52437
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -52439,8 +52439,8 @@ function createCanvasDrawer(board) {
|
|
|
52439
52439
|
anchorDiv.style.position = "absolute";
|
|
52440
52440
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
52441
52441
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
52442
|
-
anchorDiv.style.backgroundColor = `${
|
|
52443
|
-
anchorDiv.style.border = `${
|
|
52442
|
+
anchorDiv.style.backgroundColor = `${conf.SELECTION_ANCHOR_COLOR}`;
|
|
52443
|
+
anchorDiv.style.border = `${conf.SELECTION_ANCHOR_WIDTH}px solid ${conf.SELECTION_COLOR}`;
|
|
52444
52444
|
anchorDiv.style.borderRadius = "2px";
|
|
52445
52445
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
52446
52446
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -52448,10 +52448,10 @@ function createCanvasDrawer(board) {
|
|
|
52448
52448
|
return anchorDiv;
|
|
52449
52449
|
};
|
|
52450
52450
|
const anchors = [
|
|
52451
|
-
createAnchorDiv("0%", "0%",
|
|
52452
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
52453
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
52454
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
52451
|
+
createAnchorDiv("0%", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
52452
|
+
createAnchorDiv("100% + 1px", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
52453
|
+
createAnchorDiv("0%", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS),
|
|
52454
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS)
|
|
52455
52455
|
];
|
|
52456
52456
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
52457
52457
|
for (const anchor of anchors) {
|
|
@@ -53804,8 +53804,8 @@ class Select extends Tool {
|
|
|
53804
53804
|
const { x, y } = pointer.point;
|
|
53805
53805
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
53806
53806
|
this.rect = this.line.getMbr();
|
|
53807
|
-
this.rect.borderColor =
|
|
53808
|
-
this.rect.backgroundColor =
|
|
53807
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
53808
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
53809
53809
|
this.board.tools.publish();
|
|
53810
53810
|
this.board.presence.throttledEmit({
|
|
53811
53811
|
method: "DrawSelect",
|
|
@@ -53890,8 +53890,8 @@ class Select extends Tool {
|
|
|
53890
53890
|
const point7 = this.board.pointer.point.copy();
|
|
53891
53891
|
this.line = new Line(this.line.start, point7);
|
|
53892
53892
|
this.rect = this.line.getMbr();
|
|
53893
|
-
this.rect.borderColor =
|
|
53894
|
-
this.rect.backgroundColor =
|
|
53893
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
53894
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
53895
53895
|
this.board.tools.publish();
|
|
53896
53896
|
this.board.presence.throttledEmit({
|
|
53897
53897
|
method: "DrawSelect",
|
|
@@ -54402,7 +54402,7 @@ class ShapeTool extends CustomTool {
|
|
|
54402
54402
|
const point7 = this.board.pointer.point;
|
|
54403
54403
|
this.line = new Line(point7.copy(), point7.copy());
|
|
54404
54404
|
this.bounds = this.line.getMbr();
|
|
54405
|
-
this.bounds.borderColor =
|
|
54405
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
54406
54406
|
this.initTransformation();
|
|
54407
54407
|
this.board.tools.publish();
|
|
54408
54408
|
return true;
|
|
@@ -54420,7 +54420,7 @@ class ShapeTool extends CustomTool {
|
|
|
54420
54420
|
}
|
|
54421
54421
|
this.line = new Line(startPoint, endPoint);
|
|
54422
54422
|
this.bounds = this.line.getMbr();
|
|
54423
|
-
this.bounds.borderColor =
|
|
54423
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
54424
54424
|
this.initTransformation();
|
|
54425
54425
|
this.board.tools.publish();
|
|
54426
54426
|
return true;
|
|
@@ -55389,9 +55389,9 @@ class Camera {
|
|
|
55389
55389
|
matrix = new Matrix2;
|
|
55390
55390
|
pointer = new Point;
|
|
55391
55391
|
window = {
|
|
55392
|
-
width:
|
|
55393
|
-
height:
|
|
55394
|
-
dpi:
|
|
55392
|
+
width: conf.getDocumentWidth(),
|
|
55393
|
+
height: conf.getDocumentHeight(),
|
|
55394
|
+
dpi: conf.getDPI(),
|
|
55395
55395
|
getMbr: () => {
|
|
55396
55396
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
55397
55397
|
}
|
|
@@ -55767,9 +55767,9 @@ class Camera {
|
|
|
55767
55767
|
this.updateBoardPointer();
|
|
55768
55768
|
}
|
|
55769
55769
|
onWindowResize() {
|
|
55770
|
-
this.window.width =
|
|
55771
|
-
this.window.height =
|
|
55772
|
-
this.window.dpi =
|
|
55770
|
+
this.window.width = conf.getDocumentWidth();
|
|
55771
|
+
this.window.height = conf.getDocumentHeight();
|
|
55772
|
+
this.window.dpi = conf.getDPI();
|
|
55773
55773
|
this.resizeSubject.publish(this);
|
|
55774
55774
|
this.subject.publish(this);
|
|
55775
55775
|
}
|
|
@@ -55782,10 +55782,10 @@ class Camera {
|
|
|
55782
55782
|
let y = 0;
|
|
55783
55783
|
const { activeKeys } = keyboard;
|
|
55784
55784
|
const directions = {
|
|
55785
|
-
ArrowRight: [-
|
|
55786
|
-
ArrowLeft: [
|
|
55787
|
-
ArrowDown: [0, -
|
|
55788
|
-
ArrowUp: [0,
|
|
55785
|
+
ArrowRight: [-conf.NAVIGATION_STEP, 0],
|
|
55786
|
+
ArrowLeft: [conf.NAVIGATION_STEP, 0],
|
|
55787
|
+
ArrowDown: [0, -conf.NAVIGATION_STEP],
|
|
55788
|
+
ArrowUp: [0, conf.NAVIGATION_STEP]
|
|
55789
55789
|
};
|
|
55790
55790
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
55791
55791
|
if (activeArrowKeys.length === 2) {
|
|
@@ -56168,6 +56168,322 @@ function isHotkeyPushed(hotkey, event) {
|
|
|
56168
56168
|
}
|
|
56169
56169
|
// src/isMacos.ts
|
|
56170
56170
|
var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
56171
|
+
// src/Keyboard/hotkeys.json
|
|
56172
|
+
var hotkeys_default2 = {
|
|
56173
|
+
select: {
|
|
56174
|
+
key: {
|
|
56175
|
+
button: "KeyV"
|
|
56176
|
+
},
|
|
56177
|
+
label: {
|
|
56178
|
+
windows: "V",
|
|
56179
|
+
mac: "V"
|
|
56180
|
+
}
|
|
56181
|
+
},
|
|
56182
|
+
navigateMode: {
|
|
56183
|
+
key: {
|
|
56184
|
+
button: "Space"
|
|
56185
|
+
},
|
|
56186
|
+
label: {
|
|
56187
|
+
windows: "Space",
|
|
56188
|
+
mac: "Space"
|
|
56189
|
+
}
|
|
56190
|
+
},
|
|
56191
|
+
text: {
|
|
56192
|
+
key: {
|
|
56193
|
+
button: "KeyT"
|
|
56194
|
+
},
|
|
56195
|
+
label: {
|
|
56196
|
+
windows: "T",
|
|
56197
|
+
mac: "T"
|
|
56198
|
+
}
|
|
56199
|
+
},
|
|
56200
|
+
sticker: {
|
|
56201
|
+
key: {
|
|
56202
|
+
button: "KeyN"
|
|
56203
|
+
},
|
|
56204
|
+
label: {
|
|
56205
|
+
mac: "N",
|
|
56206
|
+
windows: "N"
|
|
56207
|
+
}
|
|
56208
|
+
},
|
|
56209
|
+
shape: {
|
|
56210
|
+
key: {
|
|
56211
|
+
button: "KeyS"
|
|
56212
|
+
},
|
|
56213
|
+
label: {
|
|
56214
|
+
mac: "S",
|
|
56215
|
+
windows: "S"
|
|
56216
|
+
}
|
|
56217
|
+
},
|
|
56218
|
+
connector: {
|
|
56219
|
+
key: {
|
|
56220
|
+
button: "KeyL"
|
|
56221
|
+
},
|
|
56222
|
+
label: {
|
|
56223
|
+
mac: "L",
|
|
56224
|
+
windows: "L"
|
|
56225
|
+
}
|
|
56226
|
+
},
|
|
56227
|
+
pen: {
|
|
56228
|
+
key: {
|
|
56229
|
+
button: "KeyP"
|
|
56230
|
+
},
|
|
56231
|
+
label: {
|
|
56232
|
+
mac: "P",
|
|
56233
|
+
windows: "P"
|
|
56234
|
+
}
|
|
56235
|
+
},
|
|
56236
|
+
eraser: {
|
|
56237
|
+
key: {
|
|
56238
|
+
button: "KeyE"
|
|
56239
|
+
},
|
|
56240
|
+
label: {
|
|
56241
|
+
mac: "E",
|
|
56242
|
+
windows: "E"
|
|
56243
|
+
}
|
|
56244
|
+
},
|
|
56245
|
+
frame: {
|
|
56246
|
+
key: {
|
|
56247
|
+
button: "KeyF"
|
|
56248
|
+
},
|
|
56249
|
+
label: {
|
|
56250
|
+
mac: "F",
|
|
56251
|
+
windows: "F"
|
|
56252
|
+
}
|
|
56253
|
+
},
|
|
56254
|
+
undo: {
|
|
56255
|
+
key: {
|
|
56256
|
+
button: "KeyZ",
|
|
56257
|
+
ctrl: true
|
|
56258
|
+
},
|
|
56259
|
+
label: {
|
|
56260
|
+
mac: "⌘Z",
|
|
56261
|
+
windows: "Ctrl + Z"
|
|
56262
|
+
}
|
|
56263
|
+
},
|
|
56264
|
+
redo: {
|
|
56265
|
+
key: {
|
|
56266
|
+
button: "KeyZ",
|
|
56267
|
+
ctrl: true,
|
|
56268
|
+
shift: true
|
|
56269
|
+
},
|
|
56270
|
+
label: {
|
|
56271
|
+
mac: "⌘⇧Z",
|
|
56272
|
+
windows: "Ctrl + Shift + Z"
|
|
56273
|
+
}
|
|
56274
|
+
},
|
|
56275
|
+
textBold: {
|
|
56276
|
+
key: {
|
|
56277
|
+
button: "KeyB",
|
|
56278
|
+
ctrl: true
|
|
56279
|
+
},
|
|
56280
|
+
label: {
|
|
56281
|
+
mac: "⌘B",
|
|
56282
|
+
windows: "Ctrl + B"
|
|
56283
|
+
}
|
|
56284
|
+
},
|
|
56285
|
+
textStrike: {
|
|
56286
|
+
key: {
|
|
56287
|
+
button: "KeyS",
|
|
56288
|
+
ctrl: true
|
|
56289
|
+
},
|
|
56290
|
+
label: {
|
|
56291
|
+
mac: "⌘S",
|
|
56292
|
+
windows: "Ctrl + S"
|
|
56293
|
+
}
|
|
56294
|
+
},
|
|
56295
|
+
textUnderline: {
|
|
56296
|
+
key: {
|
|
56297
|
+
button: "KeyU",
|
|
56298
|
+
ctrl: true
|
|
56299
|
+
},
|
|
56300
|
+
label: {
|
|
56301
|
+
mac: "⌘U",
|
|
56302
|
+
windows: "Ctrl + U"
|
|
56303
|
+
}
|
|
56304
|
+
},
|
|
56305
|
+
textItalic: {
|
|
56306
|
+
key: {
|
|
56307
|
+
button: "KeyI",
|
|
56308
|
+
ctrl: true
|
|
56309
|
+
},
|
|
56310
|
+
label: {
|
|
56311
|
+
mac: "⌘I",
|
|
56312
|
+
windows: "Ctrl + I"
|
|
56313
|
+
}
|
|
56314
|
+
},
|
|
56315
|
+
zoomOut: {
|
|
56316
|
+
key: {
|
|
56317
|
+
button: "Minus",
|
|
56318
|
+
ctrl: true
|
|
56319
|
+
},
|
|
56320
|
+
label: {
|
|
56321
|
+
mac: "⌘-",
|
|
56322
|
+
windows: "Ctrl + -"
|
|
56323
|
+
}
|
|
56324
|
+
},
|
|
56325
|
+
zoomIn: {
|
|
56326
|
+
key: {
|
|
56327
|
+
button: "Equal",
|
|
56328
|
+
ctrl: true
|
|
56329
|
+
},
|
|
56330
|
+
label: {
|
|
56331
|
+
mac: "⌘+",
|
|
56332
|
+
windows: "Ctrl + +"
|
|
56333
|
+
}
|
|
56334
|
+
},
|
|
56335
|
+
zoomDefault: {
|
|
56336
|
+
key: {
|
|
56337
|
+
button: "Digit0",
|
|
56338
|
+
ctrl: true
|
|
56339
|
+
},
|
|
56340
|
+
label: {
|
|
56341
|
+
mac: "⌘0",
|
|
56342
|
+
windows: "Ctrl + 0"
|
|
56343
|
+
}
|
|
56344
|
+
},
|
|
56345
|
+
duplicate: {
|
|
56346
|
+
key: {
|
|
56347
|
+
button: "KeyD",
|
|
56348
|
+
ctrl: true
|
|
56349
|
+
},
|
|
56350
|
+
label: {
|
|
56351
|
+
mac: "⌘D",
|
|
56352
|
+
windows: "Ctrl + D"
|
|
56353
|
+
}
|
|
56354
|
+
},
|
|
56355
|
+
bringToFront: {
|
|
56356
|
+
key: {
|
|
56357
|
+
button: "PageUp"
|
|
56358
|
+
},
|
|
56359
|
+
label: {
|
|
56360
|
+
mac: "fn↑ (PgUp)",
|
|
56361
|
+
windows: "PgUp"
|
|
56362
|
+
}
|
|
56363
|
+
},
|
|
56364
|
+
sendToBack: {
|
|
56365
|
+
key: {
|
|
56366
|
+
button: "PageDown"
|
|
56367
|
+
},
|
|
56368
|
+
label: {
|
|
56369
|
+
mac: "fn↓ (PgDn)",
|
|
56370
|
+
windows: "PgDn"
|
|
56371
|
+
}
|
|
56372
|
+
},
|
|
56373
|
+
delete: {
|
|
56374
|
+
key: {
|
|
56375
|
+
button: ["Delete", "Backspace"]
|
|
56376
|
+
},
|
|
56377
|
+
label: {
|
|
56378
|
+
mac: "Delete",
|
|
56379
|
+
windows: "Delete"
|
|
56380
|
+
}
|
|
56381
|
+
},
|
|
56382
|
+
cancel: {
|
|
56383
|
+
key: {
|
|
56384
|
+
button: "Escape"
|
|
56385
|
+
},
|
|
56386
|
+
label: {
|
|
56387
|
+
mac: "Esc",
|
|
56388
|
+
windows: "Esc"
|
|
56389
|
+
}
|
|
56390
|
+
},
|
|
56391
|
+
selectAll: {
|
|
56392
|
+
key: {
|
|
56393
|
+
button: "KeyA",
|
|
56394
|
+
ctrl: true
|
|
56395
|
+
},
|
|
56396
|
+
label: {
|
|
56397
|
+
mac: "⌘A",
|
|
56398
|
+
windows: "Ctrl + A"
|
|
56399
|
+
}
|
|
56400
|
+
},
|
|
56401
|
+
copy: {
|
|
56402
|
+
key: {
|
|
56403
|
+
button: "KeyC",
|
|
56404
|
+
ctrl: true
|
|
56405
|
+
},
|
|
56406
|
+
label: {
|
|
56407
|
+
mac: "⌘C",
|
|
56408
|
+
windows: "Ctrl + C"
|
|
56409
|
+
}
|
|
56410
|
+
},
|
|
56411
|
+
paste: {
|
|
56412
|
+
key: {
|
|
56413
|
+
button: "KeyV",
|
|
56414
|
+
ctrl: true
|
|
56415
|
+
},
|
|
56416
|
+
label: {
|
|
56417
|
+
mac: "⌘V",
|
|
56418
|
+
windows: "Ctrl + V"
|
|
56419
|
+
}
|
|
56420
|
+
},
|
|
56421
|
+
confirm: {
|
|
56422
|
+
key: {
|
|
56423
|
+
button: "Enter"
|
|
56424
|
+
},
|
|
56425
|
+
label: {
|
|
56426
|
+
mac: "⏎",
|
|
56427
|
+
windows: "⏎"
|
|
56428
|
+
}
|
|
56429
|
+
},
|
|
56430
|
+
frameNavigationNext: {
|
|
56431
|
+
key: {
|
|
56432
|
+
button: "ArrowRight",
|
|
56433
|
+
ctrl: true
|
|
56434
|
+
},
|
|
56435
|
+
label: {
|
|
56436
|
+
mac: "⌘→",
|
|
56437
|
+
windows: "Ctrl→"
|
|
56438
|
+
}
|
|
56439
|
+
},
|
|
56440
|
+
frameNavigationPrev: {
|
|
56441
|
+
key: {
|
|
56442
|
+
button: "ArrowLeft",
|
|
56443
|
+
ctrl: true
|
|
56444
|
+
},
|
|
56445
|
+
label: {
|
|
56446
|
+
mac: "⌘←",
|
|
56447
|
+
windows: "Ctrl←"
|
|
56448
|
+
}
|
|
56449
|
+
},
|
|
56450
|
+
navigationRight: {
|
|
56451
|
+
key: {
|
|
56452
|
+
button: "ArrowRight"
|
|
56453
|
+
},
|
|
56454
|
+
label: {
|
|
56455
|
+
mac: "→",
|
|
56456
|
+
windows: "→"
|
|
56457
|
+
}
|
|
56458
|
+
},
|
|
56459
|
+
navigationLeft: {
|
|
56460
|
+
key: {
|
|
56461
|
+
button: "ArrowLeft"
|
|
56462
|
+
},
|
|
56463
|
+
label: {
|
|
56464
|
+
mac: "←",
|
|
56465
|
+
windows: "←"
|
|
56466
|
+
}
|
|
56467
|
+
},
|
|
56468
|
+
navigationUp: {
|
|
56469
|
+
key: {
|
|
56470
|
+
button: "ArrowUp"
|
|
56471
|
+
},
|
|
56472
|
+
label: {
|
|
56473
|
+
mac: "↑",
|
|
56474
|
+
windows: "↑"
|
|
56475
|
+
}
|
|
56476
|
+
},
|
|
56477
|
+
navigationDown: {
|
|
56478
|
+
key: {
|
|
56479
|
+
button: "ArrowDown"
|
|
56480
|
+
},
|
|
56481
|
+
label: {
|
|
56482
|
+
mac: "↓",
|
|
56483
|
+
windows: "↓"
|
|
56484
|
+
}
|
|
56485
|
+
}
|
|
56486
|
+
};
|
|
56171
56487
|
|
|
56172
56488
|
// src/Keyboard/logHotkey.ts
|
|
56173
56489
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
@@ -56175,7 +56491,7 @@ function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
|
56175
56491
|
return;
|
|
56176
56492
|
}
|
|
56177
56493
|
const isFunction = typeof hotkeyConfig === "function";
|
|
56178
|
-
const hotkeyData =
|
|
56494
|
+
const hotkeyData = hotkeys_default2[hotkeyName];
|
|
56179
56495
|
switch (status) {
|
|
56180
56496
|
case "triggered":
|
|
56181
56497
|
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;");
|
|
@@ -56263,7 +56579,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
56263
56579
|
// src/Keyboard/getHotkeyLabel.ts
|
|
56264
56580
|
function getHotkeyLabel(hotkey) {
|
|
56265
56581
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
56266
|
-
switch (
|
|
56582
|
+
switch (conf.FORCE_HOTKEYS || "auto") {
|
|
56267
56583
|
case "windows":
|
|
56268
56584
|
return hotkeyLabel.windows;
|
|
56269
56585
|
case "macos":
|
|
@@ -58240,7 +58556,7 @@ class SpatialIndex {
|
|
|
58240
58556
|
this.itemsArray.push(item);
|
|
58241
58557
|
this.itemsIndex.insert(item);
|
|
58242
58558
|
}
|
|
58243
|
-
if (
|
|
58559
|
+
if (conf.isNode()) {
|
|
58244
58560
|
return;
|
|
58245
58561
|
}
|
|
58246
58562
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -59769,7 +60085,7 @@ class Transformer extends Tool {
|
|
|
59769
60085
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
59770
60086
|
if (mbr) {
|
|
59771
60087
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
59772
|
-
const selectionColor = isLockedItems ?
|
|
60088
|
+
const selectionColor = isLockedItems ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
59773
60089
|
mbr.borderColor = selectionColor;
|
|
59774
60090
|
mbr.render(context);
|
|
59775
60091
|
}
|
|
@@ -59795,7 +60111,7 @@ class Transformer extends Tool {
|
|
|
59795
60111
|
new Point(right, bottom)
|
|
59796
60112
|
];
|
|
59797
60113
|
for (const point7 of points) {
|
|
59798
|
-
const circle = new Anchor(point7.x, point7.y,
|
|
60114
|
+
const circle = new Anchor(point7.x, point7.y, conf.SELECTION_ANCHOR_RADIUS, conf.SELECTION_COLOR, conf.SELECTION_ANCHOR_COLOR, conf.SELECTION_ANCHOR_WIDTH);
|
|
59799
60115
|
anchors.push(circle);
|
|
59800
60116
|
}
|
|
59801
60117
|
}
|
|
@@ -60996,7 +61312,7 @@ class BoardSelection {
|
|
|
60996
61312
|
renderItemMbr(context, item, customScale) {
|
|
60997
61313
|
const mbr = item.getMbr();
|
|
60998
61314
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
60999
|
-
const selectionColor = item.transformation.isLocked ?
|
|
61315
|
+
const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
61000
61316
|
mbr.borderColor = selectionColor;
|
|
61001
61317
|
mbr.render(context);
|
|
61002
61318
|
}
|
|
@@ -61443,7 +61759,7 @@ class Board {
|
|
|
61443
61759
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
61444
61760
|
const css = INDEX_CSS;
|
|
61445
61761
|
const boardName = this.getName() || this.getBoardId();
|
|
61446
|
-
const items = this.items.getWholeHTML(
|
|
61762
|
+
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
61447
61763
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
61448
61764
|
const scripts = `
|
|
61449
61765
|
<script type="module">${customTagsScript}</script>
|
|
@@ -61483,7 +61799,7 @@ class Board {
|
|
|
61483
61799
|
return `${head}${body}`;
|
|
61484
61800
|
}
|
|
61485
61801
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
61486
|
-
const parser =
|
|
61802
|
+
const parser = conf.getDOMParser();
|
|
61487
61803
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
61488
61804
|
const items = doc.body.querySelector("#items");
|
|
61489
61805
|
if (items) {
|
|
@@ -61535,7 +61851,7 @@ class Board {
|
|
|
61535
61851
|
return [];
|
|
61536
61852
|
}
|
|
61537
61853
|
deserializeHTML(stringedHTML) {
|
|
61538
|
-
const parser =
|
|
61854
|
+
const parser = conf.getDOMParser();
|
|
61539
61855
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
61540
61856
|
const itemsDiv = doc.body.querySelector("#items");
|
|
61541
61857
|
if (!itemsDiv) {
|
|
@@ -62674,19 +62990,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
62674
62990
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
62675
62991
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
62676
62992
|
const transformed = { ...toTransform };
|
|
62677
|
-
const
|
|
62993
|
+
const conf2 = confirmed.path;
|
|
62678
62994
|
const path4 = transformed.path;
|
|
62679
|
-
if (Path3.equals(
|
|
62995
|
+
if (Path3.equals(conf2, path4)) {
|
|
62680
62996
|
return transformed;
|
|
62681
62997
|
}
|
|
62682
|
-
const isDescendant = path4.length >
|
|
62998
|
+
const isDescendant = path4.length > conf2.length && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
62683
62999
|
if (isDescendant) {
|
|
62684
63000
|
const newPath = [...path4];
|
|
62685
63001
|
newPath[0] = newPath[0] + 1;
|
|
62686
63002
|
transformed.path = newPath;
|
|
62687
63003
|
return transformed;
|
|
62688
63004
|
}
|
|
62689
|
-
if (Path3.isBefore(
|
|
63005
|
+
if (Path3.isBefore(conf2, path4)) {
|
|
62690
63006
|
transformPath(confirmed, transformed);
|
|
62691
63007
|
}
|
|
62692
63008
|
return transformed;
|
|
@@ -62695,23 +63011,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
62695
63011
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
62696
63012
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
62697
63013
|
const transformed = { ...toTransform };
|
|
62698
|
-
const
|
|
63014
|
+
const conf2 = confirmed.path;
|
|
62699
63015
|
const path4 = transformed.path;
|
|
62700
|
-
if (Path3.equals(
|
|
63016
|
+
if (Path3.equals(conf2, path4)) {
|
|
62701
63017
|
return transformed;
|
|
62702
63018
|
}
|
|
62703
|
-
if (path4.length ===
|
|
63019
|
+
if (path4.length === conf2.length + 1 && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
62704
63020
|
const newPath = [...path4];
|
|
62705
|
-
if (
|
|
63021
|
+
if (conf2.length === 1) {
|
|
62706
63022
|
newPath[0] = newPath[0] + 1;
|
|
62707
63023
|
} else {
|
|
62708
|
-
newPath[
|
|
63024
|
+
newPath[conf2.length] = newPath[conf2.length] + 1;
|
|
62709
63025
|
}
|
|
62710
63026
|
transformed.path = newPath;
|
|
62711
63027
|
return transformed;
|
|
62712
63028
|
}
|
|
62713
|
-
const isDescendant = path4.length >
|
|
62714
|
-
if (Path3.isBefore(
|
|
63029
|
+
const isDescendant = path4.length > conf2.length && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
63030
|
+
if (Path3.isBefore(conf2, path4) && !isDescendant) {
|
|
62715
63031
|
transformPath(confirmed, transformed);
|
|
62716
63032
|
}
|
|
62717
63033
|
return transformed;
|
|
@@ -63291,8 +63607,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
63291
63607
|
const transformed = [];
|
|
63292
63608
|
for (const transf of toTransform) {
|
|
63293
63609
|
let actualyTransformed = { ...transf };
|
|
63294
|
-
for (const
|
|
63295
|
-
const { operation: confOp } =
|
|
63610
|
+
for (const conf2 of confirmed) {
|
|
63611
|
+
const { operation: confOp } = conf2.body;
|
|
63296
63612
|
const { operation: transfOp } = actualyTransformed.body;
|
|
63297
63613
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
63298
63614
|
if (transformedOp) {
|
|
@@ -63924,7 +64240,7 @@ class Events2 {
|
|
|
63924
64240
|
return record !== null;
|
|
63925
64241
|
}
|
|
63926
64242
|
sendPresenceEvent(event) {
|
|
63927
|
-
|
|
64243
|
+
conf.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
63928
64244
|
}
|
|
63929
64245
|
canUndoEvent(op, byUserId) {
|
|
63930
64246
|
if (op.method === "undo") {
|
|
@@ -64025,9 +64341,9 @@ function handleChatChunk(chunk, board) {
|
|
|
64025
64341
|
default:
|
|
64026
64342
|
board.camera.unsubscribeFromItem();
|
|
64027
64343
|
if (!chunk.isExternalApiError) {
|
|
64028
|
-
|
|
64029
|
-
header:
|
|
64030
|
-
body:
|
|
64344
|
+
conf.notify({
|
|
64345
|
+
header: conf.i18n.t("AIInput.textGenerationError.header"),
|
|
64346
|
+
body: conf.i18n.t("AIInput.textGenerationError.body"),
|
|
64031
64347
|
variant: "error",
|
|
64032
64348
|
duration: 4000
|
|
64033
64349
|
});
|
|
@@ -64042,7 +64358,7 @@ function handleChatChunk(chunk, board) {
|
|
|
64042
64358
|
editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
64043
64359
|
if (chunk.isExternalApiError) {
|
|
64044
64360
|
editor.clearText();
|
|
64045
|
-
editor.insertCopiedText(
|
|
64361
|
+
editor.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
64046
64362
|
}
|
|
64047
64363
|
}
|
|
64048
64364
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -64069,7 +64385,7 @@ function handleAudioGenerate(response, board) {
|
|
|
64069
64385
|
}
|
|
64070
64386
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
64071
64387
|
const { left, top, right } = placeholderNode.getMbr();
|
|
64072
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
64388
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf.AUDIO_DIMENSIONS.width) / 2, top);
|
|
64073
64389
|
audio.updateMbr();
|
|
64074
64390
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
64075
64391
|
board.remove(placeholderNode, false);
|
|
@@ -64091,7 +64407,7 @@ function handleAudioGenerate(response, board) {
|
|
|
64091
64407
|
type: "audio/wav"
|
|
64092
64408
|
});
|
|
64093
64409
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
64094
|
-
const linkElem =
|
|
64410
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
64095
64411
|
linkElem.href = audioUrl2;
|
|
64096
64412
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
64097
64413
|
linkElem.click();
|
|
@@ -64110,9 +64426,9 @@ function handleAudioGenerate(response, board) {
|
|
|
64110
64426
|
board.selection.add(placeholderNode);
|
|
64111
64427
|
}
|
|
64112
64428
|
console.error("Audio generation error:", response.message);
|
|
64113
|
-
|
|
64114
|
-
header:
|
|
64115
|
-
body:
|
|
64429
|
+
conf.notify({
|
|
64430
|
+
header: conf.i18n.t("AIInput.audioGenerationError.header"),
|
|
64431
|
+
body: conf.i18n.t("AIInput.audioGenerationError.body"),
|
|
64116
64432
|
variant: "error",
|
|
64117
64433
|
duration: 4000
|
|
64118
64434
|
});
|
|
@@ -64175,14 +64491,14 @@ function handleImageGenerate(response, board) {
|
|
|
64175
64491
|
board.selection.add(item);
|
|
64176
64492
|
const editor = item.getRichText()?.editor;
|
|
64177
64493
|
editor?.clearText();
|
|
64178
|
-
editor?.insertCopiedText(
|
|
64494
|
+
editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
64179
64495
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
64180
64496
|
}
|
|
64181
64497
|
}
|
|
64182
64498
|
} else {
|
|
64183
|
-
|
|
64184
|
-
header:
|
|
64185
|
-
body:
|
|
64499
|
+
conf.notify({
|
|
64500
|
+
header: conf.i18n.t("AIInput.imageGenerationError.header"),
|
|
64501
|
+
body: conf.i18n.t("AIInput.imageGenerationError.body"),
|
|
64186
64502
|
variant: "error",
|
|
64187
64503
|
duration: 4000
|
|
64188
64504
|
});
|
|
@@ -64249,10 +64565,10 @@ function startIntervals(board) {
|
|
|
64249
64565
|
}
|
|
64250
64566
|
log.publishIntervalTimer = setInterval(() => {
|
|
64251
64567
|
tryPublishEvent(board);
|
|
64252
|
-
},
|
|
64568
|
+
}, conf.EVENTS_PUBLISH_INTERVAL);
|
|
64253
64569
|
log.resendIntervalTimer = setInterval(() => {
|
|
64254
64570
|
tryResendEvent(board);
|
|
64255
|
-
},
|
|
64571
|
+
}, conf.EVENTS_RESEND_INTERVAL);
|
|
64256
64572
|
}
|
|
64257
64573
|
function tryPublishEvent(board) {
|
|
64258
64574
|
const { log } = board.events;
|
|
@@ -64271,14 +64587,14 @@ function tryResendEvent(board) {
|
|
|
64271
64587
|
return;
|
|
64272
64588
|
}
|
|
64273
64589
|
const date = Date.now();
|
|
64274
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
64590
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf.EVENTS_RESEND_INTERVAL;
|
|
64275
64591
|
if (!isTimeToSendPendingEvent) {
|
|
64276
64592
|
return;
|
|
64277
64593
|
}
|
|
64278
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
64594
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf.EVENTS_RESEND_INTERVAL * 5;
|
|
64279
64595
|
if (isProbablyLostConnection) {
|
|
64280
64596
|
board.presence.clear();
|
|
64281
|
-
|
|
64597
|
+
conf.connection?.notifyAboutLostConnection();
|
|
64282
64598
|
}
|
|
64283
64599
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
64284
64600
|
}
|
|
@@ -64309,12 +64625,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
64309
64625
|
lastKnownOrder: log.getLastIndex()
|
|
64310
64626
|
}
|
|
64311
64627
|
};
|
|
64312
|
-
|
|
64628
|
+
conf.connection.send({
|
|
64313
64629
|
type: "BoardEvent",
|
|
64314
64630
|
boardId: board.getBoardId(),
|
|
64315
64631
|
event: toSend,
|
|
64316
64632
|
sequenceNumber,
|
|
64317
|
-
userId:
|
|
64633
|
+
userId: conf.connection.getCurrentUser()
|
|
64318
64634
|
});
|
|
64319
64635
|
const date = Date.now();
|
|
64320
64636
|
log.pendingEvent = {
|
|
@@ -64360,7 +64676,7 @@ function handleConfirmation(msg2, board) {
|
|
|
64360
64676
|
if (!isPendingEventConfirmation) {
|
|
64361
64677
|
return;
|
|
64362
64678
|
}
|
|
64363
|
-
|
|
64679
|
+
conf.connection?.dismissNotificationAboutLostConnection();
|
|
64364
64680
|
log.currentSequenceNumber++;
|
|
64365
64681
|
log.pendingEvent.event.order = msg2.order;
|
|
64366
64682
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -64372,7 +64688,7 @@ function handleConfirmation(msg2, board) {
|
|
|
64372
64688
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
64373
64689
|
function handleCreateSnapshotRequestMessage(msg2, board) {
|
|
64374
64690
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
64375
|
-
|
|
64691
|
+
conf.connection.send({
|
|
64376
64692
|
type: "BoardSnapshot",
|
|
64377
64693
|
boardId,
|
|
64378
64694
|
snapshot,
|
|
@@ -64403,9 +64719,9 @@ function handleModeMessage(message, board) {
|
|
|
64403
64719
|
if (isTemplateView()) {
|
|
64404
64720
|
return;
|
|
64405
64721
|
}
|
|
64406
|
-
|
|
64407
|
-
header:
|
|
64408
|
-
body: message.mode === "edit" ?
|
|
64722
|
+
conf.notify({
|
|
64723
|
+
header: conf.i18n.t("sharing.settingsChanged.heading"),
|
|
64724
|
+
body: message.mode === "edit" ? conf.i18n.t("sharing.settingsChanged.bodyEdit") : conf.i18n.t("sharing.settingsChanged.bodyView"),
|
|
64409
64725
|
duration: 5000
|
|
64410
64726
|
});
|
|
64411
64727
|
}
|
|
@@ -64441,8 +64757,8 @@ messageRouter.addHandler("PresenceEvent", handlePresenceEventMessage);
|
|
|
64441
64757
|
messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
64442
64758
|
// src/api/initI18N.ts
|
|
64443
64759
|
function initI18N(i18nInstance) {
|
|
64444
|
-
|
|
64445
|
-
|
|
64760
|
+
conf.i18n = i18nInstance;
|
|
64761
|
+
conf.planNames = {
|
|
64446
64762
|
basic: i18nInstance.t("userPlan.plans.basic.name"),
|
|
64447
64763
|
plus: i18nInstance.t("userPlan.plans.plus.name")
|
|
64448
64764
|
};
|
|
@@ -64451,7 +64767,7 @@ function initI18N(i18nInstance) {
|
|
|
64451
64767
|
// src/api/getMeasureCtx.ts
|
|
64452
64768
|
function getMeasureCtx() {
|
|
64453
64769
|
if (typeof document !== "undefined") {
|
|
64454
|
-
const measureCanvas =
|
|
64770
|
+
const measureCanvas = conf.documentFactory.createElement("canvas");
|
|
64455
64771
|
const measureCtx = measureCanvas.getContext("2d");
|
|
64456
64772
|
if (!measureCtx) {
|
|
64457
64773
|
throw new Error("Failde to create canvas and get 2d context");
|
|
@@ -64472,7 +64788,7 @@ function getBrowserDOMParser() {
|
|
|
64472
64788
|
|
|
64473
64789
|
// src/api/initPaths.ts
|
|
64474
64790
|
function initPaths(path2D) {
|
|
64475
|
-
|
|
64791
|
+
conf.EXPORT_FRAME_DECORATIONS = {
|
|
64476
64792
|
"top-left": {
|
|
64477
64793
|
path: new path2D("M13 1H1V13"),
|
|
64478
64794
|
lineWidth: 2,
|
|
@@ -64514,22 +64830,22 @@ function initPaths(path2D) {
|
|
|
64514
64830
|
|
|
64515
64831
|
// src/api/initBrowserSettings.ts
|
|
64516
64832
|
function initBrowserSettings() {
|
|
64517
|
-
|
|
64518
|
-
|
|
64519
|
-
|
|
64520
|
-
|
|
64521
|
-
|
|
64522
|
-
|
|
64523
|
-
|
|
64833
|
+
conf.documentFactory = new BrowserDocumentFactory;
|
|
64834
|
+
conf.path2DFactory = BrowserPath2D;
|
|
64835
|
+
conf.measureCtx = getMeasureCtx();
|
|
64836
|
+
conf.getDocumentWidth = () => document.documentElement.clientWidth;
|
|
64837
|
+
conf.getDocumentHeight = () => document.documentElement.clientHeight;
|
|
64838
|
+
conf.getDPI = () => window.devicePixelRatio;
|
|
64839
|
+
conf.getDOMParser = getBrowserDOMParser;
|
|
64524
64840
|
initPaths(BrowserPath2D);
|
|
64525
|
-
|
|
64841
|
+
conf.reactEditorFocus = (editor) => {
|
|
64526
64842
|
try {
|
|
64527
64843
|
ReactEditor.focus(editor);
|
|
64528
64844
|
} catch (e) {
|
|
64529
64845
|
console.warn("Failed to focus editor:", e);
|
|
64530
64846
|
}
|
|
64531
64847
|
};
|
|
64532
|
-
|
|
64848
|
+
conf.reactEditorToSlatePoint = (editor, domNode, offset, options) => {
|
|
64533
64849
|
try {
|
|
64534
64850
|
return ReactEditor.toSlatePoint(editor, [domNode, offset], options);
|
|
64535
64851
|
} catch (e) {
|
|
@@ -64537,7 +64853,7 @@ function initBrowserSettings() {
|
|
|
64537
64853
|
return null;
|
|
64538
64854
|
}
|
|
64539
64855
|
};
|
|
64540
|
-
return
|
|
64856
|
+
return conf;
|
|
64541
64857
|
}
|
|
64542
64858
|
|
|
64543
64859
|
// src/browser.ts
|
|
@@ -64603,7 +64919,7 @@ export {
|
|
|
64603
64919
|
defaultCursors as cursors,
|
|
64604
64920
|
createVideoItem,
|
|
64605
64921
|
createEvents,
|
|
64606
|
-
|
|
64922
|
+
conf,
|
|
64607
64923
|
checkHotkeys,
|
|
64608
64924
|
catmullRomInterpolate,
|
|
64609
64925
|
catchErrorResponse,
|