microboard-temp 0.4.5 → 0.4.7
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 +590 -120
- package/dist/cjs/index.js +590 -120
- package/dist/cjs/node.js +590 -120
- package/dist/esm/browser.js +591 -121
- package/dist/esm/index.js +591 -121
- package/dist/esm/node.js +591 -121
- package/dist/types/BoardOperations.d.ts +7 -1
- package/dist/types/Items/AINode/AINode.d.ts +2 -1
- package/dist/types/Items/BaseItem/BaseItem.d.ts +1 -0
- package/dist/types/Items/Comment/Comment.d.ts +1 -0
- package/dist/types/Items/Curve/Curve.d.ts +2 -0
- package/dist/types/Items/Line/Line.d.ts +1 -0
- package/dist/types/Items/RichText/CanvasText/LayoutBlockNodes.d.ts +2 -1
- package/dist/types/Items/RichText/CanvasText/Render.d.ts +61 -0
- package/dist/types/Items/RichText/Editor/BlockNode.d.ts +5 -11
- package/dist/types/Items/RichText/editorHelpers/common/getAreAllChildrenEmpty.d.ts +2 -1
- package/dist/types/Items/RichText/setNodeStyles.d.ts +2 -2
- package/dist/types/Items/Shape/Shape.d.ts +1 -0
- package/dist/types/Selection/QuickAddButtons/quickAddHelpers.d.ts +1 -1
- package/dist/types/Selection/Selection.d.ts +3 -3
- package/dist/types/SpatialIndex/SpacialIndex.d.ts +3 -3
- package/dist/types/public/customWebComponents.d.ts +24 -0
- package/dist/types/public/loadLinkImages.d.ts +0 -0
- package/package.json +19 -19
package/dist/esm/browser.js
CHANGED
|
@@ -1474,6 +1474,9 @@ class Line {
|
|
|
1474
1474
|
getStartPoint() {
|
|
1475
1475
|
return this.start;
|
|
1476
1476
|
}
|
|
1477
|
+
getEndPoint() {
|
|
1478
|
+
return this.end;
|
|
1479
|
+
}
|
|
1477
1480
|
getLength() {
|
|
1478
1481
|
const { start, end } = this;
|
|
1479
1482
|
const deltaX = end.x - start.x;
|
|
@@ -3071,6 +3074,9 @@ class QuadraticBezier extends BaseCurve {
|
|
|
3071
3074
|
getStartPoint() {
|
|
3072
3075
|
return this.start;
|
|
3073
3076
|
}
|
|
3077
|
+
getEndPoint() {
|
|
3078
|
+
return this.end;
|
|
3079
|
+
}
|
|
3074
3080
|
moveToStart(ctx) {
|
|
3075
3081
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3076
3082
|
}
|
|
@@ -3114,6 +3120,9 @@ class CubicBezier extends BaseCurve {
|
|
|
3114
3120
|
getStartPoint() {
|
|
3115
3121
|
return this.start;
|
|
3116
3122
|
}
|
|
3123
|
+
getEndPoint() {
|
|
3124
|
+
return this.end;
|
|
3125
|
+
}
|
|
3117
3126
|
moveToStart(ctx) {
|
|
3118
3127
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3119
3128
|
}
|
|
@@ -7216,25 +7225,33 @@ class TransformationCommand {
|
|
|
7216
7225
|
x: 1 / op2.x,
|
|
7217
7226
|
y: 1 / op2.y
|
|
7218
7227
|
};
|
|
7228
|
+
} else {
|
|
7229
|
+
reverseOp = {
|
|
7230
|
+
...op2,
|
|
7231
|
+
x: 1,
|
|
7232
|
+
y: 1
|
|
7233
|
+
};
|
|
7219
7234
|
}
|
|
7220
7235
|
return { item: currTrans, operation: reverseOp };
|
|
7221
7236
|
});
|
|
7222
7237
|
}
|
|
7223
7238
|
case "locked": {
|
|
7239
|
+
const op2 = this.operation;
|
|
7224
7240
|
return mapItemsByOperation(this.transformation, () => {
|
|
7225
7241
|
return {
|
|
7226
|
-
...
|
|
7227
|
-
item: [...
|
|
7242
|
+
...op2,
|
|
7243
|
+
item: [...op2.item],
|
|
7228
7244
|
method: "unlocked",
|
|
7229
7245
|
locked: false
|
|
7230
7246
|
};
|
|
7231
7247
|
});
|
|
7232
7248
|
}
|
|
7233
7249
|
case "unlocked": {
|
|
7250
|
+
const op2 = this.operation;
|
|
7234
7251
|
return mapItemsByOperation(this.transformation, () => {
|
|
7235
7252
|
return {
|
|
7236
|
-
...
|
|
7237
|
-
item: [...
|
|
7253
|
+
...op2,
|
|
7254
|
+
item: [...op2.item],
|
|
7238
7255
|
method: "locked",
|
|
7239
7256
|
locked: true
|
|
7240
7257
|
};
|
|
@@ -8845,6 +8862,13 @@ var tagByType = {
|
|
|
8845
8862
|
Comment: "comment-item",
|
|
8846
8863
|
Group: ""
|
|
8847
8864
|
};
|
|
8865
|
+
var headingTagsMap = {
|
|
8866
|
+
h1: "heading_one",
|
|
8867
|
+
h2: "heading_two",
|
|
8868
|
+
h3: "heading_three",
|
|
8869
|
+
h4: "heading_four",
|
|
8870
|
+
h5: "heading_five"
|
|
8871
|
+
};
|
|
8848
8872
|
var parsersHTML = {
|
|
8849
8873
|
"sticker-item": parseHTMLSticker,
|
|
8850
8874
|
"shape-item": parseHTMLShape,
|
|
@@ -8869,12 +8893,12 @@ function getTransformationData(el) {
|
|
|
8869
8893
|
if (transformMatch) {
|
|
8870
8894
|
const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
|
|
8871
8895
|
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
8872
|
-
return { ...matrix, rotate: 0 };
|
|
8896
|
+
return { ...matrix, rotate: 0, isLocked: false };
|
|
8873
8897
|
}
|
|
8874
|
-
return { ...new Matrix2, rotate: 0 };
|
|
8898
|
+
return { ...new Matrix2, rotate: 0, isLocked: false };
|
|
8875
8899
|
}
|
|
8876
8900
|
function parseHTMLRichText(el, options) {
|
|
8877
|
-
const parseNode = (node) => {
|
|
8901
|
+
const parseNode = (node, nestingLevel = 1) => {
|
|
8878
8902
|
const isLinkNode = node.tagName.toLowerCase() === "a";
|
|
8879
8903
|
if (node.tagName.toLowerCase() === "span" || isLinkNode && node.children.length === 0) {
|
|
8880
8904
|
const isSingleSpace = node.textContent?.length === 1 && node.textContent?.trim() === "";
|
|
@@ -8897,7 +8921,7 @@ function parseHTMLRichText(el, options) {
|
|
|
8897
8921
|
superscript: false
|
|
8898
8922
|
};
|
|
8899
8923
|
}
|
|
8900
|
-
const children2 = Array.from(node.children).map((child) => parseNode(child));
|
|
8924
|
+
const children2 = Array.from(node.children).map((child) => parseNode(child, nestingLevel + 1));
|
|
8901
8925
|
const tagName = node.tagName.toLowerCase();
|
|
8902
8926
|
const extractCommonProps = () => ({
|
|
8903
8927
|
horisontalAlignment: node.style.textAlign || "left",
|
|
@@ -8905,23 +8929,19 @@ function parseHTMLRichText(el, options) {
|
|
|
8905
8929
|
paddingBottom: parseFloat(node.style.paddingBottom) || undefined
|
|
8906
8930
|
});
|
|
8907
8931
|
switch (tagName) {
|
|
8908
|
-
case "blockquote":
|
|
8909
|
-
return {
|
|
8910
|
-
type: "block-quote",
|
|
8911
|
-
...extractCommonProps(),
|
|
8912
|
-
children: children2
|
|
8913
|
-
};
|
|
8914
8932
|
case "ul":
|
|
8915
8933
|
return {
|
|
8916
8934
|
type: "ul_list",
|
|
8917
8935
|
...extractCommonProps(),
|
|
8918
|
-
children: children2
|
|
8936
|
+
children: children2,
|
|
8937
|
+
listLevel: nestingLevel
|
|
8919
8938
|
};
|
|
8920
8939
|
case "ol":
|
|
8921
8940
|
return {
|
|
8922
8941
|
type: "ol_list",
|
|
8923
8942
|
...extractCommonProps(),
|
|
8924
|
-
children: children2
|
|
8943
|
+
children: children2,
|
|
8944
|
+
listLevel: nestingLevel
|
|
8925
8945
|
};
|
|
8926
8946
|
case "li":
|
|
8927
8947
|
return {
|
|
@@ -8943,11 +8963,9 @@ function parseHTMLRichText(el, options) {
|
|
|
8943
8963
|
case "h2":
|
|
8944
8964
|
case "h3":
|
|
8945
8965
|
case "h4":
|
|
8946
|
-
case "h5":
|
|
8947
|
-
case "h6": {
|
|
8948
|
-
const headingType = `heading_${["one", "two", "three", "four", "five", "six"][parseInt(tagName[1]) - 1]}`;
|
|
8966
|
+
case "h5": {
|
|
8949
8967
|
return {
|
|
8950
|
-
type:
|
|
8968
|
+
type: headingTagsMap[tagName],
|
|
8951
8969
|
...extractCommonProps(),
|
|
8952
8970
|
children: children2
|
|
8953
8971
|
};
|
|
@@ -9151,6 +9169,7 @@ function parseHTMLConnector(el) {
|
|
|
9151
9169
|
...endPointType === "FixedConnector" ? { segment: startSegment, tangent: endTangent } : {}
|
|
9152
9170
|
};
|
|
9153
9171
|
const connectorData = {
|
|
9172
|
+
middlePoint: null,
|
|
9154
9173
|
id: el.id,
|
|
9155
9174
|
itemType: "Connector",
|
|
9156
9175
|
transformation,
|
|
@@ -9211,6 +9230,7 @@ function parseHTMLDrawing(el) {
|
|
|
9211
9230
|
}
|
|
9212
9231
|
function parseHTMLAINode(el) {
|
|
9213
9232
|
const aiNodeData = {
|
|
9233
|
+
threadDirection: 3,
|
|
9214
9234
|
id: el.id,
|
|
9215
9235
|
itemType: "AINode",
|
|
9216
9236
|
parentNodeId: el.getAttribute("parent-node-id") || undefined,
|
|
@@ -9544,17 +9564,18 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
9544
9564
|
break;
|
|
9545
9565
|
default:
|
|
9546
9566
|
if ("text" in child && typeof child.text === "string") {
|
|
9547
|
-
const
|
|
9567
|
+
const textNode = child;
|
|
9568
|
+
const fontScale2 = (textNode.fontSize === "auto" ? 14 : textNode.fontSize ?? 14) / 14;
|
|
9548
9569
|
handleTextNode({
|
|
9549
9570
|
isFrame,
|
|
9550
|
-
child,
|
|
9571
|
+
child: textNode,
|
|
9551
9572
|
node,
|
|
9552
9573
|
maxWidth,
|
|
9553
9574
|
paddingTop: i === 0 ? 16 * (data.paddingTop || 0) : 0,
|
|
9554
9575
|
marginLeft: (listData ? fontScale2 * 16 : 0) + (listData?.level || 0) * fontScale2 * 24,
|
|
9555
9576
|
newLine: i === 0 ? newLine : false,
|
|
9556
9577
|
listMark: i === 0 ? listMark : undefined,
|
|
9557
|
-
link:
|
|
9578
|
+
link: textNode.link
|
|
9558
9579
|
});
|
|
9559
9580
|
} else {
|
|
9560
9581
|
const blockNode = getBlockNode(child, maxWidth, isFrame, listData, i === 0 ? listMark : undefined, true);
|
|
@@ -9598,7 +9619,8 @@ function getTextNode(data) {
|
|
|
9598
9619
|
type: "text",
|
|
9599
9620
|
text,
|
|
9600
9621
|
style: getTextStyle(data),
|
|
9601
|
-
blocks: []
|
|
9622
|
+
blocks: [],
|
|
9623
|
+
newLine: false
|
|
9602
9624
|
};
|
|
9603
9625
|
return node;
|
|
9604
9626
|
}
|
|
@@ -9844,7 +9866,7 @@ function setBlockNodeCoordinates(blockNode) {
|
|
|
9844
9866
|
}
|
|
9845
9867
|
lineBottom += maxFontSize * lineHeight;
|
|
9846
9868
|
leading = maxFontSize * lineHeight - maxFontSize;
|
|
9847
|
-
yOffset = lineBottom - leading / 2 - highestBlock
|
|
9869
|
+
yOffset = lineBottom - leading / 2 - (highestBlock?.measure.descent || 0);
|
|
9848
9870
|
for (const block of line) {
|
|
9849
9871
|
block.y = yOffset;
|
|
9850
9872
|
}
|
|
@@ -9868,7 +9890,7 @@ function getTextBlock({
|
|
|
9868
9890
|
x: 0,
|
|
9869
9891
|
y: 0,
|
|
9870
9892
|
measure,
|
|
9871
|
-
fontSize: style.fontSize,
|
|
9893
|
+
fontSize: style.fontSize === "auto" ? 14 : style.fontSize,
|
|
9872
9894
|
paddingTop,
|
|
9873
9895
|
marginLeft,
|
|
9874
9896
|
listMark,
|
|
@@ -10390,7 +10412,7 @@ function handleListMerge(editor) {
|
|
|
10390
10412
|
return false;
|
|
10391
10413
|
}
|
|
10392
10414
|
const [textNode, textNodePath] = Editor2.node(editor, anchor.path);
|
|
10393
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10415
|
+
if (!textNode || Editor2.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
|
|
10394
10416
|
return false;
|
|
10395
10417
|
}
|
|
10396
10418
|
const paragraphPath = Path5.parent(textNodePath);
|
|
@@ -10400,12 +10422,12 @@ function handleListMerge(editor) {
|
|
|
10400
10422
|
}
|
|
10401
10423
|
const listItemPath = Path5.parent(paragraphPath);
|
|
10402
10424
|
const [listItem] = Editor2.node(editor, listItemPath);
|
|
10403
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10425
|
+
if (!listItem || Editor2.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10404
10426
|
return false;
|
|
10405
10427
|
}
|
|
10406
10428
|
const listPath = Path5.parent(listItemPath);
|
|
10407
10429
|
const [list] = Editor2.node(editor, listPath);
|
|
10408
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10430
|
+
if (!list || Editor2.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10409
10431
|
return false;
|
|
10410
10432
|
}
|
|
10411
10433
|
const listItemIndex = listItemPath[listItemPath.length - 1];
|
|
@@ -10439,6 +10461,9 @@ function handleListMerge(editor) {
|
|
|
10439
10461
|
} else {
|
|
10440
10462
|
const previousItemPath = Path5.previous(listItemPath);
|
|
10441
10463
|
const [previousItem] = Editor2.node(editor, previousItemPath);
|
|
10464
|
+
if ("text" in previousItem) {
|
|
10465
|
+
return false;
|
|
10466
|
+
}
|
|
10442
10467
|
currentListItemChildren.forEach((childNode, index) => {
|
|
10443
10468
|
const copiedNode = structuredClone(childNode);
|
|
10444
10469
|
copiedNode.paddingTop = 0;
|
|
@@ -10470,7 +10495,18 @@ function createParagraphNode(text, editor, horisontalAlignment) {
|
|
|
10470
10495
|
const marks = Editor3.marks(editor) || {};
|
|
10471
10496
|
const pargaraph = {
|
|
10472
10497
|
type: "paragraph",
|
|
10473
|
-
children: [{
|
|
10498
|
+
children: [{
|
|
10499
|
+
type: "text",
|
|
10500
|
+
text,
|
|
10501
|
+
...marks,
|
|
10502
|
+
bold: false,
|
|
10503
|
+
italic: false,
|
|
10504
|
+
underline: false,
|
|
10505
|
+
overline: false,
|
|
10506
|
+
"line-through": false,
|
|
10507
|
+
subscript: false,
|
|
10508
|
+
superscript: false
|
|
10509
|
+
}]
|
|
10474
10510
|
};
|
|
10475
10511
|
if (horisontalAlignment) {
|
|
10476
10512
|
pargaraph.horisontalAlignment = horisontalAlignment;
|
|
@@ -10524,6 +10560,9 @@ function handleSplitListItem(editor) {
|
|
|
10524
10560
|
if (isBlockEmpty && isOnlyChildParagraph) {
|
|
10525
10561
|
const listItemIndex = listItemPath[listItemPath.length - 1];
|
|
10526
10562
|
const [parentList, parentListPath] = Editor4.parent(editor, listItemPath);
|
|
10563
|
+
if (Editor4.isEditor(parentList) || parentList.type !== "ol_list" && parentList.type !== "ul_list") {
|
|
10564
|
+
return false;
|
|
10565
|
+
}
|
|
10527
10566
|
const listType = parentList.type;
|
|
10528
10567
|
Editor4.withoutNormalizing(editor, () => {
|
|
10529
10568
|
const nextPath = Path6.next(parentListPath);
|
|
@@ -10548,6 +10587,9 @@ function handleSplitListItem(editor) {
|
|
|
10548
10587
|
match: (n, path2) => path2[path2.length - 1] >= listItemIndex
|
|
10549
10588
|
});
|
|
10550
10589
|
const [updatedParentList] = Editor4.node(editor, parentListPath);
|
|
10590
|
+
if (Editor4.isEditor(updatedParentList)) {
|
|
10591
|
+
return false;
|
|
10592
|
+
}
|
|
10551
10593
|
if (getAreAllChildrenEmpty(updatedParentList)) {
|
|
10552
10594
|
Transforms3.removeNodes(editor, { at: parentListPath });
|
|
10553
10595
|
}
|
|
@@ -10579,7 +10621,7 @@ import { Transforms as Transforms5 } from "slate";
|
|
|
10579
10621
|
import { Editor as Editor5, Transforms as Transforms4 } from "slate";
|
|
10580
10622
|
function clearAllTextNodes(editor) {
|
|
10581
10623
|
for (const [node, path2] of Editor5.nodes(editor, {
|
|
10582
|
-
match: (n) => n.type === "text"
|
|
10624
|
+
match: (n) => !Editor5.isEditor(n) && n.type === "text"
|
|
10583
10625
|
})) {
|
|
10584
10626
|
Transforms4.removeNodes(editor, { at: path2 });
|
|
10585
10627
|
Transforms4.setNodes(editor, { ...node, text: "" }, { at: path2 });
|
|
@@ -10614,7 +10656,7 @@ function handleWrapIntoNestedList(editor) {
|
|
|
10614
10656
|
}
|
|
10615
10657
|
const { anchor } = selection;
|
|
10616
10658
|
const [textNode, textNodePath] = Editor6.node(editor, anchor.path);
|
|
10617
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10659
|
+
if (!textNode || Editor6.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
|
|
10618
10660
|
return false;
|
|
10619
10661
|
}
|
|
10620
10662
|
const paragraphPath = Path7.parent(textNodePath);
|
|
@@ -10624,12 +10666,12 @@ function handleWrapIntoNestedList(editor) {
|
|
|
10624
10666
|
}
|
|
10625
10667
|
const listItemPath = Path7.parent(paragraphPath);
|
|
10626
10668
|
const [listItem] = Editor6.node(editor, listItemPath);
|
|
10627
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10669
|
+
if (!listItem || Editor6.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10628
10670
|
return false;
|
|
10629
10671
|
}
|
|
10630
10672
|
const listPath = Path7.parent(listItemPath);
|
|
10631
10673
|
const [list] = Editor6.node(editor, listPath);
|
|
10632
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10674
|
+
if (!list || Editor6.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10633
10675
|
return false;
|
|
10634
10676
|
}
|
|
10635
10677
|
Transforms6.wrapNodes(editor, { type: "list_item", children: [] }, { at: paragraphPath });
|
|
@@ -10652,19 +10694,19 @@ function wrapIntoList(editor, targetListType, location) {
|
|
|
10652
10694
|
}
|
|
10653
10695
|
|
|
10654
10696
|
// src/Items/RichText/editorHelpers/lists/toggleListTypeForSelection.ts
|
|
10655
|
-
import { Editor as Editor8, Element as Element2, Path as Path9,
|
|
10697
|
+
import { Editor as Editor8, Element as Element2, Path as Path9, Transforms as Transforms8 } from "slate";
|
|
10656
10698
|
|
|
10657
10699
|
// src/Items/RichText/editorHelpers/lists/getBlockParentList.ts
|
|
10658
10700
|
import { Editor as Editor7, Path as Path8 } from "slate";
|
|
10659
10701
|
function getBlockParentList(editor, blockPath) {
|
|
10660
10702
|
const listItemPath = Path8.parent(blockPath);
|
|
10661
10703
|
const [listItem] = Editor7.node(editor, listItemPath);
|
|
10662
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10704
|
+
if (!listItem || Editor7.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10663
10705
|
return null;
|
|
10664
10706
|
}
|
|
10665
10707
|
const listPath = Path8.parent(listItemPath);
|
|
10666
10708
|
const [list] = Editor7.node(editor, listPath);
|
|
10667
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10709
|
+
if (!list || Editor7.isEditor(listItem) || "type" in list && list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10668
10710
|
return null;
|
|
10669
10711
|
}
|
|
10670
10712
|
return [list, listPath];
|
|
@@ -10677,17 +10719,16 @@ function toggleListTypeForSelection(editor, targetListType) {
|
|
|
10677
10719
|
return false;
|
|
10678
10720
|
}
|
|
10679
10721
|
Editor8.withoutNormalizing(editor, () => {
|
|
10680
|
-
const [start, end] = Range4.edges(selection);
|
|
10681
|
-
const commonAncestorPath = Path9.common(start.path, end.path);
|
|
10682
10722
|
const nodes = Array.from(Editor8.nodes(editor, {
|
|
10683
10723
|
at: selection,
|
|
10684
10724
|
mode: "lowest",
|
|
10685
|
-
match: (n) => Editor8.isBlock(editor, n)
|
|
10725
|
+
match: (n) => !Editor8.isEditor(n) && n.type !== "text" && Editor8.isBlock(editor, n)
|
|
10686
10726
|
}));
|
|
10687
10727
|
const nodesWithLists = {};
|
|
10688
10728
|
const unwrapCandidates = [];
|
|
10689
10729
|
nodes.forEach(([node, path2]) => {
|
|
10690
10730
|
const parentList = getBlockParentList(editor, path2);
|
|
10731
|
+
node = node;
|
|
10691
10732
|
if (parentList) {
|
|
10692
10733
|
unwrapCandidates.push(node);
|
|
10693
10734
|
if (!nodesWithLists[parentList[1].length]) {
|
|
@@ -10797,7 +10838,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10797
10838
|
Editor9.withoutNormalizing(editor, () => {
|
|
10798
10839
|
const { anchor } = selection;
|
|
10799
10840
|
const [textNode, textNodePath] = Editor9.node(editor, anchor.path);
|
|
10800
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10841
|
+
if (!textNode || Editor9.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode)) {
|
|
10801
10842
|
result = false;
|
|
10802
10843
|
return;
|
|
10803
10844
|
}
|
|
@@ -10809,7 +10850,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10809
10850
|
}
|
|
10810
10851
|
const listItemPath = Path10.parent(paragraphPath);
|
|
10811
10852
|
const [listItem] = Editor9.node(editor, listItemPath);
|
|
10812
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10853
|
+
if (!listItem || Editor9.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10813
10854
|
if (shouldWrap) {
|
|
10814
10855
|
wrapIntoList(editor, targetListType, selection);
|
|
10815
10856
|
return;
|
|
@@ -10819,7 +10860,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10819
10860
|
}
|
|
10820
10861
|
const listPath = Path10.parent(listItemPath);
|
|
10821
10862
|
const [list] = Editor9.node(editor, listPath);
|
|
10822
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10863
|
+
if (!list || Editor9.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10823
10864
|
if (shouldWrap) {
|
|
10824
10865
|
wrapIntoList(editor, targetListType, selection);
|
|
10825
10866
|
return;
|
|
@@ -10901,7 +10942,7 @@ function getListTypeAtSelectionStart(editor) {
|
|
|
10901
10942
|
const startPoint = Range6.start(selection);
|
|
10902
10943
|
const listEntry = Editor11.above(editor, {
|
|
10903
10944
|
at: startPoint,
|
|
10904
|
-
match: (n) => n.type === "ol_list" || n.type === "ul_list"
|
|
10945
|
+
match: (n) => !Editor11.isEditor(n) && (n.type === "ol_list" || n.type === "ul_list")
|
|
10905
10946
|
});
|
|
10906
10947
|
if (listEntry) {
|
|
10907
10948
|
const [listNode] = listEntry;
|
|
@@ -10924,11 +10965,11 @@ var setLink = (editor, link, selection) => {
|
|
|
10924
10965
|
const format = link ? "rgba(71, 120, 245, 1)" : "rgb(20, 21, 26)";
|
|
10925
10966
|
Editor12.addMark(editor, "fontColor", format);
|
|
10926
10967
|
for (const [node, path2] of Editor12.nodes(editor, {
|
|
10927
|
-
match: (n) => n.type === "text"
|
|
10968
|
+
match: (n) => !Editor12.isEditor(n) && n.type === "text"
|
|
10928
10969
|
})) {
|
|
10929
10970
|
const nodeRange = Editor12.range(editor, path2);
|
|
10930
10971
|
Transforms11.select(editor, nodeRange);
|
|
10931
|
-
Transforms11.setNodes(editor, { link }, { split: false, match: (n) => n.type === "text" });
|
|
10972
|
+
Transforms11.setNodes(editor, { link }, { split: false, match: (n) => !Editor12.isEditor(n) && n.type === "text" });
|
|
10932
10973
|
}
|
|
10933
10974
|
};
|
|
10934
10975
|
|
|
@@ -17051,7 +17092,9 @@ function setNodeChildrenStyles({
|
|
|
17051
17092
|
}) {
|
|
17052
17093
|
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
17053
17094
|
if (editor) {
|
|
17054
|
-
|
|
17095
|
+
const marks = Editor16.marks(editor);
|
|
17096
|
+
const fontSize = marks?.fontSize ? marks.fontSize === "auto" ? conf.DEFAULT_TEXT_STYLES.fontSize : marks.fontSize : conf.DEFAULT_TEXT_STYLES.fontSize;
|
|
17097
|
+
fontStyles = marks ? { ...conf.DEFAULT_TEXT_STYLES, ...marks, fontSize } : conf.DEFAULT_TEXT_STYLES;
|
|
17055
17098
|
}
|
|
17056
17099
|
switch (node2.type) {
|
|
17057
17100
|
case "heading_one":
|
|
@@ -17101,6 +17144,9 @@ function setNodeStyles({
|
|
|
17101
17144
|
editor,
|
|
17102
17145
|
horisontalAlignment
|
|
17103
17146
|
}) {
|
|
17147
|
+
if (node2.type === "list_item") {
|
|
17148
|
+
return;
|
|
17149
|
+
}
|
|
17104
17150
|
if (node2.type === "ol_list" || node2.type === "ul_list") {
|
|
17105
17151
|
node2.listLevel = listLevel;
|
|
17106
17152
|
for (const listItem of node2.children) {
|
|
@@ -17251,9 +17297,10 @@ class MarkdownProcessor {
|
|
|
17251
17297
|
} else {
|
|
17252
17298
|
const lastParagraphPath = this.getText().length - 1;
|
|
17253
17299
|
const lastParagraph = this.getText()[lastParagraphPath];
|
|
17300
|
+
const lastParagraphText = lastParagraph.children[lastParagraph.children.length - 1];
|
|
17254
17301
|
const insertLocation = {
|
|
17255
17302
|
path: [lastParagraphPath, lastParagraph.children.length - 1],
|
|
17256
|
-
offset:
|
|
17303
|
+
offset: lastParagraphText.text.length
|
|
17257
17304
|
};
|
|
17258
17305
|
Transforms13.insertText(this.editor, combinedText, {
|
|
17259
17306
|
at: insertLocation
|
|
@@ -17318,7 +17365,7 @@ function getFirstSelectionLink(editor, selection) {
|
|
|
17318
17365
|
}
|
|
17319
17366
|
for (const [node2] of Editor20.nodes(editor, {
|
|
17320
17367
|
at: selection,
|
|
17321
|
-
match: (n) => !!n.link
|
|
17368
|
+
match: (n) => ("link" in n) && !!n.link
|
|
17322
17369
|
})) {
|
|
17323
17370
|
return node2.link;
|
|
17324
17371
|
}
|
|
@@ -18268,14 +18315,6 @@ class RichTextCommand {
|
|
|
18268
18315
|
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
18269
18316
|
}
|
|
18270
18317
|
}));
|
|
18271
|
-
case "setBlockType":
|
|
18272
|
-
return items.map((id) => ({
|
|
18273
|
-
item: id,
|
|
18274
|
-
operation: {
|
|
18275
|
-
...this.operation,
|
|
18276
|
-
type: this.board.items.getById(id)?.getRichText()?.getBlockType() || "paragraph"
|
|
18277
|
-
}
|
|
18278
|
-
}));
|
|
18279
18318
|
case "setFontStyle":
|
|
18280
18319
|
return items.map((id) => ({
|
|
18281
18320
|
item: id,
|
|
@@ -18378,7 +18417,8 @@ class RichTextGroupCommand {
|
|
|
18378
18417
|
class: "RichText",
|
|
18379
18418
|
method: "edit",
|
|
18380
18419
|
item: [richText.getId() ?? ""],
|
|
18381
|
-
ops
|
|
18420
|
+
ops,
|
|
18421
|
+
selection: null
|
|
18382
18422
|
}
|
|
18383
18423
|
});
|
|
18384
18424
|
}
|
|
@@ -18395,7 +18435,8 @@ class RichTextGroupCommand {
|
|
|
18395
18435
|
class: "RichText",
|
|
18396
18436
|
method: "edit",
|
|
18397
18437
|
item: [richText.getId() ?? ""],
|
|
18398
|
-
ops: ops.map((op) => Operation3.inverse(op)).reverse()
|
|
18438
|
+
ops: ops.map((op) => Operation3.inverse(op)).reverse(),
|
|
18439
|
+
selection: null
|
|
18399
18440
|
}
|
|
18400
18441
|
});
|
|
18401
18442
|
}
|
|
@@ -19045,6 +19086,9 @@ class Comment2 {
|
|
|
19045
19086
|
const anchor = this.anchor.copy();
|
|
19046
19087
|
return new Mbr(anchor.x, anchor.y, anchor.x, anchor.y);
|
|
19047
19088
|
}
|
|
19089
|
+
getPathMbr() {
|
|
19090
|
+
return this.getMbr();
|
|
19091
|
+
}
|
|
19048
19092
|
getNearestEdgePointTo(point3) {
|
|
19049
19093
|
return this.anchor;
|
|
19050
19094
|
}
|
|
@@ -19532,6 +19576,9 @@ class BaseItem extends Mbr {
|
|
|
19532
19576
|
onRemove() {
|
|
19533
19577
|
this.onRemoveCallbacks.forEach((cb) => cb());
|
|
19534
19578
|
}
|
|
19579
|
+
getPathMbr() {
|
|
19580
|
+
return this.getMbr().copy();
|
|
19581
|
+
}
|
|
19535
19582
|
render(context) {}
|
|
19536
19583
|
renderHTML(documentFactory) {
|
|
19537
19584
|
return documentFactory.createElement("div");
|
|
@@ -20057,7 +20104,10 @@ class RichText extends BaseItem {
|
|
|
20057
20104
|
}
|
|
20058
20105
|
getFontSize() {
|
|
20059
20106
|
const marks = this.editor.getSelectionMarks();
|
|
20060
|
-
|
|
20107
|
+
let fontSize = marks?.fontSize ?? this.initialTextStyles.fontSize;
|
|
20108
|
+
if (fontSize === "auto") {
|
|
20109
|
+
fontSize = this.initialTextStyles.fontSize;
|
|
20110
|
+
}
|
|
20061
20111
|
if (this.autoSize) {
|
|
20062
20112
|
return fontSize * this.autoSizeScale;
|
|
20063
20113
|
}
|
|
@@ -20075,7 +20125,7 @@ class RichText extends BaseItem {
|
|
|
20075
20125
|
for (const [node2] of textNodes) {
|
|
20076
20126
|
const fontSize = node2.fontSize || node2 && node2.fontSize;
|
|
20077
20127
|
if (fontSize) {
|
|
20078
|
-
fontSizes.push(fontSize);
|
|
20128
|
+
fontSizes.push(fontSize === "auto" ? this.initialTextStyles.fontSize : fontSize);
|
|
20079
20129
|
}
|
|
20080
20130
|
}
|
|
20081
20131
|
if (fontSizes.length > 0) {
|
|
@@ -20088,7 +20138,7 @@ class RichText extends BaseItem {
|
|
|
20088
20138
|
return marks?.fontHighlight ?? this.initialTextStyles.fontHighlight;
|
|
20089
20139
|
}
|
|
20090
20140
|
getBlockType() {
|
|
20091
|
-
const blockNode = getSelectedBlockNode(this.editor);
|
|
20141
|
+
const blockNode = getSelectedBlockNode(this.editor.editor);
|
|
20092
20142
|
return blockNode ? blockNode.type : "paragraph";
|
|
20093
20143
|
}
|
|
20094
20144
|
getHorisontalAlignment() {
|
|
@@ -20119,16 +20169,18 @@ class RichText extends BaseItem {
|
|
|
20119
20169
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
20120
20170
|
if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
20121
20171
|
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
20122
|
-
|
|
20123
|
-
|
|
20124
|
-
|
|
20125
|
-
|
|
20126
|
-
|
|
20127
|
-
|
|
20128
|
-
|
|
20129
|
-
|
|
20130
|
-
|
|
20131
|
-
|
|
20172
|
+
if (domRange) {
|
|
20173
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
20174
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
20175
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
20176
|
+
exactMatch: false,
|
|
20177
|
+
suppressThrow: false
|
|
20178
|
+
});
|
|
20179
|
+
if (slatePoint) {
|
|
20180
|
+
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
20181
|
+
this.editorTransforms.select(this.editor.editor, nRange);
|
|
20182
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
20183
|
+
}
|
|
20132
20184
|
}
|
|
20133
20185
|
} else {
|
|
20134
20186
|
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
@@ -37336,6 +37388,9 @@ class Shape extends BaseItem {
|
|
|
37336
37388
|
getMbr() {
|
|
37337
37389
|
return this.mbr.copy();
|
|
37338
37390
|
}
|
|
37391
|
+
getPathMbr() {
|
|
37392
|
+
return this.getPath().getMbr();
|
|
37393
|
+
}
|
|
37339
37394
|
getNearestEdgePointTo(point5) {
|
|
37340
37395
|
return this.path.getNearestEdgePointTo(point5);
|
|
37341
37396
|
}
|
|
@@ -43116,13 +43171,8 @@ function createCanvasDrawer(board) {
|
|
|
43116
43171
|
// src/Selection/QuickAddButtons/quickAddHelpers.ts
|
|
43117
43172
|
function getControlPointData(item, index2, isRichText = false) {
|
|
43118
43173
|
const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
|
|
43119
|
-
const width2 = item.
|
|
43120
|
-
let height3;
|
|
43121
|
-
if (item.itemType === "Shape" && index2 !== 2 && index2 !== 3) {
|
|
43122
|
-
height3 = item.getPath().getMbr().getHeight();
|
|
43123
|
-
} else {
|
|
43124
|
-
height3 = item.getMbr().getHeight();
|
|
43125
|
-
}
|
|
43174
|
+
const width2 = item.getPathMbr().getWidth();
|
|
43175
|
+
let height3 = item.getPathMbr().getHeight();
|
|
43126
43176
|
const adjMapScaled = {
|
|
43127
43177
|
0: { x: 0, y: height3 / 2 / itemScale.y },
|
|
43128
43178
|
1: {
|
|
@@ -43155,7 +43205,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43155
43205
|
optionalItem = new Sticker(board);
|
|
43156
43206
|
break;
|
|
43157
43207
|
case "AINode":
|
|
43158
|
-
optionalItem = createAINode2(board, startPoint?.item?.getId()
|
|
43208
|
+
optionalItem = createAINode2(board, 3, "item" in startPoint ? startPoint?.item?.getId() : undefined);
|
|
43159
43209
|
break;
|
|
43160
43210
|
}
|
|
43161
43211
|
let itemMbr = optionalItem.getMbr();
|
|
@@ -43182,20 +43232,25 @@ function quickAddItem(board, type, connector) {
|
|
|
43182
43232
|
if ("text" in guarded && guarded.itemType !== "AINode" && guarded.itemType !== "RichText") {
|
|
43183
43233
|
delete guarded.text;
|
|
43184
43234
|
}
|
|
43235
|
+
if (!itemData.transformation) {
|
|
43236
|
+
itemData.transformation = new DefaultTransformationData;
|
|
43237
|
+
}
|
|
43185
43238
|
itemData.transformation.translateX = endPoint.x;
|
|
43186
43239
|
itemData.transformation.translateY = endPoint.y;
|
|
43187
43240
|
const lines = connector.lines.getSegments();
|
|
43188
43241
|
const lastLine = lines[lines.length - 1];
|
|
43189
|
-
|
|
43242
|
+
const lastLineStart = lastLine.getStartPoint();
|
|
43243
|
+
const lastLineEnd = lastLine.getEndPoint();
|
|
43244
|
+
let dir2 = getDirection(lastLineStart, lastLineEnd);
|
|
43245
|
+
const firstLineStart = lines[0].getEndPoint();
|
|
43190
43246
|
if (!dir2) {
|
|
43191
|
-
const
|
|
43192
|
-
const
|
|
43193
|
-
const yDiff = Math.abs(firstLine.start.y - lastLine.end.y);
|
|
43247
|
+
const xDiff = Math.abs(firstLineStart.x - lastLineEnd.x);
|
|
43248
|
+
const yDiff = Math.abs(firstLineStart.y - lastLineEnd.y);
|
|
43194
43249
|
dir2 = xDiff > yDiff ? "horizontal" : "vertical";
|
|
43195
43250
|
}
|
|
43196
43251
|
let dirIndex = -1;
|
|
43197
43252
|
if (dir2 === "vertical") {
|
|
43198
|
-
if (
|
|
43253
|
+
if (firstLineStart.y > lastLineEnd.y) {
|
|
43199
43254
|
itemData.transformation.translateX -= itemMbr.getWidth() / 2;
|
|
43200
43255
|
itemData.transformation.translateY -= itemMbr.getHeight();
|
|
43201
43256
|
dirIndex = 3;
|
|
@@ -43204,7 +43259,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43204
43259
|
dirIndex = 2;
|
|
43205
43260
|
}
|
|
43206
43261
|
} else if (dir2 === "horizontal") {
|
|
43207
|
-
if (
|
|
43262
|
+
if (firstLineStart.x > lastLineEnd.x) {
|
|
43208
43263
|
itemData.transformation.translateX -= itemMbr.getWidth();
|
|
43209
43264
|
itemData.transformation.translateY -= itemMbr.getHeight() / 2;
|
|
43210
43265
|
dirIndex = 1;
|
|
@@ -43226,7 +43281,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43226
43281
|
connector.setEndPoint(newEndPoint);
|
|
43227
43282
|
board.selection.removeAll();
|
|
43228
43283
|
board.selection.add(added);
|
|
43229
|
-
if (added
|
|
43284
|
+
if (added instanceof RichText || added instanceof AINode) {
|
|
43230
43285
|
const text5 = added.getRichText();
|
|
43231
43286
|
text5.editor.setMaxWidth(text5.editor.maxWidth || 600);
|
|
43232
43287
|
board.selection.editText();
|
|
@@ -43234,7 +43289,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43234
43289
|
board.selection.setContext("EditUnderPointer");
|
|
43235
43290
|
}
|
|
43236
43291
|
}
|
|
43237
|
-
function createAINode2(board,
|
|
43292
|
+
function createAINode2(board, directionIndex, parentNodeId) {
|
|
43238
43293
|
const node2 = new AINode(board, true, parentNodeId, undefined, directionIndex);
|
|
43239
43294
|
const nodeRichText = node2.getRichText();
|
|
43240
43295
|
nodeRichText.applyMaxWidth(600);
|
|
@@ -43268,17 +43323,17 @@ function getQuickAddButtons(selection, board) {
|
|
|
43268
43323
|
let quickAddItems = undefined;
|
|
43269
43324
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
43270
43325
|
const connectorStorage = new SessionStorage;
|
|
43271
|
-
const currMbr = selectedItem.
|
|
43326
|
+
const currMbr = selectedItem.getPathMbr();
|
|
43272
43327
|
const selectedItemData = selectedItem.serialize();
|
|
43273
|
-
const width2 =
|
|
43274
|
-
const height3 =
|
|
43328
|
+
const width2 = currMbr.getWidth();
|
|
43329
|
+
const height3 = currMbr.getHeight();
|
|
43275
43330
|
let offsetX = width2;
|
|
43276
43331
|
let offsetY = height3;
|
|
43277
43332
|
let newWidth = width2;
|
|
43278
43333
|
let newHeight = height3;
|
|
43279
43334
|
let itemData;
|
|
43280
43335
|
if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
|
|
43281
|
-
const item = selectedItem.itemType === "AINode" ? createAINode2(board, selectedItem.getId()
|
|
43336
|
+
const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
|
|
43282
43337
|
newWidth = item.getMbr().getWidth();
|
|
43283
43338
|
newHeight = item.getMbr().getHeight();
|
|
43284
43339
|
itemData = item.serialize();
|
|
@@ -43327,9 +43382,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
43327
43382
|
const endPoints = getQuickButtonsPositions(newMbr);
|
|
43328
43383
|
const reverseIndexMap = { 0: 1, 1: 0, 2: 3, 3: 2 };
|
|
43329
43384
|
const connectorEndPoint = endPoints?.positions[reverseIndexMap[index2]] || new Point;
|
|
43330
|
-
const fontSize = selectedItem
|
|
43385
|
+
const fontSize = selectedItem instanceof RichText ? selectedItem.getFontSize() : 14;
|
|
43331
43386
|
const newItem = board.createItem(board.getNewItemId(), newItemData);
|
|
43332
|
-
if (newItem
|
|
43387
|
+
if (newItem instanceof RichText) {
|
|
43333
43388
|
const storage = new SessionStorage;
|
|
43334
43389
|
storage.setFontSize("RichText", fontSize);
|
|
43335
43390
|
newItem.editor.selectWholeText();
|
|
@@ -43342,6 +43397,10 @@ function getQuickAddButtons(selection, board) {
|
|
|
43342
43397
|
const scaleX = newItemMbr.getWidth() / 100;
|
|
43343
43398
|
const scaleY = newItemMbr.getHeight() / 100;
|
|
43344
43399
|
shapeData.transformation = {
|
|
43400
|
+
isLocked: false,
|
|
43401
|
+
rotate: 0,
|
|
43402
|
+
translateX: 0,
|
|
43403
|
+
translateY: 0,
|
|
43345
43404
|
...newItemData.transformation,
|
|
43346
43405
|
scaleX,
|
|
43347
43406
|
scaleY
|
|
@@ -43398,7 +43457,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
43398
43457
|
}
|
|
43399
43458
|
let pathCenter;
|
|
43400
43459
|
if (single.itemType === "Shape") {
|
|
43401
|
-
pathCenter = single.
|
|
43460
|
+
pathCenter = single.getPathMbr().getCenter();
|
|
43402
43461
|
}
|
|
43403
43462
|
const center = itemMbr.getCenter();
|
|
43404
43463
|
const width2 = itemMbr.getWidth();
|
|
@@ -47767,7 +47826,7 @@ class Presence {
|
|
|
47767
47826
|
};
|
|
47768
47827
|
});
|
|
47769
47828
|
ctx2.restore();
|
|
47770
|
-
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop);
|
|
47829
|
+
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop) || null;
|
|
47771
47830
|
};
|
|
47772
47831
|
renderLoop();
|
|
47773
47832
|
}
|
|
@@ -49134,7 +49193,7 @@ class SpatialIndex {
|
|
|
49134
49193
|
return this.itemsIndex.getRectsEnclosedOrCrossedBy(new Mbr(left, top, right, bottom));
|
|
49135
49194
|
}
|
|
49136
49195
|
getComments() {
|
|
49137
|
-
return this.itemsArray.filter((item) => item instanceof
|
|
49196
|
+
return this.itemsArray.filter((item) => item instanceof Comment2);
|
|
49138
49197
|
}
|
|
49139
49198
|
getMbr() {
|
|
49140
49199
|
return this.Mbr;
|
|
@@ -49258,10 +49317,10 @@ class Items {
|
|
|
49258
49317
|
}
|
|
49259
49318
|
const { nearest } = enclosed.reduce((acc, item) => {
|
|
49260
49319
|
const area = item.getMbr().getHeight() * item.getMbr().getWidth();
|
|
49261
|
-
if (item
|
|
49320
|
+
if (item instanceof Drawing && !item.isPointNearLine(this.pointer.point)) {
|
|
49262
49321
|
return acc;
|
|
49263
49322
|
}
|
|
49264
|
-
const isItemTransparent = item
|
|
49323
|
+
const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
|
|
49265
49324
|
const itemZIndex = this.getZIndex(item);
|
|
49266
49325
|
const accZIndex = this.getZIndex(acc.nearest);
|
|
49267
49326
|
if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
|
|
@@ -49292,7 +49351,7 @@ class Items {
|
|
|
49292
49351
|
}
|
|
49293
49352
|
getLinkedConnectorsById(id) {
|
|
49294
49353
|
return this.listAll().filter((item) => {
|
|
49295
|
-
if (item
|
|
49354
|
+
if (!(item instanceof Connector2)) {
|
|
49296
49355
|
return false;
|
|
49297
49356
|
}
|
|
49298
49357
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -49307,7 +49366,7 @@ class Items {
|
|
|
49307
49366
|
return [];
|
|
49308
49367
|
}
|
|
49309
49368
|
return this.listAll().filter((item) => {
|
|
49310
|
-
if (item
|
|
49369
|
+
if (!(item instanceof Connector2) || !item.isConnected()) {
|
|
49311
49370
|
return false;
|
|
49312
49371
|
}
|
|
49313
49372
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -49482,7 +49541,7 @@ class SelectionItems {
|
|
|
49482
49541
|
return ids;
|
|
49483
49542
|
}
|
|
49484
49543
|
getSingle() {
|
|
49485
|
-
return this.isSingle() ? this.items.values().next().value : null;
|
|
49544
|
+
return this.isSingle() ? this.items.values().next().value || null : null;
|
|
49486
49545
|
}
|
|
49487
49546
|
listByIds(itemIdList) {
|
|
49488
49547
|
return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
|
|
@@ -49530,7 +49589,7 @@ class ConnectorTransformer extends Tool {
|
|
|
49530
49589
|
getConnector(items) {
|
|
49531
49590
|
if (items.isSingle()) {
|
|
49532
49591
|
const connector = items.getSingle();
|
|
49533
|
-
if (connector
|
|
49592
|
+
if (connector instanceof Connector2) {
|
|
49534
49593
|
return connector;
|
|
49535
49594
|
}
|
|
49536
49595
|
}
|
|
@@ -51000,10 +51059,10 @@ class BoardSelection {
|
|
|
51000
51059
|
}
|
|
51001
51060
|
copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
|
|
51002
51061
|
}
|
|
51003
|
-
copy(skipImageBlobCopy
|
|
51062
|
+
copy(skipImageBlobCopy) {
|
|
51004
51063
|
const copiedItemsMap = {};
|
|
51005
51064
|
const single = this.items.getSingle();
|
|
51006
|
-
if (!skipImageBlobCopy && single && single
|
|
51065
|
+
if (!skipImageBlobCopy && single && single instanceof ImageItem) {
|
|
51007
51066
|
this.handleItemCopy(single, copiedItemsMap);
|
|
51008
51067
|
return { imageElement: single.image, imageData: copiedItemsMap };
|
|
51009
51068
|
}
|
|
@@ -51028,7 +51087,7 @@ class BoardSelection {
|
|
|
51028
51087
|
return copiedItemsMap;
|
|
51029
51088
|
}
|
|
51030
51089
|
cut() {
|
|
51031
|
-
const items = this.copy();
|
|
51090
|
+
const items = this.copy(true);
|
|
51032
51091
|
this.removeFromBoard();
|
|
51033
51092
|
return items;
|
|
51034
51093
|
}
|
|
@@ -51179,7 +51238,7 @@ class BoardSelection {
|
|
|
51179
51238
|
});
|
|
51180
51239
|
Object.values(selectedMap).forEach((val) => {
|
|
51181
51240
|
const parentFrame = this.board.items.getById(val.item.parent);
|
|
51182
|
-
const isParentFrame = parentFrame
|
|
51241
|
+
const isParentFrame = parentFrame instanceof Frame;
|
|
51183
51242
|
const parentFrameId = isParentFrame ? parentFrame.getId() : null;
|
|
51184
51243
|
if (val.nested) {
|
|
51185
51244
|
const isRemoveChildFromFrame = Object.values(selectedMap).some((val2) => val2.nested && val2.nested.getId() !== parentFrameId);
|
|
@@ -51194,7 +51253,7 @@ class BoardSelection {
|
|
|
51194
51253
|
console.warn(`Didnt find frame with id ${val.item.parent}`);
|
|
51195
51254
|
}
|
|
51196
51255
|
}
|
|
51197
|
-
if (val.item
|
|
51256
|
+
if (val.item instanceof Frame && checkFrames) {
|
|
51198
51257
|
const currFrame = val.item;
|
|
51199
51258
|
const currMbr = currFrame.getMbr();
|
|
51200
51259
|
const children = val.item.getChildrenIds().map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
|
|
@@ -51602,12 +51661,6 @@ class BoardSelection {
|
|
|
51602
51661
|
text5.setEditorFocus(this.context);
|
|
51603
51662
|
}
|
|
51604
51663
|
}
|
|
51605
|
-
getMediaStorageIds() {
|
|
51606
|
-
return this.items.list().filter((item) => {
|
|
51607
|
-
const shouldClearStorageUsage = item.itemType === "Image" || item.itemType === "Video" && item.getIsStorageUrl() || item.itemType === "Audio" && item.getIsStorageUrl();
|
|
51608
|
-
return shouldClearStorageUsage;
|
|
51609
|
-
}).map((item) => item.getStorageId());
|
|
51610
|
-
}
|
|
51611
51664
|
removeFromBoard() {
|
|
51612
51665
|
const isLocked = this.items.list().some((item) => item.transformation.isLocked);
|
|
51613
51666
|
if (isLocked) {
|
|
@@ -51622,7 +51675,6 @@ class BoardSelection {
|
|
|
51622
51675
|
const connectors = itemIds.flatMap((id) => {
|
|
51623
51676
|
return this.board.items.getLinkedConnectorsById(id);
|
|
51624
51677
|
}).map((connector) => connector.getId());
|
|
51625
|
-
conf.hooks.beforeMediaRemove(this.getMediaStorageIds(), this.board.getBoardId());
|
|
51626
51678
|
this.emit({
|
|
51627
51679
|
class: "Board",
|
|
51628
51680
|
method: "remove",
|
|
@@ -51659,7 +51711,15 @@ class BoardSelection {
|
|
|
51659
51711
|
this.board.sendToBack(this.items.list());
|
|
51660
51712
|
}
|
|
51661
51713
|
async duplicate() {
|
|
51662
|
-
const mediaIds =
|
|
51714
|
+
const mediaIds = [];
|
|
51715
|
+
this.items.list().forEach((item) => {
|
|
51716
|
+
if ("getStorageId" in item) {
|
|
51717
|
+
const storageId = item.getStorageId();
|
|
51718
|
+
if (storageId) {
|
|
51719
|
+
mediaIds.push(storageId);
|
|
51720
|
+
}
|
|
51721
|
+
}
|
|
51722
|
+
});
|
|
51663
51723
|
const canDuplicate = mediaIds.length ? await conf.hooks.beforeMediaUpload(mediaIds, this.board.getBoardId()) : true;
|
|
51664
51724
|
if (!canDuplicate) {
|
|
51665
51725
|
return;
|
|
@@ -51727,7 +51787,7 @@ class BoardSelection {
|
|
|
51727
51787
|
}
|
|
51728
51788
|
}
|
|
51729
51789
|
const contextItems = [];
|
|
51730
|
-
if (single && single
|
|
51790
|
+
if (single && single instanceof AINode) {
|
|
51731
51791
|
const contextItemsIds = single.getContextItems();
|
|
51732
51792
|
if (contextItemsIds.length) {
|
|
51733
51793
|
const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
|
|
@@ -51749,7 +51809,7 @@ class BoardSelection {
|
|
|
51749
51809
|
}
|
|
51750
51810
|
}
|
|
51751
51811
|
contextItems.forEach((item) => {
|
|
51752
|
-
if (item
|
|
51812
|
+
if (item instanceof AINode) {
|
|
51753
51813
|
const path2 = item.getPath();
|
|
51754
51814
|
path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
|
|
51755
51815
|
path2.setBorderWidth(2);
|
|
@@ -51764,6 +51824,416 @@ class BoardSelection {
|
|
|
51764
51824
|
});
|
|
51765
51825
|
}
|
|
51766
51826
|
}
|
|
51827
|
+
// src/public/customWebComponents.js
|
|
51828
|
+
var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
|
|
51829
|
+
class RichTextElement extends HTMLElement {
|
|
51830
|
+
constructor() {
|
|
51831
|
+
super();
|
|
51832
|
+
}
|
|
51833
|
+
}
|
|
51834
|
+
|
|
51835
|
+
class ShapeItemElement extends HTMLElement {
|
|
51836
|
+
constructor() {
|
|
51837
|
+
super();
|
|
51838
|
+
}
|
|
51839
|
+
}
|
|
51840
|
+
|
|
51841
|
+
class StickerElement extends HTMLElement {
|
|
51842
|
+
constructor() {
|
|
51843
|
+
super();
|
|
51844
|
+
}
|
|
51845
|
+
}
|
|
51846
|
+
|
|
51847
|
+
class DrawingElement extends HTMLElement {
|
|
51848
|
+
constructor() {
|
|
51849
|
+
super();
|
|
51850
|
+
}
|
|
51851
|
+
}
|
|
51852
|
+
|
|
51853
|
+
class ConnectorElement extends HTMLElement {
|
|
51854
|
+
constructor() {
|
|
51855
|
+
super();
|
|
51856
|
+
}
|
|
51857
|
+
}
|
|
51858
|
+
|
|
51859
|
+
class FrameItemElement extends HTMLElement {
|
|
51860
|
+
constructor() {
|
|
51861
|
+
super();
|
|
51862
|
+
}
|
|
51863
|
+
}
|
|
51864
|
+
|
|
51865
|
+
class ImageItemElement extends HTMLElement {
|
|
51866
|
+
constructor() {
|
|
51867
|
+
super();
|
|
51868
|
+
}
|
|
51869
|
+
}
|
|
51870
|
+
|
|
51871
|
+
class LinkItemElement extends HTMLElement {
|
|
51872
|
+
constructor() {
|
|
51873
|
+
super();
|
|
51874
|
+
}
|
|
51875
|
+
}
|
|
51876
|
+
|
|
51877
|
+
class AINodeItemElement extends HTMLElement {
|
|
51878
|
+
constructor() {
|
|
51879
|
+
super();
|
|
51880
|
+
}
|
|
51881
|
+
}
|
|
51882
|
+
|
|
51883
|
+
class VideoItemElement extends HTMLElement {
|
|
51884
|
+
constructor() {
|
|
51885
|
+
super();
|
|
51886
|
+
}
|
|
51887
|
+
}
|
|
51888
|
+
|
|
51889
|
+
class CommentElement extends HTMLElement {
|
|
51890
|
+
constructor() {
|
|
51891
|
+
super();
|
|
51892
|
+
}
|
|
51893
|
+
}
|
|
51894
|
+
|
|
51895
|
+
class AudioItemElement extends HTMLElement {
|
|
51896
|
+
constructor() {
|
|
51897
|
+
super();
|
|
51898
|
+
}
|
|
51899
|
+
}
|
|
51900
|
+
|
|
51901
|
+
customElements.define("rich-text", RichTextElement);
|
|
51902
|
+
customElements.define("shape-item", ShapeItemElement);
|
|
51903
|
+
customElements.define("sticker-item", StickerElement);
|
|
51904
|
+
customElements.define("drawing-item", DrawingElement);
|
|
51905
|
+
customElements.define("connector-item", ConnectorElement);
|
|
51906
|
+
customElements.define("frame-item", FrameItemElement);
|
|
51907
|
+
customElements.define("image-item", ImageItemElement);
|
|
51908
|
+
customElements.define("link-item", LinkItemElement);
|
|
51909
|
+
customElements.define("ainode-item", AINodeItemElement);
|
|
51910
|
+
customElements.define("video-item", VideoItemElement);
|
|
51911
|
+
customElements.define("comment-item", CommentElement);
|
|
51912
|
+
customElements.define("audio-item", AudioItemElement);
|
|
51913
|
+
|
|
51914
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
51915
|
+
const itemsDiv = document.querySelector("#items");
|
|
51916
|
+
if (!itemsDiv) {
|
|
51917
|
+
console.error("ITEMS DIV NOT FOUND!");
|
|
51918
|
+
return;
|
|
51919
|
+
}
|
|
51920
|
+
let isDragging = false;
|
|
51921
|
+
let startX, startY;
|
|
51922
|
+
let translateX = 0;
|
|
51923
|
+
let translateY = 0;
|
|
51924
|
+
let scale = 1;
|
|
51925
|
+
|
|
51926
|
+
itemsDiv.style.transformOrigin = "0 0";
|
|
51927
|
+
document.body.style.cursor = "grab";
|
|
51928
|
+
|
|
51929
|
+
function updateTransform() {
|
|
51930
|
+
itemsDiv.style.transform =
|
|
51931
|
+
"translate(" +
|
|
51932
|
+
translateX +
|
|
51933
|
+
"px, " +
|
|
51934
|
+
translateY +
|
|
51935
|
+
"px) scale(" +
|
|
51936
|
+
scale +
|
|
51937
|
+
")";
|
|
51938
|
+
}
|
|
51939
|
+
|
|
51940
|
+
function handleMouseDown(ev) {
|
|
51941
|
+
isDragging = true;
|
|
51942
|
+
startX = ev.clientX;
|
|
51943
|
+
startY = ev.clientY;
|
|
51944
|
+
itemsDiv.style.cursor = "grabbing";
|
|
51945
|
+
}
|
|
51946
|
+
|
|
51947
|
+
function handleMouseMove(ev) {
|
|
51948
|
+
if (!isDragging) {
|
|
51949
|
+
return;
|
|
51950
|
+
}
|
|
51951
|
+
const dx = ev.clientX - startX;
|
|
51952
|
+
const dy = ev.clientY - startY;
|
|
51953
|
+
startX += dx;
|
|
51954
|
+
startY += dy;
|
|
51955
|
+
translateX += dx;
|
|
51956
|
+
translateY += dy;
|
|
51957
|
+
updateTransform();
|
|
51958
|
+
}
|
|
51959
|
+
|
|
51960
|
+
function handleMouseUp(ev) {
|
|
51961
|
+
if (!isDragging) {
|
|
51962
|
+
return;
|
|
51963
|
+
}
|
|
51964
|
+
isDragging = false;
|
|
51965
|
+
itemsDiv.style.cursor = "grab";
|
|
51966
|
+
}
|
|
51967
|
+
|
|
51968
|
+
function handleWheel(ev) {
|
|
51969
|
+
ev.preventDefault();
|
|
51970
|
+
const factor = ev.deltaY < 0 ? 1.1 : 0.9;
|
|
51971
|
+
translateX = ev.clientX - (ev.clientX - translateX) * factor;
|
|
51972
|
+
translateY = ev.clientY - (ev.clientY - translateY) * factor;
|
|
51973
|
+
scale *= factor;
|
|
51974
|
+
updateTransform();
|
|
51975
|
+
}
|
|
51976
|
+
|
|
51977
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
51978
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
51979
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
51980
|
+
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
51981
|
+
|
|
51982
|
+
const titlePanel = document.createElement("div");
|
|
51983
|
+
titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
|
|
51984
|
+
titlePanel.style.position = "fixed";
|
|
51985
|
+
titlePanel.style.left = "12px";
|
|
51986
|
+
titlePanel.style.top = "12px";
|
|
51987
|
+
titlePanel.style.borderRadius = "12px";
|
|
51988
|
+
titlePanel.style.backgroundColor = "#ffff";
|
|
51989
|
+
titlePanel.style.display = "flex";
|
|
51990
|
+
titlePanel.style.alignItems = "center";
|
|
51991
|
+
titlePanel.style.gap = "8px";
|
|
51992
|
+
titlePanel.style.padding = "0 12px";
|
|
51993
|
+
titlePanel.style.height = "48px";
|
|
51994
|
+
const editButton = document.createElement("button");
|
|
51995
|
+
const editIcon = document.createElementNS(
|
|
51996
|
+
"http://www.w3.org/2000/svg",
|
|
51997
|
+
"svg",
|
|
51998
|
+
);
|
|
51999
|
+
editIcon.setAttribute("width", "13");
|
|
52000
|
+
editIcon.setAttribute("height", "13");
|
|
52001
|
+
editIcon.setAttribute("viewBox", "0 0 13 13");
|
|
52002
|
+
editIcon.setAttribute("fill", "none");
|
|
52003
|
+
editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52004
|
+
const editIconPath = document.createElementNS(
|
|
52005
|
+
"http://www.w3.org/2000/svg",
|
|
52006
|
+
"path",
|
|
52007
|
+
);
|
|
52008
|
+
editIconPath.setAttribute(
|
|
52009
|
+
"d",
|
|
52010
|
+
"M7.838 0.999902V2.33324H1.33333V11.6666H10.6667V5.1619H12V12.3332C12 12.51 11.9298 12.6796 11.8047 12.8046C11.6797 12.9297 11.5101 12.9999 11.3333 12.9999H0.666667C0.489856 12.9999 0.320286 12.9297 0.195262 12.8046C0.0702379 12.6796 0 12.51 0 12.3332V1.66657C0 1.48976 0.0702379 1.32019 0.195262 1.19516C0.320286 1.07014 0.489856 0.999902 0.666667 0.999902H7.838ZM11.1847 0.872018C11.4453 0.611315 11.868 0.611355 12.1285 0.872108C12.3889 1.1327 12.3889 1.55503 12.1284 1.81553L6.472 7.4719L5.53067 7.4739L5.52933 6.52924L11.1847 0.872018Z",
|
|
52011
|
+
);
|
|
52012
|
+
editIconPath.setAttribute("fill", "#ffff");
|
|
52013
|
+
editIcon.appendChild(editIconPath);
|
|
52014
|
+
editButton.appendChild(editIcon);
|
|
52015
|
+
const editFileText = document.createElement("p");
|
|
52016
|
+
const isSnapshotInIframe =
|
|
52017
|
+
window.parent &&
|
|
52018
|
+
window.parent !== window &&
|
|
52019
|
+
window.parent.location.href.includes("/snapshots/");
|
|
52020
|
+
editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
|
|
52021
|
+
editButton.appendChild(editFileText);
|
|
52022
|
+
|
|
52023
|
+
editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
|
|
52024
|
+
editButton.style.cursor = "pointer";
|
|
52025
|
+
editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
|
|
52026
|
+
editButton.style.color = "#ffff";
|
|
52027
|
+
editButton.style.fontSize = "14px";
|
|
52028
|
+
editButton.style.lineHeight = "20px";
|
|
52029
|
+
editButton.style.display = "flex";
|
|
52030
|
+
editButton.style.alignItems = "center";
|
|
52031
|
+
editButton.style.gap = "8px";
|
|
52032
|
+
editButton.style.padding = "8px";
|
|
52033
|
+
editButton.style.borderRadius = "10px";
|
|
52034
|
+
const separator = document.createElement("div");
|
|
52035
|
+
separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
|
|
52036
|
+
separator.style.height = "100%";
|
|
52037
|
+
const boardName = document.createElement("div");
|
|
52038
|
+
const fileIcon = document.createElementNS(
|
|
52039
|
+
"http://www.w3.org/2000/svg",
|
|
52040
|
+
"svg",
|
|
52041
|
+
);
|
|
52042
|
+
fileIcon.setAttribute("width", "16");
|
|
52043
|
+
fileIcon.setAttribute("height", "18");
|
|
52044
|
+
fileIcon.setAttribute("viewBox", "0 0 16 18");
|
|
52045
|
+
fileIcon.setAttribute("fill", "none");
|
|
52046
|
+
fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52047
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
52048
|
+
path.setAttribute(
|
|
52049
|
+
"d",
|
|
52050
|
+
"M10.5 2.33341H2.16667V15.6667H13.8333V5.66675H10.5V2.33341ZM0.5 1.49341C0.5 1.03675 0.8725 0.666748 1.3325 0.666748H11.3333L15.5 4.83342V16.4942C15.5008 16.6037 15.48 16.7122 15.4388 16.8136C15.3976 16.915 15.3369 17.0073 15.2601 17.0852C15.1832 17.1631 15.0918 17.2252 14.991 17.2678C14.8902 17.3103 14.7819 17.3327 14.6725 17.3334H1.3275C1.10865 17.3319 0.899181 17.2443 0.744348 17.0897C0.589515 16.935 0.501746 16.7256 0.5 16.5067V1.49341ZM7.16667 8.16675V5.66675H8.83333V8.16675H11.3333V9.83342H8.83333V12.3334H7.16667V9.83342H4.66667V8.16675H7.16667Z",
|
|
52051
|
+
);
|
|
52052
|
+
path.setAttribute("fill", "#696B76");
|
|
52053
|
+
fileIcon.appendChild(path);
|
|
52054
|
+
boardName.appendChild(fileIcon);
|
|
52055
|
+
const boardNameTag = document.querySelector('meta[name="board-name"]');
|
|
52056
|
+
let boardNameStr = "Untitled";
|
|
52057
|
+
if (boardNameTag) {
|
|
52058
|
+
boardNameStr = boardNameTag.getAttribute("content");
|
|
52059
|
+
}
|
|
52060
|
+
const p = document.createElement("p");
|
|
52061
|
+
p.textContent = boardNameStr;
|
|
52062
|
+
p.style.fontSize = "16px";
|
|
52063
|
+
p.style.lineHeight = "24px";
|
|
52064
|
+
boardName.appendChild(p);
|
|
52065
|
+
const cloudIcon = document.createElementNS(
|
|
52066
|
+
"http://www.w3.org/2000/svg",
|
|
52067
|
+
"svg",
|
|
52068
|
+
);
|
|
52069
|
+
cloudIcon.setAttribute("width", "20");
|
|
52070
|
+
cloudIcon.setAttribute("height", "18");
|
|
52071
|
+
cloudIcon.setAttribute("viewBox", "0 0 20 18");
|
|
52072
|
+
cloudIcon.setAttribute("fill", "none");
|
|
52073
|
+
cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52074
|
+
const cloudIconPath = document.createElementNS(
|
|
52075
|
+
"http://www.w3.org/2000/svg",
|
|
52076
|
+
"path",
|
|
52077
|
+
);
|
|
52078
|
+
cloudIconPath.setAttribute(
|
|
52079
|
+
"d",
|
|
52080
|
+
"M2.92711 0.75009L18.8371 16.6601L17.6579 17.8393L15.9796 16.1601C15.401 16.3854 14.7855 16.5007 14.1646 16.5001H5.83128C4.65063 16.5008 3.50782 16.0838 2.60518 15.3227C1.70255 14.5617 1.09833 13.5058 0.89953 12.342C0.700726 11.1782 0.920157 9.98165 1.51897 8.96413C2.11778 7.94662 3.05734 7.17382 4.17128 6.78259C4.13561 6.05854 4.23538 5.3342 4.46544 4.64676L1.74794 1.92842L2.92711 0.75009ZM5.83128 6.50009C5.83128 6.56759 5.83294 6.63592 5.83628 6.70259L5.89461 7.94259L4.72461 8.35426C3.98336 8.6164 3.35857 9.132 2.96052 9.81003C2.56248 10.4881 2.41678 11.2849 2.54916 12.0599C2.68153 12.8349 3.08347 13.5383 3.684 14.0457C4.28453 14.5532 5.04504 14.8322 5.83128 14.8334H14.1646C14.3196 14.8334 14.4721 14.8226 14.6213 14.8026L5.85628 6.03759C5.83961 6.18926 5.83128 6.34342 5.83128 6.50009ZM9.99794 0.666756C10.7878 0.666732 11.5694 0.827112 12.2954 1.13817C13.0214 1.44923 13.6767 1.90449 14.2215 2.47635C14.7664 3.04821 15.1894 3.72476 15.4649 4.46498C15.7405 5.2052 15.8629 5.99367 15.8246 6.78259C16.5167 7.02639 17.1467 7.41945 17.6699 7.93391C18.1931 8.44837 18.5967 9.07163 18.8521 9.75951C19.1076 10.4474 19.2085 11.183 19.1479 11.9143C19.0873 12.6455 18.8665 13.3545 18.5013 13.9909L17.2571 12.7468C17.5023 12.1401 17.5636 11.4747 17.4331 10.8335C17.3027 10.1924 16.9864 9.60375 16.5237 9.14112C16.061 8.67849 15.4723 8.36232 14.8311 8.23202C14.1899 8.10173 13.5245 8.16308 12.9179 8.40842L11.6729 7.16259C12.4071 6.74176 13.2571 6.50009 14.1646 6.50009C14.1646 5.73714 13.9551 4.98884 13.559 4.33679C13.1629 3.68473 12.5953 3.15396 11.9182 2.80235C11.2411 2.45073 10.4805 2.29177 9.71923 2.34281C8.95799 2.39384 8.22538 2.65291 7.60127 3.09176L6.40961 1.90009C7.43392 1.09887 8.69749 0.664571 9.99794 0.666756Z",
|
|
52081
|
+
);
|
|
52082
|
+
cloudIconPath.setAttribute("fill", "#696B76");
|
|
52083
|
+
cloudIcon.appendChild(cloudIconPath);
|
|
52084
|
+
boardName.appendChild(cloudIcon);
|
|
52085
|
+
boardName.style.display = "flex";
|
|
52086
|
+
boardName.style.alignItems = "center";
|
|
52087
|
+
boardName.style.gap = "8px";
|
|
52088
|
+
titlePanel.appendChild(boardName);
|
|
52089
|
+
titlePanel.appendChild(separator);
|
|
52090
|
+
titlePanel.appendChild(editButton);
|
|
52091
|
+
document.body.appendChild(titlePanel);
|
|
52092
|
+
|
|
52093
|
+
editButton.onclick = async () => {
|
|
52094
|
+
editButton.disabled = true;
|
|
52095
|
+
editButton.textContent = "Loading...";
|
|
52096
|
+
|
|
52097
|
+
try {
|
|
52098
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
52099
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
52100
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
52101
|
+
document.removeEventListener("wheel", handleWheel, {
|
|
52102
|
+
passive: false,
|
|
52103
|
+
});
|
|
52104
|
+
translateX = 0;
|
|
52105
|
+
translateY = 0;
|
|
52106
|
+
scale = 1;
|
|
52107
|
+
updateTransform();
|
|
52108
|
+
|
|
52109
|
+
const { initBrowserSettings } = await import(
|
|
52110
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
52111
|
+
);
|
|
52112
|
+
initBrowserSettings();
|
|
52113
|
+
|
|
52114
|
+
const { createApp } = await import(
|
|
52115
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
52116
|
+
);
|
|
52117
|
+
|
|
52118
|
+
const app = createApp();
|
|
52119
|
+
window.app = app;
|
|
52120
|
+
const stringed = await app.openAndEditFile();
|
|
52121
|
+
|
|
52122
|
+
if (stringed) {
|
|
52123
|
+
await app.openBoardFromFile();
|
|
52124
|
+
app.getBoard().deserializeHTML(stringed);
|
|
52125
|
+
app.localRender("items");
|
|
52126
|
+
}
|
|
52127
|
+
|
|
52128
|
+
const response = await fetch(
|
|
52129
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
|
|
52130
|
+
);
|
|
52131
|
+
const cssText = await response.text();
|
|
52132
|
+
const styleEl = document.createElement("style");
|
|
52133
|
+
styleEl.textContent = cssText;
|
|
52134
|
+
document.body.appendChild(styleEl);
|
|
52135
|
+
|
|
52136
|
+
const responseSvg = await fetch(
|
|
52137
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
|
|
52138
|
+
);
|
|
52139
|
+
const svgText = await responseSvg.text();
|
|
52140
|
+
const div = document.createElement("div");
|
|
52141
|
+
div.style.display = "none";
|
|
52142
|
+
div.id = "sprite";
|
|
52143
|
+
div.innerHTML = svgText;
|
|
52144
|
+
document.body.appendChild(div);
|
|
52145
|
+
} finally {
|
|
52146
|
+
editButton.disabled = false;
|
|
52147
|
+
editButton.textContent = "Edit board";
|
|
52148
|
+
}
|
|
52149
|
+
};
|
|
52150
|
+
});
|
|
52151
|
+
`;
|
|
52152
|
+
|
|
52153
|
+
// src/public/loadLinkImages.js
|
|
52154
|
+
var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
|
|
52155
|
+
document.querySelectorAll(".link-object").forEach(linkItem => {
|
|
52156
|
+
const linkImage = linkItem.querySelector(".link-image");
|
|
52157
|
+
const linkContainer = linkItem.querySelector("a");
|
|
52158
|
+
linkImage.onerror = () => {
|
|
52159
|
+
linkImage.onerror = null;
|
|
52160
|
+
linkImage.style.display = "none";
|
|
52161
|
+
const svgNamespace = "http://www.w3.org/2000/svg";
|
|
52162
|
+
const svg = document.createElementNS(svgNamespace, "svg");
|
|
52163
|
+
svg.setAttribute("width", "20");
|
|
52164
|
+
svg.setAttribute("height", "20");
|
|
52165
|
+
svg.setAttribute("viewBox", "0 0 13 14");
|
|
52166
|
+
svg.setAttribute("fill", "none");
|
|
52167
|
+
|
|
52168
|
+
const path = document.createElementNS(svgNamespace, "path");
|
|
52169
|
+
path.setAttribute(
|
|
52170
|
+
"d",
|
|
52171
|
+
"M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
|
|
52172
|
+
);
|
|
52173
|
+
path.setAttribute("fill", "#924FE8");
|
|
52174
|
+
svg.appendChild(path);
|
|
52175
|
+
|
|
52176
|
+
linkContainer.appendChild(svg);
|
|
52177
|
+
};
|
|
52178
|
+
});
|
|
52179
|
+
});
|
|
52180
|
+
`;
|
|
52181
|
+
|
|
52182
|
+
// src/public/index.css
|
|
52183
|
+
var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
|
|
52184
|
+
@import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
|
|
52185
|
+
|
|
52186
|
+
/* ../src/index.css */
|
|
52187
|
+
:root {
|
|
52188
|
+
--background-surface-default: rgb(255, 255, 255);
|
|
52189
|
+
--background-button-secondary: rgb(255, 255, 255);
|
|
52190
|
+
--background-button-secondary-hover: rgb(247, 247, 248);
|
|
52191
|
+
--background-badge-purple-disabled: rgb(247, 241, 253);
|
|
52192
|
+
--background-badge-gray: rgb(233, 234, 236);
|
|
52193
|
+
--background-accent-purple: rgb(146, 79, 232);
|
|
52194
|
+
--border-action-normal: rgb(222, 223, 227);
|
|
52195
|
+
--border-action-focus: rgb(146, 79, 232);
|
|
52196
|
+
--border-select-primary: rgb(146, 79, 232);
|
|
52197
|
+
--text-base-primary: rgb(20, 21, 26);
|
|
52198
|
+
--text-base-secondary: rgba(15, 19, 36, 0.6);
|
|
52199
|
+
--text-base-quaternary: rgb(10, 15, 41, 0.25);
|
|
52200
|
+
--text-accent-purple: rgb(152, 89, 233);
|
|
52201
|
+
--icon-base-primary: rgb(20, 21, 26);
|
|
52202
|
+
--icon-base-secondary: rgb(105, 107, 118);
|
|
52203
|
+
--icon-accent-purple: rgb(146, 79, 232);
|
|
52204
|
+
--absolute-position-panel-padding: 12px;
|
|
52205
|
+
}
|
|
52206
|
+
* {
|
|
52207
|
+
box-sizing: border-box;
|
|
52208
|
+
padding: 0;
|
|
52209
|
+
margin: 0;
|
|
52210
|
+
border: none;
|
|
52211
|
+
background: none;
|
|
52212
|
+
font-family: inherit;
|
|
52213
|
+
}
|
|
52214
|
+
html {
|
|
52215
|
+
font-size: 62.5%;
|
|
52216
|
+
}
|
|
52217
|
+
body {
|
|
52218
|
+
color: var(--text-base-primary);
|
|
52219
|
+
font-size: 1.6rem;
|
|
52220
|
+
font-optical-sizing: auto;
|
|
52221
|
+
font-style: normal;
|
|
52222
|
+
font-family: "Manrope", sans-serif;
|
|
52223
|
+
}
|
|
52224
|
+
html,
|
|
52225
|
+
body {
|
|
52226
|
+
overscroll-behavior-x: none;
|
|
52227
|
+
-webkit-user-select: none;
|
|
52228
|
+
}
|
|
52229
|
+
input:-webkit-autofill,
|
|
52230
|
+
input:-webkit-autofill:hover,
|
|
52231
|
+
input:-webkit-autofill:focus,
|
|
52232
|
+
input:-webkit-autofill:active {
|
|
52233
|
+
-webkit-box-shadow: 0 0 0 30px white inset !important;
|
|
52234
|
+
}
|
|
52235
|
+
`;
|
|
52236
|
+
|
|
51767
52237
|
// src/Board.ts
|
|
51768
52238
|
class Board {
|
|
51769
52239
|
boardId;
|
|
@@ -52146,9 +52616,9 @@ class Board {
|
|
|
52146
52616
|
return this.copy();
|
|
52147
52617
|
}
|
|
52148
52618
|
serializeHTML() {
|
|
52149
|
-
const customTagsScript =
|
|
52150
|
-
const loadLinksImagesScript =
|
|
52151
|
-
const css =
|
|
52619
|
+
const customTagsScript = customWebComponents_default;
|
|
52620
|
+
const loadLinksImagesScript = loadLinkImages_default;
|
|
52621
|
+
const css = public_default;
|
|
52152
52622
|
const boardName = this.getName() || this.getBoardId();
|
|
52153
52623
|
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
52154
52624
|
const itemsDiv = `<div id="items">${items}</div>`;
|