microboard-temp 0.1.21 → 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 +601 -388
- package/dist/cjs/index.js +589 -295
- package/dist/cjs/node.js +597 -303
- package/dist/esm/browser.js +601 -388
- package/dist/esm/index.js +589 -295
- package/dist/esm/node.js +597 -303
- package/dist/types/api/initDefaultI18N.d.ts +11 -0
- package/dist/types/api/initI18N.d.ts +6 -11
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/api/initI18NBrowser.d.ts +0 -2
package/dist/cjs/browser.js
CHANGED
|
@@ -2140,6 +2140,7 @@ __export(exports_browser, {
|
|
|
2140
2140
|
isHotkeyPushed: () => isHotkeyPushed,
|
|
2141
2141
|
isFiniteNumber: () => isFiniteNumber,
|
|
2142
2142
|
isControlCharacter: () => isControlCharacter,
|
|
2143
|
+
initI18N: () => initI18N,
|
|
2143
2144
|
getYouTubeVideoPreview: () => getYouTubeVideoPreview,
|
|
2144
2145
|
getYouTubeThumbnail: () => getYouTubeThumbnail,
|
|
2145
2146
|
getVideoMetadata: () => getVideoMetadata,
|
|
@@ -2159,7 +2160,7 @@ __export(exports_browser, {
|
|
|
2159
2160
|
cursors: () => defaultCursors,
|
|
2160
2161
|
createVideoItem: () => createVideoItem,
|
|
2161
2162
|
createEvents: () => createEvents,
|
|
2162
|
-
conf: () =>
|
|
2163
|
+
conf: () => conf,
|
|
2163
2164
|
checkHotkeys: () => checkHotkeys,
|
|
2164
2165
|
catmullRomInterpolate: () => catmullRomInterpolate,
|
|
2165
2166
|
catchErrorResponse: () => catchErrorResponse,
|
|
@@ -8150,7 +8151,7 @@ var Browser = /* @__PURE__ */ function() {
|
|
|
8150
8151
|
}();
|
|
8151
8152
|
Browser.type = "languageDetector";
|
|
8152
8153
|
|
|
8153
|
-
// src/api/
|
|
8154
|
+
// src/api/initDefaultI18N.ts
|
|
8154
8155
|
var defaultNS = "default";
|
|
8155
8156
|
var resources = {
|
|
8156
8157
|
en: {
|
|
@@ -8160,22 +8161,22 @@ var resources = {
|
|
|
8160
8161
|
default: {}
|
|
8161
8162
|
}
|
|
8162
8163
|
};
|
|
8163
|
-
function
|
|
8164
|
+
function initDefaultI18N() {
|
|
8164
8165
|
instance.use(Browser).init({
|
|
8165
|
-
debug:
|
|
8166
|
+
debug: conf.debug,
|
|
8166
8167
|
detection: {
|
|
8167
8168
|
order: ["navigator"]
|
|
8168
8169
|
},
|
|
8169
8170
|
supportedLngs: ["en", "ru"],
|
|
8170
8171
|
defaultNS,
|
|
8171
8172
|
resources,
|
|
8172
|
-
fallbackLng:
|
|
8173
|
+
fallbackLng: conf.FALLBACK_LNG,
|
|
8173
8174
|
interpolation: {
|
|
8174
8175
|
escapeValue: false
|
|
8175
8176
|
}
|
|
8176
8177
|
});
|
|
8177
|
-
|
|
8178
|
-
|
|
8178
|
+
conf.i18n = instance;
|
|
8179
|
+
conf.planNames = {
|
|
8179
8180
|
basic: instance.t("userPlan.plans.basic.name"),
|
|
8180
8181
|
plus: instance.t("userPlan.plans.plus.name")
|
|
8181
8182
|
};
|
|
@@ -8190,7 +8191,7 @@ var ExportQuality;
|
|
|
8190
8191
|
ExportQuality2[ExportQuality2["STANDARD"] = 2] = "STANDARD";
|
|
8191
8192
|
ExportQuality2[ExportQuality2["LOW"] = 3] = "LOW";
|
|
8192
8193
|
})(ExportQuality ||= {});
|
|
8193
|
-
var
|
|
8194
|
+
var conf = {
|
|
8194
8195
|
connection: undefined,
|
|
8195
8196
|
path2DFactory: typeof Path2D !== "undefined" ? BrowserPath2D : MockPath2D,
|
|
8196
8197
|
documentFactory: typeof document !== "undefined" ? new BrowserDocumentFactory : new MockDocumentFactory,
|
|
@@ -8517,7 +8518,7 @@ var conf2 = {
|
|
|
8517
8518
|
FALLBACK_LNG: "en",
|
|
8518
8519
|
cursorsMap
|
|
8519
8520
|
};
|
|
8520
|
-
|
|
8521
|
+
initDefaultI18N();
|
|
8521
8522
|
|
|
8522
8523
|
// src/Items/Transformation/Matrix.ts
|
|
8523
8524
|
class Matrix2 {
|
|
@@ -9238,7 +9239,7 @@ class DrawingContext {
|
|
|
9238
9239
|
this.setCamera(camera);
|
|
9239
9240
|
}
|
|
9240
9241
|
dpi() {
|
|
9241
|
-
return
|
|
9242
|
+
return conf.getDPI();
|
|
9242
9243
|
}
|
|
9243
9244
|
setCamera(camera) {
|
|
9244
9245
|
this.camera = camera;
|
|
@@ -9248,7 +9249,7 @@ class DrawingContext {
|
|
|
9248
9249
|
}
|
|
9249
9250
|
clear() {
|
|
9250
9251
|
this.ctx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
9251
|
-
this.ctx.clearRect(0, 0,
|
|
9252
|
+
this.ctx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
9252
9253
|
this.matrix.applyToContext(this.ctx);
|
|
9253
9254
|
}
|
|
9254
9255
|
clearCursor() {
|
|
@@ -9256,7 +9257,7 @@ class DrawingContext {
|
|
|
9256
9257
|
return;
|
|
9257
9258
|
}
|
|
9258
9259
|
this.cursorCtx.setTransform(1 * this.dpi(), 0, 0, 1 * this.dpi(), 0, 0);
|
|
9259
|
-
this.cursorCtx.clearRect(0, 0,
|
|
9260
|
+
this.cursorCtx.clearRect(0, 0, conf.getDocumentWidth(), conf.getDocumentHeight());
|
|
9260
9261
|
this.matrix.applyToContext(this.cursorCtx);
|
|
9261
9262
|
}
|
|
9262
9263
|
applyChanges() {
|
|
@@ -9359,7 +9360,7 @@ class Path {
|
|
|
9359
9360
|
this.width = this.getMbr().getWidth();
|
|
9360
9361
|
this.height = this.getMbr().getHeight();
|
|
9361
9362
|
this.maxDimension = Math.max(mbr.getWidth(), mbr.getHeight());
|
|
9362
|
-
this.path2d = new
|
|
9363
|
+
this.path2d = new conf.path2DFactory;
|
|
9363
9364
|
this.updateCache();
|
|
9364
9365
|
}
|
|
9365
9366
|
getBackgroundColor() {
|
|
@@ -9436,7 +9437,7 @@ class Path {
|
|
|
9436
9437
|
this.y = top - this.paddingTop;
|
|
9437
9438
|
this.width = right - left + this.paddingLeft + this.paddingRight;
|
|
9438
9439
|
this.height = bottom - top + this.paddingTop + this.paddingBottom;
|
|
9439
|
-
const path2d = new
|
|
9440
|
+
const path2d = new conf.path2DFactory;
|
|
9440
9441
|
if (this.segments.length === 0) {
|
|
9441
9442
|
return;
|
|
9442
9443
|
}
|
|
@@ -10480,7 +10481,7 @@ var parsersHTML = {
|
|
|
10480
10481
|
"comment-item": parseHTMLComment
|
|
10481
10482
|
};
|
|
10482
10483
|
var decodeHtml = (htmlString) => {
|
|
10483
|
-
const parser =
|
|
10484
|
+
const parser = conf.getDOMParser();
|
|
10484
10485
|
const doc = parser.parseFromString(htmlString, "text/html");
|
|
10485
10486
|
return doc.documentElement.textContent || "";
|
|
10486
10487
|
};
|
|
@@ -10509,10 +10510,10 @@ function parseHTMLRichText(el, options) {
|
|
|
10509
10510
|
italic: node.style.fontStyle === "italic",
|
|
10510
10511
|
underline: node.style.textDecoration.includes("underline"),
|
|
10511
10512
|
"line-through": node.style.textDecoration.includes("line-through"),
|
|
10512
|
-
fontColor: node.style.color ||
|
|
10513
|
-
fontHighlight: node.style.backgroundColor ||
|
|
10514
|
-
fontSize: parseFloat(node.style.fontSize) ||
|
|
10515
|
-
fontFamily: node.style.fontFamily ||
|
|
10513
|
+
fontColor: node.style.color || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
10514
|
+
fontHighlight: node.style.backgroundColor || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
10515
|
+
fontSize: parseFloat(node.style.fontSize) || conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
10516
|
+
fontFamily: node.style.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily,
|
|
10516
10517
|
overline: false,
|
|
10517
10518
|
subscript: false,
|
|
10518
10519
|
superscript: false
|
|
@@ -10577,7 +10578,7 @@ function parseHTMLRichText(el, options) {
|
|
|
10577
10578
|
return {
|
|
10578
10579
|
type: "paragraph",
|
|
10579
10580
|
...extractCommonProps(),
|
|
10580
|
-
lineHeight: parseFloat(node.style.lineHeight) ||
|
|
10581
|
+
lineHeight: parseFloat(node.style.lineHeight) || conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
10581
10582
|
children: children2
|
|
10582
10583
|
};
|
|
10583
10584
|
default:
|
|
@@ -17057,8 +17058,8 @@ class LinkTo {
|
|
|
17057
17058
|
const ctx = context.ctx;
|
|
17058
17059
|
ctx.save();
|
|
17059
17060
|
ctx.globalCompositeOperation = "destination-out";
|
|
17060
|
-
const size =
|
|
17061
|
-
const offset =
|
|
17061
|
+
const size = conf.LINK_BTN_SIZE / scale;
|
|
17062
|
+
const offset = conf.LINK_BTN_OFFSET / scale;
|
|
17062
17063
|
ctx.fillRect(right - size - offset, top + offset, size, size);
|
|
17063
17064
|
ctx.restore();
|
|
17064
17065
|
}
|
|
@@ -17209,7 +17210,7 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
17209
17210
|
} else if (node3.type === "ul_list" && !listData) {
|
|
17210
17211
|
listData = { level: 0, isNumberedList: false };
|
|
17211
17212
|
}
|
|
17212
|
-
const listMarks =
|
|
17213
|
+
const listMarks = conf[getListMarkType((listData?.level || 0) + 1)];
|
|
17213
17214
|
for (let i = 0;i < data.children.length; i++) {
|
|
17214
17215
|
const child = structuredClone(data.children[i]);
|
|
17215
17216
|
switch (child.type) {
|
|
@@ -17614,8 +17615,8 @@ function measureText(text, style, paddingTop = 0, marginLeft = 0) {
|
|
|
17614
17615
|
rect2.height += paddingTop;
|
|
17615
17616
|
}
|
|
17616
17617
|
}
|
|
17617
|
-
|
|
17618
|
-
const measure =
|
|
17618
|
+
conf.measureCtx.font = style.font;
|
|
17619
|
+
const measure = conf.measureCtx.measureText(text);
|
|
17619
17620
|
const actualBoundingBoxAscent = toFiniteNumber2(measure.actualBoundingBoxAscent);
|
|
17620
17621
|
const actualBoundingBoxDescent = toFiniteNumber2(measure.actualBoundingBoxDescent);
|
|
17621
17622
|
const actualBoundingBoxLeft = toFiniteNumber2(measure.actualBoundingBoxLeft);
|
|
@@ -19345,7 +19346,7 @@ var create2 = (key) => {
|
|
|
19345
19346
|
return false;
|
|
19346
19347
|
};
|
|
19347
19348
|
};
|
|
19348
|
-
var
|
|
19349
|
+
var hotkeys = {
|
|
19349
19350
|
isBold: create2("bold"),
|
|
19350
19351
|
isCompose: create2("compose"),
|
|
19351
19352
|
isMoveBackward: create2("moveBackward"),
|
|
@@ -26737,7 +26738,7 @@ var convertLinkNodeToTextNode = (node4) => {
|
|
|
26737
26738
|
const link = node4.link;
|
|
26738
26739
|
const text3 = node4.children.map((child) => child.text).join("");
|
|
26739
26740
|
return {
|
|
26740
|
-
...
|
|
26741
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
26741
26742
|
type: "text",
|
|
26742
26743
|
text: text3,
|
|
26743
26744
|
link,
|
|
@@ -26753,9 +26754,9 @@ function setNodeChildrenStyles({
|
|
|
26753
26754
|
horisontalAlignment,
|
|
26754
26755
|
node: node4
|
|
26755
26756
|
}) {
|
|
26756
|
-
let fontStyles =
|
|
26757
|
+
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
26757
26758
|
if (editor) {
|
|
26758
|
-
fontStyles = Editor.marks(editor) ||
|
|
26759
|
+
fontStyles = Editor.marks(editor) || conf.DEFAULT_TEXT_STYLES;
|
|
26759
26760
|
}
|
|
26760
26761
|
switch (node4.type) {
|
|
26761
26762
|
case "heading_one":
|
|
@@ -26787,7 +26788,7 @@ function setNodeChildrenStyles({
|
|
|
26787
26788
|
children.text += " ";
|
|
26788
26789
|
}
|
|
26789
26790
|
let fontColor = fontStyles.fontColor;
|
|
26790
|
-
if (fontColor ===
|
|
26791
|
+
if (fontColor === conf.DEFAULT_TEXT_STYLES.fontColor && children.link) {
|
|
26791
26792
|
fontColor = "rgba(71, 120, 245, 1)";
|
|
26792
26793
|
}
|
|
26793
26794
|
return {
|
|
@@ -26827,8 +26828,6 @@ function setNodeStyles({
|
|
|
26827
26828
|
}
|
|
26828
26829
|
|
|
26829
26830
|
// src/Items/RichText/editorHelpers/markdown/markdownProcessor.ts
|
|
26830
|
-
var { i18n: i18n2 } = conf2;
|
|
26831
|
-
|
|
26832
26831
|
class MarkdownProcessor {
|
|
26833
26832
|
chunksQueue = [];
|
|
26834
26833
|
isProcessingChunk = false;
|
|
@@ -26859,7 +26858,7 @@ class MarkdownProcessor {
|
|
|
26859
26858
|
this.subject.publish(this);
|
|
26860
26859
|
return true;
|
|
26861
26860
|
}
|
|
26862
|
-
if (
|
|
26861
|
+
if (text3.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
26863
26862
|
return true;
|
|
26864
26863
|
}
|
|
26865
26864
|
const isPrevTextEmpty = isTextEmpty(this.editor.children);
|
|
@@ -26917,7 +26916,7 @@ class MarkdownProcessor {
|
|
|
26917
26916
|
return;
|
|
26918
26917
|
}
|
|
26919
26918
|
const prevText = this.getText()?.[this.getText().length - 1]?.children[0]?.text;
|
|
26920
|
-
if (
|
|
26919
|
+
if (prevText?.startsWith(conf.i18n.t("AIInput.generatingResponse"))) {
|
|
26921
26920
|
clearText(this.editor);
|
|
26922
26921
|
}
|
|
26923
26922
|
if (chunk.includes(`
|
|
@@ -27943,7 +27942,7 @@ class RichTextCommand {
|
|
|
27943
27942
|
item: id,
|
|
27944
27943
|
operation: {
|
|
27945
27944
|
...this.operation,
|
|
27946
|
-
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() ||
|
|
27945
|
+
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
27947
27946
|
}
|
|
27948
27947
|
}));
|
|
27949
27948
|
case "setBlockType":
|
|
@@ -27967,7 +27966,7 @@ class RichTextCommand {
|
|
|
27967
27966
|
item: id,
|
|
27968
27967
|
operation: {
|
|
27969
27968
|
...this.operation,
|
|
27970
|
-
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() ||
|
|
27969
|
+
fontFamily: this.board.items.getById(id)?.getRichText()?.getFontFamily() || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
27971
27970
|
}
|
|
27972
27971
|
}));
|
|
27973
27972
|
case "setFontSize":
|
|
@@ -27975,7 +27974,7 @@ class RichTextCommand {
|
|
|
27975
27974
|
item: id,
|
|
27976
27975
|
operation: {
|
|
27977
27976
|
...this.operation,
|
|
27978
|
-
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() ||
|
|
27977
|
+
fontSize: this.board.items.getById(id)?.getRichText()?.getFontSize() || conf.DEFAULT_TEXT_STYLES.fontSize
|
|
27979
27978
|
}
|
|
27980
27979
|
}));
|
|
27981
27980
|
case "setFontHighlight":
|
|
@@ -27983,7 +27982,7 @@ class RichTextCommand {
|
|
|
27983
27982
|
item: id,
|
|
27984
27983
|
operation: {
|
|
27985
27984
|
...this.operation,
|
|
27986
|
-
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() ||
|
|
27985
|
+
fontHighlight: this.board.items.getById(id)?.getRichText()?.getFontHighlight() || conf.DEFAULT_TEXT_STYLES.fontHighlight
|
|
27987
27986
|
}
|
|
27988
27987
|
}));
|
|
27989
27988
|
case "setHorisontalAlignment":
|
|
@@ -29202,7 +29201,6 @@ class BaseItem extends Mbr {
|
|
|
29202
29201
|
}
|
|
29203
29202
|
|
|
29204
29203
|
// src/Items/RichText/RichText.ts
|
|
29205
|
-
var { i18n: i18n3 } = conf2;
|
|
29206
29204
|
var isEditInProcessValue = false;
|
|
29207
29205
|
var counter = 0;
|
|
29208
29206
|
|
|
@@ -29223,7 +29221,7 @@ class RichText extends BaseItem {
|
|
|
29223
29221
|
isContainerSet = false;
|
|
29224
29222
|
isRenderEnabled = true;
|
|
29225
29223
|
layoutNodes;
|
|
29226
|
-
clipPath = new
|
|
29224
|
+
clipPath = new conf.path2DFactory;
|
|
29227
29225
|
updateRequired = false;
|
|
29228
29226
|
autoSizeScale = 1;
|
|
29229
29227
|
containerMaxWidth;
|
|
@@ -29238,7 +29236,7 @@ class RichText extends BaseItem {
|
|
|
29238
29236
|
shrinkWidth = false;
|
|
29239
29237
|
prevMbr = null;
|
|
29240
29238
|
rtCounter = 0;
|
|
29241
|
-
constructor(board, container, id = "", transformation = new Transformation(id, board.events), linkTo, placeholderText =
|
|
29239
|
+
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) {
|
|
29242
29240
|
super(board, id);
|
|
29243
29241
|
this.container = container;
|
|
29244
29242
|
this.transformation = transformation;
|
|
@@ -29372,11 +29370,11 @@ class RichText extends BaseItem {
|
|
|
29372
29370
|
return;
|
|
29373
29371
|
}
|
|
29374
29372
|
try {
|
|
29375
|
-
|
|
29373
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29376
29374
|
} catch {}
|
|
29377
29375
|
};
|
|
29378
29376
|
updateElement = () => {
|
|
29379
|
-
if (
|
|
29377
|
+
if (conf.isNode()) {
|
|
29380
29378
|
return;
|
|
29381
29379
|
}
|
|
29382
29380
|
if (this.updateRequired) {
|
|
@@ -29505,7 +29503,7 @@ class RichText extends BaseItem {
|
|
|
29505
29503
|
const container = this.getTransformedContainer();
|
|
29506
29504
|
const width = container.getWidth();
|
|
29507
29505
|
const height = container.getHeight();
|
|
29508
|
-
this.clipPath = new
|
|
29506
|
+
this.clipPath = new conf.path2DFactory;
|
|
29509
29507
|
this.clipPath.rect(0, 0, width, height);
|
|
29510
29508
|
}
|
|
29511
29509
|
setContainer(container) {
|
|
@@ -29782,24 +29780,24 @@ class RichText extends BaseItem {
|
|
|
29782
29780
|
this.clearLastClickPoint();
|
|
29783
29781
|
const domMbr = ref.getBoundingClientRect();
|
|
29784
29782
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
29785
|
-
if (refMbr.isInside(point5) && (
|
|
29786
|
-
const domRange =
|
|
29787
|
-
const textNode =
|
|
29788
|
-
const offset =
|
|
29789
|
-
const slatePoint =
|
|
29783
|
+
if (refMbr.isInside(point5) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
29784
|
+
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point5.x, point5.y) : conf.documentFactory.caretRangeFromPoint(point5.x, point5.y);
|
|
29785
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
29786
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
29787
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
29790
29788
|
exactMatch: false,
|
|
29791
29789
|
suppressThrow: false
|
|
29792
29790
|
});
|
|
29793
29791
|
if (slatePoint) {
|
|
29794
29792
|
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
29795
29793
|
this.editorTransforms.select(this.editor.editor, nRange);
|
|
29796
|
-
|
|
29794
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29797
29795
|
}
|
|
29798
29796
|
} else {
|
|
29799
|
-
if (!(
|
|
29797
|
+
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
29800
29798
|
console.error("document.caretPositionFromPoint and document.caretRangeFromPoint are not available!");
|
|
29801
29799
|
}
|
|
29802
|
-
|
|
29800
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
29803
29801
|
}
|
|
29804
29802
|
}
|
|
29805
29803
|
}
|
|
@@ -29906,11 +29904,11 @@ class RichText extends BaseItem {
|
|
|
29906
29904
|
if (node4.type === "text" || "text" in node4) {
|
|
29907
29905
|
node4 = node4;
|
|
29908
29906
|
const text3 = node4.text.trim() !== "" ? decodeHtml(escapeHtml2(node4.text)) : " ";
|
|
29909
|
-
const textElement = node4.link ? Object.assign(
|
|
29907
|
+
const textElement = node4.link ? Object.assign(conf.documentFactory.createElement("a"), {
|
|
29910
29908
|
href: node4.link,
|
|
29911
29909
|
target: "_blank",
|
|
29912
29910
|
rel: "noreferrer"
|
|
29913
|
-
}) :
|
|
29911
|
+
}) : conf.documentFactory.createElement("span");
|
|
29914
29912
|
Object.assign(textElement.style, {
|
|
29915
29913
|
fontWeight: node4.bold ? "700" : "400",
|
|
29916
29914
|
fontStyle: node4.italic ? "italic" : "",
|
|
@@ -29918,10 +29916,10 @@ class RichText extends BaseItem {
|
|
|
29918
29916
|
node4.underline ? "underline" : "",
|
|
29919
29917
|
node4["line-through"] ? "line-through" : ""
|
|
29920
29918
|
].filter(Boolean).join(" "),
|
|
29921
|
-
color: node4.fontColor ||
|
|
29922
|
-
backgroundColor: node4.fontHighlight ||
|
|
29923
|
-
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${
|
|
29924
|
-
fontFamily: node4.fontFamily ||
|
|
29919
|
+
color: node4.fontColor || conf.DEFAULT_TEXT_STYLES.fontColor,
|
|
29920
|
+
backgroundColor: node4.fontHighlight || conf.DEFAULT_TEXT_STYLES.fontHighlight,
|
|
29921
|
+
fontSize: node4.fontSize ? `${node4.fontSize}px` : `${conf.DEFAULT_TEXT_STYLES.fontSize}px`,
|
|
29922
|
+
fontFamily: node4.fontFamily || conf.DEFAULT_TEXT_STYLES.fontFamily
|
|
29925
29923
|
});
|
|
29926
29924
|
if (this.insideOf === "Frame") {
|
|
29927
29925
|
Object.assign(textElement.style, {
|
|
@@ -29956,14 +29954,14 @@ class RichText extends BaseItem {
|
|
|
29956
29954
|
four: 4,
|
|
29957
29955
|
five: 5
|
|
29958
29956
|
};
|
|
29959
|
-
const header =
|
|
29957
|
+
const header = conf.documentFactory.createElement(`h${levels2[level]}`);
|
|
29960
29958
|
applyCommonStyles(header);
|
|
29961
29959
|
header.append(...children);
|
|
29962
29960
|
return header;
|
|
29963
29961
|
}
|
|
29964
29962
|
case "code_block": {
|
|
29965
|
-
const pre =
|
|
29966
|
-
const code =
|
|
29963
|
+
const pre = conf.documentFactory.createElement("pre");
|
|
29964
|
+
const code = conf.documentFactory.createElement("code");
|
|
29967
29965
|
applyCommonStyles(pre);
|
|
29968
29966
|
if (node4.language) {
|
|
29969
29967
|
code.classList.add(`language-${node4.language}`);
|
|
@@ -29977,35 +29975,35 @@ class RichText extends BaseItem {
|
|
|
29977
29975
|
return pre;
|
|
29978
29976
|
}
|
|
29979
29977
|
case "block-quote": {
|
|
29980
|
-
const blockquote =
|
|
29978
|
+
const blockquote = conf.documentFactory.createElement("blockquote");
|
|
29981
29979
|
applyCommonStyles(blockquote);
|
|
29982
29980
|
blockquote.append(...children);
|
|
29983
29981
|
return blockquote;
|
|
29984
29982
|
}
|
|
29985
29983
|
case "ul_list": {
|
|
29986
|
-
const ul =
|
|
29984
|
+
const ul = conf.documentFactory.createElement("ul");
|
|
29987
29985
|
applyCommonStyles(ul);
|
|
29988
29986
|
ul.append(...children);
|
|
29989
29987
|
return ul;
|
|
29990
29988
|
}
|
|
29991
29989
|
case "ol_list": {
|
|
29992
|
-
const ol =
|
|
29990
|
+
const ol = conf.documentFactory.createElement("ol");
|
|
29993
29991
|
applyCommonStyles(ol);
|
|
29994
29992
|
ol.append(...children);
|
|
29995
29993
|
return ol;
|
|
29996
29994
|
}
|
|
29997
29995
|
case "list_item": {
|
|
29998
|
-
const li =
|
|
29996
|
+
const li = conf.documentFactory.createElement("li");
|
|
29999
29997
|
applyCommonStyles(li);
|
|
30000
29998
|
li.append(...children);
|
|
30001
29999
|
return li;
|
|
30002
30000
|
}
|
|
30003
30001
|
case "paragraph":
|
|
30004
30002
|
default: {
|
|
30005
|
-
const par =
|
|
30003
|
+
const par = conf.documentFactory.createElement("p");
|
|
30006
30004
|
applyCommonStyles(par);
|
|
30007
30005
|
Object.assign(par.style, {
|
|
30008
|
-
lineHeight: node4.lineHeight ? `${node4.lineHeight}` :
|
|
30006
|
+
lineHeight: node4.lineHeight ? `${node4.lineHeight}` : conf.DEFAULT_TEXT_STYLES.lineHeight,
|
|
30009
30007
|
margin: "0"
|
|
30010
30008
|
});
|
|
30011
30009
|
par.append(...children);
|
|
@@ -30013,7 +30011,7 @@ class RichText extends BaseItem {
|
|
|
30013
30011
|
}
|
|
30014
30012
|
}
|
|
30015
30013
|
}
|
|
30016
|
-
return
|
|
30014
|
+
return conf.documentFactory.createElement("div");
|
|
30017
30015
|
};
|
|
30018
30016
|
const escapeHtml2 = (unsafe) => {
|
|
30019
30017
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -43076,7 +43074,7 @@ var transformHtmlOrTextToMarkdown = async (text5, html4) => {
|
|
|
43076
43074
|
markdownString = String(file).trim();
|
|
43077
43075
|
}
|
|
43078
43076
|
let slateNodes = [];
|
|
43079
|
-
if (
|
|
43077
|
+
if (conf.URL_REGEX.test(text5)) {
|
|
43080
43078
|
slateNodes = [createLinkNode(text5)];
|
|
43081
43079
|
} else {
|
|
43082
43080
|
slateNodes = await convertMarkdownToSlate(markdownString.replace(/<!--(Start|End)Fragment-->/g, ""));
|
|
@@ -43092,7 +43090,7 @@ function createLinkNode(link2) {
|
|
|
43092
43090
|
type: "text",
|
|
43093
43091
|
link: link2,
|
|
43094
43092
|
text: link2,
|
|
43095
|
-
...
|
|
43093
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
43096
43094
|
fontColor: "rgba(71, 120, 245, 1)"
|
|
43097
43095
|
};
|
|
43098
43096
|
}
|
|
@@ -43203,7 +43201,7 @@ class AINode extends BaseItem {
|
|
|
43203
43201
|
constructor(board, isUserRequest = false, parentNodeId, contextItems = [], threadDirection, id = "") {
|
|
43204
43202
|
super(board, id);
|
|
43205
43203
|
this.id = id;
|
|
43206
|
-
this.buttonIcon =
|
|
43204
|
+
this.buttonIcon = conf.documentFactory.createElement("img");
|
|
43207
43205
|
this.buttonIcon.src = ICON_SRC;
|
|
43208
43206
|
this.contextItems = contextItems;
|
|
43209
43207
|
this.isUserRequest = isUserRequest;
|
|
@@ -44374,7 +44372,6 @@ function getLine(lineStyle, start2, end2, middle) {
|
|
|
44374
44372
|
}
|
|
44375
44373
|
}
|
|
44376
44374
|
// src/Items/Connector/Connector.ts
|
|
44377
|
-
var { i18n: i18n4 } = conf2;
|
|
44378
44375
|
var ConnectionLineWidths = [1, 2, 3, 4, 5, 6, 7, 8, 12];
|
|
44379
44376
|
var CONNECTOR_COLOR = "rgb(20, 21, 26)";
|
|
44380
44377
|
var CONNECTOR_LINE_WIDTH = 1;
|
|
@@ -44429,12 +44426,12 @@ class Connector2 extends BaseItem {
|
|
|
44429
44426
|
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
44430
44427
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
44431
44428
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
44432
|
-
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo,
|
|
44429
|
+
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf.i18n.t("connector.textPlaceholder", {
|
|
44433
44430
|
ns: "default"
|
|
44434
44431
|
}), true, false, "Connector", {
|
|
44435
|
-
...
|
|
44436
|
-
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) :
|
|
44437
|
-
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") :
|
|
44432
|
+
...conf.DEFAULT_TEXT_STYLES,
|
|
44433
|
+
fontSize: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextSize") ? Number(localStorage.getItem("lastConnectorTextSize")) : conf.DEFAULT_TEXT_STYLES.fontSize,
|
|
44434
|
+
fontColor: typeof window !== "undefined" && localStorage.getItem("lastConnectorTextColor") ? localStorage.getItem("lastConnectorTextColor") : conf.DEFAULT_TEXT_STYLES.fontColor
|
|
44438
44435
|
});
|
|
44439
44436
|
this.startPointer = getStartPointer(this.startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
44440
44437
|
this.endPointer = getEndPointer(this.endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.3);
|
|
@@ -44884,7 +44881,7 @@ class Connector2 extends BaseItem {
|
|
|
44884
44881
|
this.text.transformation.applyTranslateTo(x - textWidth / 2, y - textHeight / 2);
|
|
44885
44882
|
this.text.render(context);
|
|
44886
44883
|
if (DRAW_TEXT_BORDER && (selectionContext === "EditUnderPointer" || selectionContext === "EditTextUnderPointer") && this.board.selection.items.list().includes(this)) {
|
|
44887
|
-
ctx.strokeStyle =
|
|
44884
|
+
ctx.strokeStyle = conf.SELECTION_COLOR;
|
|
44888
44885
|
ctx.lineWidth = 1;
|
|
44889
44886
|
ctx.beginPath();
|
|
44890
44887
|
ctx.rect(textMbr.left - TEXT_BORDER_PADDING, textMbr.top - TEXT_BORDER_PADDING, textMbr.getWidth() + TEXT_BORDER_PADDING * 2, textMbr.getHeight() + TEXT_BORDER_PADDING * 2);
|
|
@@ -45111,7 +45108,7 @@ class Connector2 extends BaseItem {
|
|
|
45111
45108
|
}
|
|
45112
45109
|
}
|
|
45113
45110
|
updatePaths() {
|
|
45114
|
-
if (
|
|
45111
|
+
if (conf.isNode()) {
|
|
45115
45112
|
return;
|
|
45116
45113
|
}
|
|
45117
45114
|
const startPoint = this.startPoint;
|
|
@@ -45922,7 +45919,7 @@ class DefaultShapeData {
|
|
|
45922
45919
|
text;
|
|
45923
45920
|
linkTo;
|
|
45924
45921
|
itemType = "Shape";
|
|
45925
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor =
|
|
45922
|
+
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) {
|
|
45926
45923
|
this.shapeType = shapeType;
|
|
45927
45924
|
this.backgroundColor = backgroundColor;
|
|
45928
45925
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -47120,7 +47117,7 @@ class Shape extends BaseItem {
|
|
|
47120
47117
|
this.text.updateElement();
|
|
47121
47118
|
}
|
|
47122
47119
|
transformPath() {
|
|
47123
|
-
if (
|
|
47120
|
+
if (conf.isNode()) {
|
|
47124
47121
|
return;
|
|
47125
47122
|
}
|
|
47126
47123
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
@@ -47313,7 +47310,7 @@ class Sticker extends BaseItem {
|
|
|
47313
47310
|
return this;
|
|
47314
47311
|
}
|
|
47315
47312
|
transformPath() {
|
|
47316
|
-
if (
|
|
47313
|
+
if (conf.isNode()) {
|
|
47317
47314
|
return;
|
|
47318
47315
|
}
|
|
47319
47316
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
@@ -47799,7 +47796,7 @@ class Frame extends BaseItem {
|
|
|
47799
47796
|
this.path = Frames[this.shapeType].path.copy();
|
|
47800
47797
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
47801
47798
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
47802
|
-
this.text = new RichText(board, this.textContainer, this.id, this.transformation, this.linkTo, this.name, true, false, "Frame", { ...
|
|
47799
|
+
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 });
|
|
47803
47800
|
this.text.setSelectionHorisontalAlignment("left");
|
|
47804
47801
|
this.transformation.subject.subscribe(() => {
|
|
47805
47802
|
this.transformPath();
|
|
@@ -48345,10 +48342,10 @@ class Frame extends BaseItem {
|
|
|
48345
48342
|
}
|
|
48346
48343
|
// src/Items/Video/Video.ts
|
|
48347
48344
|
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";
|
|
48348
|
-
var videoIcon =
|
|
48345
|
+
var videoIcon = conf.documentFactory.createElement("img");
|
|
48349
48346
|
videoIcon.src = VIDEO_ICON_SRC;
|
|
48350
48347
|
var createPlaceholderImage = (width2, height2) => {
|
|
48351
|
-
const canvas =
|
|
48348
|
+
const canvas = conf.documentFactory.createElement("canvas");
|
|
48352
48349
|
canvas.width = width2;
|
|
48353
48350
|
canvas.height = height2;
|
|
48354
48351
|
const ctx = canvas.getContext("2d");
|
|
@@ -48390,7 +48387,7 @@ class VideoItem extends BaseItem {
|
|
|
48390
48387
|
super(board, id);
|
|
48391
48388
|
this.events = events2;
|
|
48392
48389
|
this.extension = extension2;
|
|
48393
|
-
this.isStorageUrl = !
|
|
48390
|
+
this.isStorageUrl = !conf.getYouTubeId(url);
|
|
48394
48391
|
this.preview = createPlaceholderImage(videoDimension.width, videoDimension.height);
|
|
48395
48392
|
this.linkTo = new LinkTo(this.id, events2);
|
|
48396
48393
|
this.board = board;
|
|
@@ -48760,59 +48757,59 @@ async function fileTosha256(file) {
|
|
|
48760
48757
|
var catchErrorResponse = async (response, mediaType) => {
|
|
48761
48758
|
if (response.status === 403) {
|
|
48762
48759
|
const data = await response.json();
|
|
48763
|
-
let errorBody =
|
|
48760
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyWithoutLimit");
|
|
48764
48761
|
if (!data.isOwnerRequest) {
|
|
48765
|
-
errorBody =
|
|
48762
|
+
errorBody = conf.i18n.t("toolsPanel.addMedia.limitReached.bodyOwner");
|
|
48766
48763
|
} else if (data.currentUsage && data.storageLimit) {
|
|
48767
|
-
errorBody =
|
|
48764
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.limitReached.body.${parseInt(data.storageLimit) < 1e5 ? "basic" : "plus"}`);
|
|
48768
48765
|
}
|
|
48769
|
-
|
|
48766
|
+
conf.notify({
|
|
48770
48767
|
variant: "warning",
|
|
48771
|
-
header:
|
|
48768
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
48772
48769
|
body: errorBody,
|
|
48773
48770
|
button: data.isOwnerRequest && data.storageLimit <= 100 ? {
|
|
48774
|
-
text:
|
|
48775
|
-
onClick: () =>
|
|
48771
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48772
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48776
48773
|
} : undefined,
|
|
48777
48774
|
duration: 8000
|
|
48778
48775
|
});
|
|
48779
48776
|
} else if (response.status === 413) {
|
|
48780
48777
|
const data = await response.json();
|
|
48781
|
-
let errorBody =
|
|
48778
|
+
let errorBody = conf.i18n.t("toolsPanel.addMedia.tooLarge.bodyWithoutLimit");
|
|
48782
48779
|
let isBasicPlan = false;
|
|
48783
48780
|
if (data.fileSizeLimit && data.fileSize) {
|
|
48784
48781
|
if (mediaType === "image") {
|
|
48785
48782
|
isBasicPlan = parseInt(data.fileSizeLimit) < 20;
|
|
48786
|
-
errorBody =
|
|
48783
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48787
48784
|
} else {
|
|
48788
48785
|
isBasicPlan = parseInt(data.fileSizeLimit) < 1000;
|
|
48789
|
-
errorBody =
|
|
48786
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48790
48787
|
}
|
|
48791
48788
|
}
|
|
48792
|
-
|
|
48789
|
+
conf.notify({
|
|
48793
48790
|
variant: "warning",
|
|
48794
|
-
header:
|
|
48791
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48795
48792
|
body: errorBody,
|
|
48796
48793
|
button: isBasicPlan ? {
|
|
48797
|
-
text:
|
|
48798
|
-
onClick: () =>
|
|
48794
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48795
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48799
48796
|
} : undefined,
|
|
48800
48797
|
duration: 4000
|
|
48801
48798
|
});
|
|
48802
48799
|
} else if (response.status === 401) {
|
|
48803
|
-
|
|
48800
|
+
conf.openModal("MEDIA_UNAVAILABLE_MODAL_ID");
|
|
48804
48801
|
} else if (response.status === 415) {
|
|
48805
|
-
|
|
48802
|
+
conf.notify({
|
|
48806
48803
|
variant: "warning",
|
|
48807
|
-
header:
|
|
48808
|
-
body:
|
|
48804
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
48805
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
48809
48806
|
duration: 4000
|
|
48810
48807
|
});
|
|
48811
48808
|
} else {
|
|
48812
|
-
|
|
48809
|
+
conf.notify({
|
|
48813
48810
|
variant: "error",
|
|
48814
|
-
header:
|
|
48815
|
-
body:
|
|
48811
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
48812
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
48816
48813
|
duration: 4000
|
|
48817
48814
|
});
|
|
48818
48815
|
}
|
|
@@ -48820,17 +48817,17 @@ var catchErrorResponse = async (response, mediaType) => {
|
|
|
48820
48817
|
};
|
|
48821
48818
|
var catchDuplicateErrorResponse = async (response) => {
|
|
48822
48819
|
if (response.status === 403) {
|
|
48823
|
-
|
|
48820
|
+
conf.notify({
|
|
48824
48821
|
variant: "warning",
|
|
48825
|
-
header:
|
|
48826
|
-
body:
|
|
48822
|
+
header: conf.i18n.t("toolsPanel.addMedia.limitReached.header"),
|
|
48823
|
+
body: conf.i18n.t("toolsPanel.addMedia.limitReached.duplicateBody"),
|
|
48827
48824
|
duration: 4000
|
|
48828
48825
|
});
|
|
48829
48826
|
} else {
|
|
48830
|
-
|
|
48827
|
+
conf.notify({
|
|
48831
48828
|
variant: "error",
|
|
48832
|
-
header:
|
|
48833
|
-
body:
|
|
48829
|
+
header: conf.i18n.t("toolsPanel.addMedia.unhandled.header"),
|
|
48830
|
+
body: conf.i18n.t("toolsPanel.addMedia.unhandled.body"),
|
|
48834
48831
|
duration: 4000
|
|
48835
48832
|
});
|
|
48836
48833
|
}
|
|
@@ -48838,40 +48835,40 @@ var catchDuplicateErrorResponse = async (response) => {
|
|
|
48838
48835
|
};
|
|
48839
48836
|
var validateMediaFile = (file, account2) => {
|
|
48840
48837
|
const fileExtension = file.name.split(".").pop()?.toLowerCase() || "";
|
|
48841
|
-
if (!file.type.startsWith("image") && !
|
|
48842
|
-
|
|
48838
|
+
if (!file.type.startsWith("image") && !conf.AUDIO_FORMATS.includes(fileExtension) && !conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
48839
|
+
conf.notify({
|
|
48843
48840
|
variant: "warning",
|
|
48844
|
-
header:
|
|
48845
|
-
body:
|
|
48841
|
+
header: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.header"),
|
|
48842
|
+
body: conf.i18n.t("toolsPanel.addMedia.unsupportedFormat.body"),
|
|
48846
48843
|
duration: 4000
|
|
48847
48844
|
});
|
|
48848
48845
|
return false;
|
|
48849
48846
|
}
|
|
48850
48847
|
const isBasicPlan = account2.billingInfo?.plan.name === "basic";
|
|
48851
|
-
let errorBody =
|
|
48852
|
-
if (
|
|
48853
|
-
errorBody =
|
|
48848
|
+
let errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.imageBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48849
|
+
if (conf.AUDIO_FORMATS.includes(fileExtension) || conf.VIDEO_FORMATS.includes(fileExtension)) {
|
|
48850
|
+
errorBody = conf.i18n.t(`toolsPanel.addMedia.tooLarge.audioOrVideoBody.${isBasicPlan ? "basic" : "plus"}`);
|
|
48854
48851
|
if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxMediaSize || Infinity)) {
|
|
48855
|
-
|
|
48852
|
+
conf.notify({
|
|
48856
48853
|
variant: "warning",
|
|
48857
|
-
header:
|
|
48854
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48858
48855
|
body: errorBody,
|
|
48859
48856
|
button: isBasicPlan ? {
|
|
48860
|
-
text:
|
|
48861
|
-
onClick: () =>
|
|
48857
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48858
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48862
48859
|
} : undefined,
|
|
48863
48860
|
duration: 4000
|
|
48864
48861
|
});
|
|
48865
48862
|
return false;
|
|
48866
48863
|
}
|
|
48867
48864
|
} else if (file.size / 1024 ** 2 > (account2.billingInfo?.storage.maxImageSize || Infinity)) {
|
|
48868
|
-
|
|
48865
|
+
conf.notify({
|
|
48869
48866
|
variant: "warning",
|
|
48870
|
-
header:
|
|
48867
|
+
header: conf.i18n.t("toolsPanel.addMedia.tooLarge.header"),
|
|
48871
48868
|
body: errorBody,
|
|
48872
48869
|
button: isBasicPlan ? {
|
|
48873
|
-
text:
|
|
48874
|
-
onClick: () =>
|
|
48870
|
+
text: conf.i18n.t("toolsPanel.addMedia.upgradeToPlus"),
|
|
48871
|
+
onClick: () => conf.openModal("USER_PLAN_MODAL_ID")
|
|
48875
48872
|
} : undefined,
|
|
48876
48873
|
duration: 4000
|
|
48877
48874
|
});
|
|
@@ -48950,7 +48947,7 @@ var resizeAndConvertToPng = async (inp) => {
|
|
|
48950
48947
|
};
|
|
48951
48948
|
if (base64String.startsWith("data:image/svg+xml")) {
|
|
48952
48949
|
image2.onload = async () => {
|
|
48953
|
-
const parser =
|
|
48950
|
+
const parser = conf.getDOMParser();
|
|
48954
48951
|
const svgDoc = parser.parseFromString(atob(base64String.split(",")[1]), "image/svg+xml");
|
|
48955
48952
|
const svgElement = svgDoc.documentElement;
|
|
48956
48953
|
svgElement.removeAttribute("width");
|
|
@@ -49162,8 +49159,8 @@ class AudioItem extends BaseItem {
|
|
|
49162
49159
|
this.subject.publish(this);
|
|
49163
49160
|
});
|
|
49164
49161
|
this.transformation.subject.subscribe(this.onTransform);
|
|
49165
|
-
this.right = this.left +
|
|
49166
|
-
this.bottom = this.top +
|
|
49162
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width;
|
|
49163
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height;
|
|
49167
49164
|
this.shouldUseCustomRender = true;
|
|
49168
49165
|
}
|
|
49169
49166
|
setCurrentTime(time2) {
|
|
@@ -49232,8 +49229,8 @@ class AudioItem extends BaseItem {
|
|
|
49232
49229
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
49233
49230
|
this.left = translateX;
|
|
49234
49231
|
this.top = translateY;
|
|
49235
|
-
this.right = this.left +
|
|
49236
|
-
this.bottom = this.top +
|
|
49232
|
+
this.right = this.left + conf.AUDIO_DIMENSIONS.width * scaleX;
|
|
49233
|
+
this.bottom = this.top + conf.AUDIO_DIMENSIONS.height * scaleY;
|
|
49237
49234
|
}
|
|
49238
49235
|
render(context) {
|
|
49239
49236
|
if (this.transformationRenderBlock) {
|
|
@@ -49262,8 +49259,8 @@ class AudioItem extends BaseItem {
|
|
|
49262
49259
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.matrix;
|
|
49263
49260
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
49264
49261
|
div.id = this.getId();
|
|
49265
|
-
div.style.width = `${
|
|
49266
|
-
div.style.height = `${
|
|
49262
|
+
div.style.width = `${conf.AUDIO_DIMENSIONS.width}px`;
|
|
49263
|
+
div.style.height = `${conf.AUDIO_DIMENSIONS.height}px`;
|
|
49267
49264
|
div.style.transformOrigin = "top left";
|
|
49268
49265
|
div.style.transform = transform;
|
|
49269
49266
|
div.style.position = "absolute";
|
|
@@ -49382,7 +49379,7 @@ class AudioItem extends BaseItem {
|
|
|
49382
49379
|
}
|
|
49383
49380
|
download() {
|
|
49384
49381
|
if (this.extension) {
|
|
49385
|
-
const linkElem =
|
|
49382
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
49386
49383
|
linkElem.href = this.url;
|
|
49387
49384
|
linkElem.setAttribute("download", `${this.board.getBoardId()}.${this.extension}`);
|
|
49388
49385
|
linkElem.click();
|
|
@@ -49723,7 +49720,7 @@ class Placeholder extends BaseItem {
|
|
|
49723
49720
|
}
|
|
49724
49721
|
// src/Items/Image/Image.ts
|
|
49725
49722
|
function getPlaceholderImage(board, imageDimension) {
|
|
49726
|
-
const placeholderCanvas =
|
|
49723
|
+
const placeholderCanvas = conf.documentFactory.createElement("canvas");
|
|
49727
49724
|
const placeholderContext = placeholderCanvas.getContext("2d");
|
|
49728
49725
|
const context = new DrawingContext(board.camera, placeholderContext);
|
|
49729
49726
|
const placeholder = new Placeholder;
|
|
@@ -50004,7 +50001,7 @@ class Drawing extends BaseItem {
|
|
|
50004
50001
|
itemType = "Drawing";
|
|
50005
50002
|
parent = "Board";
|
|
50006
50003
|
transformation;
|
|
50007
|
-
path2d = new
|
|
50004
|
+
path2d = new conf.path2DFactory;
|
|
50008
50005
|
subject = new Subject;
|
|
50009
50006
|
untransformedMbr = new Mbr;
|
|
50010
50007
|
lines = [];
|
|
@@ -50079,7 +50076,7 @@ class Drawing extends BaseItem {
|
|
|
50079
50076
|
this.bottom = mbr.bottom;
|
|
50080
50077
|
}
|
|
50081
50078
|
updatePath2d() {
|
|
50082
|
-
this.path2d = new
|
|
50079
|
+
this.path2d = new conf.path2DFactory;
|
|
50083
50080
|
const context = this.path2d;
|
|
50084
50081
|
const points = this.points;
|
|
50085
50082
|
if (points.length < 3) {
|
|
@@ -51331,14 +51328,14 @@ class AddConnector extends BoardTool {
|
|
|
51331
51328
|
class AddDrawing extends BoardTool {
|
|
51332
51329
|
drawing = null;
|
|
51333
51330
|
isDown = false;
|
|
51334
|
-
strokeWidth =
|
|
51335
|
-
strokeColor =
|
|
51336
|
-
strokeStyle =
|
|
51331
|
+
strokeWidth = conf.PEN_INITIAL_STROKE_WIDTH;
|
|
51332
|
+
strokeColor = conf.PEN_DEFAULT_COLOR;
|
|
51333
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
51337
51334
|
constructor(board) {
|
|
51338
51335
|
super(board);
|
|
51339
51336
|
this.setCursor();
|
|
51340
|
-
if (
|
|
51341
|
-
const drawingSettings = localStorage.getItem(
|
|
51337
|
+
if (conf.PEN_SETTINGS_KEY) {
|
|
51338
|
+
const drawingSettings = localStorage.getItem(conf.PEN_SETTINGS_KEY);
|
|
51342
51339
|
if (drawingSettings) {
|
|
51343
51340
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(drawingSettings);
|
|
51344
51341
|
this.strokeWidth = strokeWidth;
|
|
@@ -51348,7 +51345,7 @@ class AddDrawing extends BoardTool {
|
|
|
51348
51345
|
}
|
|
51349
51346
|
}
|
|
51350
51347
|
updateSettings() {
|
|
51351
|
-
localStorage.setItem(
|
|
51348
|
+
localStorage.setItem(conf.PEN_SETTINGS_KEY, JSON.stringify({
|
|
51352
51349
|
strokeWidth: this.strokeWidth,
|
|
51353
51350
|
strokeColor: this.strokeColor,
|
|
51354
51351
|
strokeStyle: this.strokeStyle
|
|
@@ -51378,7 +51375,7 @@ class AddDrawing extends BoardTool {
|
|
|
51378
51375
|
ctx.beginPath();
|
|
51379
51376
|
ctx.arc(point7.x, point7.y, this.strokeWidth / 2, 0, 2 * Math.PI, false);
|
|
51380
51377
|
ctx.lineWidth = 1;
|
|
51381
|
-
ctx.strokeStyle =
|
|
51378
|
+
ctx.strokeStyle = conf.PEN_POINTER_CIRCLE_COLOR;
|
|
51382
51379
|
ctx.stroke();
|
|
51383
51380
|
}
|
|
51384
51381
|
setCursor() {
|
|
@@ -51460,7 +51457,7 @@ class AddDrawing extends BoardTool {
|
|
|
51460
51457
|
this.setCursor();
|
|
51461
51458
|
};
|
|
51462
51459
|
render(context) {
|
|
51463
|
-
if (
|
|
51460
|
+
if (conf.PEN_RENDER_POINTER_CIRCLE) {
|
|
51464
51461
|
this.renderPointerCircle(this.board.pointer.point, context);
|
|
51465
51462
|
}
|
|
51466
51463
|
if (!this.drawing) {
|
|
@@ -51475,14 +51472,14 @@ class AddDrawing extends BoardTool {
|
|
|
51475
51472
|
}
|
|
51476
51473
|
// src/Tools/AddDrawing/AddHighlighter.ts
|
|
51477
51474
|
class AddHighlighter extends AddDrawing {
|
|
51478
|
-
strokeWidth =
|
|
51479
|
-
strokeColor =
|
|
51480
|
-
strokeStyle =
|
|
51475
|
+
strokeWidth = conf.HIGHLIGHTER_INITIAL_STROKE_WIDTH;
|
|
51476
|
+
strokeColor = conf.HIGHLIGHTER_DEFAULT_COLOR;
|
|
51477
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
51481
51478
|
constructor(board) {
|
|
51482
51479
|
super(board);
|
|
51483
51480
|
this.setCursor();
|
|
51484
|
-
if (
|
|
51485
|
-
const highlighterSettings = localStorage.getItem(
|
|
51481
|
+
if (conf.HIGHLIGHTER_SETTINGS_KEY) {
|
|
51482
|
+
const highlighterSettings = localStorage.getItem(conf.HIGHLIGHTER_SETTINGS_KEY);
|
|
51486
51483
|
if (highlighterSettings) {
|
|
51487
51484
|
const { strokeWidth, strokeColor, strokeStyle } = JSON.parse(highlighterSettings);
|
|
51488
51485
|
this.strokeWidth = strokeWidth;
|
|
@@ -51495,7 +51492,7 @@ class AddHighlighter extends AddDrawing {
|
|
|
51495
51492
|
return true;
|
|
51496
51493
|
}
|
|
51497
51494
|
updateSettings() {
|
|
51498
|
-
localStorage.setItem(
|
|
51495
|
+
localStorage.setItem(conf.HIGHLIGHTER_SETTINGS_KEY, JSON.stringify({
|
|
51499
51496
|
strokeWidth: this.strokeWidth,
|
|
51500
51497
|
strokeColor: this.strokeColor,
|
|
51501
51498
|
strokeStyle: this.strokeStyle
|
|
@@ -51819,7 +51816,7 @@ class AddShape extends BoardTool {
|
|
|
51819
51816
|
const point7 = this.board.pointer.point;
|
|
51820
51817
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51821
51818
|
this.bounds = this.line.getMbr();
|
|
51822
|
-
this.bounds.borderColor =
|
|
51819
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51823
51820
|
this.shape.apply({
|
|
51824
51821
|
class: "Shape",
|
|
51825
51822
|
method: "setShapeType",
|
|
@@ -51843,7 +51840,7 @@ class AddShape extends BoardTool {
|
|
|
51843
51840
|
}
|
|
51844
51841
|
this.line = new Line(startPoint, endPoint);
|
|
51845
51842
|
this.bounds = this.line.getMbr();
|
|
51846
|
-
this.bounds.borderColor =
|
|
51843
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51847
51844
|
this.initTransformation();
|
|
51848
51845
|
this.board.tools.publish();
|
|
51849
51846
|
return true;
|
|
@@ -51915,7 +51912,7 @@ class AddShape extends BoardTool {
|
|
|
51915
51912
|
const y = (top + bottom) / 2 - 50;
|
|
51916
51913
|
this.bounds = new Mbr(x, y, x, y);
|
|
51917
51914
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
51918
|
-
this.bounds.borderColor =
|
|
51915
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51919
51916
|
this.shape.apply({
|
|
51920
51917
|
class: "Shape",
|
|
51921
51918
|
method: "setShapeType",
|
|
@@ -51948,8 +51945,8 @@ class AddSticker extends BoardTool {
|
|
|
51948
51945
|
this.setCursor(this.sticker.getBackgroundColor());
|
|
51949
51946
|
}
|
|
51950
51947
|
setCursor(color2) {
|
|
51951
|
-
if (
|
|
51952
|
-
const colorName = color2 ?
|
|
51948
|
+
if (conf.STICKER_COLOR_NAMES) {
|
|
51949
|
+
const colorName = color2 ? conf.STICKER_COLOR_NAMES[conf.STICKER_COLORS.indexOf(color2)] : undefined;
|
|
51953
51950
|
this.board.pointer.setCursor(colorName ? `sticker-${colorName}` : "crosshair");
|
|
51954
51951
|
} else {
|
|
51955
51952
|
this.board.pointer.setCursor("crosshair");
|
|
@@ -51973,7 +51970,7 @@ class AddSticker extends BoardTool {
|
|
|
51973
51970
|
const point7 = this.board.pointer.point;
|
|
51974
51971
|
this.line = new Line(point7.copy(), point7.copy());
|
|
51975
51972
|
this.bounds = this.line.getMbr();
|
|
51976
|
-
this.bounds.borderColor =
|
|
51973
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51977
51974
|
this.board.tools.publish();
|
|
51978
51975
|
return true;
|
|
51979
51976
|
}
|
|
@@ -51982,7 +51979,7 @@ class AddSticker extends BoardTool {
|
|
|
51982
51979
|
this.line = new Line(this.line.start.copy(), this.board.pointer.point.copy());
|
|
51983
51980
|
this.sticker.applyDiagonal(this.line);
|
|
51984
51981
|
this.bounds = this.sticker.getMbr();
|
|
51985
|
-
this.bounds.borderColor =
|
|
51982
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
51986
51983
|
this.board.tools.publish();
|
|
51987
51984
|
return true;
|
|
51988
51985
|
}
|
|
@@ -52082,7 +52079,7 @@ class AddText extends BoardTool {
|
|
|
52082
52079
|
const point7 = this.board.pointer.point;
|
|
52083
52080
|
this.line = new Line(point7.copy(), point7.copy());
|
|
52084
52081
|
this.bounds = this.line.getMbr();
|
|
52085
|
-
this.bounds.borderColor =
|
|
52082
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
52086
52083
|
this.board.tools.publish();
|
|
52087
52084
|
return true;
|
|
52088
52085
|
}
|
|
@@ -52093,7 +52090,7 @@ class AddText extends BoardTool {
|
|
|
52093
52090
|
const end2 = new Point(cursorPoint.x, start2.y + height2);
|
|
52094
52091
|
this.line = new Line(start2, end2);
|
|
52095
52092
|
this.bounds = this.line.getMbr();
|
|
52096
|
-
this.bounds.borderColor =
|
|
52093
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
52097
52094
|
this.board.tools.publish();
|
|
52098
52095
|
return true;
|
|
52099
52096
|
}
|
|
@@ -52158,11 +52155,11 @@ class AddText extends BoardTool {
|
|
|
52158
52155
|
class Eraser extends BoardTool {
|
|
52159
52156
|
itemType = "Eraser";
|
|
52160
52157
|
isDown = false;
|
|
52161
|
-
strokeWidth =
|
|
52162
|
-
strokeColor =
|
|
52163
|
-
strokeStyle =
|
|
52158
|
+
strokeWidth = conf.ERASER_STROKE_WIDTH;
|
|
52159
|
+
strokeColor = conf.ERASER_DEFAULT_COLOR;
|
|
52160
|
+
strokeStyle = conf.PEN_STROKE_STYLE;
|
|
52164
52161
|
drawing = new Drawing(this.board, []);
|
|
52165
|
-
maxPointsInLine =
|
|
52162
|
+
maxPointsInLine = conf.ERASER_MAX_LINE_LENGTH;
|
|
52166
52163
|
constructor(board) {
|
|
52167
52164
|
super(board);
|
|
52168
52165
|
this.setCursor();
|
|
@@ -52298,8 +52295,8 @@ function getResizeType(cursorPoint, cameraScale, mbr, anchorDistance = 5) {
|
|
|
52298
52295
|
|
|
52299
52296
|
// src/Tools/ExportSnapshot/getDecorationResizeType.ts
|
|
52300
52297
|
function getDecorationResizeType(point7, mbr, tolerance = 10) {
|
|
52301
|
-
for (const key in
|
|
52302
|
-
const decoration =
|
|
52298
|
+
for (const key in conf.EXPORT_FRAME_DECORATIONS) {
|
|
52299
|
+
const decoration = conf.EXPORT_FRAME_DECORATIONS[key];
|
|
52303
52300
|
const decorationBounds = {
|
|
52304
52301
|
left: mbr.left + (decoration.offsetX ?? 0),
|
|
52305
52302
|
top: mbr.top + (decoration.offsetY ?? 0),
|
|
@@ -52340,7 +52337,7 @@ class ExportSnapshot extends Tool {
|
|
|
52340
52337
|
super();
|
|
52341
52338
|
this.board = board;
|
|
52342
52339
|
const cameraCenter = this.board.camera.getMbr().getCenter();
|
|
52343
|
-
this.mbr = new Mbr(cameraCenter.x -
|
|
52340
|
+
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);
|
|
52344
52341
|
this.board.selection.disable();
|
|
52345
52342
|
this.tempDrawingContext = new DrawingContext(board.camera, this.tempCtx);
|
|
52346
52343
|
}
|
|
@@ -52352,11 +52349,11 @@ class ExportSnapshot extends Tool {
|
|
|
52352
52349
|
resize() {
|
|
52353
52350
|
if (this.resizeType && this.mbr && this.oppositePoint) {
|
|
52354
52351
|
const resize = getResize(this.resizeType, this.board.pointer.point, this.mbr, this.oppositePoint);
|
|
52355
|
-
if (resize.mbr.getWidth() >
|
|
52352
|
+
if (resize.mbr.getWidth() > conf.EXPORT_MIN_WIDTH) {
|
|
52356
52353
|
this.mbr.left = resize.mbr.left;
|
|
52357
52354
|
this.mbr.right = resize.mbr.right;
|
|
52358
52355
|
}
|
|
52359
|
-
if (resize.mbr.getHeight() >
|
|
52356
|
+
if (resize.mbr.getHeight() > conf.EXPORT_MIN_HEIGHT) {
|
|
52360
52357
|
this.mbr.top = resize.mbr.top;
|
|
52361
52358
|
this.mbr.bottom = resize.mbr.bottom;
|
|
52362
52359
|
}
|
|
@@ -52445,7 +52442,7 @@ class ExportSnapshot extends Tool {
|
|
|
52445
52442
|
}
|
|
52446
52443
|
const res = await exportBoardSnapshot({
|
|
52447
52444
|
board: this.board,
|
|
52448
|
-
bgColor:
|
|
52445
|
+
bgColor: conf.CANVAS_BG_COLOR,
|
|
52449
52446
|
selection: this.mbr,
|
|
52450
52447
|
upscaleTo: 4000,
|
|
52451
52448
|
nameToExport: this.board.getName()
|
|
@@ -52469,18 +52466,18 @@ class ExportSnapshot extends Tool {
|
|
|
52469
52466
|
const cameraMbr = context.camera.getMbr();
|
|
52470
52467
|
this.tempDrawingContext.setCamera(this.board.camera);
|
|
52471
52468
|
this.tempDrawingContext.clear();
|
|
52472
|
-
cameraMbr.backgroundColor =
|
|
52469
|
+
cameraMbr.backgroundColor = conf.EXPORT_BLUR_BACKGROUND_COLOR;
|
|
52473
52470
|
cameraMbr.strokeWidth = 0;
|
|
52474
52471
|
cameraMbr.render(this.tempDrawingContext);
|
|
52475
52472
|
this.tempCtx.clearRect(this.mbr.left, this.mbr.top, this.mbr.getWidth(), this.mbr.getHeight());
|
|
52476
|
-
if (
|
|
52477
|
-
const topLeft =
|
|
52473
|
+
if (conf.EXPORT_FRAME_DECORATIONS) {
|
|
52474
|
+
const topLeft = conf.EXPORT_FRAME_DECORATIONS["top-left"];
|
|
52478
52475
|
this.renderDecoration(this.tempDrawingContext, topLeft.path, this.mbr.left + (topLeft.offsetX ?? 0), this.mbr.top + (topLeft.offsetY ?? 0), topLeft.color, topLeft.lineWidth);
|
|
52479
|
-
const topRight =
|
|
52476
|
+
const topRight = conf.EXPORT_FRAME_DECORATIONS["top-right"];
|
|
52480
52477
|
this.renderDecoration(this.tempDrawingContext, topRight.path, this.mbr.right + (topRight.offsetX ?? 0), this.mbr.top + (topRight.offsetY ?? 0), topRight.color, topRight.lineWidth);
|
|
52481
|
-
const bottomLeft =
|
|
52478
|
+
const bottomLeft = conf.EXPORT_FRAME_DECORATIONS["bottom-left"];
|
|
52482
52479
|
this.renderDecoration(this.tempDrawingContext, bottomLeft.path, this.mbr.left + (bottomLeft.offsetX ?? 0), this.mbr.bottom + (bottomLeft.offsetY ?? 0), bottomLeft.color, bottomLeft.lineWidth);
|
|
52483
|
-
const bottomRight =
|
|
52480
|
+
const bottomRight = conf.EXPORT_FRAME_DECORATIONS["bottom-right"];
|
|
52484
52481
|
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);
|
|
52485
52482
|
}
|
|
52486
52483
|
}
|
|
@@ -52582,7 +52579,7 @@ function createCanvasDrawer(board) {
|
|
|
52582
52579
|
borderDiv.id = "canvasBorder";
|
|
52583
52580
|
borderDiv.style.position = "absolute";
|
|
52584
52581
|
borderDiv.style.transformOrigin = "left top";
|
|
52585
|
-
borderDiv.style.border = `1px solid ${
|
|
52582
|
+
borderDiv.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
52586
52583
|
borderDiv.style.boxSizing = "border-box";
|
|
52587
52584
|
borderDiv.style.left = `${leftOffset}px`;
|
|
52588
52585
|
borderDiv.style.top = `${topOffset}px`;
|
|
@@ -52592,7 +52589,7 @@ function createCanvasDrawer(board) {
|
|
|
52592
52589
|
canvas.style.boxSizing = "border-box";
|
|
52593
52590
|
container.appendChild(borderDiv);
|
|
52594
52591
|
} else {
|
|
52595
|
-
canvas.style.border = `1px solid ${
|
|
52592
|
+
canvas.style.border = `1px solid ${conf.SELECTION_COLOR}`;
|
|
52596
52593
|
canvas.style.boxSizing = "border-box";
|
|
52597
52594
|
}
|
|
52598
52595
|
const createAnchorDiv = (left, top, radius) => {
|
|
@@ -52600,8 +52597,8 @@ function createCanvasDrawer(board) {
|
|
|
52600
52597
|
anchorDiv.style.position = "absolute";
|
|
52601
52598
|
anchorDiv.style.width = `${2 * radius}px`;
|
|
52602
52599
|
anchorDiv.style.height = `${2 * radius}px`;
|
|
52603
|
-
anchorDiv.style.backgroundColor = `${
|
|
52604
|
-
anchorDiv.style.border = `${
|
|
52600
|
+
anchorDiv.style.backgroundColor = `${conf.SELECTION_ANCHOR_COLOR}`;
|
|
52601
|
+
anchorDiv.style.border = `${conf.SELECTION_ANCHOR_WIDTH}px solid ${conf.SELECTION_COLOR}`;
|
|
52605
52602
|
anchorDiv.style.borderRadius = "2px";
|
|
52606
52603
|
anchorDiv.style.left = `calc(${left} - ${radius}px)`;
|
|
52607
52604
|
anchorDiv.style.top = `calc(${top} - ${radius}px)`;
|
|
@@ -52609,10 +52606,10 @@ function createCanvasDrawer(board) {
|
|
|
52609
52606
|
return anchorDiv;
|
|
52610
52607
|
};
|
|
52611
52608
|
const anchors = [
|
|
52612
|
-
createAnchorDiv("0%", "0%",
|
|
52613
|
-
createAnchorDiv("100% + 1px", "0%",
|
|
52614
|
-
createAnchorDiv("0%", "100% + 1px",
|
|
52615
|
-
createAnchorDiv("100% + 1px", "100% + 1px",
|
|
52609
|
+
createAnchorDiv("0%", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
52610
|
+
createAnchorDiv("100% + 1px", "0%", conf.SELECTION_ANCHOR_RADIUS),
|
|
52611
|
+
createAnchorDiv("0%", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS),
|
|
52612
|
+
createAnchorDiv("100% + 1px", "100% + 1px", conf.SELECTION_ANCHOR_RADIUS)
|
|
52616
52613
|
];
|
|
52617
52614
|
const canvasBorder = Array.from(container.children).find((child) => child.id === "canvasBorder");
|
|
52618
52615
|
for (const anchor of anchors) {
|
|
@@ -53965,8 +53962,8 @@ class Select extends Tool {
|
|
|
53965
53962
|
const { x, y } = pointer.point;
|
|
53966
53963
|
this.line = new Line(new Point(x, y), new Point(x, y));
|
|
53967
53964
|
this.rect = this.line.getMbr();
|
|
53968
|
-
this.rect.borderColor =
|
|
53969
|
-
this.rect.backgroundColor =
|
|
53965
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
53966
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
53970
53967
|
this.board.tools.publish();
|
|
53971
53968
|
this.board.presence.throttledEmit({
|
|
53972
53969
|
method: "DrawSelect",
|
|
@@ -54051,8 +54048,8 @@ class Select extends Tool {
|
|
|
54051
54048
|
const point7 = this.board.pointer.point.copy();
|
|
54052
54049
|
this.line = new Line(this.line.start, point7);
|
|
54053
54050
|
this.rect = this.line.getMbr();
|
|
54054
|
-
this.rect.borderColor =
|
|
54055
|
-
this.rect.backgroundColor =
|
|
54051
|
+
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
54052
|
+
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
54056
54053
|
this.board.tools.publish();
|
|
54057
54054
|
this.board.presence.throttledEmit({
|
|
54058
54055
|
method: "DrawSelect",
|
|
@@ -54563,7 +54560,7 @@ class ShapeTool extends CustomTool {
|
|
|
54563
54560
|
const point7 = this.board.pointer.point;
|
|
54564
54561
|
this.line = new Line(point7.copy(), point7.copy());
|
|
54565
54562
|
this.bounds = this.line.getMbr();
|
|
54566
|
-
this.bounds.borderColor =
|
|
54563
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
54567
54564
|
this.initTransformation();
|
|
54568
54565
|
this.board.tools.publish();
|
|
54569
54566
|
return true;
|
|
@@ -54581,7 +54578,7 @@ class ShapeTool extends CustomTool {
|
|
|
54581
54578
|
}
|
|
54582
54579
|
this.line = new Line(startPoint, endPoint);
|
|
54583
54580
|
this.bounds = this.line.getMbr();
|
|
54584
|
-
this.bounds.borderColor =
|
|
54581
|
+
this.bounds.borderColor = conf.SELECTION_COLOR;
|
|
54585
54582
|
this.initTransformation();
|
|
54586
54583
|
this.board.tools.publish();
|
|
54587
54584
|
return true;
|
|
@@ -55550,9 +55547,9 @@ class Camera {
|
|
|
55550
55547
|
matrix = new Matrix2;
|
|
55551
55548
|
pointer = new Point;
|
|
55552
55549
|
window = {
|
|
55553
|
-
width:
|
|
55554
|
-
height:
|
|
55555
|
-
dpi:
|
|
55550
|
+
width: conf.getDocumentWidth(),
|
|
55551
|
+
height: conf.getDocumentHeight(),
|
|
55552
|
+
dpi: conf.getDPI(),
|
|
55556
55553
|
getMbr: () => {
|
|
55557
55554
|
return new Mbr(0, 0, this.window.width, this.window.height);
|
|
55558
55555
|
}
|
|
@@ -55928,9 +55925,9 @@ class Camera {
|
|
|
55928
55925
|
this.updateBoardPointer();
|
|
55929
55926
|
}
|
|
55930
55927
|
onWindowResize() {
|
|
55931
|
-
this.window.width =
|
|
55932
|
-
this.window.height =
|
|
55933
|
-
this.window.dpi =
|
|
55928
|
+
this.window.width = conf.getDocumentWidth();
|
|
55929
|
+
this.window.height = conf.getDocumentHeight();
|
|
55930
|
+
this.window.dpi = conf.getDPI();
|
|
55934
55931
|
this.resizeSubject.publish(this);
|
|
55935
55932
|
this.subject.publish(this);
|
|
55936
55933
|
}
|
|
@@ -55943,10 +55940,10 @@ class Camera {
|
|
|
55943
55940
|
let y = 0;
|
|
55944
55941
|
const { activeKeys } = keyboard;
|
|
55945
55942
|
const directions = {
|
|
55946
|
-
ArrowRight: [-
|
|
55947
|
-
ArrowLeft: [
|
|
55948
|
-
ArrowDown: [0, -
|
|
55949
|
-
ArrowUp: [0,
|
|
55943
|
+
ArrowRight: [-conf.NAVIGATION_STEP, 0],
|
|
55944
|
+
ArrowLeft: [conf.NAVIGATION_STEP, 0],
|
|
55945
|
+
ArrowDown: [0, -conf.NAVIGATION_STEP],
|
|
55946
|
+
ArrowUp: [0, conf.NAVIGATION_STEP]
|
|
55950
55947
|
};
|
|
55951
55948
|
const activeArrowKeys = Array.from(activeKeys).filter((key) => (key in directions)).sort();
|
|
55952
55949
|
if (activeArrowKeys.length === 2) {
|
|
@@ -56329,6 +56326,322 @@ function isHotkeyPushed(hotkey, event) {
|
|
|
56329
56326
|
}
|
|
56330
56327
|
// src/isMacos.ts
|
|
56331
56328
|
var isMacos = () => navigator.platform.toUpperCase().includes("MAC");
|
|
56329
|
+
// src/Keyboard/hotkeys.json
|
|
56330
|
+
var hotkeys_default2 = {
|
|
56331
|
+
select: {
|
|
56332
|
+
key: {
|
|
56333
|
+
button: "KeyV"
|
|
56334
|
+
},
|
|
56335
|
+
label: {
|
|
56336
|
+
windows: "V",
|
|
56337
|
+
mac: "V"
|
|
56338
|
+
}
|
|
56339
|
+
},
|
|
56340
|
+
navigateMode: {
|
|
56341
|
+
key: {
|
|
56342
|
+
button: "Space"
|
|
56343
|
+
},
|
|
56344
|
+
label: {
|
|
56345
|
+
windows: "Space",
|
|
56346
|
+
mac: "Space"
|
|
56347
|
+
}
|
|
56348
|
+
},
|
|
56349
|
+
text: {
|
|
56350
|
+
key: {
|
|
56351
|
+
button: "KeyT"
|
|
56352
|
+
},
|
|
56353
|
+
label: {
|
|
56354
|
+
windows: "T",
|
|
56355
|
+
mac: "T"
|
|
56356
|
+
}
|
|
56357
|
+
},
|
|
56358
|
+
sticker: {
|
|
56359
|
+
key: {
|
|
56360
|
+
button: "KeyN"
|
|
56361
|
+
},
|
|
56362
|
+
label: {
|
|
56363
|
+
mac: "N",
|
|
56364
|
+
windows: "N"
|
|
56365
|
+
}
|
|
56366
|
+
},
|
|
56367
|
+
shape: {
|
|
56368
|
+
key: {
|
|
56369
|
+
button: "KeyS"
|
|
56370
|
+
},
|
|
56371
|
+
label: {
|
|
56372
|
+
mac: "S",
|
|
56373
|
+
windows: "S"
|
|
56374
|
+
}
|
|
56375
|
+
},
|
|
56376
|
+
connector: {
|
|
56377
|
+
key: {
|
|
56378
|
+
button: "KeyL"
|
|
56379
|
+
},
|
|
56380
|
+
label: {
|
|
56381
|
+
mac: "L",
|
|
56382
|
+
windows: "L"
|
|
56383
|
+
}
|
|
56384
|
+
},
|
|
56385
|
+
pen: {
|
|
56386
|
+
key: {
|
|
56387
|
+
button: "KeyP"
|
|
56388
|
+
},
|
|
56389
|
+
label: {
|
|
56390
|
+
mac: "P",
|
|
56391
|
+
windows: "P"
|
|
56392
|
+
}
|
|
56393
|
+
},
|
|
56394
|
+
eraser: {
|
|
56395
|
+
key: {
|
|
56396
|
+
button: "KeyE"
|
|
56397
|
+
},
|
|
56398
|
+
label: {
|
|
56399
|
+
mac: "E",
|
|
56400
|
+
windows: "E"
|
|
56401
|
+
}
|
|
56402
|
+
},
|
|
56403
|
+
frame: {
|
|
56404
|
+
key: {
|
|
56405
|
+
button: "KeyF"
|
|
56406
|
+
},
|
|
56407
|
+
label: {
|
|
56408
|
+
mac: "F",
|
|
56409
|
+
windows: "F"
|
|
56410
|
+
}
|
|
56411
|
+
},
|
|
56412
|
+
undo: {
|
|
56413
|
+
key: {
|
|
56414
|
+
button: "KeyZ",
|
|
56415
|
+
ctrl: true
|
|
56416
|
+
},
|
|
56417
|
+
label: {
|
|
56418
|
+
mac: "⌘Z",
|
|
56419
|
+
windows: "Ctrl + Z"
|
|
56420
|
+
}
|
|
56421
|
+
},
|
|
56422
|
+
redo: {
|
|
56423
|
+
key: {
|
|
56424
|
+
button: "KeyZ",
|
|
56425
|
+
ctrl: true,
|
|
56426
|
+
shift: true
|
|
56427
|
+
},
|
|
56428
|
+
label: {
|
|
56429
|
+
mac: "⌘⇧Z",
|
|
56430
|
+
windows: "Ctrl + Shift + Z"
|
|
56431
|
+
}
|
|
56432
|
+
},
|
|
56433
|
+
textBold: {
|
|
56434
|
+
key: {
|
|
56435
|
+
button: "KeyB",
|
|
56436
|
+
ctrl: true
|
|
56437
|
+
},
|
|
56438
|
+
label: {
|
|
56439
|
+
mac: "⌘B",
|
|
56440
|
+
windows: "Ctrl + B"
|
|
56441
|
+
}
|
|
56442
|
+
},
|
|
56443
|
+
textStrike: {
|
|
56444
|
+
key: {
|
|
56445
|
+
button: "KeyS",
|
|
56446
|
+
ctrl: true
|
|
56447
|
+
},
|
|
56448
|
+
label: {
|
|
56449
|
+
mac: "⌘S",
|
|
56450
|
+
windows: "Ctrl + S"
|
|
56451
|
+
}
|
|
56452
|
+
},
|
|
56453
|
+
textUnderline: {
|
|
56454
|
+
key: {
|
|
56455
|
+
button: "KeyU",
|
|
56456
|
+
ctrl: true
|
|
56457
|
+
},
|
|
56458
|
+
label: {
|
|
56459
|
+
mac: "⌘U",
|
|
56460
|
+
windows: "Ctrl + U"
|
|
56461
|
+
}
|
|
56462
|
+
},
|
|
56463
|
+
textItalic: {
|
|
56464
|
+
key: {
|
|
56465
|
+
button: "KeyI",
|
|
56466
|
+
ctrl: true
|
|
56467
|
+
},
|
|
56468
|
+
label: {
|
|
56469
|
+
mac: "⌘I",
|
|
56470
|
+
windows: "Ctrl + I"
|
|
56471
|
+
}
|
|
56472
|
+
},
|
|
56473
|
+
zoomOut: {
|
|
56474
|
+
key: {
|
|
56475
|
+
button: "Minus",
|
|
56476
|
+
ctrl: true
|
|
56477
|
+
},
|
|
56478
|
+
label: {
|
|
56479
|
+
mac: "⌘-",
|
|
56480
|
+
windows: "Ctrl + -"
|
|
56481
|
+
}
|
|
56482
|
+
},
|
|
56483
|
+
zoomIn: {
|
|
56484
|
+
key: {
|
|
56485
|
+
button: "Equal",
|
|
56486
|
+
ctrl: true
|
|
56487
|
+
},
|
|
56488
|
+
label: {
|
|
56489
|
+
mac: "⌘+",
|
|
56490
|
+
windows: "Ctrl + +"
|
|
56491
|
+
}
|
|
56492
|
+
},
|
|
56493
|
+
zoomDefault: {
|
|
56494
|
+
key: {
|
|
56495
|
+
button: "Digit0",
|
|
56496
|
+
ctrl: true
|
|
56497
|
+
},
|
|
56498
|
+
label: {
|
|
56499
|
+
mac: "⌘0",
|
|
56500
|
+
windows: "Ctrl + 0"
|
|
56501
|
+
}
|
|
56502
|
+
},
|
|
56503
|
+
duplicate: {
|
|
56504
|
+
key: {
|
|
56505
|
+
button: "KeyD",
|
|
56506
|
+
ctrl: true
|
|
56507
|
+
},
|
|
56508
|
+
label: {
|
|
56509
|
+
mac: "⌘D",
|
|
56510
|
+
windows: "Ctrl + D"
|
|
56511
|
+
}
|
|
56512
|
+
},
|
|
56513
|
+
bringToFront: {
|
|
56514
|
+
key: {
|
|
56515
|
+
button: "PageUp"
|
|
56516
|
+
},
|
|
56517
|
+
label: {
|
|
56518
|
+
mac: "fn↑ (PgUp)",
|
|
56519
|
+
windows: "PgUp"
|
|
56520
|
+
}
|
|
56521
|
+
},
|
|
56522
|
+
sendToBack: {
|
|
56523
|
+
key: {
|
|
56524
|
+
button: "PageDown"
|
|
56525
|
+
},
|
|
56526
|
+
label: {
|
|
56527
|
+
mac: "fn↓ (PgDn)",
|
|
56528
|
+
windows: "PgDn"
|
|
56529
|
+
}
|
|
56530
|
+
},
|
|
56531
|
+
delete: {
|
|
56532
|
+
key: {
|
|
56533
|
+
button: ["Delete", "Backspace"]
|
|
56534
|
+
},
|
|
56535
|
+
label: {
|
|
56536
|
+
mac: "Delete",
|
|
56537
|
+
windows: "Delete"
|
|
56538
|
+
}
|
|
56539
|
+
},
|
|
56540
|
+
cancel: {
|
|
56541
|
+
key: {
|
|
56542
|
+
button: "Escape"
|
|
56543
|
+
},
|
|
56544
|
+
label: {
|
|
56545
|
+
mac: "Esc",
|
|
56546
|
+
windows: "Esc"
|
|
56547
|
+
}
|
|
56548
|
+
},
|
|
56549
|
+
selectAll: {
|
|
56550
|
+
key: {
|
|
56551
|
+
button: "KeyA",
|
|
56552
|
+
ctrl: true
|
|
56553
|
+
},
|
|
56554
|
+
label: {
|
|
56555
|
+
mac: "⌘A",
|
|
56556
|
+
windows: "Ctrl + A"
|
|
56557
|
+
}
|
|
56558
|
+
},
|
|
56559
|
+
copy: {
|
|
56560
|
+
key: {
|
|
56561
|
+
button: "KeyC",
|
|
56562
|
+
ctrl: true
|
|
56563
|
+
},
|
|
56564
|
+
label: {
|
|
56565
|
+
mac: "⌘C",
|
|
56566
|
+
windows: "Ctrl + C"
|
|
56567
|
+
}
|
|
56568
|
+
},
|
|
56569
|
+
paste: {
|
|
56570
|
+
key: {
|
|
56571
|
+
button: "KeyV",
|
|
56572
|
+
ctrl: true
|
|
56573
|
+
},
|
|
56574
|
+
label: {
|
|
56575
|
+
mac: "⌘V",
|
|
56576
|
+
windows: "Ctrl + V"
|
|
56577
|
+
}
|
|
56578
|
+
},
|
|
56579
|
+
confirm: {
|
|
56580
|
+
key: {
|
|
56581
|
+
button: "Enter"
|
|
56582
|
+
},
|
|
56583
|
+
label: {
|
|
56584
|
+
mac: "⏎",
|
|
56585
|
+
windows: "⏎"
|
|
56586
|
+
}
|
|
56587
|
+
},
|
|
56588
|
+
frameNavigationNext: {
|
|
56589
|
+
key: {
|
|
56590
|
+
button: "ArrowRight",
|
|
56591
|
+
ctrl: true
|
|
56592
|
+
},
|
|
56593
|
+
label: {
|
|
56594
|
+
mac: "⌘→",
|
|
56595
|
+
windows: "Ctrl→"
|
|
56596
|
+
}
|
|
56597
|
+
},
|
|
56598
|
+
frameNavigationPrev: {
|
|
56599
|
+
key: {
|
|
56600
|
+
button: "ArrowLeft",
|
|
56601
|
+
ctrl: true
|
|
56602
|
+
},
|
|
56603
|
+
label: {
|
|
56604
|
+
mac: "⌘←",
|
|
56605
|
+
windows: "Ctrl←"
|
|
56606
|
+
}
|
|
56607
|
+
},
|
|
56608
|
+
navigationRight: {
|
|
56609
|
+
key: {
|
|
56610
|
+
button: "ArrowRight"
|
|
56611
|
+
},
|
|
56612
|
+
label: {
|
|
56613
|
+
mac: "→",
|
|
56614
|
+
windows: "→"
|
|
56615
|
+
}
|
|
56616
|
+
},
|
|
56617
|
+
navigationLeft: {
|
|
56618
|
+
key: {
|
|
56619
|
+
button: "ArrowLeft"
|
|
56620
|
+
},
|
|
56621
|
+
label: {
|
|
56622
|
+
mac: "←",
|
|
56623
|
+
windows: "←"
|
|
56624
|
+
}
|
|
56625
|
+
},
|
|
56626
|
+
navigationUp: {
|
|
56627
|
+
key: {
|
|
56628
|
+
button: "ArrowUp"
|
|
56629
|
+
},
|
|
56630
|
+
label: {
|
|
56631
|
+
mac: "↑",
|
|
56632
|
+
windows: "↑"
|
|
56633
|
+
}
|
|
56634
|
+
},
|
|
56635
|
+
navigationDown: {
|
|
56636
|
+
key: {
|
|
56637
|
+
button: "ArrowDown"
|
|
56638
|
+
},
|
|
56639
|
+
label: {
|
|
56640
|
+
mac: "↓",
|
|
56641
|
+
windows: "↓"
|
|
56642
|
+
}
|
|
56643
|
+
}
|
|
56644
|
+
};
|
|
56332
56645
|
|
|
56333
56646
|
// src/Keyboard/logHotkey.ts
|
|
56334
56647
|
function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
@@ -56336,7 +56649,7 @@ function logHotkey(hotkeyConfig, hotkeyName, status, context) {
|
|
|
56336
56649
|
return;
|
|
56337
56650
|
}
|
|
56338
56651
|
const isFunction = typeof hotkeyConfig === "function";
|
|
56339
|
-
const hotkeyData =
|
|
56652
|
+
const hotkeyData = hotkeys_default2[hotkeyName];
|
|
56340
56653
|
switch (status) {
|
|
56341
56654
|
case "triggered":
|
|
56342
56655
|
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;");
|
|
@@ -56424,7 +56737,7 @@ function checkHotkeys(hotkeyMap, event, board) {
|
|
|
56424
56737
|
// src/Keyboard/getHotkeyLabel.ts
|
|
56425
56738
|
function getHotkeyLabel(hotkey) {
|
|
56426
56739
|
const hotkeyLabel = hotkeys_default[hotkey].label;
|
|
56427
|
-
switch (
|
|
56740
|
+
switch (conf.FORCE_HOTKEYS || "auto") {
|
|
56428
56741
|
case "windows":
|
|
56429
56742
|
return hotkeyLabel.windows;
|
|
56430
56743
|
case "macos":
|
|
@@ -58401,7 +58714,7 @@ class SpatialIndex {
|
|
|
58401
58714
|
this.itemsArray.push(item);
|
|
58402
58715
|
this.itemsIndex.insert(item);
|
|
58403
58716
|
}
|
|
58404
|
-
if (
|
|
58717
|
+
if (conf.isNode()) {
|
|
58405
58718
|
return;
|
|
58406
58719
|
}
|
|
58407
58720
|
if (this.Mbr.getWidth() === 0 && this.Mbr.getHeight() === 0) {
|
|
@@ -59930,7 +60243,7 @@ class Transformer extends Tool {
|
|
|
59930
60243
|
const isLockedItems = this.selection.getIsLockedSelection();
|
|
59931
60244
|
if (mbr) {
|
|
59932
60245
|
mbr.strokeWidth = 1 / context.matrix.scaleX;
|
|
59933
|
-
const selectionColor = isLockedItems ?
|
|
60246
|
+
const selectionColor = isLockedItems ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
59934
60247
|
mbr.borderColor = selectionColor;
|
|
59935
60248
|
mbr.render(context);
|
|
59936
60249
|
}
|
|
@@ -59956,7 +60269,7 @@ class Transformer extends Tool {
|
|
|
59956
60269
|
new Point(right, bottom)
|
|
59957
60270
|
];
|
|
59958
60271
|
for (const point7 of points) {
|
|
59959
|
-
const circle = new Anchor(point7.x, point7.y,
|
|
60272
|
+
const circle = new Anchor(point7.x, point7.y, conf.SELECTION_ANCHOR_RADIUS, conf.SELECTION_COLOR, conf.SELECTION_ANCHOR_COLOR, conf.SELECTION_ANCHOR_WIDTH);
|
|
59960
60273
|
anchors.push(circle);
|
|
59961
60274
|
}
|
|
59962
60275
|
}
|
|
@@ -61157,7 +61470,7 @@ class BoardSelection {
|
|
|
61157
61470
|
renderItemMbr(context, item, customScale) {
|
|
61158
61471
|
const mbr = item.getMbr();
|
|
61159
61472
|
mbr.strokeWidth = !customScale ? 1 / context.matrix.scaleX : 1 / customScale;
|
|
61160
|
-
const selectionColor = item.transformation.isLocked ?
|
|
61473
|
+
const selectionColor = item.transformation.isLocked ? conf.SELECTION_LOCKED_COLOR : conf.SELECTION_COLOR;
|
|
61161
61474
|
mbr.borderColor = selectionColor;
|
|
61162
61475
|
mbr.render(context);
|
|
61163
61476
|
}
|
|
@@ -61604,7 +61917,7 @@ class Board {
|
|
|
61604
61917
|
const loadLinksImagesScript = LOAD_LINKS_IMAGES_JS;
|
|
61605
61918
|
const css = INDEX_CSS;
|
|
61606
61919
|
const boardName = this.getName() || this.getBoardId();
|
|
61607
|
-
const items = this.items.getWholeHTML(
|
|
61920
|
+
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
61608
61921
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
61609
61922
|
const scripts = `
|
|
61610
61923
|
<script type="module">${customTagsScript}</script>
|
|
@@ -61644,7 +61957,7 @@ class Board {
|
|
|
61644
61957
|
return `${head}${body}`;
|
|
61645
61958
|
}
|
|
61646
61959
|
deserializeHTMLAndEmit(stringedHTML) {
|
|
61647
|
-
const parser =
|
|
61960
|
+
const parser = conf.getDOMParser();
|
|
61648
61961
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
61649
61962
|
const items = doc.body.querySelector("#items");
|
|
61650
61963
|
if (items) {
|
|
@@ -61696,7 +62009,7 @@ class Board {
|
|
|
61696
62009
|
return [];
|
|
61697
62010
|
}
|
|
61698
62011
|
deserializeHTML(stringedHTML) {
|
|
61699
|
-
const parser =
|
|
62012
|
+
const parser = conf.getDOMParser();
|
|
61700
62013
|
const doc = parser.parseFromString(stringedHTML, "text/html");
|
|
61701
62014
|
const itemsDiv = doc.body.querySelector("#items");
|
|
61702
62015
|
if (!itemsDiv) {
|
|
@@ -62835,19 +63148,19 @@ function removeNode_removeNode(confirmed, toTransform) {
|
|
|
62835
63148
|
// src/Events/Transform/splitNode_insertNode.ts
|
|
62836
63149
|
function splitNode_insertNode(confirmed, toTransform) {
|
|
62837
63150
|
const transformed = { ...toTransform };
|
|
62838
|
-
const
|
|
63151
|
+
const conf2 = confirmed.path;
|
|
62839
63152
|
const path4 = transformed.path;
|
|
62840
|
-
if (Path3.equals(
|
|
63153
|
+
if (Path3.equals(conf2, path4)) {
|
|
62841
63154
|
return transformed;
|
|
62842
63155
|
}
|
|
62843
|
-
const isDescendant = path4.length >
|
|
63156
|
+
const isDescendant = path4.length > conf2.length && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
62844
63157
|
if (isDescendant) {
|
|
62845
63158
|
const newPath = [...path4];
|
|
62846
63159
|
newPath[0] = newPath[0] + 1;
|
|
62847
63160
|
transformed.path = newPath;
|
|
62848
63161
|
return transformed;
|
|
62849
63162
|
}
|
|
62850
|
-
if (Path3.isBefore(
|
|
63163
|
+
if (Path3.isBefore(conf2, path4)) {
|
|
62851
63164
|
transformPath(confirmed, transformed);
|
|
62852
63165
|
}
|
|
62853
63166
|
return transformed;
|
|
@@ -62856,23 +63169,23 @@ function splitNode_insertNode(confirmed, toTransform) {
|
|
|
62856
63169
|
// src/Events/Transform/splitNode_removeNode.ts
|
|
62857
63170
|
function splitNode_removeNode(confirmed, toTransform) {
|
|
62858
63171
|
const transformed = { ...toTransform };
|
|
62859
|
-
const
|
|
63172
|
+
const conf2 = confirmed.path;
|
|
62860
63173
|
const path4 = transformed.path;
|
|
62861
|
-
if (Path3.equals(
|
|
63174
|
+
if (Path3.equals(conf2, path4)) {
|
|
62862
63175
|
return transformed;
|
|
62863
63176
|
}
|
|
62864
|
-
if (path4.length ===
|
|
63177
|
+
if (path4.length === conf2.length + 1 && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i])) {
|
|
62865
63178
|
const newPath = [...path4];
|
|
62866
|
-
if (
|
|
63179
|
+
if (conf2.length === 1) {
|
|
62867
63180
|
newPath[0] = newPath[0] + 1;
|
|
62868
63181
|
} else {
|
|
62869
|
-
newPath[
|
|
63182
|
+
newPath[conf2.length] = newPath[conf2.length] + 1;
|
|
62870
63183
|
}
|
|
62871
63184
|
transformed.path = newPath;
|
|
62872
63185
|
return transformed;
|
|
62873
63186
|
}
|
|
62874
|
-
const isDescendant = path4.length >
|
|
62875
|
-
if (Path3.isBefore(
|
|
63187
|
+
const isDescendant = path4.length > conf2.length && path4.slice(0, conf2.length).every((seg, i) => seg === conf2[i]);
|
|
63188
|
+
if (Path3.isBefore(conf2, path4) && !isDescendant) {
|
|
62876
63189
|
transformPath(confirmed, transformed);
|
|
62877
63190
|
}
|
|
62878
63191
|
return transformed;
|
|
@@ -63452,8 +63765,8 @@ function transformEvents(confirmed, toTransform) {
|
|
|
63452
63765
|
const transformed = [];
|
|
63453
63766
|
for (const transf of toTransform) {
|
|
63454
63767
|
let actualyTransformed = { ...transf };
|
|
63455
|
-
for (const
|
|
63456
|
-
const { operation: confOp } =
|
|
63768
|
+
for (const conf2 of confirmed) {
|
|
63769
|
+
const { operation: confOp } = conf2.body;
|
|
63457
63770
|
const { operation: transfOp } = actualyTransformed.body;
|
|
63458
63771
|
const transformedOp = transfromOperation(confOp, transfOp);
|
|
63459
63772
|
if (transformedOp) {
|
|
@@ -64085,7 +64398,7 @@ class Events2 {
|
|
|
64085
64398
|
return record !== null;
|
|
64086
64399
|
}
|
|
64087
64400
|
sendPresenceEvent(event) {
|
|
64088
|
-
|
|
64401
|
+
conf.connection.publishPresenceEvent(this.board.getBoardId(), event);
|
|
64089
64402
|
}
|
|
64090
64403
|
canUndoEvent(op, byUserId) {
|
|
64091
64404
|
if (op.method === "undo") {
|
|
@@ -64163,81 +64476,53 @@ function handleChatChunk(chunk, board) {
|
|
|
64163
64476
|
const item = board.items.getById(itemId);
|
|
64164
64477
|
switch (chunk.type) {
|
|
64165
64478
|
case "chunk":
|
|
64166
|
-
if (!
|
|
64479
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64167
64480
|
return;
|
|
64168
64481
|
}
|
|
64169
|
-
|
|
64482
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown(chunk.content || "");
|
|
64170
64483
|
break;
|
|
64171
64484
|
case "done":
|
|
64172
|
-
if (!
|
|
64485
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64173
64486
|
board.aiGeneratingOnItem = undefined;
|
|
64174
64487
|
return;
|
|
64175
64488
|
}
|
|
64176
|
-
|
|
64489
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
|
|
64177
64490
|
break;
|
|
64178
64491
|
case "end":
|
|
64179
|
-
if (!
|
|
64492
|
+
if (!item2 || item2.itemType !== "AINode") {
|
|
64180
64493
|
board.aiGeneratingOnItem = undefined;
|
|
64181
64494
|
return;
|
|
64182
64495
|
}
|
|
64183
|
-
|
|
64496
|
+
item2.getRichText()?.editor.markdownProcessor.processMarkdown("StopProcessingMarkdown");
|
|
64184
64497
|
break;
|
|
64185
64498
|
case "error":
|
|
64186
|
-
board.camera.unsubscribeFromItem();
|
|
64187
|
-
if (board.aiGeneratingOnItem) {
|
|
64188
|
-
const item2 = board.items.getById(board.aiGeneratingOnItem);
|
|
64189
|
-
if (item2) {
|
|
64190
|
-
board.selection.removeAll();
|
|
64191
|
-
board.selection.add(item2);
|
|
64192
|
-
if (item2.itemType === "AINode") {
|
|
64193
|
-
item2.getRichText().editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
64194
|
-
if (chunk.isExternalApiError) {
|
|
64195
|
-
const editor = item2.getRichText().editor;
|
|
64196
|
-
editor.clearText();
|
|
64197
|
-
editor.insertCopiedText(conf2.i18n.t("AIInput.nodeErrorText"));
|
|
64198
|
-
}
|
|
64199
|
-
}
|
|
64200
|
-
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64201
|
-
}
|
|
64202
|
-
}
|
|
64203
|
-
console.log("Error AI generate", chunk.error);
|
|
64204
|
-
if (!chunk.isExternalApiError) {
|
|
64205
|
-
conf2.notify({
|
|
64206
|
-
header: conf2.i18n.t("AIInput.textGenerationError.header"),
|
|
64207
|
-
body: conf2.i18n.t("AIInput.textGenerationError.body"),
|
|
64208
|
-
variant: "error",
|
|
64209
|
-
duration: 4000
|
|
64210
|
-
});
|
|
64211
|
-
}
|
|
64212
|
-
board.aiGeneratingOnItem = undefined;
|
|
64213
|
-
break;
|
|
64214
64499
|
default:
|
|
64215
64500
|
board.camera.unsubscribeFromItem();
|
|
64216
64501
|
if (!chunk.isExternalApiError) {
|
|
64217
|
-
|
|
64218
|
-
header:
|
|
64219
|
-
body:
|
|
64502
|
+
conf.notify({
|
|
64503
|
+
header: conf.i18n.t("AIInput.textGenerationError.header"),
|
|
64504
|
+
body: conf.i18n.t("AIInput.textGenerationError.body"),
|
|
64220
64505
|
variant: "error",
|
|
64221
64506
|
duration: 4000
|
|
64222
64507
|
});
|
|
64223
64508
|
}
|
|
64224
|
-
|
|
64225
|
-
|
|
64226
|
-
|
|
64227
|
-
|
|
64228
|
-
|
|
64229
|
-
|
|
64230
|
-
|
|
64231
|
-
|
|
64232
|
-
|
|
64233
|
-
|
|
64234
|
-
|
|
64235
|
-
}
|
|
64509
|
+
const item2 = board.items.getById(board.aiGeneratingOnItem || "");
|
|
64510
|
+
if (board.aiGeneratingOnItem && item2) {
|
|
64511
|
+
board.selection.removeAll();
|
|
64512
|
+
board.selection.add(item2);
|
|
64513
|
+
const rt = item2?.getRichText();
|
|
64514
|
+
if (item2.itemType === "AINode" && rt) {
|
|
64515
|
+
const editor = rt.editor;
|
|
64516
|
+
editor.markdownProcessor.setStopProcessingMarkDownCb(null);
|
|
64517
|
+
if (chunk.isExternalApiError) {
|
|
64518
|
+
editor.clearText();
|
|
64519
|
+
editor.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
64236
64520
|
}
|
|
64237
|
-
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64238
64521
|
}
|
|
64522
|
+
board.camera.zoomToFit(item2.getMbr(), 20);
|
|
64239
64523
|
}
|
|
64240
64524
|
board.aiGeneratingOnItem = undefined;
|
|
64525
|
+
break;
|
|
64241
64526
|
}
|
|
64242
64527
|
}
|
|
64243
64528
|
function handleAudioGenerate(response, board) {
|
|
@@ -64258,7 +64543,7 @@ function handleAudioGenerate(response, board) {
|
|
|
64258
64543
|
}
|
|
64259
64544
|
const audio = new AudioItem(board, true, audioUrl2, board.events, "", "wav");
|
|
64260
64545
|
const { left, top, right } = placeholderNode.getMbr();
|
|
64261
|
-
audio.transformation.applyTranslateTo(left + (right - left -
|
|
64546
|
+
audio.transformation.applyTranslateTo(left + (right - left - conf.AUDIO_DIMENSIONS.width) / 2, top);
|
|
64262
64547
|
audio.updateMbr();
|
|
64263
64548
|
const threadDirection = placeholderNode.getThreadDirection();
|
|
64264
64549
|
board.remove(placeholderNode, false);
|
|
@@ -64280,7 +64565,7 @@ function handleAudioGenerate(response, board) {
|
|
|
64280
64565
|
type: "audio/wav"
|
|
64281
64566
|
});
|
|
64282
64567
|
const audioUrl2 = URL.createObjectURL(audioBlob);
|
|
64283
|
-
const linkElem =
|
|
64568
|
+
const linkElem = conf.documentFactory.createElement("a");
|
|
64284
64569
|
linkElem.href = audioUrl2;
|
|
64285
64570
|
linkElem.setAttribute("download", `${board.getBoardId()}-generated.wav`);
|
|
64286
64571
|
linkElem.click();
|
|
@@ -64299,9 +64584,9 @@ function handleAudioGenerate(response, board) {
|
|
|
64299
64584
|
board.selection.add(placeholderNode);
|
|
64300
64585
|
}
|
|
64301
64586
|
console.error("Audio generation error:", response.message);
|
|
64302
|
-
|
|
64303
|
-
header:
|
|
64304
|
-
body:
|
|
64587
|
+
conf.notify({
|
|
64588
|
+
header: conf.i18n.t("AIInput.audioGenerationError.header"),
|
|
64589
|
+
body: conf.i18n.t("AIInput.audioGenerationError.body"),
|
|
64305
64590
|
variant: "error",
|
|
64306
64591
|
duration: 4000
|
|
64307
64592
|
});
|
|
@@ -64364,14 +64649,14 @@ function handleImageGenerate(response, board) {
|
|
|
64364
64649
|
board.selection.add(item);
|
|
64365
64650
|
const editor = item.getRichText()?.editor;
|
|
64366
64651
|
editor?.clearText();
|
|
64367
|
-
editor?.insertCopiedText(
|
|
64652
|
+
editor?.insertCopiedText(conf.i18n.t("AIInput.nodeErrorText"));
|
|
64368
64653
|
board.camera.zoomToFit(item.getMbr(), 20);
|
|
64369
64654
|
}
|
|
64370
64655
|
}
|
|
64371
64656
|
} else {
|
|
64372
|
-
|
|
64373
|
-
header:
|
|
64374
|
-
body:
|
|
64657
|
+
conf.notify({
|
|
64658
|
+
header: conf.i18n.t("AIInput.imageGenerationError.header"),
|
|
64659
|
+
body: conf.i18n.t("AIInput.imageGenerationError.body"),
|
|
64375
64660
|
variant: "error",
|
|
64376
64661
|
duration: 4000
|
|
64377
64662
|
});
|
|
@@ -64438,10 +64723,10 @@ function startIntervals(board) {
|
|
|
64438
64723
|
}
|
|
64439
64724
|
log.publishIntervalTimer = setInterval(() => {
|
|
64440
64725
|
tryPublishEvent(board);
|
|
64441
|
-
},
|
|
64726
|
+
}, conf.EVENTS_PUBLISH_INTERVAL);
|
|
64442
64727
|
log.resendIntervalTimer = setInterval(() => {
|
|
64443
64728
|
tryResendEvent(board);
|
|
64444
|
-
},
|
|
64729
|
+
}, conf.EVENTS_RESEND_INTERVAL);
|
|
64445
64730
|
}
|
|
64446
64731
|
function tryPublishEvent(board) {
|
|
64447
64732
|
const { log } = board.events;
|
|
@@ -64460,14 +64745,14 @@ function tryResendEvent(board) {
|
|
|
64460
64745
|
return;
|
|
64461
64746
|
}
|
|
64462
64747
|
const date = Date.now();
|
|
64463
|
-
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >=
|
|
64748
|
+
const isTimeToSendPendingEvent = date - log.pendingEvent.lastSentTime >= conf.EVENTS_RESEND_INTERVAL;
|
|
64464
64749
|
if (!isTimeToSendPendingEvent) {
|
|
64465
64750
|
return;
|
|
64466
64751
|
}
|
|
64467
|
-
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >=
|
|
64752
|
+
const isProbablyLostConnection = log.firstSentTime && date - log.firstSentTime >= conf.EVENTS_RESEND_INTERVAL * 5;
|
|
64468
64753
|
if (isProbablyLostConnection) {
|
|
64469
64754
|
board.presence.clear();
|
|
64470
|
-
|
|
64755
|
+
conf.connection?.notifyAboutLostConnection();
|
|
64471
64756
|
}
|
|
64472
64757
|
sendBoardEvent(board, log.pendingEvent.event, log.currentSequenceNumber);
|
|
64473
64758
|
}
|
|
@@ -64498,12 +64783,12 @@ function sendBoardEvent(board, event, sequenceNumber) {
|
|
|
64498
64783
|
lastKnownOrder: log.getLastIndex()
|
|
64499
64784
|
}
|
|
64500
64785
|
};
|
|
64501
|
-
|
|
64786
|
+
conf.connection.send({
|
|
64502
64787
|
type: "BoardEvent",
|
|
64503
64788
|
boardId: board.getBoardId(),
|
|
64504
64789
|
event: toSend,
|
|
64505
64790
|
sequenceNumber,
|
|
64506
|
-
userId:
|
|
64791
|
+
userId: conf.connection.getCurrentUser()
|
|
64507
64792
|
});
|
|
64508
64793
|
const date = Date.now();
|
|
64509
64794
|
log.pendingEvent = {
|
|
@@ -64549,7 +64834,7 @@ function handleConfirmation(msg2, board) {
|
|
|
64549
64834
|
if (!isPendingEventConfirmation) {
|
|
64550
64835
|
return;
|
|
64551
64836
|
}
|
|
64552
|
-
|
|
64837
|
+
conf.connection?.dismissNotificationAboutLostConnection();
|
|
64553
64838
|
log.currentSequenceNumber++;
|
|
64554
64839
|
log.pendingEvent.event.order = msg2.order;
|
|
64555
64840
|
log.confirmSentLocalEvent(log.pendingEvent.event);
|
|
@@ -64561,7 +64846,7 @@ function handleConfirmation(msg2, board) {
|
|
|
64561
64846
|
// src/Events/MessageRouter/handleCreateSnapshotRequestMessage.ts
|
|
64562
64847
|
function handleCreateSnapshotRequestMessage(msg2, board) {
|
|
64563
64848
|
const { boardId, snapshot, lastOrder } = getSnapshotToPublish(board);
|
|
64564
|
-
|
|
64849
|
+
conf.connection.send({
|
|
64565
64850
|
type: "BoardSnapshot",
|
|
64566
64851
|
boardId,
|
|
64567
64852
|
snapshot,
|
|
@@ -64592,9 +64877,9 @@ function handleModeMessage(message, board) {
|
|
|
64592
64877
|
if (isTemplateView()) {
|
|
64593
64878
|
return;
|
|
64594
64879
|
}
|
|
64595
|
-
|
|
64596
|
-
header:
|
|
64597
|
-
body: message.mode === "edit" ?
|
|
64880
|
+
conf.notify({
|
|
64881
|
+
header: conf.i18n.t("sharing.settingsChanged.heading"),
|
|
64882
|
+
body: message.mode === "edit" ? conf.i18n.t("sharing.settingsChanged.bodyEdit") : conf.i18n.t("sharing.settingsChanged.bodyView"),
|
|
64598
64883
|
duration: 5000
|
|
64599
64884
|
});
|
|
64600
64885
|
}
|
|
@@ -64628,10 +64913,19 @@ messageRouter.addHandler("AiChat", handleAiChatMassage);
|
|
|
64628
64913
|
messageRouter.addHandler("Mode", handleModeMessage);
|
|
64629
64914
|
messageRouter.addHandler("PresenceEvent", handlePresenceEventMessage);
|
|
64630
64915
|
messageRouter.addHandler("UserJoin", handleUserJoinMessage);
|
|
64916
|
+
// src/api/initI18N.ts
|
|
64917
|
+
function initI18N(i18nInstance) {
|
|
64918
|
+
conf.i18n = i18nInstance;
|
|
64919
|
+
conf.planNames = {
|
|
64920
|
+
basic: i18nInstance.t("userPlan.plans.basic.name"),
|
|
64921
|
+
plus: i18nInstance.t("userPlan.plans.plus.name")
|
|
64922
|
+
};
|
|
64923
|
+
return i18nInstance;
|
|
64924
|
+
}
|
|
64631
64925
|
// src/api/getMeasureCtx.ts
|
|
64632
64926
|
function getMeasureCtx() {
|
|
64633
64927
|
if (typeof document !== "undefined") {
|
|
64634
|
-
const measureCanvas =
|
|
64928
|
+
const measureCanvas = conf.documentFactory.createElement("canvas");
|
|
64635
64929
|
const measureCtx = measureCanvas.getContext("2d");
|
|
64636
64930
|
if (!measureCtx) {
|
|
64637
64931
|
throw new Error("Failde to create canvas and get 2d context");
|
|
@@ -64652,7 +64946,7 @@ function getBrowserDOMParser() {
|
|
|
64652
64946
|
|
|
64653
64947
|
// src/api/initPaths.ts
|
|
64654
64948
|
function initPaths(path2D) {
|
|
64655
|
-
|
|
64949
|
+
conf.EXPORT_FRAME_DECORATIONS = {
|
|
64656
64950
|
"top-left": {
|
|
64657
64951
|
path: new path2D("M13 1H1V13"),
|
|
64658
64952
|
lineWidth: 2,
|
|
@@ -64692,105 +64986,24 @@ function initPaths(path2D) {
|
|
|
64692
64986
|
};
|
|
64693
64987
|
}
|
|
64694
64988
|
|
|
64695
|
-
// node_modules/react-i18next/dist/es/unescape.js
|
|
64696
|
-
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
64697
|
-
var htmlEntities = {
|
|
64698
|
-
"&": "&",
|
|
64699
|
-
"&": "&",
|
|
64700
|
-
"<": "<",
|
|
64701
|
-
"<": "<",
|
|
64702
|
-
">": ">",
|
|
64703
|
-
">": ">",
|
|
64704
|
-
"'": "'",
|
|
64705
|
-
"'": "'",
|
|
64706
|
-
""": '"',
|
|
64707
|
-
""": '"',
|
|
64708
|
-
" ": " ",
|
|
64709
|
-
" ": " ",
|
|
64710
|
-
"©": "©",
|
|
64711
|
-
"©": "©",
|
|
64712
|
-
"®": "®",
|
|
64713
|
-
"®": "®",
|
|
64714
|
-
"…": "…",
|
|
64715
|
-
"…": "…",
|
|
64716
|
-
"/": "/",
|
|
64717
|
-
"/": "/"
|
|
64718
|
-
};
|
|
64719
|
-
var unescapeHtmlEntity = (m) => htmlEntities[m];
|
|
64720
|
-
var unescape = (text5) => text5.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
64721
|
-
|
|
64722
|
-
// node_modules/react-i18next/dist/es/defaults.js
|
|
64723
|
-
var defaultOptions = {
|
|
64724
|
-
bindI18n: "languageChanged",
|
|
64725
|
-
bindI18nStore: "",
|
|
64726
|
-
transEmptyNodeValue: "",
|
|
64727
|
-
transSupportBasicHtmlNodes: true,
|
|
64728
|
-
transWrapTextNodes: "",
|
|
64729
|
-
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
64730
|
-
useSuspense: true,
|
|
64731
|
-
unescape
|
|
64732
|
-
};
|
|
64733
|
-
function setDefaults() {
|
|
64734
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
64735
|
-
defaultOptions = {
|
|
64736
|
-
...defaultOptions,
|
|
64737
|
-
...options
|
|
64738
|
-
};
|
|
64739
|
-
}
|
|
64740
|
-
|
|
64741
|
-
// node_modules/react-i18next/dist/es/i18nInstance.js
|
|
64742
|
-
var i18nInstance;
|
|
64743
|
-
function setI18n(instance2) {
|
|
64744
|
-
i18nInstance = instance2;
|
|
64745
|
-
}
|
|
64746
|
-
|
|
64747
|
-
// node_modules/react-i18next/dist/es/initReactI18next.js
|
|
64748
|
-
var initReactI18next = {
|
|
64749
|
-
type: "3rdParty",
|
|
64750
|
-
init(instance2) {
|
|
64751
|
-
setDefaults(instance2.options.react);
|
|
64752
|
-
setI18n(instance2);
|
|
64753
|
-
}
|
|
64754
|
-
};
|
|
64755
|
-
// src/api/initI18NBrowser.ts
|
|
64756
|
-
function initI18NReact(isNode = false) {
|
|
64757
|
-
const i18nBrowser = createInstance();
|
|
64758
|
-
i18nBrowser.use(initReactI18next).use(Browser).init({
|
|
64759
|
-
debug: conf2.debug,
|
|
64760
|
-
detection: {
|
|
64761
|
-
order: ["navigator"]
|
|
64762
|
-
},
|
|
64763
|
-
supportedLngs: ["en", "ru"],
|
|
64764
|
-
defaultNS,
|
|
64765
|
-
resources,
|
|
64766
|
-
fallbackLng: conf2.FALLBACK_LNG,
|
|
64767
|
-
interpolation: {
|
|
64768
|
-
escapeValue: false
|
|
64769
|
-
}
|
|
64770
|
-
});
|
|
64771
|
-
conf2.i18n = i18nBrowser;
|
|
64772
|
-
return i18nBrowser;
|
|
64773
|
-
}
|
|
64774
|
-
|
|
64775
64989
|
// src/api/initBrowserSettings.ts
|
|
64776
64990
|
function initBrowserSettings() {
|
|
64777
|
-
|
|
64778
|
-
|
|
64779
|
-
|
|
64780
|
-
|
|
64781
|
-
|
|
64782
|
-
|
|
64783
|
-
|
|
64784
|
-
initI18NReact();
|
|
64991
|
+
conf.documentFactory = new BrowserDocumentFactory;
|
|
64992
|
+
conf.path2DFactory = BrowserPath2D;
|
|
64993
|
+
conf.measureCtx = getMeasureCtx();
|
|
64994
|
+
conf.getDocumentWidth = () => document.documentElement.clientWidth;
|
|
64995
|
+
conf.getDocumentHeight = () => document.documentElement.clientHeight;
|
|
64996
|
+
conf.getDPI = () => window.devicePixelRatio;
|
|
64997
|
+
conf.getDOMParser = getBrowserDOMParser;
|
|
64785
64998
|
initPaths(BrowserPath2D);
|
|
64786
|
-
|
|
64999
|
+
conf.reactEditorFocus = (editor) => {
|
|
64787
65000
|
try {
|
|
64788
65001
|
ReactEditor.focus(editor);
|
|
64789
65002
|
} catch (e) {
|
|
64790
65003
|
console.warn("Failed to focus editor:", e);
|
|
64791
65004
|
}
|
|
64792
65005
|
};
|
|
64793
|
-
|
|
65006
|
+
conf.reactEditorToSlatePoint = (editor, domNode, offset, options) => {
|
|
64794
65007
|
try {
|
|
64795
65008
|
return ReactEditor.toSlatePoint(editor, [domNode, offset], options);
|
|
64796
65009
|
} catch (e) {
|
|
@@ -64798,7 +65011,7 @@ function initBrowserSettings() {
|
|
|
64798
65011
|
return null;
|
|
64799
65012
|
}
|
|
64800
65013
|
};
|
|
64801
|
-
return
|
|
65014
|
+
return conf;
|
|
64802
65015
|
}
|
|
64803
65016
|
|
|
64804
65017
|
// src/browser.ts
|