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/cjs/node.js
CHANGED
|
@@ -11828,7 +11828,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
11828
11828
|
return false;
|
|
11829
11829
|
};
|
|
11830
11830
|
};
|
|
11831
|
-
var
|
|
11831
|
+
var hotkeys = {
|
|
11832
11832
|
isBold: create2("bold"),
|
|
11833
11833
|
isCompose: create2("compose"),
|
|
11834
11834
|
isMoveBackward: create2("moveBackward"),
|
|
@@ -11959,7 +11959,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
11959
11959
|
exports2.EDITOR_TO_WINDOW = EDITOR_TO_WINDOW;
|
|
11960
11960
|
exports2.ELEMENT_TO_NODE = ELEMENT_TO_NODE;
|
|
11961
11961
|
exports2.HAS_BEFORE_INPUT_SUPPORT = HAS_BEFORE_INPUT_SUPPORT;
|
|
11962
|
-
exports2.Hotkeys =
|
|
11962
|
+
exports2.Hotkeys = hotkeys;
|
|
11963
11963
|
exports2.IS_ANDROID = IS_ANDROID;
|
|
11964
11964
|
exports2.IS_CHROME = IS_CHROME;
|
|
11965
11965
|
exports2.IS_COMPOSING = IS_COMPOSING;
|
|
@@ -17234,7 +17234,7 @@ __export(exports_node, {
|
|
|
17234
17234
|
cursors: () => defaultCursors,
|
|
17235
17235
|
createVideoItem: () => createVideoItem,
|
|
17236
17236
|
createEvents: () => createEvents,
|
|
17237
|
-
conf: () =>
|
|
17237
|
+
conf: () => conf,
|
|
17238
17238
|
checkHotkeys: () => checkHotkeys,
|
|
17239
17239
|
catmullRomInterpolate: () => catmullRomInterpolate,
|
|
17240
17240
|
catchErrorResponse: () => catchErrorResponse,
|
|
@@ -23237,20 +23237,20 @@ var resources = {
|
|
|
23237
23237
|
};
|
|
23238
23238
|
function initDefaultI18N() {
|
|
23239
23239
|
instance.use(Browser).init({
|
|
23240
|
-
debug:
|
|
23240
|
+
debug: conf.debug,
|
|
23241
23241
|
detection: {
|
|
23242
23242
|
order: ["navigator"]
|
|
23243
23243
|
},
|
|
23244
23244
|
supportedLngs: ["en", "ru"],
|
|
23245
23245
|
defaultNS,
|
|
23246
23246
|
resources,
|
|
23247
|
-
fallbackLng:
|
|
23247
|
+
fallbackLng: conf.FALLBACK_LNG,
|
|
23248
23248
|
interpolation: {
|
|
23249
23249
|
escapeValue: false
|
|
23250
23250
|
}
|
|
23251
23251
|
});
|
|
23252
|
-
|
|
23253
|
-
|
|
23252
|
+
conf.i18n = instance;
|
|
23253
|
+
conf.planNames = {
|
|
23254
23254
|
basic: instance.t("userPlan.plans.basic.name"),
|
|
23255
23255
|
plus: instance.t("userPlan.plans.plus.name")
|
|
23256
23256
|
};
|
|
@@ -23265,7 +23265,7 @@ var ExportQuality;
|
|
|
23265
23265
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
23266
23266
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
23267
23267
|
})(ExportQuality ||= {});
|
|
23268
|
-
var
|
|
23268
|
+
var conf = {
|
|
23269
23269
|
connection: undefined,
|
|
23270
23270
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
23271
23271
|
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
@@ -24313,7 +24313,7 @@ class DrawingContext {
|
|
|
24313
24313
|
this.setCamera(camera);
|
|
24314
24314
|
}
|
|
24315
24315
|
dpi() {
|
|
24316
|
-
return
|
|
24316
|
+
return conf.getDPI();
|
|
24317
24317
|
}
|
|
24318
24318
|
setCamera(camera) {
|
|
24319
24319
|
this.camera = camera;
|
|
@@ -24323,7 +24323,7 @@ class DrawingContext {
|
|
|
24323
24323
|
}
|
|
24324
24324
|
clear() {
|
|
24325
24325
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
24326
|
-
this.ctx.clearRect(0, 0,
|
|
24326
|
+
this.ctx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
24327
24327
|
this.matrix.applyToContext(this.ctx);
|
|
24328
24328
|
}
|
|
24329
24329
|
clearCursor() {
|
|
@@ -24331,7 +24331,7 @@ class DrawingContext {
|
|
|
24331
24331
|
return;
|
|
24332
24332
|
}
|
|
24333
24333
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
24334
|
-
this.cursorCtx.clearRect(0, 0,
|
|
24334
|
+
this.cursorCtx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
24335
24335
|
this.matrix.applyToContext(this.cursorCtx);
|
|
24336
24336
|
}
|
|
24337
24337
|
applyChanges() {
|
|
@@ -24434,7 +24434,7 @@ class Path {
|
|
|
24434
24434
|
this.width = this.getMbr().getWidth();
|
|
24435
24435
|
this.height = this.getMbr().getHeight();
|
|
24436
24436
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
24437
|
-
this.path2d = new
|
|
24437
|
+
this.path2d = new conf.path2DFactory;
|
|
24438
24438
|
this.updateCache();
|
|
24439
24439
|
}
|
|
24440
24440
|
getBackgroundColor() {
|
|
@@ -24511,7 +24511,7 @@ class Path {
|
|
|
24511
24511
|
this.y = top - this.paddingTop;
|
|
24512
24512
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
24513
24513
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
24514
|
-
const path2d = new
|
|
24514
|
+
const path2d = new conf.path2DFactory;
|
|
24515
24515
|
if (this.segments.length === 0) {
|
|
24516
24516
|
return;
|
|
24517
24517
|
}
|
|
@@ -25555,7 +25555,7 @@ var parsersHTML = {
|
|
|
25555
25555
|
"comment-item": parseHTMLComment
|
|
25556
25556
|
};
|
|
25557
25557
|
var decodeHtml = (htmlString) => {
|
|
25558
|
-
const parser =
|
|
25558
|
+
const parser = conf.getDOMParser();
|
|
25559
25559
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
25560
25560
|
return doc.documentElement.textContent || "";
|
|
25561
25561
|
};
|
|
@@ -25584,10 +25584,10 @@ function parseHTMLRichText(el, options) {
|
|
|
25584
25584
|
italic: node.style.fontStyle === "italic",
|
|
25585
25585
|
underline: node.style.textDecoration.includes("underline"),
|
|
25586
25586
|
"line-through": node.style.textDecoration.includes("line-through"),
|
|
25587
|
-
fontColor: node.style.color ||
|
|
25588
|
-
fontHighlight: node.style.backgroundColor ||
|
|
25589
|
-
fontSize: parseFloat(node.style.fontSize) ||
|
|
25590
|
-
fontFamily: node.style.fontFamily ||
|
|
25587
|
+
fontColor: node.style.color || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
25588
|
+
fontHighlight: node.style.backgroundColor || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
25589
|
+
fontSize: parseFloat(node.style.fontSize) || conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
25590
|
+
fontFamily: node.style.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily,
|
|
25591
25591
|
overline: false,
|
|
25592
25592
|
subscript: false,
|
|
25593
25593
|
superscript: false
|
|
@@ -25652,7 +25652,7 @@ function parseHTMLRichText(el, options) {
|
|
|
25652
25652
|
return {
|
|
25653
25653
|
type: "paragraph",
|
|
25654
25654
|
...extractCommonProps(),
|
|
25655
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
25655
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
25656
25656
|
children: children2
|
|
25657
25657
|
};
|
|
25658
25658
|
default:
|
|
@@ -26025,8 +26025,8 @@ class LinkTo {
|
|
|
26025
26025
|
const ctx = context.ctx;
|
|
26026
26026
|
ctx.save();
|
|
26027
26027
|
ctx.globalCompositeOperation = "destination-out";
|
|
26028
|
-
const size =
|
|
26029
|
-
const offset =
|
|
26028
|
+
const size = conf.LINK_BTN_SIZE / scale;
|
|
26029
|
+
const offset = conf.LINK_BTN_OFFSET / scale;
|
|
26030
26030
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
26031
26031
|
ctx.restore();
|
|
26032
26032
|
}
|
|
@@ -26177,7 +26177,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
26177
26177
|
} else if (node.type === "ul_list" && !listData) {
|
|
26178
26178
|
listData = { level: 0, isNumberedList: false };
|
|
26179
26179
|
}
|
|
26180
|
-
const listMarks =
|
|
26180
|
+
const listMarks = conf[getListMarkType((listData?.level || 0) + 1)];
|
|
26181
26181
|
for (let i = 0;i < data.children.length; i++) {
|
|
26182
26182
|
const child = structuredClone(data.children[i]);
|
|
26183
26183
|
switch (child.type) {
|
|
@@ -26582,8 +26582,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
26582
26582
|
rect2.height += paddingTop;
|
|
26583
26583
|
}
|
|
26584
26584
|
}
|
|
26585
|
-
|
|
26586
|
-
const measure =
|
|
26585
|
+
conf.measureCtx.font = style.font;
|
|
26586
|
+
const measure = conf.measureCtx.measureText(text);
|
|
26587
26587
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
26588
26588
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
26589
26589
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -35223,7 +35223,7 @@ var convertLinkNodeToTextNode = (node2) => {
|
|
|
35223
35223
|
const link = node2.link;
|
|
35224
35224
|
const text3 = node2.children.map((child) => child.text).join("");
|
|
35225
35225
|
return {
|
|
35226
|
-
...
|
|
35226
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
35227
35227
|
type: "text",
|
|
35228
35228
|
text: text3,
|
|
35229
35229
|
link,
|
|
@@ -35239,9 +35239,9 @@ function setNodeChildrenStyles({
|
|
|
35239
35239
|
horisontalAlignment,
|
|
35240
35240
|
node: node2
|
|
35241
35241
|
}) {
|
|
35242
|
-
let fontStyles =
|
|
35242
|
+
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
35243
35243
|
if (editor) {
|
|
35244
|
-
fontStyles = import_slate18.Editor.marks(editor) ||
|
|
35244
|
+
fontStyles = import_slate18.Editor.marks(editor) || conf.DEFAULT_TEXT_STYLES;
|
|
35245
35245
|
}
|
|
35246
35246
|
switch (node2.type) {
|
|
35247
35247
|
case "heading_one":
|
|
@@ -35273,7 +35273,7 @@ function setNodeChildrenStyles({
|
|
|
35273
35273
|
children.text += " ";
|
|
35274
35274
|
}
|
|
35275
35275
|
let fontColor = fontStyles.fontColor;
|
|
35276
|
-
if (fontColor ===
|
|
35276
|
+
if (fontColor === conf.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
35277
35277
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
35278
35278
|
}
|
|
35279
35279
|
return {
|
|
@@ -35343,7 +35343,7 @@ class MarkdownProcessor {
|
|
|
35343
35343
|
this.subject.publish(this);
|
|
35344
35344
|
return true;
|
|
35345
35345
|
}
|
|
35346
|
-
if (text3.startsWith(
|
|
35346
|
+
if (text3.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
35347
35347
|
return true;
|
|
35348
35348
|
}
|
|
35349
35349
|
const isPrevTextEmpty = isTextEmpty(this.editor.children);
|
|
@@ -35401,7 +35401,7 @@ class MarkdownProcessor {
|
|
|
35401
35401
|
return;
|
|
35402
35402
|
}
|
|
35403
35403
|
const prevText = this.getText()?.[this.getText().length - 1]?.children[0]?.text;
|
|
35404
|
-
if (prevText?.startsWith(
|
|
35404
|
+
if (prevText?.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
35405
35405
|
clearText(this.editor);
|
|
35406
35406
|
}
|
|
35407
35407
|
if (chunk.includes(`
|
|
@@ -36451,7 +36451,7 @@ class RichTextCommand {
|
|
|
36451
36451
|
item: id,
|
|
36452
36452
|
operation: {
|
|
36453
36453
|
...this.operation,
|
|
36454
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
36454
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
36455
36455
|
}
|
|
36456
36456
|
}));
|
|
36457
36457
|
case "setBlockType":
|
|
@@ -36475,7 +36475,7 @@ class RichTextCommand {
|
|
|
36475
36475
|
item: id,
|
|
36476
36476
|
operation: {
|
|
36477
36477
|
...this.operation,
|
|
36478
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
36478
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
36479
36479
|
}
|
|
36480
36480
|
}));
|
|
36481
36481
|
case "setFontSize":
|
|
@@ -36483,7 +36483,7 @@ class RichTextCommand {
|
|
|
36483
36483
|
item: id,
|
|
36484
36484
|
operation: {
|
|
36485
36485
|
...this.operation,
|
|
36486
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
36486
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf.DEFAULT_TEXT_STYLES.fontSize
|
|
36487
36487
|
}
|
|
36488
36488
|
}));
|
|
36489
36489
|
case "setFontHighlight":
|
|
@@ -36491,7 +36491,7 @@ class RichTextCommand {
|
|
|
36491
36491
|
item: id,
|
|
36492
36492
|
operation: {
|
|
36493
36493
|
...this.operation,
|
|
36494
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
36494
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf.DEFAULT_TEXT_STYLES.fontHighlight
|
|
36495
36495
|
}
|
|
36496
36496
|
}));
|
|
36497
36497
|
case "setHorisontalAlignment":
|
|
@@ -37729,7 +37729,7 @@ class RichText extends BaseItem {
|
|
|
37729
37729
|
isContainerSet = false;
|
|
37730
37730
|
isRenderEnabled = true;
|
|
37731
37731
|
layoutNodes;
|
|
37732
|
-
clipPath = new
|
|
37732
|
+
clipPath = new conf.path2DFactory;
|
|
37733
37733
|
updateRequired = false;
|
|
37734
37734
|
autoSizeScale = 1;
|
|
37735
37735
|
containerMaxWidth;
|
|
@@ -37744,7 +37744,7 @@ class RichText extends BaseItem {
|
|
|
37744
37744
|
shrinkWidth = false;
|
|
37745
37745
|
prevMbr = null;
|
|
37746
37746
|
rtCounter = 0;
|
|
37747
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText =
|
|
37747
|
+
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) {
|
|
37748
37748
|
super(board, id);
|
|
37749
37749
|
this.container = container;
|
|
37750
37750
|
this.transformation = transformation;
|
|
@@ -37878,11 +37878,11 @@ class RichText extends BaseItem {
|
|
|
37878
37878
|
return;
|
|
37879
37879
|
}
|
|
37880
37880
|
try {
|
|
37881
|
-
|
|
37881
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
37882
37882
|
} catch {}
|
|
37883
37883
|
};
|
|
37884
37884
|
updateElement = () => {
|
|
37885
|
-
if (
|
|
37885
|
+
if (conf.isNode()) {
|
|
37886
37886
|
return;
|
|
37887
37887
|
}
|
|
37888
37888
|
if (this.updateRequired) {
|
|
@@ -38011,7 +38011,7 @@ class RichText extends BaseItem {
|
|
|
38011
38011
|
const container = this.getTransformedContainer();
|
|
38012
38012
|
const width = container.getWidth();
|
|
38013
38013
|
const height = container.getHeight();
|
|
38014
|
-
this.clipPath = new
|
|
38014
|
+
this.clipPath = new conf.path2DFactory;
|
|
38015
38015
|
this.clipPath.rect(0, 0, width, height);
|
|
38016
38016
|
}
|
|
38017
38017
|
setContainer(container) {
|
|
@@ -38288,24 +38288,24 @@ class RichText extends BaseItem {
|
|
|
38288
38288
|
this.clearLastClickPoint();
|
|
38289
38289
|
const domMbr = ref.getBoundingClientRect();
|
|
38290
38290
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
38291
|
-
if (refMbr.isInside(point3) && (
|
|
38292
|
-
const domRange =
|
|
38293
|
-
const textNode =
|
|
38294
|
-
const offset =
|
|
38295
|
-
const slatePoint =
|
|
38291
|
+
if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
38292
|
+
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
38293
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
38294
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
38295
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
38296
38296
|
exactMatch: false,
|
|
38297
38297
|
suppressThrow: false
|
|
38298
38298
|
});
|
|
38299
38299
|
if (slatePoint) {
|
|
38300
38300
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
38301
38301
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
38302
|
-
|
|
38302
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
38303
38303
|
}
|
|
38304
38304
|
} else {
|
|
38305
|
-
if (!(
|
|
38305
|
+
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
38306
38306
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
38307
38307
|
}
|
|
38308
|
-
|
|
38308
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
38309
38309
|
}
|
|
38310
38310
|
}
|
|
38311
38311
|
}
|
|
@@ -38412,11 +38412,11 @@ class RichText extends BaseItem {
|
|
|
38412
38412
|
if (node2.type === "text" || "text" in node2) {
|
|
38413
38413
|
node2 = node2;
|
|
38414
38414
|
const text3 = node2.text.trim() !== "" ? decodeHtml(escapeHtml(node2.text)) : " ";
|
|
38415
|
-
const textElement = node2.link ? Object.assign(
|
|
38415
|
+
const textElement = node2.link ? Object.assign(conf.documentFactory.createElement("a"), {
|
|
38416
38416
|
href: node2.link,
|
|
38417
38417
|
target: "_blank",
|
|
38418
38418
|
rel: "noreferrer"
|
|
38419
|
-
}) :
|
|
38419
|
+
}) : conf.documentFactory.createElement("span");
|
|
38420
38420
|
Object.assign(textElement.style, {
|
|
38421
38421
|
fontWeight: node2.bold ? "700" : "400",
|
|
38422
38422
|
fontStyle: node2.italic ? "italic" : "",
|
|
@@ -38424,10 +38424,10 @@ class RichText extends BaseItem {
|
|
|
38424
38424
|
node2.underline ? "underline" : "",
|
|
38425
38425
|
node2["line-through"] ? "line-through" : ""
|
|
38426
38426
|
].filter(Boolean).join(" "),
|
|
38427
|
-
color: node2.fontColor ||
|
|
38428
|
-
backgroundColor: node2.fontHighlight ||
|
|
38429
|
-
fontSize: node2.fontSize ? `${node2.fontSize}px` : `${
|
|
38430
|
-
fontFamily: node2.fontFamily ||
|
|
38427
|
+
color: node2.fontColor || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
38428
|
+
backgroundColor: node2.fontHighlight || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
38429
|
+
fontSize: node2.fontSize ? `${node2.fontSize}px` : `${conf.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
38430
|
+
fontFamily: node2.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
38431
38431
|
});
|
|
38432
38432
|
if (this.insideOf === "Frame") {
|
|
38433
38433
|
Object.assign(textElement.style, {
|
|
@@ -38462,14 +38462,14 @@ class RichText extends BaseItem {
|
|
|
38462
38462
|
four: 4,
|
|
38463
38463
|
five: 5
|
|
38464
38464
|
};
|
|
38465
|
-
const header =
|
|
38465
|
+
const header = conf.documentFactory.createElement(`h${levels[level]}`);
|
|
38466
38466
|
applyCommonStyles(header);
|
|
38467
38467
|
header.append(...children);
|
|
38468
38468
|
return header;
|
|
38469
38469
|
}
|
|
38470
38470
|
case "code_block": {
|
|
38471
|
-
const pre =
|
|
38472
|
-
const code =
|
|
38471
|
+
const pre = conf.documentFactory.createElement("pre");
|
|
38472
|
+
const code = conf.documentFactory.createElement("code");
|
|
38473
38473
|
applyCommonStyles(pre);
|
|
38474
38474
|
if (node2.language) {
|
|
38475
38475
|
code.classList.add(`language-${node2.language}`);
|
|
@@ -38483,35 +38483,35 @@ class RichText extends BaseItem {
|
|
|
38483
38483
|
return pre;
|
|
38484
38484
|
}
|
|
38485
38485
|
case "block-quote": {
|
|
38486
|
-
const blockquote =
|
|
38486
|
+
const blockquote = conf.documentFactory.createElement("blockquote");
|
|
38487
38487
|
applyCommonStyles(blockquote);
|
|
38488
38488
|
blockquote.append(...children);
|
|
38489
38489
|
return blockquote;
|
|
38490
38490
|
}
|
|
38491
38491
|
case "ul_list": {
|
|
38492
|
-
const ul =
|
|
38492
|
+
const ul = conf.documentFactory.createElement("ul");
|
|
38493
38493
|
applyCommonStyles(ul);
|
|
38494
38494
|
ul.append(...children);
|
|
38495
38495
|
return ul;
|
|
38496
38496
|
}
|
|
38497
38497
|
case "ol_list": {
|
|
38498
|
-
const ol =
|
|
38498
|
+
const ol = conf.documentFactory.createElement("ol");
|
|
38499
38499
|
applyCommonStyles(ol);
|
|
38500
38500
|
ol.append(...children);
|
|
38501
38501
|
return ol;
|
|
38502
38502
|
}
|
|
38503
38503
|
case "list_item": {
|
|
38504
|
-
const li =
|
|
38504
|
+
const li = conf.documentFactory.createElement("li");
|
|
38505
38505
|
applyCommonStyles(li);
|
|
38506
38506
|
li.append(...children);
|
|
38507
38507
|
return li;
|
|
38508
38508
|
}
|
|
38509
38509
|
case "paragraph":
|
|
38510
38510
|
default: {
|
|
38511
|
-
const par =
|
|
38511
|
+
const par = conf.documentFactory.createElement("p");
|
|
38512
38512
|
applyCommonStyles(par);
|
|
38513
38513
|
Object.assign(par.style, {
|
|
38514
|
-
lineHeight: node2.lineHeight ? `${node2.lineHeight}` :
|
|
38514
|
+
lineHeight: node2.lineHeight ? `${node2.lineHeight}` : conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
38515
38515
|
margin: "0"
|
|
38516
38516
|
});
|
|
38517
38517
|
par.append(...children);
|
|
@@ -38519,7 +38519,7 @@ class RichText extends BaseItem {
|
|
|
38519
38519
|
}
|
|
38520
38520
|
}
|
|
38521
38521
|
}
|
|
38522
|
-
return
|
|
38522
|
+
return conf.documentFactory.createElement("div");
|
|
38523
38523
|
};
|
|
38524
38524
|
const escapeHtml = (unsafe) => {
|
|
38525
38525
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -51583,7 +51583,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
51583
51583
|
markdownString = String(file).trim();
|
|
51584
51584
|
}
|
|
51585
51585
|
let slateNodes = [];
|
|
51586
|
-
if (
|
|
51586
|
+
if (conf.URL_REGEX.test(text5)) {
|
|
51587
51587
|
slateNodes = [createLinkNode(text5)];
|
|
51588
51588
|
} else {
|
|
51589
51589
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -51599,7 +51599,7 @@ function createLinkNode(link2) {
|
|
|
51599
51599
|
type: "text",
|
|
51600
51600
|
link: link2,
|
|
51601
51601
|
text: link2,
|
|
51602
|
-
...
|
|
51602
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
51603
51603
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
51604
51604
|
};
|
|
51605
51605
|
}
|
|
@@ -51710,7 +51710,7 @@ class AINode extends BaseItem {
|
|
|
51710
51710
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
51711
51711
|
super(board, id);
|
|
51712
51712
|
this.id = id;
|
|
51713
|
-
this.buttonIcon =
|
|
51713
|
+
this.buttonIcon = conf.documentFactory.createElement("img");
|
|
51714
51714
|
this.buttonIcon.src = ICON_SRC;
|
|
51715
51715
|
this.contextItems = contextItems;
|
|
51716
51716
|
this.isUserRequest = isUserRequest;
|
|
@@ -52935,12 +52935,12 @@ class Connector2 extends BaseItem {
|
|
|
52935
52935
|
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
52936
52936
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
52937
52937
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
52938
|
-
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo,
|
|
52938
|
+
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf.i18n.t("connector.textPlaceholder", {
|
|
52939
52939
|
ns: "default"
|
|
52940
52940
|
}), true, false, "Connector", {
|
|
52941
|
-
...
|
|
52942
|
-
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) :
|
|
52943
|
-
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") :
|
|
52941
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
52942
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
52943
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf.DEFAULT_TEXT_STYLES.fontColor
|
|
52944
52944
|
});
|
|
52945
52945
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
52946
52946
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -53390,7 +53390,7 @@ class Connector2 extends BaseItem {
|
|
|
53390
53390
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
53391
53391
|
this.text.render(context);
|
|
53392
53392
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
53393
|
-
ctx.strokeStyle =
|
|
53393
|
+
ctx.strokeStyle = conf.SELECTION_COLOR;
|
|
53394
53394
|
ctx.lineWidth = 1;
|
|
53395
53395
|
ctx.beginPath();
|
|
53396
53396
|
ctx.rect(textMbr.left - TEXT_BORDER_PADDING, textMbr.top - TEXT_BORDER_PADDING, textMbr.getWidth() + TEXT_BORDER_PADDING * 2, textMbr.getHeight() + TEXT_BORDER_PADDING * 2);
|
|
@@ -53617,7 +53617,7 @@ class Connector2 extends BaseItem {
|
|
|
53617
53617
|
}
|
|
53618
53618
|
}
|
|
53619
53619
|
updatePaths() {
|
|
53620
|
-
if (
|
|
53620
|
+
if (conf.isNode()) {
|
|
53621
53621
|
return;
|
|
53622
53622
|
}
|
|
53623
53623
|
const startPoint = this.startPoint;
|
|
@@ -54428,7 +54428,7 @@ class DefaultShapeData {
|
|
|
54428
54428
|
text;
|
|
54429
54429
|
linkTo;
|
|
54430
54430
|
itemType = "Shape";
|
|
54431
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
54431
|
+
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) {
|
|
54432
54432
|
this.shapeType = shapeType;
|
|
54433
54433
|
this.backgroundColor = backgroundColor;
|
|
54434
54434
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -55626,7 +55626,7 @@ class Shape extends BaseItem {
|
|
|
55626
55626
|
this.text.updateElement();
|
|
55627
55627
|
}
|
|
55628
55628
|
transformPath() {
|
|
55629
|
-
if (
|
|
55629
|
+
if (conf.isNode()) {
|
|
55630
55630
|
return;
|
|
55631
55631
|
}
|
|
55632
55632
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -55819,7 +55819,7 @@ class Sticker extends BaseItem {
|
|
|
55819
55819
|
return this;
|
|
55820
55820
|
}
|
|
55821
55821
|
transformPath() {
|
|
55822
|
-
if (
|
|
55822
|
+
if (conf.isNode()) {
|
|
55823
55823
|
return;
|
|
55824
55824
|
}
|
|
55825
55825
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -56305,7 +56305,7 @@ class Frame extends BaseItem {
|
|
|
56305
56305
|
this.path = Frames[this.shapeType].path.copy();
|
|
56306
56306
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
56307
56307
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
56308
|
-
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...
|
|
56308
|
+
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 });
|
|
56309
56309
|
this.text.setSelectionHorisontalAlignment("left");
|
|
56310
56310
|
this.transformation.subject.subscribe(() => {
|
|
56311
56311
|
this.transformPath();
|
|
@@ -56851,10 +56851,10 @@ class Frame extends BaseItem {
|
|
|
56851
56851
|
}
|
|
56852
56852
|
// src/Items/Video/Video.ts
|
|
56853
56853
|
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";
|
|
56854
|
-
var videoIcon =
|
|
56854
|
+
var videoIcon = conf.documentFactory.createElement("img");
|
|
56855
56855
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
56856
56856
|
var createPlaceholderImage = (width2, height2) => {
|
|
56857
|
-
const canvas =
|
|
56857
|
+
const canvas = conf.documentFactory.createElement("canvas");
|
|
56858
56858
|
canvas.width = width2;
|
|
56859
56859
|
canvas.height = height2;
|
|
56860
56860
|
const ctx = canvas.getContext("2d");
|
|
@@ -56896,7 +56896,7 @@ class VideoItem extends BaseItem {
|
|
|
56896
56896
|
super(board, id);
|
|
56897
56897
|
this.events = events;
|
|
56898
56898
|
this.extension = extension2;
|
|
56899
|
-
this.isStorageUrl = !
|
|
56899
|
+
this.isStorageUrl = !conf.getYouTubeId(url);
|
|
56900
56900
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
56901
56901
|
this.linkTo = new LinkTo(this.id, events);
|
|
56902
56902
|
this.board = board;
|
|
@@ -57266,59 +57266,59 @@ async function fileTosha256(file) {
|
|
|
57266
57266
|
var catchErrorResponse = async (response, mediaType) => {
|
|
57267
57267
|
if (response.status === 403) {
|
|
57268
57268
|
const data = await response.json();
|
|
57269
|
-
let errorBody =
|
|
57269
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
57270
57270
|
if (!data.isOwnerRequest) {
|
|
57271
|
-
errorBody =
|
|
57271
|
+
errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
57272
57272
|
} else if (data.currentUsage && data.storageLimit) {
|
|
57273
|
-
errorBody =
|
|
57273
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
57274
57274
|
}
|
|
57275
|
-
|
|
57275
|
+
conf.notify({
|
|
57276
57276
|
variant: "warning",
|
|
57277
|
-
header:
|
|
57277
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
57278
57278
|
body: errorBody,
|
|
57279
57279
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
57280
|
-
text:
|
|
57281
|
-
onClick: () =>
|
|
57280
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
57281
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
57282
57282
|
} : undefined,
|
|
57283
57283
|
duration: 8000
|
|
57284
57284
|
});
|
|
57285
57285
|
} else if (response.status === 413) {
|
|
57286
57286
|
const data = await response.json();
|
|
57287
|
-
let errorBody =
|
|
57287
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
57288
57288
|
let isBasicPlan = false;
|
|
57289
57289
|
if (data.fileSizeLimit && data.fileSize) {
|
|
57290
57290
|
if (mediaType === "image") {
|
|
57291
57291
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
57292
|
-
errorBody =
|
|
57292
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
57293
57293
|
} else {
|
|
57294
57294
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
57295
|
-
errorBody =
|
|
57295
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
57296
57296
|
}
|
|
57297
57297
|
}
|
|
57298
|
-
|
|
57298
|
+
conf.notify({
|
|
57299
57299
|
variant: "warning",
|
|
57300
|
-
header:
|
|
57300
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
57301
57301
|
body: errorBody,
|
|
57302
57302
|
button: isBasicPlan ? {
|
|
57303
|
-
text:
|
|
57304
|
-
onClick: () =>
|
|
57303
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
57304
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
57305
57305
|
} : undefined,
|
|
57306
57306
|
duration: 4000
|
|
57307
57307
|
});
|
|
57308
57308
|
} else if (response.status === 401) {
|
|
57309
|
-
|
|
57309
|
+
conf.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
57310
57310
|
} else if (response.status === 415) {
|
|
57311
|
-
|
|
57311
|
+
conf.notify({
|
|
57312
57312
|
variant: "warning",
|
|
57313
|
-
header:
|
|
57314
|
-
body:
|
|
57313
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
57314
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
57315
57315
|
duration: 4000
|
|
57316
57316
|
});
|
|
57317
57317
|
} else {
|
|
57318
|
-
|
|
57318
|
+
conf.notify({
|
|
57319
57319
|
variant: "error",
|
|
57320
|
-
header:
|
|
57321
|
-
body:
|
|
57320
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
57321
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
57322
57322
|
duration: 4000
|
|
57323
57323
|
});
|
|
57324
57324
|
}
|
|
@@ -57326,17 +57326,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
57326
57326
|
};
|
|
57327
57327
|
var catchDuplicateErrorResponse = async (response) => {
|
|
57328
57328
|
if (response.status === 403) {
|
|
57329
|
-
|
|
57329
|
+
conf.notify({
|
|
57330
57330
|
variant: "warning",
|
|
57331
|
-
header:
|
|
57332
|
-
body:
|
|
57331
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
57332
|
+
body: conf.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
57333
57333
|
duration: 4000
|
|
57334
57334
|
});
|
|
57335
57335
|
} else {
|
|
57336
|
-
|
|
57336
|
+
conf.notify({
|
|
57337
57337
|
variant: "error",
|
|
57338
|
-
header:
|
|
57339
|
-
body:
|
|
57338
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
57339
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
57340
57340
|
duration: 4000
|
|
57341
57341
|
});
|
|
57342
57342
|
}
|
|
@@ -57344,40 +57344,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
57344
57344
|
};
|
|
57345
57345
|
var validateMediaFile = (file, account2) => {
|
|
57346
57346
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
57347
|
-
if (!file.type.startsWith("image") && !
|
|
57348
|
-
|
|
57347
|
+
if (!file.type.startsWith("image") && !conf.AUDIO_FORMATS.includes(fileExtension) && !conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
57348
|
+
conf.notify({
|
|
57349
57349
|
variant: "warning",
|
|
57350
|
-
header:
|
|
57351
|
-
body:
|
|
57350
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
57351
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
57352
57352
|
duration: 4000
|
|
57353
57353
|
});
|
|
57354
57354
|
return false;
|
|
57355
57355
|
}
|
|
57356
57356
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
57357
|
-
let errorBody =
|
|
57358
|
-
if (
|
|
57359
|
-
errorBody =
|
|
57357
|
+
let errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
57358
|
+
if (conf.AUDIO_FORMATS.includes(fileExtension) || conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
57359
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
57360
57360
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
57361
|
-
|
|
57361
|
+
conf.notify({
|
|
57362
57362
|
variant: "warning",
|
|
57363
|
-
header:
|
|
57363
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
57364
57364
|
body: errorBody,
|
|
57365
57365
|
button: isBasicPlan ? {
|
|
57366
|
-
text:
|
|
57367
|
-
onClick: () =>
|
|
57366
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
57367
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
57368
57368
|
} : undefined,
|
|
57369
57369
|
duration: 4000
|
|
57370
57370
|
});
|
|
57371
57371
|
return false;
|
|
57372
57372
|
}
|
|
57373
57373
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
57374
|
-
|
|
57374
|
+
conf.notify({
|
|
57375
57375
|
variant: "warning",
|
|
57376
|
-
header:
|
|
57376
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
57377
57377
|
body: errorBody,
|
|
57378
57378
|
button: isBasicPlan ? {
|
|
57379
|
-
text:
|
|
57380
|
-
onClick: () =>
|
|
57379
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
57380
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
57381
57381
|
} : undefined,
|
|
57382
57382
|
duration: 4000
|
|
57383
57383
|
});
|
|
@@ -57456,7 +57456,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
57456
57456
|
};
|
|
57457
57457
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
57458
57458
|
image2.onload = async () => {
|
|
57459
|
-
const parser =
|
|
57459
|
+
const parser = conf.getDOMParser();
|
|
57460
57460
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
57461
57461
|
const svgElement = svgDoc.documentElement;
|
|
57462
57462
|
svgElement.removeAttribute("width");
|
|
@@ -57668,8 +57668,8 @@ class AudioItem extends BaseItem {
|
|
|
57668
57668
|
this.subject.publish(this);
|
|
57669
57669
|
});
|
|
57670
57670
|
this.transformation.subject.subscribe(this.onTransform);
|
|
57671
|
-
this.right = this.left +
|
|
57672
|
-
this.bottom = this.top +
|
|
57671
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width;
|
|
57672
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height;
|
|
57673
57673
|
this.shouldUseCustomRender = true;
|
|
57674
57674
|
}
|
|
57675
57675
|
setCurrentTime(time) {
|
|
@@ -57738,8 +57738,8 @@ class AudioItem extends BaseItem {
|
|
|
57738
57738
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
57739
57739
|
this.left = translateX;
|
|
57740
57740
|
this.top = translateY;
|
|
57741
|
-
this.right = this.left +
|
|
57742
|
-
this.bottom = this.top +
|
|
57741
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width * scaleX;
|
|
57742
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height * scaleY;
|
|
57743
57743
|
}
|
|
57744
57744
|
render(context) {
|
|
57745
57745
|
if (this.transformationRenderBlock) {
|
|
@@ -57768,8 +57768,8 @@ class AudioItem extends BaseItem {
|
|
|
57768
57768
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
57769
57769
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
57770
57770
|
div.id = this.getId();
|
|
57771
|
-
div.style.width = `${
|
|
57772
|
-
div.style.height = `${
|
|
57771
|
+
div.style.width = `${conf.AUDIO_DIMENSIONS.width}px`;
|
|
57772
|
+
div.style.height = `${conf.AUDIO_DIMENSIONS.height}px`;
|
|
57773
57773
|
div.style.transformOrigin = "top left";
|
|
57774
57774
|
div.style.transform = transform;
|
|
57775
57775
|
div.style.position = "absolute";
|
|
@@ -57888,7 +57888,7 @@ class AudioItem extends BaseItem {
|
|
|
57888
57888
|
}
|
|
57889
57889
|
download() {
|
|
57890
57890
|
if (this.extension) {
|
|
57891
|
-
const linkElem =
|
|
57891
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
57892
57892
|
linkElem.href = this.url;
|
|
57893
57893
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
57894
57894
|
linkElem.click();
|
|
@@ -58229,7 +58229,7 @@ class Placeholder extends BaseItem {
|
|
|
58229
58229
|
}
|
|
58230
58230
|
// src/Items/Image/Image.ts
|
|
58231
58231
|
function getPlaceholderImage(board, imageDimension) {
|
|
58232
|
-
const placeholderCanvas =
|
|
58232
|
+
const placeholderCanvas = conf.documentFactory.createElement("canvas");
|
|
58233
58233
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
58234
58234
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
58235
58235
|
const placeholder = new Placeholder;
|
|
@@ -58510,7 +58510,7 @@ class Drawing extends BaseItem {
|
|
|
58510
58510
|
itemType = "Drawing";
|
|
58511
58511
|
parent = "Board";
|
|
58512
58512
|
transformation;
|
|
58513
|
-
path2d = new
|
|
58513
|
+
path2d = new conf.path2DFactory;
|
|
58514
58514
|
subject = new Subject;
|
|
58515
58515
|
untransformedMbr = new Mbr;
|
|
58516
58516
|
lines = [];
|
|
@@ -58585,7 +58585,7 @@ class Drawing extends BaseItem {
|
|
|
58585
58585
|
this.bottom = mbr.bottom;
|
|
58586
58586
|
}
|
|
58587
58587
|
updatePath2d() {
|
|
58588
|
-
this.path2d = new
|
|
58588
|
+
this.path2d = new conf.path2DFactory;
|
|
58589
58589
|
const context = this.path2d;
|
|
58590
58590
|
const points = this.points;
|
|
58591
58591
|
if (points.length < 3) {
|
|
@@ -59837,14 +59837,14 @@ class AddConnector extends BoardTool {
|
|
|
59837
59837
|
class AddDrawing extends BoardTool {
|
|
59838
59838
|
drawing = null;
|
|
59839
59839
|
isDown = false;
|
|
59840
|
-
strokeWidth =
|
|
59841
|
-
strokeColor =
|
|
59842
|
-
strokeStyle =
|
|
59840
|
+
strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
|
|
59841
|
+
strokeColor = conf.PEN_DEFAULT_COLOR;
|
|
59842
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
59843
59843
|
constructor(board) {
|
|
59844
59844
|
super(board);
|
|
59845
59845
|
this.setCursor();
|
|
59846
|
-
if (
|
|
59847
|
-
const drawingSettings = localStorage.getItem(
|
|
59846
|
+
if (conf.PEN_SETTINGS_KEY) {
|
|
59847
|
+
const drawingSettings = localStorage.getItem(conf.PEN_SETTINGS_KEY);
|
|
59848
59848
|
if (drawingSettings) {
|
|
59849
59849
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
59850
59850
|
this.strokeWidth = strokeWidth;
|
|
@@ -59854,7 +59854,7 @@ class AddDrawing extends BoardTool {
|
|
|
59854
59854
|
}
|
|
59855
59855
|
}
|
|
59856
59856
|
updateSettings() {
|
|
59857
|
-
localStorage.setItem(
|
|
59857
|
+
localStorage.setItem(conf.PEN_SETTINGS_KEY, JSON.stringify({
|
|
59858
59858
|
strokeWidth: this.strokeWidth,
|
|
59859
59859
|
strokeColor: this.strokeColor,
|
|
59860
59860
|
strokeStyle: this.strokeStyle
|
|
@@ -59884,7 +59884,7 @@ class AddDrawing extends BoardTool {
|
|
|
59884
59884
|
ctx.beginPath();
|
|
59885
59885
|
ctx.arc(point5.x, point5.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
59886
59886
|
ctx.lineWidth = 1;
|
|
59887
|
-
ctx.strokeStyle =
|
|
59887
|
+
ctx.strokeStyle = conf.PEN_POINTER_CIRCLE_COLOR;
|
|
59888
59888
|
ctx.stroke();
|
|
59889
59889
|
}
|
|
59890
59890
|
setCursor() {
|
|
@@ -59966,7 +59966,7 @@ class AddDrawing extends BoardTool {
|
|
|
59966
59966
|
this.setCursor();
|
|
59967
59967
|
};
|
|
59968
59968
|
render(context) {
|
|
59969
|
-
if (
|
|
59969
|
+
if (conf.PEN_RENDER_POINTER_CIRCLE) {
|
|
59970
59970
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
59971
59971
|
}
|
|
59972
59972
|
if (!this.drawing) {
|
|
@@ -59981,14 +59981,14 @@ class AddDrawing extends BoardTool {
|
|
|
59981
59981
|
}
|
|
59982
59982
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
59983
59983
|
class AddHighlighter extends AddDrawing {
|
|
59984
|
-
strokeWidth =
|
|
59985
|
-
strokeColor =
|
|
59986
|
-
strokeStyle =
|
|
59984
|
+
strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
59985
|
+
strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
|
|
59986
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
59987
59987
|
constructor(board) {
|
|
59988
59988
|
super(board);
|
|
59989
59989
|
this.setCursor();
|
|
59990
|
-
if (
|
|
59991
|
-
const highlighterSettings = localStorage.getItem(
|
|
59990
|
+
if (conf.HIGHLIGHTER_SETTINGS_KEY) {
|
|
59991
|
+
const highlighterSettings = localStorage.getItem(conf.HIGHLIGHTER_SETTINGS_KEY);
|
|
59992
59992
|
if (highlighterSettings) {
|
|
59993
59993
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
59994
59994
|
this.strokeWidth = strokeWidth;
|
|
@@ -60001,7 +60001,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
60001
60001
|
return true;
|
|
60002
60002
|
}
|
|
60003
60003
|
updateSettings() {
|
|
60004
|
-
localStorage.setItem(
|
|
60004
|
+
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
60005
60005
|
strokeWidth: this.strokeWidth,
|
|
60006
60006
|
strokeColor: this.strokeColor,
|
|
60007
60007
|
strokeStyle: this.strokeStyle
|
|
@@ -60325,7 +60325,7 @@ class AddShape extends BoardTool {
|
|
|
60325
60325
|
const point5 = this.board.pointer.point;
|
|
60326
60326
|
this.line = new Line(point5.copy(), point5.copy());
|
|
60327
60327
|
this.bounds = this.line.getMbr();
|
|
60328
|
-
this.bounds.borderColor =
|
|
60328
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60329
60329
|
this.shape.apply({
|
|
60330
60330
|
class: "Shape",
|
|
60331
60331
|
method: "setShapeType",
|
|
@@ -60349,7 +60349,7 @@ class AddShape extends BoardTool {
|
|
|
60349
60349
|
}
|
|
60350
60350
|
this.line = new Line(startPoint, endPoint);
|
|
60351
60351
|
this.bounds = this.line.getMbr();
|
|
60352
|
-
this.bounds.borderColor =
|
|
60352
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60353
60353
|
this.initTransformation();
|
|
60354
60354
|
this.board.tools.publish();
|
|
60355
60355
|
return true;
|
|
@@ -60421,7 +60421,7 @@ class AddShape extends BoardTool {
|
|
|
60421
60421
|
const y = (top + bottom) / 2 - 50;
|
|
60422
60422
|
this.bounds = new Mbr(x, y, x, y);
|
|
60423
60423
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
60424
|
-
this.bounds.borderColor =
|
|
60424
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60425
60425
|
this.shape.apply({
|
|
60426
60426
|
class: "Shape",
|
|
60427
60427
|
method: "setShapeType",
|
|
@@ -60454,8 +60454,8 @@ class AddSticker extends BoardTool {
|
|
|
60454
60454
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
60455
60455
|
}
|
|
60456
60456
|
setCursor(color2) {
|
|
60457
|
-
if (
|
|
60458
|
-
const colorName = color2 ?
|
|
60457
|
+
if (conf.STICKER_COLOR_NAMES) {
|
|
60458
|
+
const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
60459
60459
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
60460
60460
|
} else {
|
|
60461
60461
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -60479,7 +60479,7 @@ class AddSticker extends BoardTool {
|
|
|
60479
60479
|
const point5 = this.board.pointer.point;
|
|
60480
60480
|
this.line = new Line(point5.copy(), point5.copy());
|
|
60481
60481
|
this.bounds = this.line.getMbr();
|
|
60482
|
-
this.bounds.borderColor =
|
|
60482
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60483
60483
|
this.board.tools.publish();
|
|
60484
60484
|
return true;
|
|
60485
60485
|
}
|
|
@@ -60488,7 +60488,7 @@ class AddSticker extends BoardTool {
|
|
|
60488
60488
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
60489
60489
|
this.sticker.applyDiagonal(this.line);
|
|
60490
60490
|
this.bounds = this.sticker.getMbr();
|
|
60491
|
-
this.bounds.borderColor =
|
|
60491
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60492
60492
|
this.board.tools.publish();
|
|
60493
60493
|
return true;
|
|
60494
60494
|
}
|
|
@@ -60588,7 +60588,7 @@ class AddText extends BoardTool {
|
|
|
60588
60588
|
const point5 = this.board.pointer.point;
|
|
60589
60589
|
this.line = new Line(point5.copy(), point5.copy());
|
|
60590
60590
|
this.bounds = this.line.getMbr();
|
|
60591
|
-
this.bounds.borderColor =
|
|
60591
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60592
60592
|
this.board.tools.publish();
|
|
60593
60593
|
return true;
|
|
60594
60594
|
}
|
|
@@ -60599,7 +60599,7 @@ class AddText extends BoardTool {
|
|
|
60599
60599
|
const end = new Point(cursorPoint.x, start.y + height2);
|
|
60600
60600
|
this.line = new Line(start, end);
|
|
60601
60601
|
this.bounds = this.line.getMbr();
|
|
60602
|
-
this.bounds.borderColor =
|
|
60602
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60603
60603
|
this.board.tools.publish();
|
|
60604
60604
|
return true;
|
|
60605
60605
|
}
|
|
@@ -60664,11 +60664,11 @@ class AddText extends BoardTool {
|
|
|
60664
60664
|
class Eraser extends BoardTool {
|
|
60665
60665
|
itemType = "Eraser";
|
|
60666
60666
|
isDown = false;
|
|
60667
|
-
strokeWidth =
|
|
60668
|
-
strokeColor =
|
|
60669
|
-
strokeStyle =
|
|
60667
|
+
strokeWidth = conf.ERASER_STROKE_WIDTH;
|
|
60668
|
+
strokeColor = conf.ERASER_DEFAULT_COLOR;
|
|
60669
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
60670
60670
|
drawing = new Drawing(this.board, []);
|
|
60671
|
-
maxPointsInLine =
|
|
60671
|
+
maxPointsInLine = conf.ERASER_MAX_LINE_LENGTH;
|
|
60672
60672
|
constructor(board) {
|
|
60673
60673
|
super(board);
|
|
60674
60674
|
this.setCursor();
|
|
@@ -60804,8 +60804,8 @@ function getResizeType(cursorPoint, cameraScale, mbr, anchorDistance = 5) {
|
|
|
60804
60804
|
|
|
60805
60805
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
60806
60806
|
function getDecorationResizeType(point5, mbr, tolerance = 10) {
|
|
60807
|
-
for (const key in
|
|
60808
|
-
const decoration =
|
|
60807
|
+
for (const key in conf.EXPORT_FRAME_DECORATIONS) {
|
|
60808
|
+
const decoration = conf.EXPORT_FRAME_DECORATIONS[key];
|
|
60809
60809
|
const decorationBounds = {
|
|
60810
60810
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
60811
60811
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -60846,7 +60846,7 @@ class ExportSnapshot extends Tool {
|
|
|
60846
60846
|
super();
|
|
60847
60847
|
this.board = board;
|
|
60848
60848
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
60849
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
60849
|
+
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);
|
|
60850
60850
|
this.board.selection.disable();
|
|
60851
60851
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
60852
60852
|
}
|
|
@@ -60858,11 +60858,11 @@ class ExportSnapshot extends Tool {
|
|
|
60858
60858
|
resize() {
|
|
60859
60859
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
60860
60860
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
60861
|
-
if (resize.mbr.getWidth() >
|
|
60861
|
+
if (resize.mbr.getWidth() > conf.EXPORT_MIN_WIDTH) {
|
|
60862
60862
|
this.mbr.left = resize.mbr.left;
|
|
60863
60863
|
this.mbr.right = resize.mbr.right;
|
|
60864
60864
|
}
|
|
60865
|
-
if (resize.mbr.getHeight() >
|
|
60865
|
+
if (resize.mbr.getHeight() > conf.EXPORT_MIN_HEIGHT) {
|
|
60866
60866
|
this.mbr.top = resize.mbr.top;
|
|
60867
60867
|
this.mbr.bottom = resize.mbr.bottom;
|
|
60868
60868
|
}
|
|
@@ -60951,7 +60951,7 @@ class ExportSnapshot extends Tool {
|
|
|
60951
60951
|
}
|
|
60952
60952
|
const res = await exportBoardSnapshot({
|
|
60953
60953
|
board: this.board,
|
|
60954
|
-
bgColor:
|
|
60954
|
+
bgColor: conf.CANVAS_BG_COLOR,
|
|
60955
60955
|
selection: this.mbr,
|
|
60956
60956
|
upscaleTo: 4000,
|
|
60957
60957
|
nameToExport: this.board.getName()
|
|
@@ -60975,18 +60975,18 @@ class ExportSnapshot extends Tool {
|
|
|
60975
60975
|
const cameraMbr = context.camera.getMbr();
|
|
60976
60976
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
60977
60977
|
this.tempDrawingContext.clear();
|
|
60978
|
-
cameraMbr.backgroundColor =
|
|
60978
|
+
cameraMbr.backgroundColor = conf.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
60979
60979
|
cameraMbr.strokeWidth = 0;
|
|
60980
60980
|
cameraMbr.render(this.tempDrawingContext);
|
|
60981
60981
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
60982
|
-
if (
|
|
60983
|
-
const topLeft =
|
|
60982
|
+
if (conf.EXPORT_FRAME_DECORATIONS) {
|
|
60983
|
+
const topLeft = conf.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
60984
60984
|
this.renderDecoration(this.tempDrawingContext, topLeft.path, this.mbr.left + (topLeft.offsetX ?? 0), this.mbr.top + (topLeft.offsetY ?? 0), topLeft.color, topLeft.lineWidth);
|
|
60985
|
-
const topRight =
|
|
60985
|
+
const topRight = conf.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
60986
60986
|
this.renderDecoration(this.tempDrawingContext, topRight.path, this.mbr.right + (topRight.offsetX ?? 0), this.mbr.top + (topRight.offsetY ?? 0), topRight.color, topRight.lineWidth);
|
|
60987
|
-
const bottomLeft =
|
|
60987
|
+
const bottomLeft = conf.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
60988
60988
|
this.renderDecoration(this.tempDrawingContext, bottomLeft.path, this.mbr.left + (bottomLeft.offsetX ?? 0), this.mbr.bottom + (bottomLeft.offsetY ?? 0), bottomLeft.color, bottomLeft.lineWidth);
|
|
60989
|
-
const bottomRight =
|
|
60989
|
+
const bottomRight = conf.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
60990
60990
|
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);
|
|
60991
60991
|
}
|
|
60992
60992
|
}
|
|
@@ -61088,7 +61088,7 @@ function createCanvasDrawer(board) {
|
|
|
61088
61088
|
borderDiv.id = "canvasBorder";
|
|
61089
61089
|
borderDiv.style.position = "absolute";
|
|
61090
61090
|
borderDiv.style.transformOrigin = "left top";
|
|
61091
|
-
borderDiv.style.border = `1px solid ${
|
|
61091
|
+
borderDiv.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
61092
61092
|
borderDiv.style.boxSizing = "border-box";
|
|
61093
61093
|
borderDiv.style.left = `${leftOffset}px`;
|
|
61094
61094
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -61098,7 +61098,7 @@ function createCanvasDrawer(board) {
|
|
|
61098
61098
|
canvas.style.boxSizing = "border-box";
|
|
61099
61099
|
container.appendChild(borderDiv);
|
|
61100
61100
|
} else {
|
|
61101
|
-
canvas.style.border = `1px solid ${
|
|
61101
|
+
canvas.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
61102
61102
|
canvas.style.boxSizing = "border-box";
|
|
61103
61103
|
}
|
|
61104
61104
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -61106,8 +61106,8 @@ function createCanvasDrawer(board) {
|
|
|
61106
61106
|
anchorDiv.style.position = "absolute";
|
|
61107
61107
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
61108
61108
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
61109
|
-
anchorDiv.style.backgroundColor = `${
|
|
61110
|
-
anchorDiv.style.border = `${
|
|
61109
|
+
anchorDiv.style.backgroundColor = `${conf.SELECTION_ANCHOR_COLOR}`;
|
|
61110
|
+
anchorDiv.style.border = `${conf.SELECTION_ANCHOR_WIDTH}px solid ${conf.SELECTION_COLOR}`;
|
|
61111
61111
|
anchorDiv.style.borderRadius = "2px";
|
|
61112
61112
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
61113
61113
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -61115,10 +61115,10 @@ function createCanvasDrawer(board) {
|
|
|
61115
61115
|
return anchorDiv;
|
|
61116
61116
|
};
|
|
61117
61117
|
const anchors = [
|
|
61118
|
-
createAnchorDiv("0%", "0%",
|
|
61119
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
61120
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
61121
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
61118
|
+
createAnchorDiv("0%", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
61119
|
+
createAnchorDiv("100% + 1px", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
61120
|
+
createAnchorDiv("0%", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS),
|
|
61121
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS)
|
|
61122
61122
|
];
|
|
61123
61123
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
61124
61124
|
for (const anchor of anchors) {
|
|
@@ -62471,8 +62471,8 @@ class Select extends Tool {
|
|
|
62471
62471
|
const { x, y } = pointer.point;
|
|
62472
62472
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
62473
62473
|
this.rect = this.line.getMbr();
|
|
62474
|
-
this.rect.borderColor =
|
|
62475
|
-
this.rect.backgroundColor =
|
|
62474
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
62475
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
62476
62476
|
this.board.tools.publish();
|
|
62477
62477
|
this.board.presence.throttledEmit({
|
|
62478
62478
|
method: "DrawSelect",
|
|
@@ -62557,8 +62557,8 @@ class Select extends Tool {
|
|
|
62557
62557
|
const point5 = this.board.pointer.point.copy();
|
|
62558
62558
|
this.line = new Line(this.line.start, point5);
|
|
62559
62559
|
this.rect = this.line.getMbr();
|
|
62560
|
-
this.rect.borderColor =
|
|
62561
|
-
this.rect.backgroundColor =
|
|
62560
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
62561
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
62562
62562
|
this.board.tools.publish();
|
|
62563
62563
|
this.board.presence.throttledEmit({
|
|
62564
62564
|
method: "DrawSelect",
|
|
@@ -63069,7 +63069,7 @@ class ShapeTool extends CustomTool {
|
|
|
63069
63069
|
const point5 = this.board.pointer.point;
|
|
63070
63070
|
this.line = new Line(point5.copy(), point5.copy());
|
|
63071
63071
|
this.bounds = this.line.getMbr();
|
|
63072
|
-
this.bounds.borderColor =
|
|
63072
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
63073
63073
|
this.initTransformation();
|
|
63074
63074
|
this.board.tools.publish();
|
|
63075
63075
|
return true;
|
|
@@ -63087,7 +63087,7 @@ class ShapeTool extends CustomTool {
|
|
|
63087
63087
|
}
|
|
63088
63088
|
this.line = new Line(startPoint, endPoint);
|
|
63089
63089
|
this.bounds = this.line.getMbr();
|
|
63090
|
-
this.bounds.borderColor =
|
|
63090
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
63091
63091
|
this.initTransformation();
|
|
63092
63092
|
this.board.tools.publish();
|
|
63093
63093
|
return true;
|
|
@@ -64056,9 +64056,9 @@ class Camera {
|
|
|
64056
64056
|
matrix = new Matrix2;
|
|
64057
64057
|
pointer = new Point;
|
|
64058
64058
|
window = {
|
|
64059
|
-
width:
|
|
64060
|
-
height:
|
|
64061
|
-
dpi:
|
|
64059
|
+
width: conf.getDocumentWidth(),
|
|
64060
|
+
height: conf.getDocumentHeight(),
|
|
64061
|
+
dpi: conf.getDPI(),
|
|
64062
64062
|
getMbr: () => {
|
|
64063
64063
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
64064
64064
|
}
|
|
@@ -64434,9 +64434,9 @@ class Camera {
|
|
|
64434
64434
|
this.updateBoardPointer();
|
|
64435
64435
|
}
|
|
64436
64436
|
onWindowResize() {
|
|
64437
|
-
this.window.width =
|
|
64438
|
-
this.window.height =
|
|
64439
|
-
this.window.dpi =
|
|
64437
|
+
this.window.width = conf.getDocumentWidth();
|
|
64438
|
+
this.window.height = conf.getDocumentHeight();
|
|
64439
|
+
this.window.dpi = conf.getDPI();
|
|
64440
64440
|
this.resizeSubject.publish(this);
|
|
64441
64441
|
this.subject.publish(this);
|
|
64442
64442
|
}
|
|
@@ -64449,10 +64449,10 @@ class Camera {
|
|
|
64449
64449
|
let y = 0;
|
|
64450
64450
|
const { activeKeys } = keyboard;
|
|
64451
64451
|
const directions = {
|
|
64452
|
-
ArrowRight: [-
|
|
64453
|
-
ArrowLeft: [
|
|
64454
|
-
ArrowDown: [0, -
|
|
64455
|
-
ArrowUp: [0,
|
|
64452
|
+
ArrowRight: [-conf.NAVIGATION_STEP, 0],
|
|
64453
|
+
ArrowLeft: [conf.NAVIGATION_STEP, 0],
|
|
64454
|
+
ArrowDown: [0, -conf.NAVIGATION_STEP],
|
|
64455
|
+
ArrowUp: [0, conf.NAVIGATION_STEP]
|
|
64456
64456
|
};
|
|
64457
64457
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
64458
64458
|
if (activeArrowKeys.length === 2) {
|
|
@@ -64835,6 +64835,322 @@ function isHotkeyPushed(hotkey, event) {
|
|
|
64835
64835
|
}
|
|
64836
64836
|
// src/isMacos.ts
|
|
64837
64837
|
var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
64838
|
+
// src/Keyboard/hotkeys.json
|
|
64839
|
+
var hotkeys_default2 = {
|
|
64840
|
+
select: {
|
|
64841
|
+
key: {
|
|
64842
|
+
button: "KeyV"
|
|
64843
|
+
},
|
|
64844
|
+
label: {
|
|
64845
|
+
windows: "V",
|
|
64846
|
+
mac: "V"
|
|
64847
|
+
}
|
|
64848
|
+
},
|
|
64849
|
+
navigateMode: {
|
|
64850
|
+
key: {
|
|
64851
|
+
button: "Space"
|
|
64852
|
+
},
|
|
64853
|
+
label: {
|
|
64854
|
+
windows: "Space",
|
|
64855
|
+
mac: "Space"
|
|
64856
|
+
}
|
|
64857
|
+
},
|
|
64858
|
+
text: {
|
|
64859
|
+
key: {
|
|
64860
|
+
button: "KeyT"
|
|
64861
|
+
},
|
|
64862
|
+
label: {
|
|
64863
|
+
windows: "T",
|
|
64864
|
+
mac: "T"
|
|
64865
|
+
}
|
|
64866
|
+
},
|
|
64867
|
+
sticker: {
|
|
64868
|
+
key: {
|
|
64869
|
+
button: "KeyN"
|
|
64870
|
+
},
|
|
64871
|
+
label: {
|
|
64872
|
+
mac: "N",
|
|
64873
|
+
windows: "N"
|
|
64874
|
+
}
|
|
64875
|
+
},
|
|
64876
|
+
shape: {
|
|
64877
|
+
key: {
|
|
64878
|
+
button: "KeyS"
|
|
64879
|
+
},
|
|
64880
|
+
label: {
|
|
64881
|
+
mac: "S",
|
|
64882
|
+
windows: "S"
|
|
64883
|
+
}
|
|
64884
|
+
},
|
|
64885
|
+
connector: {
|
|
64886
|
+
key: {
|
|
64887
|
+
button: "KeyL"
|
|
64888
|
+
},
|
|
64889
|
+
label: {
|
|
64890
|
+
mac: "L",
|
|
64891
|
+
windows: "L"
|
|
64892
|
+
}
|
|
64893
|
+
},
|
|
64894
|
+
pen: {
|
|
64895
|
+
key: {
|
|
64896
|
+
button: "KeyP"
|
|
64897
|
+
},
|
|
64898
|
+
label: {
|
|
64899
|
+
mac: "P",
|
|
64900
|
+
windows: "P"
|
|
64901
|
+
}
|
|
64902
|
+
},
|
|
64903
|
+
eraser: {
|
|
64904
|
+
key: {
|
|
64905
|
+
button: "KeyE"
|
|
64906
|
+
},
|
|
64907
|
+
label: {
|
|
64908
|
+
mac: "E",
|
|
64909
|
+
windows: "E"
|
|
64910
|
+
}
|
|
64911
|
+
},
|
|
64912
|
+
frame: {
|
|
64913
|
+
key: {
|
|
64914
|
+
button: "KeyF"
|
|
64915
|
+
},
|
|
64916
|
+
label: {
|
|
64917
|
+
mac: "F",
|
|
64918
|
+
windows: "F"
|
|
64919
|
+
}
|
|
64920
|
+
},
|
|
64921
|
+
undo: {
|
|
64922
|
+
key: {
|
|
64923
|
+
button: "KeyZ",
|
|
64924
|
+
ctrl: true
|
|
64925
|
+
},
|
|
64926
|
+
label: {
|
|
64927
|
+
mac: "⌘Z",
|
|
64928
|
+
windows: "Ctrl + Z"
|
|
64929
|
+
}
|
|
64930
|
+
},
|
|
64931
|
+
redo: {
|
|
64932
|
+
key: {
|
|
64933
|
+
button: "KeyZ",
|
|
64934
|
+
ctrl: true,
|
|
64935
|
+
shift: true
|
|
64936
|
+
},
|
|
64937
|
+
label: {
|
|
64938
|
+
mac: "⌘⇧Z",
|
|
64939
|
+
windows: "Ctrl + Shift + Z"
|
|
64940
|
+
}
|
|
64941
|
+
},
|
|
64942
|
+
textBold: {
|
|
64943
|
+
key: {
|
|
64944
|
+
button: "KeyB",
|
|
64945
|
+
ctrl: true
|
|
64946
|
+
},
|
|
64947
|
+
label: {
|
|
64948
|
+
mac: "⌘B",
|
|
64949
|
+
windows: "Ctrl + B"
|
|
64950
|
+
}
|
|
64951
|
+
},
|
|
64952
|
+
textStrike: {
|
|
64953
|
+
key: {
|
|
64954
|
+
button: "KeyS",
|
|
64955
|
+
ctrl: true
|
|
64956
|
+
},
|
|
64957
|
+
label: {
|
|
64958
|
+
mac: "⌘S",
|
|
64959
|
+
windows: "Ctrl + S"
|
|
64960
|
+
}
|
|
64961
|
+
},
|
|
64962
|
+
textUnderline: {
|
|
64963
|
+
key: {
|
|
64964
|
+
button: "KeyU",
|
|
64965
|
+
ctrl: true
|
|
64966
|
+
},
|
|
64967
|
+
label: {
|
|
64968
|
+
mac: "⌘U",
|
|
64969
|
+
windows: "Ctrl + U"
|
|
64970
|
+
}
|
|
64971
|
+
},
|
|
64972
|
+
textItalic: {
|
|
64973
|
+
key: {
|
|
64974
|
+
button: "KeyI",
|
|
64975
|
+
ctrl: true
|
|
64976
|
+
},
|
|
64977
|
+
label: {
|
|
64978
|
+
mac: "⌘I",
|
|
64979
|
+
windows: "Ctrl + I"
|
|
64980
|
+
}
|
|
64981
|
+
},
|
|
64982
|
+
zoomOut: {
|
|
64983
|
+
key: {
|
|
64984
|
+
button: "Minus",
|
|
64985
|
+
ctrl: true
|
|
64986
|
+
},
|
|
64987
|
+
label: {
|
|
64988
|
+
mac: "⌘-",
|
|
64989
|
+
windows: "Ctrl + -"
|
|
64990
|
+
}
|
|
64991
|
+
},
|
|
64992
|
+
zoomIn: {
|
|
64993
|
+
key: {
|
|
64994
|
+
button: "Equal",
|
|
64995
|
+
ctrl: true
|
|
64996
|
+
},
|
|
64997
|
+
label: {
|
|
64998
|
+
mac: "⌘+",
|
|
64999
|
+
windows: "Ctrl + +"
|
|
65000
|
+
}
|
|
65001
|
+
},
|
|
65002
|
+
zoomDefault: {
|
|
65003
|
+
key: {
|
|
65004
|
+
button: "Digit0",
|
|
65005
|
+
ctrl: true
|
|
65006
|
+
},
|
|
65007
|
+
label: {
|
|
65008
|
+
mac: "⌘0",
|
|
65009
|
+
windows: "Ctrl + 0"
|
|
65010
|
+
}
|
|
65011
|
+
},
|
|
65012
|
+
duplicate: {
|
|
65013
|
+
key: {
|
|
65014
|
+
button: "KeyD",
|
|
65015
|
+
ctrl: true
|
|
65016
|
+
},
|
|
65017
|
+
label: {
|
|
65018
|
+
mac: "⌘D",
|
|
65019
|
+
windows: "Ctrl + D"
|
|
65020
|
+
}
|
|
65021
|
+
},
|
|
65022
|
+
bringToFront: {
|
|
65023
|
+
key: {
|
|
65024
|
+
button: "PageUp"
|
|
65025
|
+
},
|
|
65026
|
+
label: {
|
|
65027
|
+
mac: "fn↑ (PgUp)",
|
|
65028
|
+
windows: "PgUp"
|
|
65029
|
+
}
|
|
65030
|
+
},
|
|
65031
|
+
sendToBack: {
|
|
65032
|
+
key: {
|
|
65033
|
+
button: "PageDown"
|
|
65034
|
+
},
|
|
65035
|
+
label: {
|
|
65036
|
+
mac: "fn↓ (PgDn)",
|
|
65037
|
+
windows: "PgDn"
|
|
65038
|
+
}
|
|
65039
|
+
},
|
|
65040
|
+
delete: {
|
|
65041
|
+
key: {
|
|
65042
|
+
button: ["Delete", "Backspace"]
|
|
65043
|
+
},
|
|
65044
|
+
label: {
|
|
65045
|
+
mac: "Delete",
|
|
65046
|
+
windows: "Delete"
|
|
65047
|
+
}
|
|
65048
|
+
},
|
|
65049
|
+
cancel: {
|
|
65050
|
+
key: {
|
|
65051
|
+
button: "Escape"
|
|
65052
|
+
},
|
|
65053
|
+
label: {
|
|
65054
|
+
mac: "Esc",
|
|
65055
|
+
windows: "Esc"
|
|
65056
|
+
}
|
|
65057
|
+
},
|
|
65058
|
+
selectAll: {
|
|
65059
|
+
key: {
|
|
65060
|
+
button: "KeyA",
|
|
65061
|
+
ctrl: true
|
|
65062
|
+
},
|
|
65063
|
+
label: {
|
|
65064
|
+
mac: "⌘A",
|
|
65065
|
+
windows: "Ctrl + A"
|
|
65066
|
+
}
|
|
65067
|
+
},
|
|
65068
|
+
copy: {
|
|
65069
|
+
key: {
|
|
65070
|
+
button: "KeyC",
|
|
65071
|
+
ctrl: true
|
|
65072
|
+
},
|
|
65073
|
+
label: {
|
|
65074
|
+
mac: "⌘C",
|
|
65075
|
+
windows: "Ctrl + C"
|
|
65076
|
+
}
|
|
65077
|
+
},
|
|
65078
|
+
paste: {
|
|
65079
|
+
key: {
|
|
65080
|
+
button: "KeyV",
|
|
65081
|
+
ctrl: true
|
|
65082
|
+
},
|
|
65083
|
+
label: {
|
|
65084
|
+
mac: "⌘V",
|
|
65085
|
+
windows: "Ctrl + V"
|
|
65086
|
+
}
|
|
65087
|
+
},
|
|
65088
|
+
confirm: {
|
|
65089
|
+
key: {
|
|
65090
|
+
button: "Enter"
|
|
65091
|
+
},
|
|
65092
|
+
label: {
|
|
65093
|
+
mac: "⏎",
|
|
65094
|
+
windows: "⏎"
|
|
65095
|
+
}
|
|
65096
|
+
},
|
|
65097
|
+
frameNavigationNext: {
|
|
65098
|
+
key: {
|
|
65099
|
+
button: "ArrowRight",
|
|
65100
|
+
ctrl: true
|
|
65101
|
+
},
|
|
65102
|
+
label: {
|
|
65103
|
+
mac: "⌘→",
|
|
65104
|
+
windows: "Ctrl→"
|
|
65105
|
+
}
|
|
65106
|
+
},
|
|
65107
|
+
frameNavigationPrev: {
|
|
65108
|
+
key: {
|
|
65109
|
+
button: "ArrowLeft",
|
|
65110
|
+
ctrl: true
|
|
65111
|
+
},
|
|
65112
|
+
label: {
|
|
65113
|
+
mac: "⌘←",
|
|
65114
|
+
windows: "Ctrl←"
|
|
65115
|
+
}
|
|
65116
|
+
},
|
|
65117
|
+
navigationRight: {
|
|
65118
|
+
key: {
|
|
65119
|
+
button: "ArrowRight"
|
|
65120
|
+
},
|
|
65121
|
+
label: {
|
|
65122
|
+
mac: "→",
|
|
65123
|
+
windows: "→"
|
|
65124
|
+
}
|
|
65125
|
+
},
|
|
65126
|
+
navigationLeft: {
|
|
65127
|
+
key: {
|
|
65128
|
+
button: "ArrowLeft"
|
|
65129
|
+
},
|
|
65130
|
+
label: {
|
|
65131
|
+
mac: "←",
|
|
65132
|
+
windows: "←"
|
|
65133
|
+
}
|
|
65134
|
+
},
|
|
65135
|
+
navigationUp: {
|
|
65136
|
+
key: {
|
|
65137
|
+
button: "ArrowUp"
|
|
65138
|
+
},
|
|
65139
|
+
label: {
|
|
65140
|
+
mac: "↑",
|
|
65141
|
+
windows: "↑"
|
|
65142
|
+
}
|
|
65143
|
+
},
|
|
65144
|
+
navigationDown: {
|
|
65145
|
+
key: {
|
|
65146
|
+
button: "ArrowDown"
|
|
65147
|
+
},
|
|
65148
|
+
label: {
|
|
65149
|
+
mac: "↓",
|
|
65150
|
+
windows: "↓"
|
|
65151
|
+
}
|
|
65152
|
+
}
|
|
65153
|
+
};
|
|
64838
65154
|
|
|
64839
65155
|
// src/Keyboard/logHotkey.ts
|
|
64840
65156
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
@@ -64842,7 +65158,7 @@ function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
|
64842
65158
|
return;
|
|
64843
65159
|
}
|
|
64844
65160
|
const isFunction = typeof hotkeyConfig === "function";
|
|
64845
|
-
const hotkeyData =
|
|
65161
|
+
const hotkeyData = hotkeys_default2[hotkeyName];
|
|
64846
65162
|
switch (status) {
|
|
64847
65163
|
case "triggered":
|
|
64848
65164
|
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;");
|
|
@@ -64930,7 +65246,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
64930
65246
|
// src/Keyboard/getHotkeyLabel.ts
|
|
64931
65247
|
function getHotkeyLabel(hotkey) {
|
|
64932
65248
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
64933
|
-
switch (
|
|
65249
|
+
switch (conf.FORCE_HOTKEYS || "auto") {
|
|
64934
65250
|
case "windows":
|
|
64935
65251
|
return hotkeyLabel.windows;
|
|
64936
65252
|
case "macos":
|
|
@@ -66840,7 +67156,7 @@ class SpatialIndex {
|
|
|
66840
67156
|
this.itemsArray.push(item);
|
|
66841
67157
|
this.itemsIndex.insert(item);
|
|
66842
67158
|
}
|
|
66843
|
-
if (
|
|
67159
|
+
if (conf.isNode()) {
|
|
66844
67160
|
return;
|
|
66845
67161
|
}
|
|
66846
67162
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -68369,7 +68685,7 @@ class Transformer extends Tool {
|
|
|
68369
68685
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
68370
68686
|
if (mbr) {
|
|
68371
68687
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
68372
|
-
const selectionColor = isLockedItems ?
|
|
68688
|
+
const selectionColor = isLockedItems ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
68373
68689
|
mbr.borderColor = selectionColor;
|
|
68374
68690
|
mbr.render(context);
|
|
68375
68691
|
}
|
|
@@ -68395,7 +68711,7 @@ class Transformer extends Tool {
|
|
|
68395
68711
|
new Point(right, bottom)
|
|
68396
68712
|
];
|
|
68397
68713
|
for (const point5 of points) {
|
|
68398
|
-
const circle = new Anchor(point5.x, point5.y,
|
|
68714
|
+
const circle = new Anchor(point5.x, point5.y, conf.SELECTION_ANCHOR_RADIUS, conf.SELECTION_COLOR, conf.SELECTION_ANCHOR_COLOR, conf.SELECTION_ANCHOR_WIDTH);
|
|
68399
68715
|
anchors.push(circle);
|
|
68400
68716
|
}
|
|
68401
68717
|
}
|
|
@@ -69597,7 +69913,7 @@ class BoardSelection {
|
|
|
69597
69913
|
renderItemMbr(context, item, customScale) {
|
|
69598
69914
|
const mbr = item.getMbr();
|
|
69599
69915
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
69600
|
-
const selectionColor = item.transformation.isLocked ?
|
|
69916
|
+
const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
69601
69917
|
mbr.borderColor = selectionColor;
|
|
69602
69918
|
mbr.render(context);
|
|
69603
69919
|
}
|
|
@@ -70044,7 +70360,7 @@ class Board {
|
|
|
70044
70360
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
70045
70361
|
const css = INDEX_CSS;
|
|
70046
70362
|
const boardName = this.getName() || this.getBoardId();
|
|
70047
|
-
const items = this.items.getWholeHTML(
|
|
70363
|
+
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
70048
70364
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
70049
70365
|
const scripts = `
|
|
70050
70366
|
<script type="module">${customTagsScript}</script>
|
|
@@ -70084,7 +70400,7 @@ class Board {
|
|
|
70084
70400
|
return `${head}${body}`;
|
|
70085
70401
|
}
|
|
70086
70402
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
70087
|
-
const parser =
|
|
70403
|
+
const parser = conf.getDOMParser();
|
|
70088
70404
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
70089
70405
|
const items = doc.body.querySelector("#items");
|
|
70090
70406
|
if (items) {
|
|
@@ -70136,7 +70452,7 @@ class Board {
|
|
|
70136
70452
|
return [];
|
|
70137
70453
|
}
|
|
70138
70454
|
deserializeHTML(stringedHTML) {
|
|
70139
|
-
const parser =
|
|
70455
|
+
const parser = conf.getDOMParser();
|
|
70140
70456
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
70141
70457
|
const itemsDiv = doc.body.querySelector("#items");
|
|
70142
70458
|
if (!itemsDiv) {
|
|
@@ -71288,19 +71604,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
71288
71604
|
var import_slate45 = __toESM(require_dist());
|
|
71289
71605
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
71290
71606
|
const transformed = { ...toTransform };
|
|
71291
|
-
const
|
|
71607
|
+
const conf2 = confirmed.path;
|
|
71292
71608
|
const path2 = transformed.path;
|
|
71293
|
-
if (import_slate45.Path.equals(
|
|
71609
|
+
if (import_slate45.Path.equals(conf2, path2)) {
|
|
71294
71610
|
return transformed;
|
|
71295
71611
|
}
|
|
71296
|
-
const isDescendant = path2.length >
|
|
71612
|
+
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
71297
71613
|
if (isDescendant) {
|
|
71298
71614
|
const newPath = [...path2];
|
|
71299
71615
|
newPath[0] = newPath[0] + 1;
|
|
71300
71616
|
transformed.path = newPath;
|
|
71301
71617
|
return transformed;
|
|
71302
71618
|
}
|
|
71303
|
-
if (import_slate45.Path.isBefore(
|
|
71619
|
+
if (import_slate45.Path.isBefore(conf2, path2)) {
|
|
71304
71620
|
transformPath(confirmed, transformed);
|
|
71305
71621
|
}
|
|
71306
71622
|
return transformed;
|
|
@@ -71310,23 +71626,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
71310
71626
|
var import_slate46 = __toESM(require_dist());
|
|
71311
71627
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
71312
71628
|
const transformed = { ...toTransform };
|
|
71313
|
-
const
|
|
71629
|
+
const conf2 = confirmed.path;
|
|
71314
71630
|
const path2 = transformed.path;
|
|
71315
|
-
if (import_slate46.Path.equals(
|
|
71631
|
+
if (import_slate46.Path.equals(conf2, path2)) {
|
|
71316
71632
|
return transformed;
|
|
71317
71633
|
}
|
|
71318
|
-
if (path2.length ===
|
|
71634
|
+
if (path2.length === conf2.length + 1 && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
71319
71635
|
const newPath = [...path2];
|
|
71320
|
-
if (
|
|
71636
|
+
if (conf2.length === 1) {
|
|
71321
71637
|
newPath[0] = newPath[0] + 1;
|
|
71322
71638
|
} else {
|
|
71323
|
-
newPath[
|
|
71639
|
+
newPath[conf2.length] = newPath[conf2.length] + 1;
|
|
71324
71640
|
}
|
|
71325
71641
|
transformed.path = newPath;
|
|
71326
71642
|
return transformed;
|
|
71327
71643
|
}
|
|
71328
|
-
const isDescendant = path2.length >
|
|
71329
|
-
if (import_slate46.Path.isBefore(
|
|
71644
|
+
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
71645
|
+
if (import_slate46.Path.isBefore(conf2, path2) && !isDescendant) {
|
|
71330
71646
|
transformPath(confirmed, transformed);
|
|
71331
71647
|
}
|
|
71332
71648
|
return transformed;
|
|
@@ -71919,8 +72235,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
71919
72235
|
const transformed = [];
|
|
71920
72236
|
for (const transf of toTransform) {
|
|
71921
72237
|
let actualyTransformed = { ...transf };
|
|
71922
|
-
for (const
|
|
71923
|
-
const { operation: confOp } =
|
|
72238
|
+
for (const conf2 of confirmed) {
|
|
72239
|
+
const { operation: confOp } = conf2.body;
|
|
71924
72240
|
const { operation: transfOp } = actualyTransformed.body;
|
|
71925
72241
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
71926
72242
|
if (transformedOp) {
|
|
@@ -72552,7 +72868,7 @@ class Events2 {
|
|
|
72552
72868
|
return record !== null;
|
|
72553
72869
|
}
|
|
72554
72870
|
sendPresenceEvent(event) {
|
|
72555
|
-
|
|
72871
|
+
conf.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
72556
72872
|
}
|
|
72557
72873
|
canUndoEvent(op, byUserId) {
|
|
72558
72874
|
if (op.method === "undo") {
|
|
@@ -72653,9 +72969,9 @@ function handleChatChunk(chunk, board) {
|
|
|
72653
72969
|
default:
|
|
72654
72970
|
board.camera.unsubscribeFromItem();
|
|
72655
72971
|
if (!chunk.isExternalApiError) {
|
|
72656
|
-
|
|
72657
|
-
header:
|
|
72658
|
-
body:
|
|
72972
|
+
conf.notify({
|
|
72973
|
+
header: conf.i18n.t("AIInput.textGenerationError.header"),
|
|
72974
|
+
body: conf.i18n.t("AIInput.textGenerationError.body"),
|
|
72659
72975
|
variant: "error",
|
|
72660
72976
|
duration: 4000
|
|
72661
72977
|
});
|
|
@@ -72670,7 +72986,7 @@ function handleChatChunk(chunk, board) {
|
|
|
72670
72986
|
editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
72671
72987
|
if (chunk.isExternalApiError) {
|
|
72672
72988
|
editor.clearText();
|
|
72673
|
-
editor.insertCopiedText(
|
|
72989
|
+
editor.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
72674
72990
|
}
|
|
72675
72991
|
}
|
|
72676
72992
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -72697,7 +73013,7 @@ function handleAudioGenerate(response, board) {
|
|
|
72697
73013
|
}
|
|
72698
73014
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
72699
73015
|
const { left, top, right } = placeholderNode.getMbr();
|
|
72700
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
73016
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf.AUDIO_DIMENSIONS.width) / 2, top);
|
|
72701
73017
|
audio.updateMbr();
|
|
72702
73018
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
72703
73019
|
board.remove(placeholderNode, false);
|
|
@@ -72719,7 +73035,7 @@ function handleAudioGenerate(response, board) {
|
|
|
72719
73035
|
type: "audio/wav"
|
|
72720
73036
|
});
|
|
72721
73037
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
72722
|
-
const linkElem =
|
|
73038
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
72723
73039
|
linkElem.href = audioUrl2;
|
|
72724
73040
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
72725
73041
|
linkElem.click();
|
|
@@ -72738,9 +73054,9 @@ function handleAudioGenerate(response, board) {
|
|
|
72738
73054
|
board.selection.add(placeholderNode);
|
|
72739
73055
|
}
|
|
72740
73056
|
console.error("Audio generation error:", response.message);
|
|
72741
|
-
|
|
72742
|
-
header:
|
|
72743
|
-
body:
|
|
73057
|
+
conf.notify({
|
|
73058
|
+
header: conf.i18n.t("AIInput.audioGenerationError.header"),
|
|
73059
|
+
body: conf.i18n.t("AIInput.audioGenerationError.body"),
|
|
72744
73060
|
variant: "error",
|
|
72745
73061
|
duration: 4000
|
|
72746
73062
|
});
|
|
@@ -72803,14 +73119,14 @@ function handleImageGenerate(response, board) {
|
|
|
72803
73119
|
board.selection.add(item);
|
|
72804
73120
|
const editor = item.getRichText()?.editor;
|
|
72805
73121
|
editor?.clearText();
|
|
72806
|
-
editor?.insertCopiedText(
|
|
73122
|
+
editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
72807
73123
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
72808
73124
|
}
|
|
72809
73125
|
}
|
|
72810
73126
|
} else {
|
|
72811
|
-
|
|
72812
|
-
header:
|
|
72813
|
-
body:
|
|
73127
|
+
conf.notify({
|
|
73128
|
+
header: conf.i18n.t("AIInput.imageGenerationError.header"),
|
|
73129
|
+
body: conf.i18n.t("AIInput.imageGenerationError.body"),
|
|
72814
73130
|
variant: "error",
|
|
72815
73131
|
duration: 4000
|
|
72816
73132
|
});
|
|
@@ -72877,10 +73193,10 @@ function startIntervals(board) {
|
|
|
72877
73193
|
}
|
|
72878
73194
|
log.publishIntervalTimer = setInterval(() => {
|
|
72879
73195
|
tryPublishEvent(board);
|
|
72880
|
-
},
|
|
73196
|
+
}, conf.EVENTS_PUBLISH_INTERVAL);
|
|
72881
73197
|
log.resendIntervalTimer = setInterval(() => {
|
|
72882
73198
|
tryResendEvent(board);
|
|
72883
|
-
},
|
|
73199
|
+
}, conf.EVENTS_RESEND_INTERVAL);
|
|
72884
73200
|
}
|
|
72885
73201
|
function tryPublishEvent(board) {
|
|
72886
73202
|
const { log } = board.events;
|
|
@@ -72899,14 +73215,14 @@ function tryResendEvent(board) {
|
|
|
72899
73215
|
return;
|
|
72900
73216
|
}
|
|
72901
73217
|
const date = Date.now();
|
|
72902
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
73218
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf.EVENTS_RESEND_INTERVAL;
|
|
72903
73219
|
if (!isTimeToSendPendingEvent) {
|
|
72904
73220
|
return;
|
|
72905
73221
|
}
|
|
72906
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
73222
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf.EVENTS_RESEND_INTERVAL * 5;
|
|
72907
73223
|
if (isProbablyLostConnection) {
|
|
72908
73224
|
board.presence.clear();
|
|
72909
|
-
|
|
73225
|
+
conf.connection?.notifyAboutLostConnection();
|
|
72910
73226
|
}
|
|
72911
73227
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
72912
73228
|
}
|
|
@@ -72937,12 +73253,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
72937
73253
|
lastKnownOrder: log.getLastIndex()
|
|
72938
73254
|
}
|
|
72939
73255
|
};
|
|
72940
|
-
|
|
73256
|
+
conf.connection.send({
|
|
72941
73257
|
type: "BoardEvent",
|
|
72942
73258
|
boardId: board.getBoardId(),
|
|
72943
73259
|
event: toSend,
|
|
72944
73260
|
sequenceNumber,
|
|
72945
|
-
userId:
|
|
73261
|
+
userId: conf.connection.getCurrentUser()
|
|
72946
73262
|
});
|
|
72947
73263
|
const date = Date.now();
|
|
72948
73264
|
log.pendingEvent = {
|
|
@@ -72988,7 +73304,7 @@ function handleConfirmation(msg, board) {
|
|
|
72988
73304
|
if (!isPendingEventConfirmation) {
|
|
72989
73305
|
return;
|
|
72990
73306
|
}
|
|
72991
|
-
|
|
73307
|
+
conf.connection?.dismissNotificationAboutLostConnection();
|
|
72992
73308
|
log.currentSequenceNumber++;
|
|
72993
73309
|
log.pendingEvent.event.order = msg.order;
|
|
72994
73310
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -73000,7 +73316,7 @@ function handleConfirmation(msg, board) {
|
|
|
73000
73316
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
73001
73317
|
function handleCreateSnapshotRequestMessage(msg, board) {
|
|
73002
73318
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
73003
|
-
|
|
73319
|
+
conf.connection.send({
|
|
73004
73320
|
type: "BoardSnapshot",
|
|
73005
73321
|
boardId,
|
|
73006
73322
|
snapshot,
|
|
@@ -73031,9 +73347,9 @@ function handleModeMessage(message, board) {
|
|
|
73031
73347
|
if (isTemplateView()) {
|
|
73032
73348
|
return;
|
|
73033
73349
|
}
|
|
73034
|
-
|
|
73035
|
-
header:
|
|
73036
|
-
body: message.mode === "edit" ?
|
|
73350
|
+
conf.notify({
|
|
73351
|
+
header: conf.i18n.t("sharing.settingsChanged.heading"),
|
|
73352
|
+
body: message.mode === "edit" ? conf.i18n.t("sharing.settingsChanged.bodyEdit") : conf.i18n.t("sharing.settingsChanged.bodyView"),
|
|
73037
73353
|
duration: 5000
|
|
73038
73354
|
});
|
|
73039
73355
|
}
|
|
@@ -73069,8 +73385,8 @@ messageRouter.addHandler("PresenceEvent", handlePresenceEventMessage);
|
|
|
73069
73385
|
messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
73070
73386
|
// src/api/initI18N.ts
|
|
73071
73387
|
function initI18N(i18nInstance) {
|
|
73072
|
-
|
|
73073
|
-
|
|
73388
|
+
conf.i18n = i18nInstance;
|
|
73389
|
+
conf.planNames = {
|
|
73074
73390
|
basic: i18nInstance.t("userPlan.plans.basic.name"),
|
|
73075
73391
|
plus: i18nInstance.t("userPlan.plans.plus.name")
|
|
73076
73392
|
};
|
|
@@ -73160,7 +73476,7 @@ class NodePath2D extends Path2DFactory {
|
|
|
73160
73476
|
|
|
73161
73477
|
// src/api/initPaths.ts
|
|
73162
73478
|
function initPaths(path2D) {
|
|
73163
|
-
|
|
73479
|
+
conf.EXPORT_FRAME_DECORATIONS = {
|
|
73164
73480
|
"top-left": {
|
|
73165
73481
|
path: new path2D("M13 1H1V13"),
|
|
73166
73482
|
lineWidth: 2,
|
|
@@ -73203,7 +73519,7 @@ function initPaths(path2D) {
|
|
|
73203
73519
|
// src/api/getMeasureCtx.ts
|
|
73204
73520
|
function getMeasureCtx() {
|
|
73205
73521
|
if (typeof document !== "undefined") {
|
|
73206
|
-
const measureCanvas =
|
|
73522
|
+
const measureCanvas = conf.documentFactory.createElement("canvas");
|
|
73207
73523
|
const measureCtx = measureCanvas.getContext("2d");
|
|
73208
73524
|
if (!measureCtx) {
|
|
73209
73525
|
throw new Error("Failde to create canvas and get 2d context");
|
|
@@ -73221,12 +73537,12 @@ function getMeasureCtx() {
|
|
|
73221
73537
|
var import_css = __toESM(require_css_escape());
|
|
73222
73538
|
function initNodeSettings() {
|
|
73223
73539
|
const documentFactory = new NodeDocumentFactory;
|
|
73224
|
-
|
|
73225
|
-
|
|
73226
|
-
|
|
73227
|
-
|
|
73540
|
+
conf.documentFactory = documentFactory;
|
|
73541
|
+
conf.path2DFactory = NodePath2D;
|
|
73542
|
+
conf.measureCtx = getMeasureCtx();
|
|
73543
|
+
conf.getDOMParser = getNodeDOMParser;
|
|
73228
73544
|
initPaths(NodePath2D);
|
|
73229
|
-
return
|
|
73545
|
+
return conf;
|
|
73230
73546
|
}
|
|
73231
73547
|
|
|
73232
73548
|
// src/node.ts
|