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/index.js
CHANGED
|
@@ -1467,6 +1467,9 @@ class Line {
|
|
|
1467
1467
|
getStartPoint() {
|
|
1468
1468
|
return this.start;
|
|
1469
1469
|
}
|
|
1470
|
+
getEndPoint() {
|
|
1471
|
+
return this.end;
|
|
1472
|
+
}
|
|
1470
1473
|
getLength() {
|
|
1471
1474
|
const { start, end } = this;
|
|
1472
1475
|
const deltaX = end.x - start.x;
|
|
@@ -3064,6 +3067,9 @@ class QuadraticBezier extends BaseCurve {
|
|
|
3064
3067
|
getStartPoint() {
|
|
3065
3068
|
return this.start;
|
|
3066
3069
|
}
|
|
3070
|
+
getEndPoint() {
|
|
3071
|
+
return this.end;
|
|
3072
|
+
}
|
|
3067
3073
|
moveToStart(ctx) {
|
|
3068
3074
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3069
3075
|
}
|
|
@@ -3107,6 +3113,9 @@ class CubicBezier extends BaseCurve {
|
|
|
3107
3113
|
getStartPoint() {
|
|
3108
3114
|
return this.start;
|
|
3109
3115
|
}
|
|
3116
|
+
getEndPoint() {
|
|
3117
|
+
return this.end;
|
|
3118
|
+
}
|
|
3110
3119
|
moveToStart(ctx) {
|
|
3111
3120
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3112
3121
|
}
|
|
@@ -7209,25 +7218,33 @@ class TransformationCommand {
|
|
|
7209
7218
|
x: 1 / op2.x,
|
|
7210
7219
|
y: 1 / op2.y
|
|
7211
7220
|
};
|
|
7221
|
+
} else {
|
|
7222
|
+
reverseOp = {
|
|
7223
|
+
...op2,
|
|
7224
|
+
x: 1,
|
|
7225
|
+
y: 1
|
|
7226
|
+
};
|
|
7212
7227
|
}
|
|
7213
7228
|
return { item: currTrans, operation: reverseOp };
|
|
7214
7229
|
});
|
|
7215
7230
|
}
|
|
7216
7231
|
case "locked": {
|
|
7232
|
+
const op2 = this.operation;
|
|
7217
7233
|
return mapItemsByOperation(this.transformation, () => {
|
|
7218
7234
|
return {
|
|
7219
|
-
...
|
|
7220
|
-
item: [...
|
|
7235
|
+
...op2,
|
|
7236
|
+
item: [...op2.item],
|
|
7221
7237
|
method: "unlocked",
|
|
7222
7238
|
locked: false
|
|
7223
7239
|
};
|
|
7224
7240
|
});
|
|
7225
7241
|
}
|
|
7226
7242
|
case "unlocked": {
|
|
7243
|
+
const op2 = this.operation;
|
|
7227
7244
|
return mapItemsByOperation(this.transformation, () => {
|
|
7228
7245
|
return {
|
|
7229
|
-
...
|
|
7230
|
-
item: [...
|
|
7246
|
+
...op2,
|
|
7247
|
+
item: [...op2.item],
|
|
7231
7248
|
method: "locked",
|
|
7232
7249
|
locked: true
|
|
7233
7250
|
};
|
|
@@ -8838,6 +8855,13 @@ var tagByType = {
|
|
|
8838
8855
|
Comment: "comment-item",
|
|
8839
8856
|
Group: ""
|
|
8840
8857
|
};
|
|
8858
|
+
var headingTagsMap = {
|
|
8859
|
+
h1: "heading_one",
|
|
8860
|
+
h2: "heading_two",
|
|
8861
|
+
h3: "heading_three",
|
|
8862
|
+
h4: "heading_four",
|
|
8863
|
+
h5: "heading_five"
|
|
8864
|
+
};
|
|
8841
8865
|
var parsersHTML = {
|
|
8842
8866
|
"sticker-item": parseHTMLSticker,
|
|
8843
8867
|
"shape-item": parseHTMLShape,
|
|
@@ -8862,12 +8886,12 @@ function getTransformationData(el) {
|
|
|
8862
8886
|
if (transformMatch) {
|
|
8863
8887
|
const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
|
|
8864
8888
|
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
8865
|
-
return { ...matrix, rotate: 0 };
|
|
8889
|
+
return { ...matrix, rotate: 0, isLocked: false };
|
|
8866
8890
|
}
|
|
8867
|
-
return { ...new Matrix2, rotate: 0 };
|
|
8891
|
+
return { ...new Matrix2, rotate: 0, isLocked: false };
|
|
8868
8892
|
}
|
|
8869
8893
|
function parseHTMLRichText(el, options) {
|
|
8870
|
-
const parseNode = (node) => {
|
|
8894
|
+
const parseNode = (node, nestingLevel = 1) => {
|
|
8871
8895
|
const isLinkNode = node.tagName.toLowerCase() === "a";
|
|
8872
8896
|
if (node.tagName.toLowerCase() === "span" || isLinkNode && node.children.length === 0) {
|
|
8873
8897
|
const isSingleSpace = node.textContent?.length === 1 && node.textContent?.trim() === "";
|
|
@@ -8890,7 +8914,7 @@ function parseHTMLRichText(el, options) {
|
|
|
8890
8914
|
superscript: false
|
|
8891
8915
|
};
|
|
8892
8916
|
}
|
|
8893
|
-
const children2 = Array.from(node.children).map((child) => parseNode(child));
|
|
8917
|
+
const children2 = Array.from(node.children).map((child) => parseNode(child, nestingLevel + 1));
|
|
8894
8918
|
const tagName = node.tagName.toLowerCase();
|
|
8895
8919
|
const extractCommonProps = () => ({
|
|
8896
8920
|
horisontalAlignment: node.style.textAlign || "left",
|
|
@@ -8898,23 +8922,19 @@ function parseHTMLRichText(el, options) {
|
|
|
8898
8922
|
paddingBottom: parseFloat(node.style.paddingBottom) || undefined
|
|
8899
8923
|
});
|
|
8900
8924
|
switch (tagName) {
|
|
8901
|
-
case "blockquote":
|
|
8902
|
-
return {
|
|
8903
|
-
type: "block-quote",
|
|
8904
|
-
...extractCommonProps(),
|
|
8905
|
-
children: children2
|
|
8906
|
-
};
|
|
8907
8925
|
case "ul":
|
|
8908
8926
|
return {
|
|
8909
8927
|
type: "ul_list",
|
|
8910
8928
|
...extractCommonProps(),
|
|
8911
|
-
children: children2
|
|
8929
|
+
children: children2,
|
|
8930
|
+
listLevel: nestingLevel
|
|
8912
8931
|
};
|
|
8913
8932
|
case "ol":
|
|
8914
8933
|
return {
|
|
8915
8934
|
type: "ol_list",
|
|
8916
8935
|
...extractCommonProps(),
|
|
8917
|
-
children: children2
|
|
8936
|
+
children: children2,
|
|
8937
|
+
listLevel: nestingLevel
|
|
8918
8938
|
};
|
|
8919
8939
|
case "li":
|
|
8920
8940
|
return {
|
|
@@ -8936,11 +8956,9 @@ function parseHTMLRichText(el, options) {
|
|
|
8936
8956
|
case "h2":
|
|
8937
8957
|
case "h3":
|
|
8938
8958
|
case "h4":
|
|
8939
|
-
case "h5":
|
|
8940
|
-
case "h6": {
|
|
8941
|
-
const headingType = `heading_${["one", "two", "three", "four", "five", "six"][parseInt(tagName[1]) - 1]}`;
|
|
8959
|
+
case "h5": {
|
|
8942
8960
|
return {
|
|
8943
|
-
type:
|
|
8961
|
+
type: headingTagsMap[tagName],
|
|
8944
8962
|
...extractCommonProps(),
|
|
8945
8963
|
children: children2
|
|
8946
8964
|
};
|
|
@@ -9144,6 +9162,7 @@ function parseHTMLConnector(el) {
|
|
|
9144
9162
|
...endPointType === "FixedConnector" ? { segment: startSegment, tangent: endTangent } : {}
|
|
9145
9163
|
};
|
|
9146
9164
|
const connectorData = {
|
|
9165
|
+
middlePoint: null,
|
|
9147
9166
|
id: el.id,
|
|
9148
9167
|
itemType: "Connector",
|
|
9149
9168
|
transformation,
|
|
@@ -9204,6 +9223,7 @@ function parseHTMLDrawing(el) {
|
|
|
9204
9223
|
}
|
|
9205
9224
|
function parseHTMLAINode(el) {
|
|
9206
9225
|
const aiNodeData = {
|
|
9226
|
+
threadDirection: 3,
|
|
9207
9227
|
id: el.id,
|
|
9208
9228
|
itemType: "AINode",
|
|
9209
9229
|
parentNodeId: el.getAttribute("parent-node-id") || undefined,
|
|
@@ -9537,17 +9557,18 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
9537
9557
|
break;
|
|
9538
9558
|
default:
|
|
9539
9559
|
if ("text" in child && typeof child.text === "string") {
|
|
9540
|
-
const
|
|
9560
|
+
const textNode = child;
|
|
9561
|
+
const fontScale2 = (textNode.fontSize === "auto" ? 14 : textNode.fontSize ?? 14) / 14;
|
|
9541
9562
|
handleTextNode({
|
|
9542
9563
|
isFrame,
|
|
9543
|
-
child,
|
|
9564
|
+
child: textNode,
|
|
9544
9565
|
node,
|
|
9545
9566
|
maxWidth,
|
|
9546
9567
|
paddingTop: i === 0 ? 16 * (data.paddingTop || 0) : 0,
|
|
9547
9568
|
marginLeft: (listData ? fontScale2 * 16 : 0) + (listData?.level || 0) * fontScale2 * 24,
|
|
9548
9569
|
newLine: i === 0 ? newLine : false,
|
|
9549
9570
|
listMark: i === 0 ? listMark : undefined,
|
|
9550
|
-
link:
|
|
9571
|
+
link: textNode.link
|
|
9551
9572
|
});
|
|
9552
9573
|
} else {
|
|
9553
9574
|
const blockNode = getBlockNode(child, maxWidth, isFrame, listData, i === 0 ? listMark : undefined, true);
|
|
@@ -9591,7 +9612,8 @@ function getTextNode(data) {
|
|
|
9591
9612
|
type: "text",
|
|
9592
9613
|
text,
|
|
9593
9614
|
style: getTextStyle(data),
|
|
9594
|
-
blocks: []
|
|
9615
|
+
blocks: [],
|
|
9616
|
+
newLine: false
|
|
9595
9617
|
};
|
|
9596
9618
|
return node;
|
|
9597
9619
|
}
|
|
@@ -9837,7 +9859,7 @@ function setBlockNodeCoordinates(blockNode) {
|
|
|
9837
9859
|
}
|
|
9838
9860
|
lineBottom += maxFontSize * lineHeight;
|
|
9839
9861
|
leading = maxFontSize * lineHeight - maxFontSize;
|
|
9840
|
-
yOffset = lineBottom - leading / 2 - highestBlock
|
|
9862
|
+
yOffset = lineBottom - leading / 2 - (highestBlock?.measure.descent || 0);
|
|
9841
9863
|
for (const block of line) {
|
|
9842
9864
|
block.y = yOffset;
|
|
9843
9865
|
}
|
|
@@ -9861,7 +9883,7 @@ function getTextBlock({
|
|
|
9861
9883
|
x: 0,
|
|
9862
9884
|
y: 0,
|
|
9863
9885
|
measure,
|
|
9864
|
-
fontSize: style.fontSize,
|
|
9886
|
+
fontSize: style.fontSize === "auto" ? 14 : style.fontSize,
|
|
9865
9887
|
paddingTop,
|
|
9866
9888
|
marginLeft,
|
|
9867
9889
|
listMark,
|
|
@@ -10383,7 +10405,7 @@ function handleListMerge(editor) {
|
|
|
10383
10405
|
return false;
|
|
10384
10406
|
}
|
|
10385
10407
|
const [textNode, textNodePath] = Editor2.node(editor, anchor.path);
|
|
10386
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10408
|
+
if (!textNode || Editor2.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
|
|
10387
10409
|
return false;
|
|
10388
10410
|
}
|
|
10389
10411
|
const paragraphPath = Path5.parent(textNodePath);
|
|
@@ -10393,12 +10415,12 @@ function handleListMerge(editor) {
|
|
|
10393
10415
|
}
|
|
10394
10416
|
const listItemPath = Path5.parent(paragraphPath);
|
|
10395
10417
|
const [listItem] = Editor2.node(editor, listItemPath);
|
|
10396
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10418
|
+
if (!listItem || Editor2.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10397
10419
|
return false;
|
|
10398
10420
|
}
|
|
10399
10421
|
const listPath = Path5.parent(listItemPath);
|
|
10400
10422
|
const [list] = Editor2.node(editor, listPath);
|
|
10401
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10423
|
+
if (!list || Editor2.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10402
10424
|
return false;
|
|
10403
10425
|
}
|
|
10404
10426
|
const listItemIndex = listItemPath[listItemPath.length - 1];
|
|
@@ -10432,6 +10454,9 @@ function handleListMerge(editor) {
|
|
|
10432
10454
|
} else {
|
|
10433
10455
|
const previousItemPath = Path5.previous(listItemPath);
|
|
10434
10456
|
const [previousItem] = Editor2.node(editor, previousItemPath);
|
|
10457
|
+
if ("text" in previousItem) {
|
|
10458
|
+
return false;
|
|
10459
|
+
}
|
|
10435
10460
|
currentListItemChildren.forEach((childNode, index) => {
|
|
10436
10461
|
const copiedNode = structuredClone(childNode);
|
|
10437
10462
|
copiedNode.paddingTop = 0;
|
|
@@ -10463,7 +10488,18 @@ function createParagraphNode(text, editor, horisontalAlignment) {
|
|
|
10463
10488
|
const marks = Editor3.marks(editor) || {};
|
|
10464
10489
|
const pargaraph = {
|
|
10465
10490
|
type: "paragraph",
|
|
10466
|
-
children: [{
|
|
10491
|
+
children: [{
|
|
10492
|
+
type: "text",
|
|
10493
|
+
text,
|
|
10494
|
+
...marks,
|
|
10495
|
+
bold: false,
|
|
10496
|
+
italic: false,
|
|
10497
|
+
underline: false,
|
|
10498
|
+
overline: false,
|
|
10499
|
+
"line-through": false,
|
|
10500
|
+
subscript: false,
|
|
10501
|
+
superscript: false
|
|
10502
|
+
}]
|
|
10467
10503
|
};
|
|
10468
10504
|
if (horisontalAlignment) {
|
|
10469
10505
|
pargaraph.horisontalAlignment = horisontalAlignment;
|
|
@@ -10517,6 +10553,9 @@ function handleSplitListItem(editor) {
|
|
|
10517
10553
|
if (isBlockEmpty && isOnlyChildParagraph) {
|
|
10518
10554
|
const listItemIndex = listItemPath[listItemPath.length - 1];
|
|
10519
10555
|
const [parentList, parentListPath] = Editor4.parent(editor, listItemPath);
|
|
10556
|
+
if (Editor4.isEditor(parentList) || parentList.type !== "ol_list" && parentList.type !== "ul_list") {
|
|
10557
|
+
return false;
|
|
10558
|
+
}
|
|
10520
10559
|
const listType = parentList.type;
|
|
10521
10560
|
Editor4.withoutNormalizing(editor, () => {
|
|
10522
10561
|
const nextPath = Path6.next(parentListPath);
|
|
@@ -10541,6 +10580,9 @@ function handleSplitListItem(editor) {
|
|
|
10541
10580
|
match: (n, path2) => path2[path2.length - 1] >= listItemIndex
|
|
10542
10581
|
});
|
|
10543
10582
|
const [updatedParentList] = Editor4.node(editor, parentListPath);
|
|
10583
|
+
if (Editor4.isEditor(updatedParentList)) {
|
|
10584
|
+
return false;
|
|
10585
|
+
}
|
|
10544
10586
|
if (getAreAllChildrenEmpty(updatedParentList)) {
|
|
10545
10587
|
Transforms3.removeNodes(editor, { at: parentListPath });
|
|
10546
10588
|
}
|
|
@@ -10572,7 +10614,7 @@ import { Transforms as Transforms5 } from "slate";
|
|
|
10572
10614
|
import { Editor as Editor5, Transforms as Transforms4 } from "slate";
|
|
10573
10615
|
function clearAllTextNodes(editor) {
|
|
10574
10616
|
for (const [node, path2] of Editor5.nodes(editor, {
|
|
10575
|
-
match: (n) => n.type === "text"
|
|
10617
|
+
match: (n) => !Editor5.isEditor(n) && n.type === "text"
|
|
10576
10618
|
})) {
|
|
10577
10619
|
Transforms4.removeNodes(editor, { at: path2 });
|
|
10578
10620
|
Transforms4.setNodes(editor, { ...node, text: "" }, { at: path2 });
|
|
@@ -10607,7 +10649,7 @@ function handleWrapIntoNestedList(editor) {
|
|
|
10607
10649
|
}
|
|
10608
10650
|
const { anchor } = selection;
|
|
10609
10651
|
const [textNode, textNodePath] = Editor6.node(editor, anchor.path);
|
|
10610
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10652
|
+
if (!textNode || Editor6.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
|
|
10611
10653
|
return false;
|
|
10612
10654
|
}
|
|
10613
10655
|
const paragraphPath = Path7.parent(textNodePath);
|
|
@@ -10617,12 +10659,12 @@ function handleWrapIntoNestedList(editor) {
|
|
|
10617
10659
|
}
|
|
10618
10660
|
const listItemPath = Path7.parent(paragraphPath);
|
|
10619
10661
|
const [listItem] = Editor6.node(editor, listItemPath);
|
|
10620
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10662
|
+
if (!listItem || Editor6.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10621
10663
|
return false;
|
|
10622
10664
|
}
|
|
10623
10665
|
const listPath = Path7.parent(listItemPath);
|
|
10624
10666
|
const [list] = Editor6.node(editor, listPath);
|
|
10625
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10667
|
+
if (!list || Editor6.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10626
10668
|
return false;
|
|
10627
10669
|
}
|
|
10628
10670
|
Transforms6.wrapNodes(editor, { type: "list_item", children: [] }, { at: paragraphPath });
|
|
@@ -10645,19 +10687,19 @@ function wrapIntoList(editor, targetListType, location) {
|
|
|
10645
10687
|
}
|
|
10646
10688
|
|
|
10647
10689
|
// src/Items/RichText/editorHelpers/lists/toggleListTypeForSelection.ts
|
|
10648
|
-
import { Editor as Editor8, Element as Element2, Path as Path9,
|
|
10690
|
+
import { Editor as Editor8, Element as Element2, Path as Path9, Transforms as Transforms8 } from "slate";
|
|
10649
10691
|
|
|
10650
10692
|
// src/Items/RichText/editorHelpers/lists/getBlockParentList.ts
|
|
10651
10693
|
import { Editor as Editor7, Path as Path8 } from "slate";
|
|
10652
10694
|
function getBlockParentList(editor, blockPath) {
|
|
10653
10695
|
const listItemPath = Path8.parent(blockPath);
|
|
10654
10696
|
const [listItem] = Editor7.node(editor, listItemPath);
|
|
10655
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10697
|
+
if (!listItem || Editor7.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10656
10698
|
return null;
|
|
10657
10699
|
}
|
|
10658
10700
|
const listPath = Path8.parent(listItemPath);
|
|
10659
10701
|
const [list] = Editor7.node(editor, listPath);
|
|
10660
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10702
|
+
if (!list || Editor7.isEditor(listItem) || "type" in list && list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10661
10703
|
return null;
|
|
10662
10704
|
}
|
|
10663
10705
|
return [list, listPath];
|
|
@@ -10670,17 +10712,16 @@ function toggleListTypeForSelection(editor, targetListType) {
|
|
|
10670
10712
|
return false;
|
|
10671
10713
|
}
|
|
10672
10714
|
Editor8.withoutNormalizing(editor, () => {
|
|
10673
|
-
const [start, end] = Range4.edges(selection);
|
|
10674
|
-
const commonAncestorPath = Path9.common(start.path, end.path);
|
|
10675
10715
|
const nodes = Array.from(Editor8.nodes(editor, {
|
|
10676
10716
|
at: selection,
|
|
10677
10717
|
mode: "lowest",
|
|
10678
|
-
match: (n) => Editor8.isBlock(editor, n)
|
|
10718
|
+
match: (n) => !Editor8.isEditor(n) && n.type !== "text" && Editor8.isBlock(editor, n)
|
|
10679
10719
|
}));
|
|
10680
10720
|
const nodesWithLists = {};
|
|
10681
10721
|
const unwrapCandidates = [];
|
|
10682
10722
|
nodes.forEach(([node, path2]) => {
|
|
10683
10723
|
const parentList = getBlockParentList(editor, path2);
|
|
10724
|
+
node = node;
|
|
10684
10725
|
if (parentList) {
|
|
10685
10726
|
unwrapCandidates.push(node);
|
|
10686
10727
|
if (!nodesWithLists[parentList[1].length]) {
|
|
@@ -10790,7 +10831,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10790
10831
|
Editor9.withoutNormalizing(editor, () => {
|
|
10791
10832
|
const { anchor } = selection;
|
|
10792
10833
|
const [textNode, textNodePath] = Editor9.node(editor, anchor.path);
|
|
10793
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10834
|
+
if (!textNode || Editor9.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode)) {
|
|
10794
10835
|
result = false;
|
|
10795
10836
|
return;
|
|
10796
10837
|
}
|
|
@@ -10802,7 +10843,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10802
10843
|
}
|
|
10803
10844
|
const listItemPath = Path10.parent(paragraphPath);
|
|
10804
10845
|
const [listItem] = Editor9.node(editor, listItemPath);
|
|
10805
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10846
|
+
if (!listItem || Editor9.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10806
10847
|
if (shouldWrap) {
|
|
10807
10848
|
wrapIntoList(editor, targetListType, selection);
|
|
10808
10849
|
return;
|
|
@@ -10812,7 +10853,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10812
10853
|
}
|
|
10813
10854
|
const listPath = Path10.parent(listItemPath);
|
|
10814
10855
|
const [list] = Editor9.node(editor, listPath);
|
|
10815
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10856
|
+
if (!list || Editor9.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10816
10857
|
if (shouldWrap) {
|
|
10817
10858
|
wrapIntoList(editor, targetListType, selection);
|
|
10818
10859
|
return;
|
|
@@ -10894,7 +10935,7 @@ function getListTypeAtSelectionStart(editor) {
|
|
|
10894
10935
|
const startPoint = Range6.start(selection);
|
|
10895
10936
|
const listEntry = Editor11.above(editor, {
|
|
10896
10937
|
at: startPoint,
|
|
10897
|
-
match: (n) => n.type === "ol_list" || n.type === "ul_list"
|
|
10938
|
+
match: (n) => !Editor11.isEditor(n) && (n.type === "ol_list" || n.type === "ul_list")
|
|
10898
10939
|
});
|
|
10899
10940
|
if (listEntry) {
|
|
10900
10941
|
const [listNode] = listEntry;
|
|
@@ -10917,11 +10958,11 @@ var setLink = (editor, link, selection) => {
|
|
|
10917
10958
|
const format = link ? "rgba(71, 120, 245, 1)" : "rgb(20, 21, 26)";
|
|
10918
10959
|
Editor12.addMark(editor, "fontColor", format);
|
|
10919
10960
|
for (const [node, path2] of Editor12.nodes(editor, {
|
|
10920
|
-
match: (n) => n.type === "text"
|
|
10961
|
+
match: (n) => !Editor12.isEditor(n) && n.type === "text"
|
|
10921
10962
|
})) {
|
|
10922
10963
|
const nodeRange = Editor12.range(editor, path2);
|
|
10923
10964
|
Transforms11.select(editor, nodeRange);
|
|
10924
|
-
Transforms11.setNodes(editor, { link }, { split: false, match: (n) => n.type === "text" });
|
|
10965
|
+
Transforms11.setNodes(editor, { link }, { split: false, match: (n) => !Editor12.isEditor(n) && n.type === "text" });
|
|
10925
10966
|
}
|
|
10926
10967
|
};
|
|
10927
10968
|
|
|
@@ -17044,7 +17085,9 @@ function setNodeChildrenStyles({
|
|
|
17044
17085
|
}) {
|
|
17045
17086
|
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
17046
17087
|
if (editor) {
|
|
17047
|
-
|
|
17088
|
+
const marks = Editor16.marks(editor);
|
|
17089
|
+
const fontSize = marks?.fontSize ? marks.fontSize === "auto" ? conf.DEFAULT_TEXT_STYLES.fontSize : marks.fontSize : conf.DEFAULT_TEXT_STYLES.fontSize;
|
|
17090
|
+
fontStyles = marks ? { ...conf.DEFAULT_TEXT_STYLES, ...marks, fontSize } : conf.DEFAULT_TEXT_STYLES;
|
|
17048
17091
|
}
|
|
17049
17092
|
switch (node2.type) {
|
|
17050
17093
|
case "heading_one":
|
|
@@ -17094,6 +17137,9 @@ function setNodeStyles({
|
|
|
17094
17137
|
editor,
|
|
17095
17138
|
horisontalAlignment
|
|
17096
17139
|
}) {
|
|
17140
|
+
if (node2.type === "list_item") {
|
|
17141
|
+
return;
|
|
17142
|
+
}
|
|
17097
17143
|
if (node2.type === "ol_list" || node2.type === "ul_list") {
|
|
17098
17144
|
node2.listLevel = listLevel;
|
|
17099
17145
|
for (const listItem of node2.children) {
|
|
@@ -17244,9 +17290,10 @@ class MarkdownProcessor {
|
|
|
17244
17290
|
} else {
|
|
17245
17291
|
const lastParagraphPath = this.getText().length - 1;
|
|
17246
17292
|
const lastParagraph = this.getText()[lastParagraphPath];
|
|
17293
|
+
const lastParagraphText = lastParagraph.children[lastParagraph.children.length - 1];
|
|
17247
17294
|
const insertLocation = {
|
|
17248
17295
|
path: [lastParagraphPath, lastParagraph.children.length - 1],
|
|
17249
|
-
offset:
|
|
17296
|
+
offset: lastParagraphText.text.length
|
|
17250
17297
|
};
|
|
17251
17298
|
Transforms13.insertText(this.editor, combinedText, {
|
|
17252
17299
|
at: insertLocation
|
|
@@ -17311,7 +17358,7 @@ function getFirstSelectionLink(editor, selection) {
|
|
|
17311
17358
|
}
|
|
17312
17359
|
for (const [node2] of Editor20.nodes(editor, {
|
|
17313
17360
|
at: selection,
|
|
17314
|
-
match: (n) => !!n.link
|
|
17361
|
+
match: (n) => ("link" in n) && !!n.link
|
|
17315
17362
|
})) {
|
|
17316
17363
|
return node2.link;
|
|
17317
17364
|
}
|
|
@@ -18261,14 +18308,6 @@ class RichTextCommand {
|
|
|
18261
18308
|
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
18262
18309
|
}
|
|
18263
18310
|
}));
|
|
18264
|
-
case "setBlockType":
|
|
18265
|
-
return items.map((id) => ({
|
|
18266
|
-
item: id,
|
|
18267
|
-
operation: {
|
|
18268
|
-
...this.operation,
|
|
18269
|
-
type: this.board.items.getById(id)?.getRichText()?.getBlockType() || "paragraph"
|
|
18270
|
-
}
|
|
18271
|
-
}));
|
|
18272
18311
|
case "setFontStyle":
|
|
18273
18312
|
return items.map((id) => ({
|
|
18274
18313
|
item: id,
|
|
@@ -18371,7 +18410,8 @@ class RichTextGroupCommand {
|
|
|
18371
18410
|
class: "RichText",
|
|
18372
18411
|
method: "edit",
|
|
18373
18412
|
item: [richText.getId() ?? ""],
|
|
18374
|
-
ops
|
|
18413
|
+
ops,
|
|
18414
|
+
selection: null
|
|
18375
18415
|
}
|
|
18376
18416
|
});
|
|
18377
18417
|
}
|
|
@@ -18388,7 +18428,8 @@ class RichTextGroupCommand {
|
|
|
18388
18428
|
class: "RichText",
|
|
18389
18429
|
method: "edit",
|
|
18390
18430
|
item: [richText.getId() ?? ""],
|
|
18391
|
-
ops: ops.map((op) => Operation3.inverse(op)).reverse()
|
|
18431
|
+
ops: ops.map((op) => Operation3.inverse(op)).reverse(),
|
|
18432
|
+
selection: null
|
|
18392
18433
|
}
|
|
18393
18434
|
});
|
|
18394
18435
|
}
|
|
@@ -19038,6 +19079,9 @@ class Comment2 {
|
|
|
19038
19079
|
const anchor = this.anchor.copy();
|
|
19039
19080
|
return new Mbr(anchor.x, anchor.y, anchor.x, anchor.y);
|
|
19040
19081
|
}
|
|
19082
|
+
getPathMbr() {
|
|
19083
|
+
return this.getMbr();
|
|
19084
|
+
}
|
|
19041
19085
|
getNearestEdgePointTo(point3) {
|
|
19042
19086
|
return this.anchor;
|
|
19043
19087
|
}
|
|
@@ -19525,6 +19569,9 @@ class BaseItem extends Mbr {
|
|
|
19525
19569
|
onRemove() {
|
|
19526
19570
|
this.onRemoveCallbacks.forEach((cb) => cb());
|
|
19527
19571
|
}
|
|
19572
|
+
getPathMbr() {
|
|
19573
|
+
return this.getMbr().copy();
|
|
19574
|
+
}
|
|
19528
19575
|
render(context) {}
|
|
19529
19576
|
renderHTML(documentFactory) {
|
|
19530
19577
|
return documentFactory.createElement("div");
|
|
@@ -20050,7 +20097,10 @@ class RichText extends BaseItem {
|
|
|
20050
20097
|
}
|
|
20051
20098
|
getFontSize() {
|
|
20052
20099
|
const marks = this.editor.getSelectionMarks();
|
|
20053
|
-
|
|
20100
|
+
let fontSize = marks?.fontSize ?? this.initialTextStyles.fontSize;
|
|
20101
|
+
if (fontSize === "auto") {
|
|
20102
|
+
fontSize = this.initialTextStyles.fontSize;
|
|
20103
|
+
}
|
|
20054
20104
|
if (this.autoSize) {
|
|
20055
20105
|
return fontSize * this.autoSizeScale;
|
|
20056
20106
|
}
|
|
@@ -20068,7 +20118,7 @@ class RichText extends BaseItem {
|
|
|
20068
20118
|
for (const [node2] of textNodes) {
|
|
20069
20119
|
const fontSize = node2.fontSize || node2 && node2.fontSize;
|
|
20070
20120
|
if (fontSize) {
|
|
20071
|
-
fontSizes.push(fontSize);
|
|
20121
|
+
fontSizes.push(fontSize === "auto" ? this.initialTextStyles.fontSize : fontSize);
|
|
20072
20122
|
}
|
|
20073
20123
|
}
|
|
20074
20124
|
if (fontSizes.length > 0) {
|
|
@@ -20081,7 +20131,7 @@ class RichText extends BaseItem {
|
|
|
20081
20131
|
return marks?.fontHighlight ?? this.initialTextStyles.fontHighlight;
|
|
20082
20132
|
}
|
|
20083
20133
|
getBlockType() {
|
|
20084
|
-
const blockNode = getSelectedBlockNode(this.editor);
|
|
20134
|
+
const blockNode = getSelectedBlockNode(this.editor.editor);
|
|
20085
20135
|
return blockNode ? blockNode.type : "paragraph";
|
|
20086
20136
|
}
|
|
20087
20137
|
getHorisontalAlignment() {
|
|
@@ -20112,16 +20162,18 @@ class RichText extends BaseItem {
|
|
|
20112
20162
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
20113
20163
|
if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
20114
20164
|
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
20115
|
-
|
|
20116
|
-
|
|
20117
|
-
|
|
20118
|
-
|
|
20119
|
-
|
|
20120
|
-
|
|
20121
|
-
|
|
20122
|
-
|
|
20123
|
-
|
|
20124
|
-
|
|
20165
|
+
if (domRange) {
|
|
20166
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
20167
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
20168
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
20169
|
+
exactMatch: false,
|
|
20170
|
+
suppressThrow: false
|
|
20171
|
+
});
|
|
20172
|
+
if (slatePoint) {
|
|
20173
|
+
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
20174
|
+
this.editorTransforms.select(this.editor.editor, nRange);
|
|
20175
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
20176
|
+
}
|
|
20125
20177
|
}
|
|
20126
20178
|
} else {
|
|
20127
20179
|
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
@@ -37329,6 +37381,9 @@ class Shape extends BaseItem {
|
|
|
37329
37381
|
getMbr() {
|
|
37330
37382
|
return this.mbr.copy();
|
|
37331
37383
|
}
|
|
37384
|
+
getPathMbr() {
|
|
37385
|
+
return this.getPath().getMbr();
|
|
37386
|
+
}
|
|
37332
37387
|
getNearestEdgePointTo(point5) {
|
|
37333
37388
|
return this.path.getNearestEdgePointTo(point5);
|
|
37334
37389
|
}
|
|
@@ -43109,13 +43164,8 @@ function createCanvasDrawer(board) {
|
|
|
43109
43164
|
// src/Selection/QuickAddButtons/quickAddHelpers.ts
|
|
43110
43165
|
function getControlPointData(item, index2, isRichText = false) {
|
|
43111
43166
|
const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
|
|
43112
|
-
const width2 = item.
|
|
43113
|
-
let height3;
|
|
43114
|
-
if (item.itemType === "Shape" && index2 !== 2 && index2 !== 3) {
|
|
43115
|
-
height3 = item.getPath().getMbr().getHeight();
|
|
43116
|
-
} else {
|
|
43117
|
-
height3 = item.getMbr().getHeight();
|
|
43118
|
-
}
|
|
43167
|
+
const width2 = item.getPathMbr().getWidth();
|
|
43168
|
+
let height3 = item.getPathMbr().getHeight();
|
|
43119
43169
|
const adjMapScaled = {
|
|
43120
43170
|
0: { x: 0, y: height3 / 2 / itemScale.y },
|
|
43121
43171
|
1: {
|
|
@@ -43148,7 +43198,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43148
43198
|
optionalItem = new Sticker(board);
|
|
43149
43199
|
break;
|
|
43150
43200
|
case "AINode":
|
|
43151
|
-
optionalItem = createAINode2(board, startPoint?.item?.getId()
|
|
43201
|
+
optionalItem = createAINode2(board, 3, "item" in startPoint ? startPoint?.item?.getId() : undefined);
|
|
43152
43202
|
break;
|
|
43153
43203
|
}
|
|
43154
43204
|
let itemMbr = optionalItem.getMbr();
|
|
@@ -43175,20 +43225,25 @@ function quickAddItem(board, type, connector) {
|
|
|
43175
43225
|
if ("text" in guarded && guarded.itemType !== "AINode" && guarded.itemType !== "RichText") {
|
|
43176
43226
|
delete guarded.text;
|
|
43177
43227
|
}
|
|
43228
|
+
if (!itemData.transformation) {
|
|
43229
|
+
itemData.transformation = new DefaultTransformationData;
|
|
43230
|
+
}
|
|
43178
43231
|
itemData.transformation.translateX = endPoint.x;
|
|
43179
43232
|
itemData.transformation.translateY = endPoint.y;
|
|
43180
43233
|
const lines = connector.lines.getSegments();
|
|
43181
43234
|
const lastLine = lines[lines.length - 1];
|
|
43182
|
-
|
|
43235
|
+
const lastLineStart = lastLine.getStartPoint();
|
|
43236
|
+
const lastLineEnd = lastLine.getEndPoint();
|
|
43237
|
+
let dir2 = getDirection(lastLineStart, lastLineEnd);
|
|
43238
|
+
const firstLineStart = lines[0].getEndPoint();
|
|
43183
43239
|
if (!dir2) {
|
|
43184
|
-
const
|
|
43185
|
-
const
|
|
43186
|
-
const yDiff = Math.abs(firstLine.start.y - lastLine.end.y);
|
|
43240
|
+
const xDiff = Math.abs(firstLineStart.x - lastLineEnd.x);
|
|
43241
|
+
const yDiff = Math.abs(firstLineStart.y - lastLineEnd.y);
|
|
43187
43242
|
dir2 = xDiff > yDiff ? "horizontal" : "vertical";
|
|
43188
43243
|
}
|
|
43189
43244
|
let dirIndex = -1;
|
|
43190
43245
|
if (dir2 === "vertical") {
|
|
43191
|
-
if (
|
|
43246
|
+
if (firstLineStart.y > lastLineEnd.y) {
|
|
43192
43247
|
itemData.transformation.translateX -= itemMbr.getWidth() / 2;
|
|
43193
43248
|
itemData.transformation.translateY -= itemMbr.getHeight();
|
|
43194
43249
|
dirIndex = 3;
|
|
@@ -43197,7 +43252,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43197
43252
|
dirIndex = 2;
|
|
43198
43253
|
}
|
|
43199
43254
|
} else if (dir2 === "horizontal") {
|
|
43200
|
-
if (
|
|
43255
|
+
if (firstLineStart.x > lastLineEnd.x) {
|
|
43201
43256
|
itemData.transformation.translateX -= itemMbr.getWidth();
|
|
43202
43257
|
itemData.transformation.translateY -= itemMbr.getHeight() / 2;
|
|
43203
43258
|
dirIndex = 1;
|
|
@@ -43219,7 +43274,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43219
43274
|
connector.setEndPoint(newEndPoint);
|
|
43220
43275
|
board.selection.removeAll();
|
|
43221
43276
|
board.selection.add(added);
|
|
43222
|
-
if (added
|
|
43277
|
+
if (added instanceof RichText || added instanceof AINode) {
|
|
43223
43278
|
const text5 = added.getRichText();
|
|
43224
43279
|
text5.editor.setMaxWidth(text5.editor.maxWidth || 600);
|
|
43225
43280
|
board.selection.editText();
|
|
@@ -43227,7 +43282,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43227
43282
|
board.selection.setContext("EditUnderPointer");
|
|
43228
43283
|
}
|
|
43229
43284
|
}
|
|
43230
|
-
function createAINode2(board,
|
|
43285
|
+
function createAINode2(board, directionIndex, parentNodeId) {
|
|
43231
43286
|
const node2 = new AINode(board, true, parentNodeId, undefined, directionIndex);
|
|
43232
43287
|
const nodeRichText = node2.getRichText();
|
|
43233
43288
|
nodeRichText.applyMaxWidth(600);
|
|
@@ -43261,17 +43316,17 @@ function getQuickAddButtons(selection, board) {
|
|
|
43261
43316
|
let quickAddItems = undefined;
|
|
43262
43317
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
43263
43318
|
const connectorStorage = new SessionStorage;
|
|
43264
|
-
const currMbr = selectedItem.
|
|
43319
|
+
const currMbr = selectedItem.getPathMbr();
|
|
43265
43320
|
const selectedItemData = selectedItem.serialize();
|
|
43266
|
-
const width2 =
|
|
43267
|
-
const height3 =
|
|
43321
|
+
const width2 = currMbr.getWidth();
|
|
43322
|
+
const height3 = currMbr.getHeight();
|
|
43268
43323
|
let offsetX = width2;
|
|
43269
43324
|
let offsetY = height3;
|
|
43270
43325
|
let newWidth = width2;
|
|
43271
43326
|
let newHeight = height3;
|
|
43272
43327
|
let itemData;
|
|
43273
43328
|
if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
|
|
43274
|
-
const item = selectedItem.itemType === "AINode" ? createAINode2(board, selectedItem.getId()
|
|
43329
|
+
const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
|
|
43275
43330
|
newWidth = item.getMbr().getWidth();
|
|
43276
43331
|
newHeight = item.getMbr().getHeight();
|
|
43277
43332
|
itemData = item.serialize();
|
|
@@ -43320,9 +43375,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
43320
43375
|
const endPoints = getQuickButtonsPositions(newMbr);
|
|
43321
43376
|
const reverseIndexMap = { 0: 1, 1: 0, 2: 3, 3: 2 };
|
|
43322
43377
|
const connectorEndPoint = endPoints?.positions[reverseIndexMap[index2]] || new Point;
|
|
43323
|
-
const fontSize = selectedItem
|
|
43378
|
+
const fontSize = selectedItem instanceof RichText ? selectedItem.getFontSize() : 14;
|
|
43324
43379
|
const newItem = board.createItem(board.getNewItemId(), newItemData);
|
|
43325
|
-
if (newItem
|
|
43380
|
+
if (newItem instanceof RichText) {
|
|
43326
43381
|
const storage = new SessionStorage;
|
|
43327
43382
|
storage.setFontSize("RichText", fontSize);
|
|
43328
43383
|
newItem.editor.selectWholeText();
|
|
@@ -43335,6 +43390,10 @@ function getQuickAddButtons(selection, board) {
|
|
|
43335
43390
|
const scaleX = newItemMbr.getWidth() / 100;
|
|
43336
43391
|
const scaleY = newItemMbr.getHeight() / 100;
|
|
43337
43392
|
shapeData.transformation = {
|
|
43393
|
+
isLocked: false,
|
|
43394
|
+
rotate: 0,
|
|
43395
|
+
translateX: 0,
|
|
43396
|
+
translateY: 0,
|
|
43338
43397
|
...newItemData.transformation,
|
|
43339
43398
|
scaleX,
|
|
43340
43399
|
scaleY
|
|
@@ -43391,7 +43450,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
43391
43450
|
}
|
|
43392
43451
|
let pathCenter;
|
|
43393
43452
|
if (single.itemType === "Shape") {
|
|
43394
|
-
pathCenter = single.
|
|
43453
|
+
pathCenter = single.getPathMbr().getCenter();
|
|
43395
43454
|
}
|
|
43396
43455
|
const center = itemMbr.getCenter();
|
|
43397
43456
|
const width2 = itemMbr.getWidth();
|
|
@@ -47760,7 +47819,7 @@ class Presence {
|
|
|
47760
47819
|
};
|
|
47761
47820
|
});
|
|
47762
47821
|
ctx2.restore();
|
|
47763
|
-
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop);
|
|
47822
|
+
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop) || null;
|
|
47764
47823
|
};
|
|
47765
47824
|
renderLoop();
|
|
47766
47825
|
}
|
|
@@ -49127,7 +49186,7 @@ class SpatialIndex {
|
|
|
49127
49186
|
return this.itemsIndex.getRectsEnclosedOrCrossedBy(new Mbr(left, top, right, bottom));
|
|
49128
49187
|
}
|
|
49129
49188
|
getComments() {
|
|
49130
|
-
return this.itemsArray.filter((item) => item instanceof
|
|
49189
|
+
return this.itemsArray.filter((item) => item instanceof Comment2);
|
|
49131
49190
|
}
|
|
49132
49191
|
getMbr() {
|
|
49133
49192
|
return this.Mbr;
|
|
@@ -49251,10 +49310,10 @@ class Items {
|
|
|
49251
49310
|
}
|
|
49252
49311
|
const { nearest } = enclosed.reduce((acc, item) => {
|
|
49253
49312
|
const area = item.getMbr().getHeight() * item.getMbr().getWidth();
|
|
49254
|
-
if (item
|
|
49313
|
+
if (item instanceof Drawing && !item.isPointNearLine(this.pointer.point)) {
|
|
49255
49314
|
return acc;
|
|
49256
49315
|
}
|
|
49257
|
-
const isItemTransparent = item
|
|
49316
|
+
const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
|
|
49258
49317
|
const itemZIndex = this.getZIndex(item);
|
|
49259
49318
|
const accZIndex = this.getZIndex(acc.nearest);
|
|
49260
49319
|
if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
|
|
@@ -49285,7 +49344,7 @@ class Items {
|
|
|
49285
49344
|
}
|
|
49286
49345
|
getLinkedConnectorsById(id) {
|
|
49287
49346
|
return this.listAll().filter((item) => {
|
|
49288
|
-
if (item
|
|
49347
|
+
if (!(item instanceof Connector2)) {
|
|
49289
49348
|
return false;
|
|
49290
49349
|
}
|
|
49291
49350
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -49300,7 +49359,7 @@ class Items {
|
|
|
49300
49359
|
return [];
|
|
49301
49360
|
}
|
|
49302
49361
|
return this.listAll().filter((item) => {
|
|
49303
|
-
if (item
|
|
49362
|
+
if (!(item instanceof Connector2) || !item.isConnected()) {
|
|
49304
49363
|
return false;
|
|
49305
49364
|
}
|
|
49306
49365
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -49475,7 +49534,7 @@ class SelectionItems {
|
|
|
49475
49534
|
return ids;
|
|
49476
49535
|
}
|
|
49477
49536
|
getSingle() {
|
|
49478
|
-
return this.isSingle() ? this.items.values().next().value : null;
|
|
49537
|
+
return this.isSingle() ? this.items.values().next().value || null : null;
|
|
49479
49538
|
}
|
|
49480
49539
|
listByIds(itemIdList) {
|
|
49481
49540
|
return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
|
|
@@ -49523,7 +49582,7 @@ class ConnectorTransformer extends Tool {
|
|
|
49523
49582
|
getConnector(items) {
|
|
49524
49583
|
if (items.isSingle()) {
|
|
49525
49584
|
const connector = items.getSingle();
|
|
49526
|
-
if (connector
|
|
49585
|
+
if (connector instanceof Connector2) {
|
|
49527
49586
|
return connector;
|
|
49528
49587
|
}
|
|
49529
49588
|
}
|
|
@@ -50993,10 +51052,10 @@ class BoardSelection {
|
|
|
50993
51052
|
}
|
|
50994
51053
|
copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
|
|
50995
51054
|
}
|
|
50996
|
-
copy(skipImageBlobCopy
|
|
51055
|
+
copy(skipImageBlobCopy) {
|
|
50997
51056
|
const copiedItemsMap = {};
|
|
50998
51057
|
const single = this.items.getSingle();
|
|
50999
|
-
if (!skipImageBlobCopy && single && single
|
|
51058
|
+
if (!skipImageBlobCopy && single && single instanceof ImageItem) {
|
|
51000
51059
|
this.handleItemCopy(single, copiedItemsMap);
|
|
51001
51060
|
return { imageElement: single.image, imageData: copiedItemsMap };
|
|
51002
51061
|
}
|
|
@@ -51021,7 +51080,7 @@ class BoardSelection {
|
|
|
51021
51080
|
return copiedItemsMap;
|
|
51022
51081
|
}
|
|
51023
51082
|
cut() {
|
|
51024
|
-
const items = this.copy();
|
|
51083
|
+
const items = this.copy(true);
|
|
51025
51084
|
this.removeFromBoard();
|
|
51026
51085
|
return items;
|
|
51027
51086
|
}
|
|
@@ -51172,7 +51231,7 @@ class BoardSelection {
|
|
|
51172
51231
|
});
|
|
51173
51232
|
Object.values(selectedMap).forEach((val) => {
|
|
51174
51233
|
const parentFrame = this.board.items.getById(val.item.parent);
|
|
51175
|
-
const isParentFrame = parentFrame
|
|
51234
|
+
const isParentFrame = parentFrame instanceof Frame;
|
|
51176
51235
|
const parentFrameId = isParentFrame ? parentFrame.getId() : null;
|
|
51177
51236
|
if (val.nested) {
|
|
51178
51237
|
const isRemoveChildFromFrame = Object.values(selectedMap).some((val2) => val2.nested && val2.nested.getId() !== parentFrameId);
|
|
@@ -51187,7 +51246,7 @@ class BoardSelection {
|
|
|
51187
51246
|
console.warn(`Didnt find frame with id ${val.item.parent}`);
|
|
51188
51247
|
}
|
|
51189
51248
|
}
|
|
51190
|
-
if (val.item
|
|
51249
|
+
if (val.item instanceof Frame && checkFrames) {
|
|
51191
51250
|
const currFrame = val.item;
|
|
51192
51251
|
const currMbr = currFrame.getMbr();
|
|
51193
51252
|
const children = val.item.getChildrenIds().map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
|
|
@@ -51595,12 +51654,6 @@ class BoardSelection {
|
|
|
51595
51654
|
text5.setEditorFocus(this.context);
|
|
51596
51655
|
}
|
|
51597
51656
|
}
|
|
51598
|
-
getMediaStorageIds() {
|
|
51599
|
-
return this.items.list().filter((item) => {
|
|
51600
|
-
const shouldClearStorageUsage = item.itemType === "Image" || item.itemType === "Video" && item.getIsStorageUrl() || item.itemType === "Audio" && item.getIsStorageUrl();
|
|
51601
|
-
return shouldClearStorageUsage;
|
|
51602
|
-
}).map((item) => item.getStorageId());
|
|
51603
|
-
}
|
|
51604
51657
|
removeFromBoard() {
|
|
51605
51658
|
const isLocked = this.items.list().some((item) => item.transformation.isLocked);
|
|
51606
51659
|
if (isLocked) {
|
|
@@ -51615,7 +51668,6 @@ class BoardSelection {
|
|
|
51615
51668
|
const connectors = itemIds.flatMap((id) => {
|
|
51616
51669
|
return this.board.items.getLinkedConnectorsById(id);
|
|
51617
51670
|
}).map((connector) => connector.getId());
|
|
51618
|
-
conf.hooks.beforeMediaRemove(this.getMediaStorageIds(), this.board.getBoardId());
|
|
51619
51671
|
this.emit({
|
|
51620
51672
|
class: "Board",
|
|
51621
51673
|
method: "remove",
|
|
@@ -51652,7 +51704,15 @@ class BoardSelection {
|
|
|
51652
51704
|
this.board.sendToBack(this.items.list());
|
|
51653
51705
|
}
|
|
51654
51706
|
async duplicate() {
|
|
51655
|
-
const mediaIds =
|
|
51707
|
+
const mediaIds = [];
|
|
51708
|
+
this.items.list().forEach((item) => {
|
|
51709
|
+
if ("getStorageId" in item) {
|
|
51710
|
+
const storageId = item.getStorageId();
|
|
51711
|
+
if (storageId) {
|
|
51712
|
+
mediaIds.push(storageId);
|
|
51713
|
+
}
|
|
51714
|
+
}
|
|
51715
|
+
});
|
|
51656
51716
|
const canDuplicate = mediaIds.length ? await conf.hooks.beforeMediaUpload(mediaIds, this.board.getBoardId()) : true;
|
|
51657
51717
|
if (!canDuplicate) {
|
|
51658
51718
|
return;
|
|
@@ -51720,7 +51780,7 @@ class BoardSelection {
|
|
|
51720
51780
|
}
|
|
51721
51781
|
}
|
|
51722
51782
|
const contextItems = [];
|
|
51723
|
-
if (single && single
|
|
51783
|
+
if (single && single instanceof AINode) {
|
|
51724
51784
|
const contextItemsIds = single.getContextItems();
|
|
51725
51785
|
if (contextItemsIds.length) {
|
|
51726
51786
|
const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
|
|
@@ -51742,7 +51802,7 @@ class BoardSelection {
|
|
|
51742
51802
|
}
|
|
51743
51803
|
}
|
|
51744
51804
|
contextItems.forEach((item) => {
|
|
51745
|
-
if (item
|
|
51805
|
+
if (item instanceof AINode) {
|
|
51746
51806
|
const path2 = item.getPath();
|
|
51747
51807
|
path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
|
|
51748
51808
|
path2.setBorderWidth(2);
|
|
@@ -51757,6 +51817,416 @@ class BoardSelection {
|
|
|
51757
51817
|
});
|
|
51758
51818
|
}
|
|
51759
51819
|
}
|
|
51820
|
+
// src/public/customWebComponents.js
|
|
51821
|
+
var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
|
|
51822
|
+
class RichTextElement extends HTMLElement {
|
|
51823
|
+
constructor() {
|
|
51824
|
+
super();
|
|
51825
|
+
}
|
|
51826
|
+
}
|
|
51827
|
+
|
|
51828
|
+
class ShapeItemElement extends HTMLElement {
|
|
51829
|
+
constructor() {
|
|
51830
|
+
super();
|
|
51831
|
+
}
|
|
51832
|
+
}
|
|
51833
|
+
|
|
51834
|
+
class StickerElement extends HTMLElement {
|
|
51835
|
+
constructor() {
|
|
51836
|
+
super();
|
|
51837
|
+
}
|
|
51838
|
+
}
|
|
51839
|
+
|
|
51840
|
+
class DrawingElement extends HTMLElement {
|
|
51841
|
+
constructor() {
|
|
51842
|
+
super();
|
|
51843
|
+
}
|
|
51844
|
+
}
|
|
51845
|
+
|
|
51846
|
+
class ConnectorElement extends HTMLElement {
|
|
51847
|
+
constructor() {
|
|
51848
|
+
super();
|
|
51849
|
+
}
|
|
51850
|
+
}
|
|
51851
|
+
|
|
51852
|
+
class FrameItemElement extends HTMLElement {
|
|
51853
|
+
constructor() {
|
|
51854
|
+
super();
|
|
51855
|
+
}
|
|
51856
|
+
}
|
|
51857
|
+
|
|
51858
|
+
class ImageItemElement extends HTMLElement {
|
|
51859
|
+
constructor() {
|
|
51860
|
+
super();
|
|
51861
|
+
}
|
|
51862
|
+
}
|
|
51863
|
+
|
|
51864
|
+
class LinkItemElement extends HTMLElement {
|
|
51865
|
+
constructor() {
|
|
51866
|
+
super();
|
|
51867
|
+
}
|
|
51868
|
+
}
|
|
51869
|
+
|
|
51870
|
+
class AINodeItemElement extends HTMLElement {
|
|
51871
|
+
constructor() {
|
|
51872
|
+
super();
|
|
51873
|
+
}
|
|
51874
|
+
}
|
|
51875
|
+
|
|
51876
|
+
class VideoItemElement extends HTMLElement {
|
|
51877
|
+
constructor() {
|
|
51878
|
+
super();
|
|
51879
|
+
}
|
|
51880
|
+
}
|
|
51881
|
+
|
|
51882
|
+
class CommentElement extends HTMLElement {
|
|
51883
|
+
constructor() {
|
|
51884
|
+
super();
|
|
51885
|
+
}
|
|
51886
|
+
}
|
|
51887
|
+
|
|
51888
|
+
class AudioItemElement extends HTMLElement {
|
|
51889
|
+
constructor() {
|
|
51890
|
+
super();
|
|
51891
|
+
}
|
|
51892
|
+
}
|
|
51893
|
+
|
|
51894
|
+
customElements.define("rich-text", RichTextElement);
|
|
51895
|
+
customElements.define("shape-item", ShapeItemElement);
|
|
51896
|
+
customElements.define("sticker-item", StickerElement);
|
|
51897
|
+
customElements.define("drawing-item", DrawingElement);
|
|
51898
|
+
customElements.define("connector-item", ConnectorElement);
|
|
51899
|
+
customElements.define("frame-item", FrameItemElement);
|
|
51900
|
+
customElements.define("image-item", ImageItemElement);
|
|
51901
|
+
customElements.define("link-item", LinkItemElement);
|
|
51902
|
+
customElements.define("ainode-item", AINodeItemElement);
|
|
51903
|
+
customElements.define("video-item", VideoItemElement);
|
|
51904
|
+
customElements.define("comment-item", CommentElement);
|
|
51905
|
+
customElements.define("audio-item", AudioItemElement);
|
|
51906
|
+
|
|
51907
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
51908
|
+
const itemsDiv = document.querySelector("#items");
|
|
51909
|
+
if (!itemsDiv) {
|
|
51910
|
+
console.error("ITEMS DIV NOT FOUND!");
|
|
51911
|
+
return;
|
|
51912
|
+
}
|
|
51913
|
+
let isDragging = false;
|
|
51914
|
+
let startX, startY;
|
|
51915
|
+
let translateX = 0;
|
|
51916
|
+
let translateY = 0;
|
|
51917
|
+
let scale = 1;
|
|
51918
|
+
|
|
51919
|
+
itemsDiv.style.transformOrigin = "0 0";
|
|
51920
|
+
document.body.style.cursor = "grab";
|
|
51921
|
+
|
|
51922
|
+
function updateTransform() {
|
|
51923
|
+
itemsDiv.style.transform =
|
|
51924
|
+
"translate(" +
|
|
51925
|
+
translateX +
|
|
51926
|
+
"px, " +
|
|
51927
|
+
translateY +
|
|
51928
|
+
"px) scale(" +
|
|
51929
|
+
scale +
|
|
51930
|
+
")";
|
|
51931
|
+
}
|
|
51932
|
+
|
|
51933
|
+
function handleMouseDown(ev) {
|
|
51934
|
+
isDragging = true;
|
|
51935
|
+
startX = ev.clientX;
|
|
51936
|
+
startY = ev.clientY;
|
|
51937
|
+
itemsDiv.style.cursor = "grabbing";
|
|
51938
|
+
}
|
|
51939
|
+
|
|
51940
|
+
function handleMouseMove(ev) {
|
|
51941
|
+
if (!isDragging) {
|
|
51942
|
+
return;
|
|
51943
|
+
}
|
|
51944
|
+
const dx = ev.clientX - startX;
|
|
51945
|
+
const dy = ev.clientY - startY;
|
|
51946
|
+
startX += dx;
|
|
51947
|
+
startY += dy;
|
|
51948
|
+
translateX += dx;
|
|
51949
|
+
translateY += dy;
|
|
51950
|
+
updateTransform();
|
|
51951
|
+
}
|
|
51952
|
+
|
|
51953
|
+
function handleMouseUp(ev) {
|
|
51954
|
+
if (!isDragging) {
|
|
51955
|
+
return;
|
|
51956
|
+
}
|
|
51957
|
+
isDragging = false;
|
|
51958
|
+
itemsDiv.style.cursor = "grab";
|
|
51959
|
+
}
|
|
51960
|
+
|
|
51961
|
+
function handleWheel(ev) {
|
|
51962
|
+
ev.preventDefault();
|
|
51963
|
+
const factor = ev.deltaY < 0 ? 1.1 : 0.9;
|
|
51964
|
+
translateX = ev.clientX - (ev.clientX - translateX) * factor;
|
|
51965
|
+
translateY = ev.clientY - (ev.clientY - translateY) * factor;
|
|
51966
|
+
scale *= factor;
|
|
51967
|
+
updateTransform();
|
|
51968
|
+
}
|
|
51969
|
+
|
|
51970
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
51971
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
51972
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
51973
|
+
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
51974
|
+
|
|
51975
|
+
const titlePanel = document.createElement("div");
|
|
51976
|
+
titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
|
|
51977
|
+
titlePanel.style.position = "fixed";
|
|
51978
|
+
titlePanel.style.left = "12px";
|
|
51979
|
+
titlePanel.style.top = "12px";
|
|
51980
|
+
titlePanel.style.borderRadius = "12px";
|
|
51981
|
+
titlePanel.style.backgroundColor = "#ffff";
|
|
51982
|
+
titlePanel.style.display = "flex";
|
|
51983
|
+
titlePanel.style.alignItems = "center";
|
|
51984
|
+
titlePanel.style.gap = "8px";
|
|
51985
|
+
titlePanel.style.padding = "0 12px";
|
|
51986
|
+
titlePanel.style.height = "48px";
|
|
51987
|
+
const editButton = document.createElement("button");
|
|
51988
|
+
const editIcon = document.createElementNS(
|
|
51989
|
+
"http://www.w3.org/2000/svg",
|
|
51990
|
+
"svg",
|
|
51991
|
+
);
|
|
51992
|
+
editIcon.setAttribute("width", "13");
|
|
51993
|
+
editIcon.setAttribute("height", "13");
|
|
51994
|
+
editIcon.setAttribute("viewBox", "0 0 13 13");
|
|
51995
|
+
editIcon.setAttribute("fill", "none");
|
|
51996
|
+
editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
51997
|
+
const editIconPath = document.createElementNS(
|
|
51998
|
+
"http://www.w3.org/2000/svg",
|
|
51999
|
+
"path",
|
|
52000
|
+
);
|
|
52001
|
+
editIconPath.setAttribute(
|
|
52002
|
+
"d",
|
|
52003
|
+
"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",
|
|
52004
|
+
);
|
|
52005
|
+
editIconPath.setAttribute("fill", "#ffff");
|
|
52006
|
+
editIcon.appendChild(editIconPath);
|
|
52007
|
+
editButton.appendChild(editIcon);
|
|
52008
|
+
const editFileText = document.createElement("p");
|
|
52009
|
+
const isSnapshotInIframe =
|
|
52010
|
+
window.parent &&
|
|
52011
|
+
window.parent !== window &&
|
|
52012
|
+
window.parent.location.href.includes("/snapshots/");
|
|
52013
|
+
editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
|
|
52014
|
+
editButton.appendChild(editFileText);
|
|
52015
|
+
|
|
52016
|
+
editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
|
|
52017
|
+
editButton.style.cursor = "pointer";
|
|
52018
|
+
editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
|
|
52019
|
+
editButton.style.color = "#ffff";
|
|
52020
|
+
editButton.style.fontSize = "14px";
|
|
52021
|
+
editButton.style.lineHeight = "20px";
|
|
52022
|
+
editButton.style.display = "flex";
|
|
52023
|
+
editButton.style.alignItems = "center";
|
|
52024
|
+
editButton.style.gap = "8px";
|
|
52025
|
+
editButton.style.padding = "8px";
|
|
52026
|
+
editButton.style.borderRadius = "10px";
|
|
52027
|
+
const separator = document.createElement("div");
|
|
52028
|
+
separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
|
|
52029
|
+
separator.style.height = "100%";
|
|
52030
|
+
const boardName = document.createElement("div");
|
|
52031
|
+
const fileIcon = document.createElementNS(
|
|
52032
|
+
"http://www.w3.org/2000/svg",
|
|
52033
|
+
"svg",
|
|
52034
|
+
);
|
|
52035
|
+
fileIcon.setAttribute("width", "16");
|
|
52036
|
+
fileIcon.setAttribute("height", "18");
|
|
52037
|
+
fileIcon.setAttribute("viewBox", "0 0 16 18");
|
|
52038
|
+
fileIcon.setAttribute("fill", "none");
|
|
52039
|
+
fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52040
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
52041
|
+
path.setAttribute(
|
|
52042
|
+
"d",
|
|
52043
|
+
"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",
|
|
52044
|
+
);
|
|
52045
|
+
path.setAttribute("fill", "#696B76");
|
|
52046
|
+
fileIcon.appendChild(path);
|
|
52047
|
+
boardName.appendChild(fileIcon);
|
|
52048
|
+
const boardNameTag = document.querySelector('meta[name="board-name"]');
|
|
52049
|
+
let boardNameStr = "Untitled";
|
|
52050
|
+
if (boardNameTag) {
|
|
52051
|
+
boardNameStr = boardNameTag.getAttribute("content");
|
|
52052
|
+
}
|
|
52053
|
+
const p = document.createElement("p");
|
|
52054
|
+
p.textContent = boardNameStr;
|
|
52055
|
+
p.style.fontSize = "16px";
|
|
52056
|
+
p.style.lineHeight = "24px";
|
|
52057
|
+
boardName.appendChild(p);
|
|
52058
|
+
const cloudIcon = document.createElementNS(
|
|
52059
|
+
"http://www.w3.org/2000/svg",
|
|
52060
|
+
"svg",
|
|
52061
|
+
);
|
|
52062
|
+
cloudIcon.setAttribute("width", "20");
|
|
52063
|
+
cloudIcon.setAttribute("height", "18");
|
|
52064
|
+
cloudIcon.setAttribute("viewBox", "0 0 20 18");
|
|
52065
|
+
cloudIcon.setAttribute("fill", "none");
|
|
52066
|
+
cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52067
|
+
const cloudIconPath = document.createElementNS(
|
|
52068
|
+
"http://www.w3.org/2000/svg",
|
|
52069
|
+
"path",
|
|
52070
|
+
);
|
|
52071
|
+
cloudIconPath.setAttribute(
|
|
52072
|
+
"d",
|
|
52073
|
+
"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",
|
|
52074
|
+
);
|
|
52075
|
+
cloudIconPath.setAttribute("fill", "#696B76");
|
|
52076
|
+
cloudIcon.appendChild(cloudIconPath);
|
|
52077
|
+
boardName.appendChild(cloudIcon);
|
|
52078
|
+
boardName.style.display = "flex";
|
|
52079
|
+
boardName.style.alignItems = "center";
|
|
52080
|
+
boardName.style.gap = "8px";
|
|
52081
|
+
titlePanel.appendChild(boardName);
|
|
52082
|
+
titlePanel.appendChild(separator);
|
|
52083
|
+
titlePanel.appendChild(editButton);
|
|
52084
|
+
document.body.appendChild(titlePanel);
|
|
52085
|
+
|
|
52086
|
+
editButton.onclick = async () => {
|
|
52087
|
+
editButton.disabled = true;
|
|
52088
|
+
editButton.textContent = "Loading...";
|
|
52089
|
+
|
|
52090
|
+
try {
|
|
52091
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
52092
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
52093
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
52094
|
+
document.removeEventListener("wheel", handleWheel, {
|
|
52095
|
+
passive: false,
|
|
52096
|
+
});
|
|
52097
|
+
translateX = 0;
|
|
52098
|
+
translateY = 0;
|
|
52099
|
+
scale = 1;
|
|
52100
|
+
updateTransform();
|
|
52101
|
+
|
|
52102
|
+
const { initBrowserSettings } = await import(
|
|
52103
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
52104
|
+
);
|
|
52105
|
+
initBrowserSettings();
|
|
52106
|
+
|
|
52107
|
+
const { createApp } = await import(
|
|
52108
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
52109
|
+
);
|
|
52110
|
+
|
|
52111
|
+
const app = createApp();
|
|
52112
|
+
window.app = app;
|
|
52113
|
+
const stringed = await app.openAndEditFile();
|
|
52114
|
+
|
|
52115
|
+
if (stringed) {
|
|
52116
|
+
await app.openBoardFromFile();
|
|
52117
|
+
app.getBoard().deserializeHTML(stringed);
|
|
52118
|
+
app.localRender("items");
|
|
52119
|
+
}
|
|
52120
|
+
|
|
52121
|
+
const response = await fetch(
|
|
52122
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
|
|
52123
|
+
);
|
|
52124
|
+
const cssText = await response.text();
|
|
52125
|
+
const styleEl = document.createElement("style");
|
|
52126
|
+
styleEl.textContent = cssText;
|
|
52127
|
+
document.body.appendChild(styleEl);
|
|
52128
|
+
|
|
52129
|
+
const responseSvg = await fetch(
|
|
52130
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
|
|
52131
|
+
);
|
|
52132
|
+
const svgText = await responseSvg.text();
|
|
52133
|
+
const div = document.createElement("div");
|
|
52134
|
+
div.style.display = "none";
|
|
52135
|
+
div.id = "sprite";
|
|
52136
|
+
div.innerHTML = svgText;
|
|
52137
|
+
document.body.appendChild(div);
|
|
52138
|
+
} finally {
|
|
52139
|
+
editButton.disabled = false;
|
|
52140
|
+
editButton.textContent = "Edit board";
|
|
52141
|
+
}
|
|
52142
|
+
};
|
|
52143
|
+
});
|
|
52144
|
+
`;
|
|
52145
|
+
|
|
52146
|
+
// src/public/loadLinkImages.js
|
|
52147
|
+
var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
|
|
52148
|
+
document.querySelectorAll(".link-object").forEach(linkItem => {
|
|
52149
|
+
const linkImage = linkItem.querySelector(".link-image");
|
|
52150
|
+
const linkContainer = linkItem.querySelector("a");
|
|
52151
|
+
linkImage.onerror = () => {
|
|
52152
|
+
linkImage.onerror = null;
|
|
52153
|
+
linkImage.style.display = "none";
|
|
52154
|
+
const svgNamespace = "http://www.w3.org/2000/svg";
|
|
52155
|
+
const svg = document.createElementNS(svgNamespace, "svg");
|
|
52156
|
+
svg.setAttribute("width", "20");
|
|
52157
|
+
svg.setAttribute("height", "20");
|
|
52158
|
+
svg.setAttribute("viewBox", "0 0 13 14");
|
|
52159
|
+
svg.setAttribute("fill", "none");
|
|
52160
|
+
|
|
52161
|
+
const path = document.createElementNS(svgNamespace, "path");
|
|
52162
|
+
path.setAttribute(
|
|
52163
|
+
"d",
|
|
52164
|
+
"M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
|
|
52165
|
+
);
|
|
52166
|
+
path.setAttribute("fill", "#924FE8");
|
|
52167
|
+
svg.appendChild(path);
|
|
52168
|
+
|
|
52169
|
+
linkContainer.appendChild(svg);
|
|
52170
|
+
};
|
|
52171
|
+
});
|
|
52172
|
+
});
|
|
52173
|
+
`;
|
|
52174
|
+
|
|
52175
|
+
// src/public/index.css
|
|
52176
|
+
var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
|
|
52177
|
+
@import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
|
|
52178
|
+
|
|
52179
|
+
/* ../src/index.css */
|
|
52180
|
+
:root {
|
|
52181
|
+
--background-surface-default: rgb(255, 255, 255);
|
|
52182
|
+
--background-button-secondary: rgb(255, 255, 255);
|
|
52183
|
+
--background-button-secondary-hover: rgb(247, 247, 248);
|
|
52184
|
+
--background-badge-purple-disabled: rgb(247, 241, 253);
|
|
52185
|
+
--background-badge-gray: rgb(233, 234, 236);
|
|
52186
|
+
--background-accent-purple: rgb(146, 79, 232);
|
|
52187
|
+
--border-action-normal: rgb(222, 223, 227);
|
|
52188
|
+
--border-action-focus: rgb(146, 79, 232);
|
|
52189
|
+
--border-select-primary: rgb(146, 79, 232);
|
|
52190
|
+
--text-base-primary: rgb(20, 21, 26);
|
|
52191
|
+
--text-base-secondary: rgba(15, 19, 36, 0.6);
|
|
52192
|
+
--text-base-quaternary: rgb(10, 15, 41, 0.25);
|
|
52193
|
+
--text-accent-purple: rgb(152, 89, 233);
|
|
52194
|
+
--icon-base-primary: rgb(20, 21, 26);
|
|
52195
|
+
--icon-base-secondary: rgb(105, 107, 118);
|
|
52196
|
+
--icon-accent-purple: rgb(146, 79, 232);
|
|
52197
|
+
--absolute-position-panel-padding: 12px;
|
|
52198
|
+
}
|
|
52199
|
+
* {
|
|
52200
|
+
box-sizing: border-box;
|
|
52201
|
+
padding: 0;
|
|
52202
|
+
margin: 0;
|
|
52203
|
+
border: none;
|
|
52204
|
+
background: none;
|
|
52205
|
+
font-family: inherit;
|
|
52206
|
+
}
|
|
52207
|
+
html {
|
|
52208
|
+
font-size: 62.5%;
|
|
52209
|
+
}
|
|
52210
|
+
body {
|
|
52211
|
+
color: var(--text-base-primary);
|
|
52212
|
+
font-size: 1.6rem;
|
|
52213
|
+
font-optical-sizing: auto;
|
|
52214
|
+
font-style: normal;
|
|
52215
|
+
font-family: "Manrope", sans-serif;
|
|
52216
|
+
}
|
|
52217
|
+
html,
|
|
52218
|
+
body {
|
|
52219
|
+
overscroll-behavior-x: none;
|
|
52220
|
+
-webkit-user-select: none;
|
|
52221
|
+
}
|
|
52222
|
+
input:-webkit-autofill,
|
|
52223
|
+
input:-webkit-autofill:hover,
|
|
52224
|
+
input:-webkit-autofill:focus,
|
|
52225
|
+
input:-webkit-autofill:active {
|
|
52226
|
+
-webkit-box-shadow: 0 0 0 30px white inset !important;
|
|
52227
|
+
}
|
|
52228
|
+
`;
|
|
52229
|
+
|
|
51760
52230
|
// src/Board.ts
|
|
51761
52231
|
class Board {
|
|
51762
52232
|
boardId;
|
|
@@ -52139,9 +52609,9 @@ class Board {
|
|
|
52139
52609
|
return this.copy();
|
|
52140
52610
|
}
|
|
52141
52611
|
serializeHTML() {
|
|
52142
|
-
const customTagsScript =
|
|
52143
|
-
const loadLinksImagesScript =
|
|
52144
|
-
const css =
|
|
52612
|
+
const customTagsScript = customWebComponents_default;
|
|
52613
|
+
const loadLinksImagesScript = loadLinkImages_default;
|
|
52614
|
+
const css = public_default;
|
|
52145
52615
|
const boardName = this.getName() || this.getBoardId();
|
|
52146
52616
|
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
52147
52617
|
const itemsDiv = `<div id="items">${items}</div>`;
|