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/node.js
CHANGED
|
@@ -11752,7 +11752,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
11752
11752
|
return false;
|
|
11753
11753
|
};
|
|
11754
11754
|
};
|
|
11755
|
-
var
|
|
11755
|
+
var hotkeys = {
|
|
11756
11756
|
isBold: create2("bold"),
|
|
11757
11757
|
isCompose: create2("compose"),
|
|
11758
11758
|
isMoveBackward: create2("moveBackward"),
|
|
@@ -11883,7 +11883,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
11883
11883
|
exports.EDITOR_TO_WINDOW = EDITOR_TO_WINDOW;
|
|
11884
11884
|
exports.ELEMENT_TO_NODE = ELEMENT_TO_NODE;
|
|
11885
11885
|
exports.HAS_BEFORE_INPUT_SUPPORT = HAS_BEFORE_INPUT_SUPPORT;
|
|
11886
|
-
exports.Hotkeys =
|
|
11886
|
+
exports.Hotkeys = hotkeys;
|
|
11887
11887
|
exports.IS_ANDROID = IS_ANDROID;
|
|
11888
11888
|
exports.IS_CHROME = IS_CHROME;
|
|
11889
11889
|
exports.IS_COMPOSING = IS_COMPOSING;
|
|
@@ -22819,20 +22819,20 @@ var resources = {
|
|
|
22819
22819
|
};
|
|
22820
22820
|
function initDefaultI18N() {
|
|
22821
22821
|
instance.use(Browser).init({
|
|
22822
|
-
debug:
|
|
22822
|
+
debug: conf.debug,
|
|
22823
22823
|
detection: {
|
|
22824
22824
|
order: ["navigator"]
|
|
22825
22825
|
},
|
|
22826
22826
|
supportedLngs: ["en", "ru"],
|
|
22827
22827
|
defaultNS,
|
|
22828
22828
|
resources,
|
|
22829
|
-
fallbackLng:
|
|
22829
|
+
fallbackLng: conf.FALLBACK_LNG,
|
|
22830
22830
|
interpolation: {
|
|
22831
22831
|
escapeValue: false
|
|
22832
22832
|
}
|
|
22833
22833
|
});
|
|
22834
|
-
|
|
22835
|
-
|
|
22834
|
+
conf.i18n = instance;
|
|
22835
|
+
conf.planNames = {
|
|
22836
22836
|
basic: instance.t("userPlan.plans.basic.name"),
|
|
22837
22837
|
plus: instance.t("userPlan.plans.plus.name")
|
|
22838
22838
|
};
|
|
@@ -22847,7 +22847,7 @@ var ExportQuality;
|
|
|
22847
22847
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
22848
22848
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
22849
22849
|
})(ExportQuality ||= {});
|
|
22850
|
-
var
|
|
22850
|
+
var conf = {
|
|
22851
22851
|
connection: undefined,
|
|
22852
22852
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
22853
22853
|
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
@@ -23895,7 +23895,7 @@ class DrawingContext {
|
|
|
23895
23895
|
this.setCamera(camera);
|
|
23896
23896
|
}
|
|
23897
23897
|
dpi() {
|
|
23898
|
-
return
|
|
23898
|
+
return conf.getDPI();
|
|
23899
23899
|
}
|
|
23900
23900
|
setCamera(camera) {
|
|
23901
23901
|
this.camera = camera;
|
|
@@ -23905,7 +23905,7 @@ class DrawingContext {
|
|
|
23905
23905
|
}
|
|
23906
23906
|
clear() {
|
|
23907
23907
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
23908
|
-
this.ctx.clearRect(0, 0,
|
|
23908
|
+
this.ctx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
23909
23909
|
this.matrix.applyToContext(this.ctx);
|
|
23910
23910
|
}
|
|
23911
23911
|
clearCursor() {
|
|
@@ -23913,7 +23913,7 @@ class DrawingContext {
|
|
|
23913
23913
|
return;
|
|
23914
23914
|
}
|
|
23915
23915
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
23916
|
-
this.cursorCtx.clearRect(0, 0,
|
|
23916
|
+
this.cursorCtx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
23917
23917
|
this.matrix.applyToContext(this.cursorCtx);
|
|
23918
23918
|
}
|
|
23919
23919
|
applyChanges() {
|
|
@@ -24016,7 +24016,7 @@ class Path {
|
|
|
24016
24016
|
this.width = this.getMbr().getWidth();
|
|
24017
24017
|
this.height = this.getMbr().getHeight();
|
|
24018
24018
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
24019
|
-
this.path2d = new
|
|
24019
|
+
this.path2d = new conf.path2DFactory;
|
|
24020
24020
|
this.updateCache();
|
|
24021
24021
|
}
|
|
24022
24022
|
getBackgroundColor() {
|
|
@@ -24093,7 +24093,7 @@ class Path {
|
|
|
24093
24093
|
this.y = top - this.paddingTop;
|
|
24094
24094
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
24095
24095
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
24096
|
-
const path2d = new
|
|
24096
|
+
const path2d = new conf.path2DFactory;
|
|
24097
24097
|
if (this.segments.length === 0) {
|
|
24098
24098
|
return;
|
|
24099
24099
|
}
|
|
@@ -25137,7 +25137,7 @@ var parsersHTML = {
|
|
|
25137
25137
|
"comment-item": parseHTMLComment
|
|
25138
25138
|
};
|
|
25139
25139
|
var decodeHtml = (htmlString) => {
|
|
25140
|
-
const parser =
|
|
25140
|
+
const parser = conf.getDOMParser();
|
|
25141
25141
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
25142
25142
|
return doc.documentElement.textContent || "";
|
|
25143
25143
|
};
|
|
@@ -25166,10 +25166,10 @@ function parseHTMLRichText(el, options) {
|
|
|
25166
25166
|
italic: node.style.fontStyle === "italic",
|
|
25167
25167
|
underline: node.style.textDecoration.includes("underline"),
|
|
25168
25168
|
"line-through": node.style.textDecoration.includes("line-through"),
|
|
25169
|
-
fontColor: node.style.color ||
|
|
25170
|
-
fontHighlight: node.style.backgroundColor ||
|
|
25171
|
-
fontSize: parseFloat(node.style.fontSize) ||
|
|
25172
|
-
fontFamily: node.style.fontFamily ||
|
|
25169
|
+
fontColor: node.style.color || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
25170
|
+
fontHighlight: node.style.backgroundColor || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
25171
|
+
fontSize: parseFloat(node.style.fontSize) || conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
25172
|
+
fontFamily: node.style.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily,
|
|
25173
25173
|
overline: false,
|
|
25174
25174
|
subscript: false,
|
|
25175
25175
|
superscript: false
|
|
@@ -25234,7 +25234,7 @@ function parseHTMLRichText(el, options) {
|
|
|
25234
25234
|
return {
|
|
25235
25235
|
type: "paragraph",
|
|
25236
25236
|
...extractCommonProps(),
|
|
25237
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
25237
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
25238
25238
|
children: children2
|
|
25239
25239
|
};
|
|
25240
25240
|
default:
|
|
@@ -25607,8 +25607,8 @@ class LinkTo {
|
|
|
25607
25607
|
const ctx = context.ctx;
|
|
25608
25608
|
ctx.save();
|
|
25609
25609
|
ctx.globalCompositeOperation = "destination-out";
|
|
25610
|
-
const size =
|
|
25611
|
-
const offset =
|
|
25610
|
+
const size = conf.LINK_BTN_SIZE / scale;
|
|
25611
|
+
const offset = conf.LINK_BTN_OFFSET / scale;
|
|
25612
25612
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
25613
25613
|
ctx.restore();
|
|
25614
25614
|
}
|
|
@@ -25759,7 +25759,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
25759
25759
|
} else if (node.type === "ul_list" && !listData) {
|
|
25760
25760
|
listData = { level: 0, isNumberedList: false };
|
|
25761
25761
|
}
|
|
25762
|
-
const listMarks =
|
|
25762
|
+
const listMarks = conf[getListMarkType((listData?.level || 0) + 1)];
|
|
25763
25763
|
for (let i = 0;i < data.children.length; i++) {
|
|
25764
25764
|
const child = structuredClone(data.children[i]);
|
|
25765
25765
|
switch (child.type) {
|
|
@@ -26164,8 +26164,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
26164
26164
|
rect2.height += paddingTop;
|
|
26165
26165
|
}
|
|
26166
26166
|
}
|
|
26167
|
-
|
|
26168
|
-
const measure =
|
|
26167
|
+
conf.measureCtx.font = style.font;
|
|
26168
|
+
const measure = conf.measureCtx.measureText(text);
|
|
26169
26169
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
26170
26170
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
26171
26171
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -35053,7 +35053,7 @@ var convertLinkNodeToTextNode = (node2) => {
|
|
|
35053
35053
|
const link = node2.link;
|
|
35054
35054
|
const text3 = node2.children.map((child) => child.text).join("");
|
|
35055
35055
|
return {
|
|
35056
|
-
...
|
|
35056
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
35057
35057
|
type: "text",
|
|
35058
35058
|
text: text3,
|
|
35059
35059
|
link,
|
|
@@ -35069,9 +35069,9 @@ function setNodeChildrenStyles({
|
|
|
35069
35069
|
horisontalAlignment,
|
|
35070
35070
|
node: node2
|
|
35071
35071
|
}) {
|
|
35072
|
-
let fontStyles =
|
|
35072
|
+
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
35073
35073
|
if (editor) {
|
|
35074
|
-
fontStyles = import_slate18.Editor.marks(editor) ||
|
|
35074
|
+
fontStyles = import_slate18.Editor.marks(editor) || conf.DEFAULT_TEXT_STYLES;
|
|
35075
35075
|
}
|
|
35076
35076
|
switch (node2.type) {
|
|
35077
35077
|
case "heading_one":
|
|
@@ -35103,7 +35103,7 @@ function setNodeChildrenStyles({
|
|
|
35103
35103
|
children.text += " ";
|
|
35104
35104
|
}
|
|
35105
35105
|
let fontColor = fontStyles.fontColor;
|
|
35106
|
-
if (fontColor ===
|
|
35106
|
+
if (fontColor === conf.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
35107
35107
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
35108
35108
|
}
|
|
35109
35109
|
return {
|
|
@@ -35173,7 +35173,7 @@ class MarkdownProcessor {
|
|
|
35173
35173
|
this.subject.publish(this);
|
|
35174
35174
|
return true;
|
|
35175
35175
|
}
|
|
35176
|
-
if (text3.startsWith(
|
|
35176
|
+
if (text3.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
35177
35177
|
return true;
|
|
35178
35178
|
}
|
|
35179
35179
|
const isPrevTextEmpty = isTextEmpty(this.editor.children);
|
|
@@ -35231,7 +35231,7 @@ class MarkdownProcessor {
|
|
|
35231
35231
|
return;
|
|
35232
35232
|
}
|
|
35233
35233
|
const prevText = this.getText()?.[this.getText().length - 1]?.children[0]?.text;
|
|
35234
|
-
if (prevText?.startsWith(
|
|
35234
|
+
if (prevText?.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
35235
35235
|
clearText(this.editor);
|
|
35236
35236
|
}
|
|
35237
35237
|
if (chunk.includes(`
|
|
@@ -36281,7 +36281,7 @@ class RichTextCommand {
|
|
|
36281
36281
|
item: id,
|
|
36282
36282
|
operation: {
|
|
36283
36283
|
...this.operation,
|
|
36284
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
36284
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
36285
36285
|
}
|
|
36286
36286
|
}));
|
|
36287
36287
|
case "setBlockType":
|
|
@@ -36305,7 +36305,7 @@ class RichTextCommand {
|
|
|
36305
36305
|
item: id,
|
|
36306
36306
|
operation: {
|
|
36307
36307
|
...this.operation,
|
|
36308
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
36308
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
36309
36309
|
}
|
|
36310
36310
|
}));
|
|
36311
36311
|
case "setFontSize":
|
|
@@ -36313,7 +36313,7 @@ class RichTextCommand {
|
|
|
36313
36313
|
item: id,
|
|
36314
36314
|
operation: {
|
|
36315
36315
|
...this.operation,
|
|
36316
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
36316
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf.DEFAULT_TEXT_STYLES.fontSize
|
|
36317
36317
|
}
|
|
36318
36318
|
}));
|
|
36319
36319
|
case "setFontHighlight":
|
|
@@ -36321,7 +36321,7 @@ class RichTextCommand {
|
|
|
36321
36321
|
item: id,
|
|
36322
36322
|
operation: {
|
|
36323
36323
|
...this.operation,
|
|
36324
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
36324
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf.DEFAULT_TEXT_STYLES.fontHighlight
|
|
36325
36325
|
}
|
|
36326
36326
|
}));
|
|
36327
36327
|
case "setHorisontalAlignment":
|
|
@@ -37559,7 +37559,7 @@ class RichText extends BaseItem {
|
|
|
37559
37559
|
isContainerSet = false;
|
|
37560
37560
|
isRenderEnabled = true;
|
|
37561
37561
|
layoutNodes;
|
|
37562
|
-
clipPath = new
|
|
37562
|
+
clipPath = new conf.path2DFactory;
|
|
37563
37563
|
updateRequired = false;
|
|
37564
37564
|
autoSizeScale = 1;
|
|
37565
37565
|
containerMaxWidth;
|
|
@@ -37574,7 +37574,7 @@ class RichText extends BaseItem {
|
|
|
37574
37574
|
shrinkWidth = false;
|
|
37575
37575
|
prevMbr = null;
|
|
37576
37576
|
rtCounter = 0;
|
|
37577
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText =
|
|
37577
|
+
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) {
|
|
37578
37578
|
super(board, id);
|
|
37579
37579
|
this.container = container;
|
|
37580
37580
|
this.transformation = transformation;
|
|
@@ -37708,11 +37708,11 @@ class RichText extends BaseItem {
|
|
|
37708
37708
|
return;
|
|
37709
37709
|
}
|
|
37710
37710
|
try {
|
|
37711
|
-
|
|
37711
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
37712
37712
|
} catch {}
|
|
37713
37713
|
};
|
|
37714
37714
|
updateElement = () => {
|
|
37715
|
-
if (
|
|
37715
|
+
if (conf.isNode()) {
|
|
37716
37716
|
return;
|
|
37717
37717
|
}
|
|
37718
37718
|
if (this.updateRequired) {
|
|
@@ -37841,7 +37841,7 @@ class RichText extends BaseItem {
|
|
|
37841
37841
|
const container = this.getTransformedContainer();
|
|
37842
37842
|
const width = container.getWidth();
|
|
37843
37843
|
const height = container.getHeight();
|
|
37844
|
-
this.clipPath = new
|
|
37844
|
+
this.clipPath = new conf.path2DFactory;
|
|
37845
37845
|
this.clipPath.rect(0, 0, width, height);
|
|
37846
37846
|
}
|
|
37847
37847
|
setContainer(container) {
|
|
@@ -38118,24 +38118,24 @@ class RichText extends BaseItem {
|
|
|
38118
38118
|
this.clearLastClickPoint();
|
|
38119
38119
|
const domMbr = ref.getBoundingClientRect();
|
|
38120
38120
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
38121
|
-
if (refMbr.isInside(point3) && (
|
|
38122
|
-
const domRange =
|
|
38123
|
-
const textNode =
|
|
38124
|
-
const offset =
|
|
38125
|
-
const slatePoint =
|
|
38121
|
+
if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
38122
|
+
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
38123
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
38124
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
38125
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
38126
38126
|
exactMatch: false,
|
|
38127
38127
|
suppressThrow: false
|
|
38128
38128
|
});
|
|
38129
38129
|
if (slatePoint) {
|
|
38130
38130
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
38131
38131
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
38132
|
-
|
|
38132
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
38133
38133
|
}
|
|
38134
38134
|
} else {
|
|
38135
|
-
if (!(
|
|
38135
|
+
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
38136
38136
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
38137
38137
|
}
|
|
38138
|
-
|
|
38138
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
38139
38139
|
}
|
|
38140
38140
|
}
|
|
38141
38141
|
}
|
|
@@ -38242,11 +38242,11 @@ class RichText extends BaseItem {
|
|
|
38242
38242
|
if (node2.type === "text" || "text" in node2) {
|
|
38243
38243
|
node2 = node2;
|
|
38244
38244
|
const text3 = node2.text.trim() !== "" ? decodeHtml(escapeHtml(node2.text)) : " ";
|
|
38245
|
-
const textElement = node2.link ? Object.assign(
|
|
38245
|
+
const textElement = node2.link ? Object.assign(conf.documentFactory.createElement("a"), {
|
|
38246
38246
|
href: node2.link,
|
|
38247
38247
|
target: "_blank",
|
|
38248
38248
|
rel: "noreferrer"
|
|
38249
|
-
}) :
|
|
38249
|
+
}) : conf.documentFactory.createElement("span");
|
|
38250
38250
|
Object.assign(textElement.style, {
|
|
38251
38251
|
fontWeight: node2.bold ? "700" : "400",
|
|
38252
38252
|
fontStyle: node2.italic ? "italic" : "",
|
|
@@ -38254,10 +38254,10 @@ class RichText extends BaseItem {
|
|
|
38254
38254
|
node2.underline ? "underline" : "",
|
|
38255
38255
|
node2["line-through"] ? "line-through" : ""
|
|
38256
38256
|
].filter(Boolean).join(" "),
|
|
38257
|
-
color: node2.fontColor ||
|
|
38258
|
-
backgroundColor: node2.fontHighlight ||
|
|
38259
|
-
fontSize: node2.fontSize ? `${node2.fontSize}px` : `${
|
|
38260
|
-
fontFamily: node2.fontFamily ||
|
|
38257
|
+
color: node2.fontColor || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
38258
|
+
backgroundColor: node2.fontHighlight || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
38259
|
+
fontSize: node2.fontSize ? `${node2.fontSize}px` : `${conf.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
38260
|
+
fontFamily: node2.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
38261
38261
|
});
|
|
38262
38262
|
if (this.insideOf === "Frame") {
|
|
38263
38263
|
Object.assign(textElement.style, {
|
|
@@ -38292,14 +38292,14 @@ class RichText extends BaseItem {
|
|
|
38292
38292
|
four: 4,
|
|
38293
38293
|
five: 5
|
|
38294
38294
|
};
|
|
38295
|
-
const header =
|
|
38295
|
+
const header = conf.documentFactory.createElement(`h${levels[level]}`);
|
|
38296
38296
|
applyCommonStyles(header);
|
|
38297
38297
|
header.append(...children);
|
|
38298
38298
|
return header;
|
|
38299
38299
|
}
|
|
38300
38300
|
case "code_block": {
|
|
38301
|
-
const pre =
|
|
38302
|
-
const code =
|
|
38301
|
+
const pre = conf.documentFactory.createElement("pre");
|
|
38302
|
+
const code = conf.documentFactory.createElement("code");
|
|
38303
38303
|
applyCommonStyles(pre);
|
|
38304
38304
|
if (node2.language) {
|
|
38305
38305
|
code.classList.add(`language-${node2.language}`);
|
|
@@ -38313,35 +38313,35 @@ class RichText extends BaseItem {
|
|
|
38313
38313
|
return pre;
|
|
38314
38314
|
}
|
|
38315
38315
|
case "block-quote": {
|
|
38316
|
-
const blockquote =
|
|
38316
|
+
const blockquote = conf.documentFactory.createElement("blockquote");
|
|
38317
38317
|
applyCommonStyles(blockquote);
|
|
38318
38318
|
blockquote.append(...children);
|
|
38319
38319
|
return blockquote;
|
|
38320
38320
|
}
|
|
38321
38321
|
case "ul_list": {
|
|
38322
|
-
const ul =
|
|
38322
|
+
const ul = conf.documentFactory.createElement("ul");
|
|
38323
38323
|
applyCommonStyles(ul);
|
|
38324
38324
|
ul.append(...children);
|
|
38325
38325
|
return ul;
|
|
38326
38326
|
}
|
|
38327
38327
|
case "ol_list": {
|
|
38328
|
-
const ol =
|
|
38328
|
+
const ol = conf.documentFactory.createElement("ol");
|
|
38329
38329
|
applyCommonStyles(ol);
|
|
38330
38330
|
ol.append(...children);
|
|
38331
38331
|
return ol;
|
|
38332
38332
|
}
|
|
38333
38333
|
case "list_item": {
|
|
38334
|
-
const li =
|
|
38334
|
+
const li = conf.documentFactory.createElement("li");
|
|
38335
38335
|
applyCommonStyles(li);
|
|
38336
38336
|
li.append(...children);
|
|
38337
38337
|
return li;
|
|
38338
38338
|
}
|
|
38339
38339
|
case "paragraph":
|
|
38340
38340
|
default: {
|
|
38341
|
-
const par =
|
|
38341
|
+
const par = conf.documentFactory.createElement("p");
|
|
38342
38342
|
applyCommonStyles(par);
|
|
38343
38343
|
Object.assign(par.style, {
|
|
38344
|
-
lineHeight: node2.lineHeight ? `${node2.lineHeight}` :
|
|
38344
|
+
lineHeight: node2.lineHeight ? `${node2.lineHeight}` : conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
38345
38345
|
margin: "0"
|
|
38346
38346
|
});
|
|
38347
38347
|
par.append(...children);
|
|
@@ -38349,7 +38349,7 @@ class RichText extends BaseItem {
|
|
|
38349
38349
|
}
|
|
38350
38350
|
}
|
|
38351
38351
|
}
|
|
38352
|
-
return
|
|
38352
|
+
return conf.documentFactory.createElement("div");
|
|
38353
38353
|
};
|
|
38354
38354
|
const escapeHtml = (unsafe) => {
|
|
38355
38355
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -51413,7 +51413,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
51413
51413
|
markdownString = String(file).trim();
|
|
51414
51414
|
}
|
|
51415
51415
|
let slateNodes = [];
|
|
51416
|
-
if (
|
|
51416
|
+
if (conf.URL_REGEX.test(text5)) {
|
|
51417
51417
|
slateNodes = [createLinkNode(text5)];
|
|
51418
51418
|
} else {
|
|
51419
51419
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -51429,7 +51429,7 @@ function createLinkNode(link2) {
|
|
|
51429
51429
|
type: "text",
|
|
51430
51430
|
link: link2,
|
|
51431
51431
|
text: link2,
|
|
51432
|
-
...
|
|
51432
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
51433
51433
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
51434
51434
|
};
|
|
51435
51435
|
}
|
|
@@ -51540,7 +51540,7 @@ class AINode extends BaseItem {
|
|
|
51540
51540
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
51541
51541
|
super(board, id);
|
|
51542
51542
|
this.id = id;
|
|
51543
|
-
this.buttonIcon =
|
|
51543
|
+
this.buttonIcon = conf.documentFactory.createElement("img");
|
|
51544
51544
|
this.buttonIcon.src = ICON_SRC;
|
|
51545
51545
|
this.contextItems = contextItems;
|
|
51546
51546
|
this.isUserRequest = isUserRequest;
|
|
@@ -52765,12 +52765,12 @@ class Connector2 extends BaseItem {
|
|
|
52765
52765
|
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
52766
52766
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
52767
52767
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
52768
|
-
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo,
|
|
52768
|
+
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf.i18n.t("connector.textPlaceholder", {
|
|
52769
52769
|
ns: "default"
|
|
52770
52770
|
}), true, false, "Connector", {
|
|
52771
|
-
...
|
|
52772
|
-
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) :
|
|
52773
|
-
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") :
|
|
52771
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
52772
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
52773
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf.DEFAULT_TEXT_STYLES.fontColor
|
|
52774
52774
|
});
|
|
52775
52775
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
52776
52776
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -53220,7 +53220,7 @@ class Connector2 extends BaseItem {
|
|
|
53220
53220
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
53221
53221
|
this.text.render(context);
|
|
53222
53222
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
53223
|
-
ctx.strokeStyle =
|
|
53223
|
+
ctx.strokeStyle = conf.SELECTION_COLOR;
|
|
53224
53224
|
ctx.lineWidth = 1;
|
|
53225
53225
|
ctx.beginPath();
|
|
53226
53226
|
ctx.rect(textMbr.left - TEXT_BORDER_PADDING, textMbr.top - TEXT_BORDER_PADDING, textMbr.getWidth() + TEXT_BORDER_PADDING * 2, textMbr.getHeight() + TEXT_BORDER_PADDING * 2);
|
|
@@ -53447,7 +53447,7 @@ class Connector2 extends BaseItem {
|
|
|
53447
53447
|
}
|
|
53448
53448
|
}
|
|
53449
53449
|
updatePaths() {
|
|
53450
|
-
if (
|
|
53450
|
+
if (conf.isNode()) {
|
|
53451
53451
|
return;
|
|
53452
53452
|
}
|
|
53453
53453
|
const startPoint = this.startPoint;
|
|
@@ -54258,7 +54258,7 @@ class DefaultShapeData {
|
|
|
54258
54258
|
text;
|
|
54259
54259
|
linkTo;
|
|
54260
54260
|
itemType = "Shape";
|
|
54261
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
54261
|
+
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) {
|
|
54262
54262
|
this.shapeType = shapeType;
|
|
54263
54263
|
this.backgroundColor = backgroundColor;
|
|
54264
54264
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -55456,7 +55456,7 @@ class Shape extends BaseItem {
|
|
|
55456
55456
|
this.text.updateElement();
|
|
55457
55457
|
}
|
|
55458
55458
|
transformPath() {
|
|
55459
|
-
if (
|
|
55459
|
+
if (conf.isNode()) {
|
|
55460
55460
|
return;
|
|
55461
55461
|
}
|
|
55462
55462
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -55649,7 +55649,7 @@ class Sticker extends BaseItem {
|
|
|
55649
55649
|
return this;
|
|
55650
55650
|
}
|
|
55651
55651
|
transformPath() {
|
|
55652
|
-
if (
|
|
55652
|
+
if (conf.isNode()) {
|
|
55653
55653
|
return;
|
|
55654
55654
|
}
|
|
55655
55655
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -56135,7 +56135,7 @@ class Frame extends BaseItem {
|
|
|
56135
56135
|
this.path = Frames[this.shapeType].path.copy();
|
|
56136
56136
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
56137
56137
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
56138
|
-
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...
|
|
56138
|
+
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 });
|
|
56139
56139
|
this.text.setSelectionHorisontalAlignment("left");
|
|
56140
56140
|
this.transformation.subject.subscribe(() => {
|
|
56141
56141
|
this.transformPath();
|
|
@@ -56681,10 +56681,10 @@ class Frame extends BaseItem {
|
|
|
56681
56681
|
}
|
|
56682
56682
|
// src/Items/Video/Video.ts
|
|
56683
56683
|
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";
|
|
56684
|
-
var videoIcon =
|
|
56684
|
+
var videoIcon = conf.documentFactory.createElement("img");
|
|
56685
56685
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
56686
56686
|
var createPlaceholderImage = (width2, height2) => {
|
|
56687
|
-
const canvas =
|
|
56687
|
+
const canvas = conf.documentFactory.createElement("canvas");
|
|
56688
56688
|
canvas.width = width2;
|
|
56689
56689
|
canvas.height = height2;
|
|
56690
56690
|
const ctx = canvas.getContext("2d");
|
|
@@ -56726,7 +56726,7 @@ class VideoItem extends BaseItem {
|
|
|
56726
56726
|
super(board, id);
|
|
56727
56727
|
this.events = events;
|
|
56728
56728
|
this.extension = extension2;
|
|
56729
|
-
this.isStorageUrl = !
|
|
56729
|
+
this.isStorageUrl = !conf.getYouTubeId(url);
|
|
56730
56730
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
56731
56731
|
this.linkTo = new LinkTo(this.id, events);
|
|
56732
56732
|
this.board = board;
|
|
@@ -57096,59 +57096,59 @@ async function fileTosha256(file) {
|
|
|
57096
57096
|
var catchErrorResponse = async (response, mediaType) => {
|
|
57097
57097
|
if (response.status === 403) {
|
|
57098
57098
|
const data = await response.json();
|
|
57099
|
-
let errorBody =
|
|
57099
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
57100
57100
|
if (!data.isOwnerRequest) {
|
|
57101
|
-
errorBody =
|
|
57101
|
+
errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
57102
57102
|
} else if (data.currentUsage && data.storageLimit) {
|
|
57103
|
-
errorBody =
|
|
57103
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
57104
57104
|
}
|
|
57105
|
-
|
|
57105
|
+
conf.notify({
|
|
57106
57106
|
variant: "warning",
|
|
57107
|
-
header:
|
|
57107
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
57108
57108
|
body: errorBody,
|
|
57109
57109
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
57110
|
-
text:
|
|
57111
|
-
onClick: () =>
|
|
57110
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
57111
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
57112
57112
|
} : undefined,
|
|
57113
57113
|
duration: 8000
|
|
57114
57114
|
});
|
|
57115
57115
|
} else if (response.status === 413) {
|
|
57116
57116
|
const data = await response.json();
|
|
57117
|
-
let errorBody =
|
|
57117
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
57118
57118
|
let isBasicPlan = false;
|
|
57119
57119
|
if (data.fileSizeLimit && data.fileSize) {
|
|
57120
57120
|
if (mediaType === "image") {
|
|
57121
57121
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
57122
|
-
errorBody =
|
|
57122
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
57123
57123
|
} else {
|
|
57124
57124
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
57125
|
-
errorBody =
|
|
57125
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
57126
57126
|
}
|
|
57127
57127
|
}
|
|
57128
|
-
|
|
57128
|
+
conf.notify({
|
|
57129
57129
|
variant: "warning",
|
|
57130
|
-
header:
|
|
57130
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
57131
57131
|
body: errorBody,
|
|
57132
57132
|
button: isBasicPlan ? {
|
|
57133
|
-
text:
|
|
57134
|
-
onClick: () =>
|
|
57133
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
57134
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
57135
57135
|
} : undefined,
|
|
57136
57136
|
duration: 4000
|
|
57137
57137
|
});
|
|
57138
57138
|
} else if (response.status === 401) {
|
|
57139
|
-
|
|
57139
|
+
conf.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
57140
57140
|
} else if (response.status === 415) {
|
|
57141
|
-
|
|
57141
|
+
conf.notify({
|
|
57142
57142
|
variant: "warning",
|
|
57143
|
-
header:
|
|
57144
|
-
body:
|
|
57143
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
57144
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
57145
57145
|
duration: 4000
|
|
57146
57146
|
});
|
|
57147
57147
|
} else {
|
|
57148
|
-
|
|
57148
|
+
conf.notify({
|
|
57149
57149
|
variant: "error",
|
|
57150
|
-
header:
|
|
57151
|
-
body:
|
|
57150
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
57151
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
57152
57152
|
duration: 4000
|
|
57153
57153
|
});
|
|
57154
57154
|
}
|
|
@@ -57156,17 +57156,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
57156
57156
|
};
|
|
57157
57157
|
var catchDuplicateErrorResponse = async (response) => {
|
|
57158
57158
|
if (response.status === 403) {
|
|
57159
|
-
|
|
57159
|
+
conf.notify({
|
|
57160
57160
|
variant: "warning",
|
|
57161
|
-
header:
|
|
57162
|
-
body:
|
|
57161
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
57162
|
+
body: conf.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
57163
57163
|
duration: 4000
|
|
57164
57164
|
});
|
|
57165
57165
|
} else {
|
|
57166
|
-
|
|
57166
|
+
conf.notify({
|
|
57167
57167
|
variant: "error",
|
|
57168
|
-
header:
|
|
57169
|
-
body:
|
|
57168
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
57169
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
57170
57170
|
duration: 4000
|
|
57171
57171
|
});
|
|
57172
57172
|
}
|
|
@@ -57174,40 +57174,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
57174
57174
|
};
|
|
57175
57175
|
var validateMediaFile = (file, account2) => {
|
|
57176
57176
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
57177
|
-
if (!file.type.startsWith("image") && !
|
|
57178
|
-
|
|
57177
|
+
if (!file.type.startsWith("image") && !conf.AUDIO_FORMATS.includes(fileExtension) && !conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
57178
|
+
conf.notify({
|
|
57179
57179
|
variant: "warning",
|
|
57180
|
-
header:
|
|
57181
|
-
body:
|
|
57180
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
57181
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
57182
57182
|
duration: 4000
|
|
57183
57183
|
});
|
|
57184
57184
|
return false;
|
|
57185
57185
|
}
|
|
57186
57186
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
57187
|
-
let errorBody =
|
|
57188
|
-
if (
|
|
57189
|
-
errorBody =
|
|
57187
|
+
let errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
57188
|
+
if (conf.AUDIO_FORMATS.includes(fileExtension) || conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
57189
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
57190
57190
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
57191
|
-
|
|
57191
|
+
conf.notify({
|
|
57192
57192
|
variant: "warning",
|
|
57193
|
-
header:
|
|
57193
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
57194
57194
|
body: errorBody,
|
|
57195
57195
|
button: isBasicPlan ? {
|
|
57196
|
-
text:
|
|
57197
|
-
onClick: () =>
|
|
57196
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
57197
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
57198
57198
|
} : undefined,
|
|
57199
57199
|
duration: 4000
|
|
57200
57200
|
});
|
|
57201
57201
|
return false;
|
|
57202
57202
|
}
|
|
57203
57203
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
57204
|
-
|
|
57204
|
+
conf.notify({
|
|
57205
57205
|
variant: "warning",
|
|
57206
|
-
header:
|
|
57206
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
57207
57207
|
body: errorBody,
|
|
57208
57208
|
button: isBasicPlan ? {
|
|
57209
|
-
text:
|
|
57210
|
-
onClick: () =>
|
|
57209
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
57210
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
57211
57211
|
} : undefined,
|
|
57212
57212
|
duration: 4000
|
|
57213
57213
|
});
|
|
@@ -57286,7 +57286,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
57286
57286
|
};
|
|
57287
57287
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
57288
57288
|
image2.onload = async () => {
|
|
57289
|
-
const parser =
|
|
57289
|
+
const parser = conf.getDOMParser();
|
|
57290
57290
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
57291
57291
|
const svgElement = svgDoc.documentElement;
|
|
57292
57292
|
svgElement.removeAttribute("width");
|
|
@@ -57498,8 +57498,8 @@ class AudioItem extends BaseItem {
|
|
|
57498
57498
|
this.subject.publish(this);
|
|
57499
57499
|
});
|
|
57500
57500
|
this.transformation.subject.subscribe(this.onTransform);
|
|
57501
|
-
this.right = this.left +
|
|
57502
|
-
this.bottom = this.top +
|
|
57501
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width;
|
|
57502
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height;
|
|
57503
57503
|
this.shouldUseCustomRender = true;
|
|
57504
57504
|
}
|
|
57505
57505
|
setCurrentTime(time) {
|
|
@@ -57568,8 +57568,8 @@ class AudioItem extends BaseItem {
|
|
|
57568
57568
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
57569
57569
|
this.left = translateX;
|
|
57570
57570
|
this.top = translateY;
|
|
57571
|
-
this.right = this.left +
|
|
57572
|
-
this.bottom = this.top +
|
|
57571
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width * scaleX;
|
|
57572
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height * scaleY;
|
|
57573
57573
|
}
|
|
57574
57574
|
render(context) {
|
|
57575
57575
|
if (this.transformationRenderBlock) {
|
|
@@ -57598,8 +57598,8 @@ class AudioItem extends BaseItem {
|
|
|
57598
57598
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
57599
57599
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
57600
57600
|
div.id = this.getId();
|
|
57601
|
-
div.style.width = `${
|
|
57602
|
-
div.style.height = `${
|
|
57601
|
+
div.style.width = `${conf.AUDIO_DIMENSIONS.width}px`;
|
|
57602
|
+
div.style.height = `${conf.AUDIO_DIMENSIONS.height}px`;
|
|
57603
57603
|
div.style.transformOrigin = "top left";
|
|
57604
57604
|
div.style.transform = transform;
|
|
57605
57605
|
div.style.position = "absolute";
|
|
@@ -57718,7 +57718,7 @@ class AudioItem extends BaseItem {
|
|
|
57718
57718
|
}
|
|
57719
57719
|
download() {
|
|
57720
57720
|
if (this.extension) {
|
|
57721
|
-
const linkElem =
|
|
57721
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
57722
57722
|
linkElem.href = this.url;
|
|
57723
57723
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
57724
57724
|
linkElem.click();
|
|
@@ -58059,7 +58059,7 @@ class Placeholder extends BaseItem {
|
|
|
58059
58059
|
}
|
|
58060
58060
|
// src/Items/Image/Image.ts
|
|
58061
58061
|
function getPlaceholderImage(board, imageDimension) {
|
|
58062
|
-
const placeholderCanvas =
|
|
58062
|
+
const placeholderCanvas = conf.documentFactory.createElement("canvas");
|
|
58063
58063
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
58064
58064
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
58065
58065
|
const placeholder = new Placeholder;
|
|
@@ -58340,7 +58340,7 @@ class Drawing extends BaseItem {
|
|
|
58340
58340
|
itemType = "Drawing";
|
|
58341
58341
|
parent = "Board";
|
|
58342
58342
|
transformation;
|
|
58343
|
-
path2d = new
|
|
58343
|
+
path2d = new conf.path2DFactory;
|
|
58344
58344
|
subject = new Subject;
|
|
58345
58345
|
untransformedMbr = new Mbr;
|
|
58346
58346
|
lines = [];
|
|
@@ -58415,7 +58415,7 @@ class Drawing extends BaseItem {
|
|
|
58415
58415
|
this.bottom = mbr.bottom;
|
|
58416
58416
|
}
|
|
58417
58417
|
updatePath2d() {
|
|
58418
|
-
this.path2d = new
|
|
58418
|
+
this.path2d = new conf.path2DFactory;
|
|
58419
58419
|
const context = this.path2d;
|
|
58420
58420
|
const points = this.points;
|
|
58421
58421
|
if (points.length < 3) {
|
|
@@ -59667,14 +59667,14 @@ class AddConnector extends BoardTool {
|
|
|
59667
59667
|
class AddDrawing extends BoardTool {
|
|
59668
59668
|
drawing = null;
|
|
59669
59669
|
isDown = false;
|
|
59670
|
-
strokeWidth =
|
|
59671
|
-
strokeColor =
|
|
59672
|
-
strokeStyle =
|
|
59670
|
+
strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
|
|
59671
|
+
strokeColor = conf.PEN_DEFAULT_COLOR;
|
|
59672
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
59673
59673
|
constructor(board) {
|
|
59674
59674
|
super(board);
|
|
59675
59675
|
this.setCursor();
|
|
59676
|
-
if (
|
|
59677
|
-
const drawingSettings = localStorage.getItem(
|
|
59676
|
+
if (conf.PEN_SETTINGS_KEY) {
|
|
59677
|
+
const drawingSettings = localStorage.getItem(conf.PEN_SETTINGS_KEY);
|
|
59678
59678
|
if (drawingSettings) {
|
|
59679
59679
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
59680
59680
|
this.strokeWidth = strokeWidth;
|
|
@@ -59684,7 +59684,7 @@ class AddDrawing extends BoardTool {
|
|
|
59684
59684
|
}
|
|
59685
59685
|
}
|
|
59686
59686
|
updateSettings() {
|
|
59687
|
-
localStorage.setItem(
|
|
59687
|
+
localStorage.setItem(conf.PEN_SETTINGS_KEY, JSON.stringify({
|
|
59688
59688
|
strokeWidth: this.strokeWidth,
|
|
59689
59689
|
strokeColor: this.strokeColor,
|
|
59690
59690
|
strokeStyle: this.strokeStyle
|
|
@@ -59714,7 +59714,7 @@ class AddDrawing extends BoardTool {
|
|
|
59714
59714
|
ctx.beginPath();
|
|
59715
59715
|
ctx.arc(point5.x, point5.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
59716
59716
|
ctx.lineWidth = 1;
|
|
59717
|
-
ctx.strokeStyle =
|
|
59717
|
+
ctx.strokeStyle = conf.PEN_POINTER_CIRCLE_COLOR;
|
|
59718
59718
|
ctx.stroke();
|
|
59719
59719
|
}
|
|
59720
59720
|
setCursor() {
|
|
@@ -59796,7 +59796,7 @@ class AddDrawing extends BoardTool {
|
|
|
59796
59796
|
this.setCursor();
|
|
59797
59797
|
};
|
|
59798
59798
|
render(context) {
|
|
59799
|
-
if (
|
|
59799
|
+
if (conf.PEN_RENDER_POINTER_CIRCLE) {
|
|
59800
59800
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
59801
59801
|
}
|
|
59802
59802
|
if (!this.drawing) {
|
|
@@ -59811,14 +59811,14 @@ class AddDrawing extends BoardTool {
|
|
|
59811
59811
|
}
|
|
59812
59812
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
59813
59813
|
class AddHighlighter extends AddDrawing {
|
|
59814
|
-
strokeWidth =
|
|
59815
|
-
strokeColor =
|
|
59816
|
-
strokeStyle =
|
|
59814
|
+
strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
59815
|
+
strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
|
|
59816
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
59817
59817
|
constructor(board) {
|
|
59818
59818
|
super(board);
|
|
59819
59819
|
this.setCursor();
|
|
59820
|
-
if (
|
|
59821
|
-
const highlighterSettings = localStorage.getItem(
|
|
59820
|
+
if (conf.HIGHLIGHTER_SETTINGS_KEY) {
|
|
59821
|
+
const highlighterSettings = localStorage.getItem(conf.HIGHLIGHTER_SETTINGS_KEY);
|
|
59822
59822
|
if (highlighterSettings) {
|
|
59823
59823
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
59824
59824
|
this.strokeWidth = strokeWidth;
|
|
@@ -59831,7 +59831,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
59831
59831
|
return true;
|
|
59832
59832
|
}
|
|
59833
59833
|
updateSettings() {
|
|
59834
|
-
localStorage.setItem(
|
|
59834
|
+
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
59835
59835
|
strokeWidth: this.strokeWidth,
|
|
59836
59836
|
strokeColor: this.strokeColor,
|
|
59837
59837
|
strokeStyle: this.strokeStyle
|
|
@@ -60155,7 +60155,7 @@ class AddShape extends BoardTool {
|
|
|
60155
60155
|
const point5 = this.board.pointer.point;
|
|
60156
60156
|
this.line = new Line(point5.copy(), point5.copy());
|
|
60157
60157
|
this.bounds = this.line.getMbr();
|
|
60158
|
-
this.bounds.borderColor =
|
|
60158
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60159
60159
|
this.shape.apply({
|
|
60160
60160
|
class: "Shape",
|
|
60161
60161
|
method: "setShapeType",
|
|
@@ -60179,7 +60179,7 @@ class AddShape extends BoardTool {
|
|
|
60179
60179
|
}
|
|
60180
60180
|
this.line = new Line(startPoint, endPoint);
|
|
60181
60181
|
this.bounds = this.line.getMbr();
|
|
60182
|
-
this.bounds.borderColor =
|
|
60182
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60183
60183
|
this.initTransformation();
|
|
60184
60184
|
this.board.tools.publish();
|
|
60185
60185
|
return true;
|
|
@@ -60251,7 +60251,7 @@ class AddShape extends BoardTool {
|
|
|
60251
60251
|
const y = (top + bottom) / 2 - 50;
|
|
60252
60252
|
this.bounds = new Mbr(x, y, x, y);
|
|
60253
60253
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
60254
|
-
this.bounds.borderColor =
|
|
60254
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60255
60255
|
this.shape.apply({
|
|
60256
60256
|
class: "Shape",
|
|
60257
60257
|
method: "setShapeType",
|
|
@@ -60284,8 +60284,8 @@ class AddSticker extends BoardTool {
|
|
|
60284
60284
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
60285
60285
|
}
|
|
60286
60286
|
setCursor(color2) {
|
|
60287
|
-
if (
|
|
60288
|
-
const colorName = color2 ?
|
|
60287
|
+
if (conf.STICKER_COLOR_NAMES) {
|
|
60288
|
+
const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
60289
60289
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
60290
60290
|
} else {
|
|
60291
60291
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -60309,7 +60309,7 @@ class AddSticker extends BoardTool {
|
|
|
60309
60309
|
const point5 = this.board.pointer.point;
|
|
60310
60310
|
this.line = new Line(point5.copy(), point5.copy());
|
|
60311
60311
|
this.bounds = this.line.getMbr();
|
|
60312
|
-
this.bounds.borderColor =
|
|
60312
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60313
60313
|
this.board.tools.publish();
|
|
60314
60314
|
return true;
|
|
60315
60315
|
}
|
|
@@ -60318,7 +60318,7 @@ class AddSticker extends BoardTool {
|
|
|
60318
60318
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
60319
60319
|
this.sticker.applyDiagonal(this.line);
|
|
60320
60320
|
this.bounds = this.sticker.getMbr();
|
|
60321
|
-
this.bounds.borderColor =
|
|
60321
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60322
60322
|
this.board.tools.publish();
|
|
60323
60323
|
return true;
|
|
60324
60324
|
}
|
|
@@ -60418,7 +60418,7 @@ class AddText extends BoardTool {
|
|
|
60418
60418
|
const point5 = this.board.pointer.point;
|
|
60419
60419
|
this.line = new Line(point5.copy(), point5.copy());
|
|
60420
60420
|
this.bounds = this.line.getMbr();
|
|
60421
|
-
this.bounds.borderColor =
|
|
60421
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60422
60422
|
this.board.tools.publish();
|
|
60423
60423
|
return true;
|
|
60424
60424
|
}
|
|
@@ -60429,7 +60429,7 @@ class AddText extends BoardTool {
|
|
|
60429
60429
|
const end = new Point(cursorPoint.x, start.y + height2);
|
|
60430
60430
|
this.line = new Line(start, end);
|
|
60431
60431
|
this.bounds = this.line.getMbr();
|
|
60432
|
-
this.bounds.borderColor =
|
|
60432
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
60433
60433
|
this.board.tools.publish();
|
|
60434
60434
|
return true;
|
|
60435
60435
|
}
|
|
@@ -60494,11 +60494,11 @@ class AddText extends BoardTool {
|
|
|
60494
60494
|
class Eraser extends BoardTool {
|
|
60495
60495
|
itemType = "Eraser";
|
|
60496
60496
|
isDown = false;
|
|
60497
|
-
strokeWidth =
|
|
60498
|
-
strokeColor =
|
|
60499
|
-
strokeStyle =
|
|
60497
|
+
strokeWidth = conf.ERASER_STROKE_WIDTH;
|
|
60498
|
+
strokeColor = conf.ERASER_DEFAULT_COLOR;
|
|
60499
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
60500
60500
|
drawing = new Drawing(this.board, []);
|
|
60501
|
-
maxPointsInLine =
|
|
60501
|
+
maxPointsInLine = conf.ERASER_MAX_LINE_LENGTH;
|
|
60502
60502
|
constructor(board) {
|
|
60503
60503
|
super(board);
|
|
60504
60504
|
this.setCursor();
|
|
@@ -60634,8 +60634,8 @@ function getResizeType(cursorPoint, cameraScale, mbr, anchorDistance = 5) {
|
|
|
60634
60634
|
|
|
60635
60635
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
60636
60636
|
function getDecorationResizeType(point5, mbr, tolerance = 10) {
|
|
60637
|
-
for (const key in
|
|
60638
|
-
const decoration =
|
|
60637
|
+
for (const key in conf.EXPORT_FRAME_DECORATIONS) {
|
|
60638
|
+
const decoration = conf.EXPORT_FRAME_DECORATIONS[key];
|
|
60639
60639
|
const decorationBounds = {
|
|
60640
60640
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
60641
60641
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -60676,7 +60676,7 @@ class ExportSnapshot extends Tool {
|
|
|
60676
60676
|
super();
|
|
60677
60677
|
this.board = board;
|
|
60678
60678
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
60679
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
60679
|
+
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);
|
|
60680
60680
|
this.board.selection.disable();
|
|
60681
60681
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
60682
60682
|
}
|
|
@@ -60688,11 +60688,11 @@ class ExportSnapshot extends Tool {
|
|
|
60688
60688
|
resize() {
|
|
60689
60689
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
60690
60690
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
60691
|
-
if (resize.mbr.getWidth() >
|
|
60691
|
+
if (resize.mbr.getWidth() > conf.EXPORT_MIN_WIDTH) {
|
|
60692
60692
|
this.mbr.left = resize.mbr.left;
|
|
60693
60693
|
this.mbr.right = resize.mbr.right;
|
|
60694
60694
|
}
|
|
60695
|
-
if (resize.mbr.getHeight() >
|
|
60695
|
+
if (resize.mbr.getHeight() > conf.EXPORT_MIN_HEIGHT) {
|
|
60696
60696
|
this.mbr.top = resize.mbr.top;
|
|
60697
60697
|
this.mbr.bottom = resize.mbr.bottom;
|
|
60698
60698
|
}
|
|
@@ -60781,7 +60781,7 @@ class ExportSnapshot extends Tool {
|
|
|
60781
60781
|
}
|
|
60782
60782
|
const res = await exportBoardSnapshot({
|
|
60783
60783
|
board: this.board,
|
|
60784
|
-
bgColor:
|
|
60784
|
+
bgColor: conf.CANVAS_BG_COLOR,
|
|
60785
60785
|
selection: this.mbr,
|
|
60786
60786
|
upscaleTo: 4000,
|
|
60787
60787
|
nameToExport: this.board.getName()
|
|
@@ -60805,18 +60805,18 @@ class ExportSnapshot extends Tool {
|
|
|
60805
60805
|
const cameraMbr = context.camera.getMbr();
|
|
60806
60806
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
60807
60807
|
this.tempDrawingContext.clear();
|
|
60808
|
-
cameraMbr.backgroundColor =
|
|
60808
|
+
cameraMbr.backgroundColor = conf.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
60809
60809
|
cameraMbr.strokeWidth = 0;
|
|
60810
60810
|
cameraMbr.render(this.tempDrawingContext);
|
|
60811
60811
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
60812
|
-
if (
|
|
60813
|
-
const topLeft =
|
|
60812
|
+
if (conf.EXPORT_FRAME_DECORATIONS) {
|
|
60813
|
+
const topLeft = conf.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
60814
60814
|
this.renderDecoration(this.tempDrawingContext, topLeft.path, this.mbr.left + (topLeft.offsetX ?? 0), this.mbr.top + (topLeft.offsetY ?? 0), topLeft.color, topLeft.lineWidth);
|
|
60815
|
-
const topRight =
|
|
60815
|
+
const topRight = conf.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
60816
60816
|
this.renderDecoration(this.tempDrawingContext, topRight.path, this.mbr.right + (topRight.offsetX ?? 0), this.mbr.top + (topRight.offsetY ?? 0), topRight.color, topRight.lineWidth);
|
|
60817
|
-
const bottomLeft =
|
|
60817
|
+
const bottomLeft = conf.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
60818
60818
|
this.renderDecoration(this.tempDrawingContext, bottomLeft.path, this.mbr.left + (bottomLeft.offsetX ?? 0), this.mbr.bottom + (bottomLeft.offsetY ?? 0), bottomLeft.color, bottomLeft.lineWidth);
|
|
60819
|
-
const bottomRight =
|
|
60819
|
+
const bottomRight = conf.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
60820
60820
|
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);
|
|
60821
60821
|
}
|
|
60822
60822
|
}
|
|
@@ -60918,7 +60918,7 @@ function createCanvasDrawer(board) {
|
|
|
60918
60918
|
borderDiv.id = "canvasBorder";
|
|
60919
60919
|
borderDiv.style.position = "absolute";
|
|
60920
60920
|
borderDiv.style.transformOrigin = "left top";
|
|
60921
|
-
borderDiv.style.border = `1px solid ${
|
|
60921
|
+
borderDiv.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
60922
60922
|
borderDiv.style.boxSizing = "border-box";
|
|
60923
60923
|
borderDiv.style.left = `${leftOffset}px`;
|
|
60924
60924
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -60928,7 +60928,7 @@ function createCanvasDrawer(board) {
|
|
|
60928
60928
|
canvas.style.boxSizing = "border-box";
|
|
60929
60929
|
container.appendChild(borderDiv);
|
|
60930
60930
|
} else {
|
|
60931
|
-
canvas.style.border = `1px solid ${
|
|
60931
|
+
canvas.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
60932
60932
|
canvas.style.boxSizing = "border-box";
|
|
60933
60933
|
}
|
|
60934
60934
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -60936,8 +60936,8 @@ function createCanvasDrawer(board) {
|
|
|
60936
60936
|
anchorDiv.style.position = "absolute";
|
|
60937
60937
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
60938
60938
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
60939
|
-
anchorDiv.style.backgroundColor = `${
|
|
60940
|
-
anchorDiv.style.border = `${
|
|
60939
|
+
anchorDiv.style.backgroundColor = `${conf.SELECTION_ANCHOR_COLOR}`;
|
|
60940
|
+
anchorDiv.style.border = `${conf.SELECTION_ANCHOR_WIDTH}px solid ${conf.SELECTION_COLOR}`;
|
|
60941
60941
|
anchorDiv.style.borderRadius = "2px";
|
|
60942
60942
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
60943
60943
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -60945,10 +60945,10 @@ function createCanvasDrawer(board) {
|
|
|
60945
60945
|
return anchorDiv;
|
|
60946
60946
|
};
|
|
60947
60947
|
const anchors = [
|
|
60948
|
-
createAnchorDiv("0%", "0%",
|
|
60949
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
60950
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
60951
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
60948
|
+
createAnchorDiv("0%", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
60949
|
+
createAnchorDiv("100% + 1px", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
60950
|
+
createAnchorDiv("0%", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS),
|
|
60951
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS)
|
|
60952
60952
|
];
|
|
60953
60953
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
60954
60954
|
for (const anchor of anchors) {
|
|
@@ -62301,8 +62301,8 @@ class Select extends Tool {
|
|
|
62301
62301
|
const { x, y } = pointer.point;
|
|
62302
62302
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
62303
62303
|
this.rect = this.line.getMbr();
|
|
62304
|
-
this.rect.borderColor =
|
|
62305
|
-
this.rect.backgroundColor =
|
|
62304
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
62305
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
62306
62306
|
this.board.tools.publish();
|
|
62307
62307
|
this.board.presence.throttledEmit({
|
|
62308
62308
|
method: "DrawSelect",
|
|
@@ -62387,8 +62387,8 @@ class Select extends Tool {
|
|
|
62387
62387
|
const point5 = this.board.pointer.point.copy();
|
|
62388
62388
|
this.line = new Line(this.line.start, point5);
|
|
62389
62389
|
this.rect = this.line.getMbr();
|
|
62390
|
-
this.rect.borderColor =
|
|
62391
|
-
this.rect.backgroundColor =
|
|
62390
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
62391
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
62392
62392
|
this.board.tools.publish();
|
|
62393
62393
|
this.board.presence.throttledEmit({
|
|
62394
62394
|
method: "DrawSelect",
|
|
@@ -62899,7 +62899,7 @@ class ShapeTool extends CustomTool {
|
|
|
62899
62899
|
const point5 = this.board.pointer.point;
|
|
62900
62900
|
this.line = new Line(point5.copy(), point5.copy());
|
|
62901
62901
|
this.bounds = this.line.getMbr();
|
|
62902
|
-
this.bounds.borderColor =
|
|
62902
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
62903
62903
|
this.initTransformation();
|
|
62904
62904
|
this.board.tools.publish();
|
|
62905
62905
|
return true;
|
|
@@ -62917,7 +62917,7 @@ class ShapeTool extends CustomTool {
|
|
|
62917
62917
|
}
|
|
62918
62918
|
this.line = new Line(startPoint, endPoint);
|
|
62919
62919
|
this.bounds = this.line.getMbr();
|
|
62920
|
-
this.bounds.borderColor =
|
|
62920
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
62921
62921
|
this.initTransformation();
|
|
62922
62922
|
this.board.tools.publish();
|
|
62923
62923
|
return true;
|
|
@@ -63886,9 +63886,9 @@ class Camera {
|
|
|
63886
63886
|
matrix = new Matrix2;
|
|
63887
63887
|
pointer = new Point;
|
|
63888
63888
|
window = {
|
|
63889
|
-
width:
|
|
63890
|
-
height:
|
|
63891
|
-
dpi:
|
|
63889
|
+
width: conf.getDocumentWidth(),
|
|
63890
|
+
height: conf.getDocumentHeight(),
|
|
63891
|
+
dpi: conf.getDPI(),
|
|
63892
63892
|
getMbr: () => {
|
|
63893
63893
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
63894
63894
|
}
|
|
@@ -64264,9 +64264,9 @@ class Camera {
|
|
|
64264
64264
|
this.updateBoardPointer();
|
|
64265
64265
|
}
|
|
64266
64266
|
onWindowResize() {
|
|
64267
|
-
this.window.width =
|
|
64268
|
-
this.window.height =
|
|
64269
|
-
this.window.dpi =
|
|
64267
|
+
this.window.width = conf.getDocumentWidth();
|
|
64268
|
+
this.window.height = conf.getDocumentHeight();
|
|
64269
|
+
this.window.dpi = conf.getDPI();
|
|
64270
64270
|
this.resizeSubject.publish(this);
|
|
64271
64271
|
this.subject.publish(this);
|
|
64272
64272
|
}
|
|
@@ -64279,10 +64279,10 @@ class Camera {
|
|
|
64279
64279
|
let y = 0;
|
|
64280
64280
|
const { activeKeys } = keyboard;
|
|
64281
64281
|
const directions = {
|
|
64282
|
-
ArrowRight: [-
|
|
64283
|
-
ArrowLeft: [
|
|
64284
|
-
ArrowDown: [0, -
|
|
64285
|
-
ArrowUp: [0,
|
|
64282
|
+
ArrowRight: [-conf.NAVIGATION_STEP, 0],
|
|
64283
|
+
ArrowLeft: [conf.NAVIGATION_STEP, 0],
|
|
64284
|
+
ArrowDown: [0, -conf.NAVIGATION_STEP],
|
|
64285
|
+
ArrowUp: [0, conf.NAVIGATION_STEP]
|
|
64286
64286
|
};
|
|
64287
64287
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
64288
64288
|
if (activeArrowKeys.length === 2) {
|
|
@@ -64665,6 +64665,322 @@ function isHotkeyPushed(hotkey, event) {
|
|
|
64665
64665
|
}
|
|
64666
64666
|
// src/isMacos.ts
|
|
64667
64667
|
var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
64668
|
+
// src/Keyboard/hotkeys.json
|
|
64669
|
+
var hotkeys_default2 = {
|
|
64670
|
+
select: {
|
|
64671
|
+
key: {
|
|
64672
|
+
button: "KeyV"
|
|
64673
|
+
},
|
|
64674
|
+
label: {
|
|
64675
|
+
windows: "V",
|
|
64676
|
+
mac: "V"
|
|
64677
|
+
}
|
|
64678
|
+
},
|
|
64679
|
+
navigateMode: {
|
|
64680
|
+
key: {
|
|
64681
|
+
button: "Space"
|
|
64682
|
+
},
|
|
64683
|
+
label: {
|
|
64684
|
+
windows: "Space",
|
|
64685
|
+
mac: "Space"
|
|
64686
|
+
}
|
|
64687
|
+
},
|
|
64688
|
+
text: {
|
|
64689
|
+
key: {
|
|
64690
|
+
button: "KeyT"
|
|
64691
|
+
},
|
|
64692
|
+
label: {
|
|
64693
|
+
windows: "T",
|
|
64694
|
+
mac: "T"
|
|
64695
|
+
}
|
|
64696
|
+
},
|
|
64697
|
+
sticker: {
|
|
64698
|
+
key: {
|
|
64699
|
+
button: "KeyN"
|
|
64700
|
+
},
|
|
64701
|
+
label: {
|
|
64702
|
+
mac: "N",
|
|
64703
|
+
windows: "N"
|
|
64704
|
+
}
|
|
64705
|
+
},
|
|
64706
|
+
shape: {
|
|
64707
|
+
key: {
|
|
64708
|
+
button: "KeyS"
|
|
64709
|
+
},
|
|
64710
|
+
label: {
|
|
64711
|
+
mac: "S",
|
|
64712
|
+
windows: "S"
|
|
64713
|
+
}
|
|
64714
|
+
},
|
|
64715
|
+
connector: {
|
|
64716
|
+
key: {
|
|
64717
|
+
button: "KeyL"
|
|
64718
|
+
},
|
|
64719
|
+
label: {
|
|
64720
|
+
mac: "L",
|
|
64721
|
+
windows: "L"
|
|
64722
|
+
}
|
|
64723
|
+
},
|
|
64724
|
+
pen: {
|
|
64725
|
+
key: {
|
|
64726
|
+
button: "KeyP"
|
|
64727
|
+
},
|
|
64728
|
+
label: {
|
|
64729
|
+
mac: "P",
|
|
64730
|
+
windows: "P"
|
|
64731
|
+
}
|
|
64732
|
+
},
|
|
64733
|
+
eraser: {
|
|
64734
|
+
key: {
|
|
64735
|
+
button: "KeyE"
|
|
64736
|
+
},
|
|
64737
|
+
label: {
|
|
64738
|
+
mac: "E",
|
|
64739
|
+
windows: "E"
|
|
64740
|
+
}
|
|
64741
|
+
},
|
|
64742
|
+
frame: {
|
|
64743
|
+
key: {
|
|
64744
|
+
button: "KeyF"
|
|
64745
|
+
},
|
|
64746
|
+
label: {
|
|
64747
|
+
mac: "F",
|
|
64748
|
+
windows: "F"
|
|
64749
|
+
}
|
|
64750
|
+
},
|
|
64751
|
+
undo: {
|
|
64752
|
+
key: {
|
|
64753
|
+
button: "KeyZ",
|
|
64754
|
+
ctrl: true
|
|
64755
|
+
},
|
|
64756
|
+
label: {
|
|
64757
|
+
mac: "⌘Z",
|
|
64758
|
+
windows: "Ctrl + Z"
|
|
64759
|
+
}
|
|
64760
|
+
},
|
|
64761
|
+
redo: {
|
|
64762
|
+
key: {
|
|
64763
|
+
button: "KeyZ",
|
|
64764
|
+
ctrl: true,
|
|
64765
|
+
shift: true
|
|
64766
|
+
},
|
|
64767
|
+
label: {
|
|
64768
|
+
mac: "⌘⇧Z",
|
|
64769
|
+
windows: "Ctrl + Shift + Z"
|
|
64770
|
+
}
|
|
64771
|
+
},
|
|
64772
|
+
textBold: {
|
|
64773
|
+
key: {
|
|
64774
|
+
button: "KeyB",
|
|
64775
|
+
ctrl: true
|
|
64776
|
+
},
|
|
64777
|
+
label: {
|
|
64778
|
+
mac: "⌘B",
|
|
64779
|
+
windows: "Ctrl + B"
|
|
64780
|
+
}
|
|
64781
|
+
},
|
|
64782
|
+
textStrike: {
|
|
64783
|
+
key: {
|
|
64784
|
+
button: "KeyS",
|
|
64785
|
+
ctrl: true
|
|
64786
|
+
},
|
|
64787
|
+
label: {
|
|
64788
|
+
mac: "⌘S",
|
|
64789
|
+
windows: "Ctrl + S"
|
|
64790
|
+
}
|
|
64791
|
+
},
|
|
64792
|
+
textUnderline: {
|
|
64793
|
+
key: {
|
|
64794
|
+
button: "KeyU",
|
|
64795
|
+
ctrl: true
|
|
64796
|
+
},
|
|
64797
|
+
label: {
|
|
64798
|
+
mac: "⌘U",
|
|
64799
|
+
windows: "Ctrl + U"
|
|
64800
|
+
}
|
|
64801
|
+
},
|
|
64802
|
+
textItalic: {
|
|
64803
|
+
key: {
|
|
64804
|
+
button: "KeyI",
|
|
64805
|
+
ctrl: true
|
|
64806
|
+
},
|
|
64807
|
+
label: {
|
|
64808
|
+
mac: "⌘I",
|
|
64809
|
+
windows: "Ctrl + I"
|
|
64810
|
+
}
|
|
64811
|
+
},
|
|
64812
|
+
zoomOut: {
|
|
64813
|
+
key: {
|
|
64814
|
+
button: "Minus",
|
|
64815
|
+
ctrl: true
|
|
64816
|
+
},
|
|
64817
|
+
label: {
|
|
64818
|
+
mac: "⌘-",
|
|
64819
|
+
windows: "Ctrl + -"
|
|
64820
|
+
}
|
|
64821
|
+
},
|
|
64822
|
+
zoomIn: {
|
|
64823
|
+
key: {
|
|
64824
|
+
button: "Equal",
|
|
64825
|
+
ctrl: true
|
|
64826
|
+
},
|
|
64827
|
+
label: {
|
|
64828
|
+
mac: "⌘+",
|
|
64829
|
+
windows: "Ctrl + +"
|
|
64830
|
+
}
|
|
64831
|
+
},
|
|
64832
|
+
zoomDefault: {
|
|
64833
|
+
key: {
|
|
64834
|
+
button: "Digit0",
|
|
64835
|
+
ctrl: true
|
|
64836
|
+
},
|
|
64837
|
+
label: {
|
|
64838
|
+
mac: "⌘0",
|
|
64839
|
+
windows: "Ctrl + 0"
|
|
64840
|
+
}
|
|
64841
|
+
},
|
|
64842
|
+
duplicate: {
|
|
64843
|
+
key: {
|
|
64844
|
+
button: "KeyD",
|
|
64845
|
+
ctrl: true
|
|
64846
|
+
},
|
|
64847
|
+
label: {
|
|
64848
|
+
mac: "⌘D",
|
|
64849
|
+
windows: "Ctrl + D"
|
|
64850
|
+
}
|
|
64851
|
+
},
|
|
64852
|
+
bringToFront: {
|
|
64853
|
+
key: {
|
|
64854
|
+
button: "PageUp"
|
|
64855
|
+
},
|
|
64856
|
+
label: {
|
|
64857
|
+
mac: "fn↑ (PgUp)",
|
|
64858
|
+
windows: "PgUp"
|
|
64859
|
+
}
|
|
64860
|
+
},
|
|
64861
|
+
sendToBack: {
|
|
64862
|
+
key: {
|
|
64863
|
+
button: "PageDown"
|
|
64864
|
+
},
|
|
64865
|
+
label: {
|
|
64866
|
+
mac: "fn↓ (PgDn)",
|
|
64867
|
+
windows: "PgDn"
|
|
64868
|
+
}
|
|
64869
|
+
},
|
|
64870
|
+
delete: {
|
|
64871
|
+
key: {
|
|
64872
|
+
button: ["Delete", "Backspace"]
|
|
64873
|
+
},
|
|
64874
|
+
label: {
|
|
64875
|
+
mac: "Delete",
|
|
64876
|
+
windows: "Delete"
|
|
64877
|
+
}
|
|
64878
|
+
},
|
|
64879
|
+
cancel: {
|
|
64880
|
+
key: {
|
|
64881
|
+
button: "Escape"
|
|
64882
|
+
},
|
|
64883
|
+
label: {
|
|
64884
|
+
mac: "Esc",
|
|
64885
|
+
windows: "Esc"
|
|
64886
|
+
}
|
|
64887
|
+
},
|
|
64888
|
+
selectAll: {
|
|
64889
|
+
key: {
|
|
64890
|
+
button: "KeyA",
|
|
64891
|
+
ctrl: true
|
|
64892
|
+
},
|
|
64893
|
+
label: {
|
|
64894
|
+
mac: "⌘A",
|
|
64895
|
+
windows: "Ctrl + A"
|
|
64896
|
+
}
|
|
64897
|
+
},
|
|
64898
|
+
copy: {
|
|
64899
|
+
key: {
|
|
64900
|
+
button: "KeyC",
|
|
64901
|
+
ctrl: true
|
|
64902
|
+
},
|
|
64903
|
+
label: {
|
|
64904
|
+
mac: "⌘C",
|
|
64905
|
+
windows: "Ctrl + C"
|
|
64906
|
+
}
|
|
64907
|
+
},
|
|
64908
|
+
paste: {
|
|
64909
|
+
key: {
|
|
64910
|
+
button: "KeyV",
|
|
64911
|
+
ctrl: true
|
|
64912
|
+
},
|
|
64913
|
+
label: {
|
|
64914
|
+
mac: "⌘V",
|
|
64915
|
+
windows: "Ctrl + V"
|
|
64916
|
+
}
|
|
64917
|
+
},
|
|
64918
|
+
confirm: {
|
|
64919
|
+
key: {
|
|
64920
|
+
button: "Enter"
|
|
64921
|
+
},
|
|
64922
|
+
label: {
|
|
64923
|
+
mac: "⏎",
|
|
64924
|
+
windows: "⏎"
|
|
64925
|
+
}
|
|
64926
|
+
},
|
|
64927
|
+
frameNavigationNext: {
|
|
64928
|
+
key: {
|
|
64929
|
+
button: "ArrowRight",
|
|
64930
|
+
ctrl: true
|
|
64931
|
+
},
|
|
64932
|
+
label: {
|
|
64933
|
+
mac: "⌘→",
|
|
64934
|
+
windows: "Ctrl→"
|
|
64935
|
+
}
|
|
64936
|
+
},
|
|
64937
|
+
frameNavigationPrev: {
|
|
64938
|
+
key: {
|
|
64939
|
+
button: "ArrowLeft",
|
|
64940
|
+
ctrl: true
|
|
64941
|
+
},
|
|
64942
|
+
label: {
|
|
64943
|
+
mac: "⌘←",
|
|
64944
|
+
windows: "Ctrl←"
|
|
64945
|
+
}
|
|
64946
|
+
},
|
|
64947
|
+
navigationRight: {
|
|
64948
|
+
key: {
|
|
64949
|
+
button: "ArrowRight"
|
|
64950
|
+
},
|
|
64951
|
+
label: {
|
|
64952
|
+
mac: "→",
|
|
64953
|
+
windows: "→"
|
|
64954
|
+
}
|
|
64955
|
+
},
|
|
64956
|
+
navigationLeft: {
|
|
64957
|
+
key: {
|
|
64958
|
+
button: "ArrowLeft"
|
|
64959
|
+
},
|
|
64960
|
+
label: {
|
|
64961
|
+
mac: "←",
|
|
64962
|
+
windows: "←"
|
|
64963
|
+
}
|
|
64964
|
+
},
|
|
64965
|
+
navigationUp: {
|
|
64966
|
+
key: {
|
|
64967
|
+
button: "ArrowUp"
|
|
64968
|
+
},
|
|
64969
|
+
label: {
|
|
64970
|
+
mac: "↑",
|
|
64971
|
+
windows: "↑"
|
|
64972
|
+
}
|
|
64973
|
+
},
|
|
64974
|
+
navigationDown: {
|
|
64975
|
+
key: {
|
|
64976
|
+
button: "ArrowDown"
|
|
64977
|
+
},
|
|
64978
|
+
label: {
|
|
64979
|
+
mac: "↓",
|
|
64980
|
+
windows: "↓"
|
|
64981
|
+
}
|
|
64982
|
+
}
|
|
64983
|
+
};
|
|
64668
64984
|
|
|
64669
64985
|
// src/Keyboard/logHotkey.ts
|
|
64670
64986
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
@@ -64672,7 +64988,7 @@ function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
|
64672
64988
|
return;
|
|
64673
64989
|
}
|
|
64674
64990
|
const isFunction = typeof hotkeyConfig === "function";
|
|
64675
|
-
const hotkeyData =
|
|
64991
|
+
const hotkeyData = hotkeys_default2[hotkeyName];
|
|
64676
64992
|
switch (status) {
|
|
64677
64993
|
case "triggered":
|
|
64678
64994
|
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;");
|
|
@@ -64760,7 +65076,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
64760
65076
|
// src/Keyboard/getHotkeyLabel.ts
|
|
64761
65077
|
function getHotkeyLabel(hotkey) {
|
|
64762
65078
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
64763
|
-
switch (
|
|
65079
|
+
switch (conf.FORCE_HOTKEYS || "auto") {
|
|
64764
65080
|
case "windows":
|
|
64765
65081
|
return hotkeyLabel.windows;
|
|
64766
65082
|
case "macos":
|
|
@@ -66670,7 +66986,7 @@ class SpatialIndex {
|
|
|
66670
66986
|
this.itemsArray.push(item);
|
|
66671
66987
|
this.itemsIndex.insert(item);
|
|
66672
66988
|
}
|
|
66673
|
-
if (
|
|
66989
|
+
if (conf.isNode()) {
|
|
66674
66990
|
return;
|
|
66675
66991
|
}
|
|
66676
66992
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -68199,7 +68515,7 @@ class Transformer extends Tool {
|
|
|
68199
68515
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
68200
68516
|
if (mbr) {
|
|
68201
68517
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
68202
|
-
const selectionColor = isLockedItems ?
|
|
68518
|
+
const selectionColor = isLockedItems ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
68203
68519
|
mbr.borderColor = selectionColor;
|
|
68204
68520
|
mbr.render(context);
|
|
68205
68521
|
}
|
|
@@ -68225,7 +68541,7 @@ class Transformer extends Tool {
|
|
|
68225
68541
|
new Point(right, bottom)
|
|
68226
68542
|
];
|
|
68227
68543
|
for (const point5 of points) {
|
|
68228
|
-
const circle = new Anchor(point5.x, point5.y,
|
|
68544
|
+
const circle = new Anchor(point5.x, point5.y, conf.SELECTION_ANCHOR_RADIUS, conf.SELECTION_COLOR, conf.SELECTION_ANCHOR_COLOR, conf.SELECTION_ANCHOR_WIDTH);
|
|
68229
68545
|
anchors.push(circle);
|
|
68230
68546
|
}
|
|
68231
68547
|
}
|
|
@@ -69427,7 +69743,7 @@ class BoardSelection {
|
|
|
69427
69743
|
renderItemMbr(context, item, customScale) {
|
|
69428
69744
|
const mbr = item.getMbr();
|
|
69429
69745
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
69430
|
-
const selectionColor = item.transformation.isLocked ?
|
|
69746
|
+
const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
69431
69747
|
mbr.borderColor = selectionColor;
|
|
69432
69748
|
mbr.render(context);
|
|
69433
69749
|
}
|
|
@@ -69874,7 +70190,7 @@ class Board {
|
|
|
69874
70190
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
69875
70191
|
const css = INDEX_CSS;
|
|
69876
70192
|
const boardName = this.getName() || this.getBoardId();
|
|
69877
|
-
const items = this.items.getWholeHTML(
|
|
70193
|
+
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
69878
70194
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
69879
70195
|
const scripts = `
|
|
69880
70196
|
<script type="module">${customTagsScript}</script>
|
|
@@ -69914,7 +70230,7 @@ class Board {
|
|
|
69914
70230
|
return `${head}${body}`;
|
|
69915
70231
|
}
|
|
69916
70232
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
69917
|
-
const parser =
|
|
70233
|
+
const parser = conf.getDOMParser();
|
|
69918
70234
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
69919
70235
|
const items = doc.body.querySelector("#items");
|
|
69920
70236
|
if (items) {
|
|
@@ -69966,7 +70282,7 @@ class Board {
|
|
|
69966
70282
|
return [];
|
|
69967
70283
|
}
|
|
69968
70284
|
deserializeHTML(stringedHTML) {
|
|
69969
|
-
const parser =
|
|
70285
|
+
const parser = conf.getDOMParser();
|
|
69970
70286
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
69971
70287
|
const itemsDiv = doc.body.querySelector("#items");
|
|
69972
70288
|
if (!itemsDiv) {
|
|
@@ -71118,19 +71434,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
71118
71434
|
var import_slate45 = __toESM(require_dist(), 1);
|
|
71119
71435
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
71120
71436
|
const transformed = { ...toTransform };
|
|
71121
|
-
const
|
|
71437
|
+
const conf2 = confirmed.path;
|
|
71122
71438
|
const path2 = transformed.path;
|
|
71123
|
-
if (import_slate45.Path.equals(
|
|
71439
|
+
if (import_slate45.Path.equals(conf2, path2)) {
|
|
71124
71440
|
return transformed;
|
|
71125
71441
|
}
|
|
71126
|
-
const isDescendant = path2.length >
|
|
71442
|
+
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
71127
71443
|
if (isDescendant) {
|
|
71128
71444
|
const newPath = [...path2];
|
|
71129
71445
|
newPath[0] = newPath[0] + 1;
|
|
71130
71446
|
transformed.path = newPath;
|
|
71131
71447
|
return transformed;
|
|
71132
71448
|
}
|
|
71133
|
-
if (import_slate45.Path.isBefore(
|
|
71449
|
+
if (import_slate45.Path.isBefore(conf2, path2)) {
|
|
71134
71450
|
transformPath(confirmed, transformed);
|
|
71135
71451
|
}
|
|
71136
71452
|
return transformed;
|
|
@@ -71140,23 +71456,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
71140
71456
|
var import_slate46 = __toESM(require_dist(), 1);
|
|
71141
71457
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
71142
71458
|
const transformed = { ...toTransform };
|
|
71143
|
-
const
|
|
71459
|
+
const conf2 = confirmed.path;
|
|
71144
71460
|
const path2 = transformed.path;
|
|
71145
|
-
if (import_slate46.Path.equals(
|
|
71461
|
+
if (import_slate46.Path.equals(conf2, path2)) {
|
|
71146
71462
|
return transformed;
|
|
71147
71463
|
}
|
|
71148
|
-
if (path2.length ===
|
|
71464
|
+
if (path2.length === conf2.length + 1 && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
71149
71465
|
const newPath = [...path2];
|
|
71150
|
-
if (
|
|
71466
|
+
if (conf2.length === 1) {
|
|
71151
71467
|
newPath[0] = newPath[0] + 1;
|
|
71152
71468
|
} else {
|
|
71153
|
-
newPath[
|
|
71469
|
+
newPath[conf2.length] = newPath[conf2.length] + 1;
|
|
71154
71470
|
}
|
|
71155
71471
|
transformed.path = newPath;
|
|
71156
71472
|
return transformed;
|
|
71157
71473
|
}
|
|
71158
|
-
const isDescendant = path2.length >
|
|
71159
|
-
if (import_slate46.Path.isBefore(
|
|
71474
|
+
const isDescendant = path2.length > conf2.length && path2.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
71475
|
+
if (import_slate46.Path.isBefore(conf2, path2) && !isDescendant) {
|
|
71160
71476
|
transformPath(confirmed, transformed);
|
|
71161
71477
|
}
|
|
71162
71478
|
return transformed;
|
|
@@ -71749,8 +72065,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
71749
72065
|
const transformed = [];
|
|
71750
72066
|
for (const transf of toTransform) {
|
|
71751
72067
|
let actualyTransformed = { ...transf };
|
|
71752
|
-
for (const
|
|
71753
|
-
const { operation: confOp } =
|
|
72068
|
+
for (const conf2 of confirmed) {
|
|
72069
|
+
const { operation: confOp } = conf2.body;
|
|
71754
72070
|
const { operation: transfOp } = actualyTransformed.body;
|
|
71755
72071
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
71756
72072
|
if (transformedOp) {
|
|
@@ -72382,7 +72698,7 @@ class Events2 {
|
|
|
72382
72698
|
return record !== null;
|
|
72383
72699
|
}
|
|
72384
72700
|
sendPresenceEvent(event) {
|
|
72385
|
-
|
|
72701
|
+
conf.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
72386
72702
|
}
|
|
72387
72703
|
canUndoEvent(op, byUserId) {
|
|
72388
72704
|
if (op.method === "undo") {
|
|
@@ -72483,9 +72799,9 @@ function handleChatChunk(chunk, board) {
|
|
|
72483
72799
|
default:
|
|
72484
72800
|
board.camera.unsubscribeFromItem();
|
|
72485
72801
|
if (!chunk.isExternalApiError) {
|
|
72486
|
-
|
|
72487
|
-
header:
|
|
72488
|
-
body:
|
|
72802
|
+
conf.notify({
|
|
72803
|
+
header: conf.i18n.t("AIInput.textGenerationError.header"),
|
|
72804
|
+
body: conf.i18n.t("AIInput.textGenerationError.body"),
|
|
72489
72805
|
variant: "error",
|
|
72490
72806
|
duration: 4000
|
|
72491
72807
|
});
|
|
@@ -72500,7 +72816,7 @@ function handleChatChunk(chunk, board) {
|
|
|
72500
72816
|
editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
72501
72817
|
if (chunk.isExternalApiError) {
|
|
72502
72818
|
editor.clearText();
|
|
72503
|
-
editor.insertCopiedText(
|
|
72819
|
+
editor.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
72504
72820
|
}
|
|
72505
72821
|
}
|
|
72506
72822
|
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
@@ -72527,7 +72843,7 @@ function handleAudioGenerate(response, board) {
|
|
|
72527
72843
|
}
|
|
72528
72844
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
72529
72845
|
const { left, top, right } = placeholderNode.getMbr();
|
|
72530
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
72846
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf.AUDIO_DIMENSIONS.width) / 2, top);
|
|
72531
72847
|
audio.updateMbr();
|
|
72532
72848
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
72533
72849
|
board.remove(placeholderNode, false);
|
|
@@ -72549,7 +72865,7 @@ function handleAudioGenerate(response, board) {
|
|
|
72549
72865
|
type: "audio/wav"
|
|
72550
72866
|
});
|
|
72551
72867
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
72552
|
-
const linkElem =
|
|
72868
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
72553
72869
|
linkElem.href = audioUrl2;
|
|
72554
72870
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
72555
72871
|
linkElem.click();
|
|
@@ -72568,9 +72884,9 @@ function handleAudioGenerate(response, board) {
|
|
|
72568
72884
|
board.selection.add(placeholderNode);
|
|
72569
72885
|
}
|
|
72570
72886
|
console.error("Audio generation error:", response.message);
|
|
72571
|
-
|
|
72572
|
-
header:
|
|
72573
|
-
body:
|
|
72887
|
+
conf.notify({
|
|
72888
|
+
header: conf.i18n.t("AIInput.audioGenerationError.header"),
|
|
72889
|
+
body: conf.i18n.t("AIInput.audioGenerationError.body"),
|
|
72574
72890
|
variant: "error",
|
|
72575
72891
|
duration: 4000
|
|
72576
72892
|
});
|
|
@@ -72633,14 +72949,14 @@ function handleImageGenerate(response, board) {
|
|
|
72633
72949
|
board.selection.add(item);
|
|
72634
72950
|
const editor = item.getRichText()?.editor;
|
|
72635
72951
|
editor?.clearText();
|
|
72636
|
-
editor?.insertCopiedText(
|
|
72952
|
+
editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
72637
72953
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
72638
72954
|
}
|
|
72639
72955
|
}
|
|
72640
72956
|
} else {
|
|
72641
|
-
|
|
72642
|
-
header:
|
|
72643
|
-
body:
|
|
72957
|
+
conf.notify({
|
|
72958
|
+
header: conf.i18n.t("AIInput.imageGenerationError.header"),
|
|
72959
|
+
body: conf.i18n.t("AIInput.imageGenerationError.body"),
|
|
72644
72960
|
variant: "error",
|
|
72645
72961
|
duration: 4000
|
|
72646
72962
|
});
|
|
@@ -72707,10 +73023,10 @@ function startIntervals(board) {
|
|
|
72707
73023
|
}
|
|
72708
73024
|
log.publishIntervalTimer = setInterval(() => {
|
|
72709
73025
|
tryPublishEvent(board);
|
|
72710
|
-
},
|
|
73026
|
+
}, conf.EVENTS_PUBLISH_INTERVAL);
|
|
72711
73027
|
log.resendIntervalTimer = setInterval(() => {
|
|
72712
73028
|
tryResendEvent(board);
|
|
72713
|
-
},
|
|
73029
|
+
}, conf.EVENTS_RESEND_INTERVAL);
|
|
72714
73030
|
}
|
|
72715
73031
|
function tryPublishEvent(board) {
|
|
72716
73032
|
const { log } = board.events;
|
|
@@ -72729,14 +73045,14 @@ function tryResendEvent(board) {
|
|
|
72729
73045
|
return;
|
|
72730
73046
|
}
|
|
72731
73047
|
const date = Date.now();
|
|
72732
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
73048
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf.EVENTS_RESEND_INTERVAL;
|
|
72733
73049
|
if (!isTimeToSendPendingEvent) {
|
|
72734
73050
|
return;
|
|
72735
73051
|
}
|
|
72736
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
73052
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf.EVENTS_RESEND_INTERVAL * 5;
|
|
72737
73053
|
if (isProbablyLostConnection) {
|
|
72738
73054
|
board.presence.clear();
|
|
72739
|
-
|
|
73055
|
+
conf.connection?.notifyAboutLostConnection();
|
|
72740
73056
|
}
|
|
72741
73057
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
72742
73058
|
}
|
|
@@ -72767,12 +73083,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
72767
73083
|
lastKnownOrder: log.getLastIndex()
|
|
72768
73084
|
}
|
|
72769
73085
|
};
|
|
72770
|
-
|
|
73086
|
+
conf.connection.send({
|
|
72771
73087
|
type: "BoardEvent",
|
|
72772
73088
|
boardId: board.getBoardId(),
|
|
72773
73089
|
event: toSend,
|
|
72774
73090
|
sequenceNumber,
|
|
72775
|
-
userId:
|
|
73091
|
+
userId: conf.connection.getCurrentUser()
|
|
72776
73092
|
});
|
|
72777
73093
|
const date = Date.now();
|
|
72778
73094
|
log.pendingEvent = {
|
|
@@ -72818,7 +73134,7 @@ function handleConfirmation(msg, board) {
|
|
|
72818
73134
|
if (!isPendingEventConfirmation) {
|
|
72819
73135
|
return;
|
|
72820
73136
|
}
|
|
72821
|
-
|
|
73137
|
+
conf.connection?.dismissNotificationAboutLostConnection();
|
|
72822
73138
|
log.currentSequenceNumber++;
|
|
72823
73139
|
log.pendingEvent.event.order = msg.order;
|
|
72824
73140
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -72830,7 +73146,7 @@ function handleConfirmation(msg, board) {
|
|
|
72830
73146
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
72831
73147
|
function handleCreateSnapshotRequestMessage(msg, board) {
|
|
72832
73148
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
72833
|
-
|
|
73149
|
+
conf.connection.send({
|
|
72834
73150
|
type: "BoardSnapshot",
|
|
72835
73151
|
boardId,
|
|
72836
73152
|
snapshot,
|
|
@@ -72861,9 +73177,9 @@ function handleModeMessage(message, board) {
|
|
|
72861
73177
|
if (isTemplateView()) {
|
|
72862
73178
|
return;
|
|
72863
73179
|
}
|
|
72864
|
-
|
|
72865
|
-
header:
|
|
72866
|
-
body: message.mode === "edit" ?
|
|
73180
|
+
conf.notify({
|
|
73181
|
+
header: conf.i18n.t("sharing.settingsChanged.heading"),
|
|
73182
|
+
body: message.mode === "edit" ? conf.i18n.t("sharing.settingsChanged.bodyEdit") : conf.i18n.t("sharing.settingsChanged.bodyView"),
|
|
72867
73183
|
duration: 5000
|
|
72868
73184
|
});
|
|
72869
73185
|
}
|
|
@@ -72899,8 +73215,8 @@ messageRouter.addHandler("PresenceEvent", handlePresenceEventMessage);
|
|
|
72899
73215
|
messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
72900
73216
|
// src/api/initI18N.ts
|
|
72901
73217
|
function initI18N(i18nInstance) {
|
|
72902
|
-
|
|
72903
|
-
|
|
73218
|
+
conf.i18n = i18nInstance;
|
|
73219
|
+
conf.planNames = {
|
|
72904
73220
|
basic: i18nInstance.t("userPlan.plans.basic.name"),
|
|
72905
73221
|
plus: i18nInstance.t("userPlan.plans.plus.name")
|
|
72906
73222
|
};
|
|
@@ -72990,7 +73306,7 @@ class NodePath2D extends Path2DFactory {
|
|
|
72990
73306
|
|
|
72991
73307
|
// src/api/initPaths.ts
|
|
72992
73308
|
function initPaths(path2D) {
|
|
72993
|
-
|
|
73309
|
+
conf.EXPORT_FRAME_DECORATIONS = {
|
|
72994
73310
|
"top-left": {
|
|
72995
73311
|
path: new path2D("M13 1H1V13"),
|
|
72996
73312
|
lineWidth: 2,
|
|
@@ -73033,7 +73349,7 @@ function initPaths(path2D) {
|
|
|
73033
73349
|
// src/api/getMeasureCtx.ts
|
|
73034
73350
|
function getMeasureCtx() {
|
|
73035
73351
|
if (typeof document !== "undefined") {
|
|
73036
|
-
const measureCanvas =
|
|
73352
|
+
const measureCanvas = conf.documentFactory.createElement("canvas");
|
|
73037
73353
|
const measureCtx = measureCanvas.getContext("2d");
|
|
73038
73354
|
if (!measureCtx) {
|
|
73039
73355
|
throw new Error("Failde to create canvas and get 2d context");
|
|
@@ -73051,12 +73367,12 @@ function getMeasureCtx() {
|
|
|
73051
73367
|
var import_css = __toESM(require_css_escape(), 1);
|
|
73052
73368
|
function initNodeSettings() {
|
|
73053
73369
|
const documentFactory = new NodeDocumentFactory;
|
|
73054
|
-
|
|
73055
|
-
|
|
73056
|
-
|
|
73057
|
-
|
|
73370
|
+
conf.documentFactory = documentFactory;
|
|
73371
|
+
conf.path2DFactory = NodePath2D;
|
|
73372
|
+
conf.measureCtx = getMeasureCtx();
|
|
73373
|
+
conf.getDOMParser = getNodeDOMParser;
|
|
73058
73374
|
initPaths(NodePath2D);
|
|
73059
|
-
return
|
|
73375
|
+
return conf;
|
|
73060
73376
|
}
|
|
73061
73377
|
|
|
73062
73378
|
// src/node.ts
|
|
@@ -73122,7 +73438,7 @@ export {
|
|
|
73122
73438
|
defaultCursors as cursors,
|
|
73123
73439
|
createVideoItem,
|
|
73124
73440
|
createEvents,
|
|
73125
|
-
|
|
73441
|
+
conf,
|
|
73126
73442
|
checkHotkeys,
|
|
73127
73443
|
catmullRomInterpolate,
|
|
73128
73444
|
catchErrorResponse,
|