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/cjs/node.js
CHANGED
|
@@ -2667,6 +2667,9 @@ class Line {
|
|
|
2667
2667
|
getStartPoint() {
|
|
2668
2668
|
return this.start;
|
|
2669
2669
|
}
|
|
2670
|
+
getEndPoint() {
|
|
2671
|
+
return this.end;
|
|
2672
|
+
}
|
|
2670
2673
|
getLength() {
|
|
2671
2674
|
const { start, end } = this;
|
|
2672
2675
|
const deltaX = end.x - start.x;
|
|
@@ -4264,6 +4267,9 @@ class QuadraticBezier extends BaseCurve {
|
|
|
4264
4267
|
getStartPoint() {
|
|
4265
4268
|
return this.start;
|
|
4266
4269
|
}
|
|
4270
|
+
getEndPoint() {
|
|
4271
|
+
return this.end;
|
|
4272
|
+
}
|
|
4267
4273
|
moveToStart(ctx) {
|
|
4268
4274
|
ctx.moveTo(this.start.x, this.start.y);
|
|
4269
4275
|
}
|
|
@@ -4307,6 +4313,9 @@ class CubicBezier extends BaseCurve {
|
|
|
4307
4313
|
getStartPoint() {
|
|
4308
4314
|
return this.start;
|
|
4309
4315
|
}
|
|
4316
|
+
getEndPoint() {
|
|
4317
|
+
return this.end;
|
|
4318
|
+
}
|
|
4310
4319
|
moveToStart(ctx) {
|
|
4311
4320
|
ctx.moveTo(this.start.x, this.start.y);
|
|
4312
4321
|
}
|
|
@@ -8409,25 +8418,33 @@ class TransformationCommand {
|
|
|
8409
8418
|
x: 1 / op2.x,
|
|
8410
8419
|
y: 1 / op2.y
|
|
8411
8420
|
};
|
|
8421
|
+
} else {
|
|
8422
|
+
reverseOp = {
|
|
8423
|
+
...op2,
|
|
8424
|
+
x: 1,
|
|
8425
|
+
y: 1
|
|
8426
|
+
};
|
|
8412
8427
|
}
|
|
8413
8428
|
return { item: currTrans, operation: reverseOp };
|
|
8414
8429
|
});
|
|
8415
8430
|
}
|
|
8416
8431
|
case "locked": {
|
|
8432
|
+
const op2 = this.operation;
|
|
8417
8433
|
return mapItemsByOperation(this.transformation, () => {
|
|
8418
8434
|
return {
|
|
8419
|
-
...
|
|
8420
|
-
item: [...
|
|
8435
|
+
...op2,
|
|
8436
|
+
item: [...op2.item],
|
|
8421
8437
|
method: "unlocked",
|
|
8422
8438
|
locked: false
|
|
8423
8439
|
};
|
|
8424
8440
|
});
|
|
8425
8441
|
}
|
|
8426
8442
|
case "unlocked": {
|
|
8443
|
+
const op2 = this.operation;
|
|
8427
8444
|
return mapItemsByOperation(this.transformation, () => {
|
|
8428
8445
|
return {
|
|
8429
|
-
...
|
|
8430
|
-
item: [...
|
|
8446
|
+
...op2,
|
|
8447
|
+
item: [...op2.item],
|
|
8431
8448
|
method: "locked",
|
|
8432
8449
|
locked: true
|
|
8433
8450
|
};
|
|
@@ -10038,6 +10055,13 @@ var tagByType = {
|
|
|
10038
10055
|
Comment: "comment-item",
|
|
10039
10056
|
Group: ""
|
|
10040
10057
|
};
|
|
10058
|
+
var headingTagsMap = {
|
|
10059
|
+
h1: "heading_one",
|
|
10060
|
+
h2: "heading_two",
|
|
10061
|
+
h3: "heading_three",
|
|
10062
|
+
h4: "heading_four",
|
|
10063
|
+
h5: "heading_five"
|
|
10064
|
+
};
|
|
10041
10065
|
var parsersHTML = {
|
|
10042
10066
|
"sticker-item": parseHTMLSticker,
|
|
10043
10067
|
"shape-item": parseHTMLShape,
|
|
@@ -10062,12 +10086,12 @@ function getTransformationData(el) {
|
|
|
10062
10086
|
if (transformMatch) {
|
|
10063
10087
|
const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
|
|
10064
10088
|
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
10065
|
-
return { ...matrix, rotate: 0 };
|
|
10089
|
+
return { ...matrix, rotate: 0, isLocked: false };
|
|
10066
10090
|
}
|
|
10067
|
-
return { ...new Matrix2, rotate: 0 };
|
|
10091
|
+
return { ...new Matrix2, rotate: 0, isLocked: false };
|
|
10068
10092
|
}
|
|
10069
10093
|
function parseHTMLRichText(el, options) {
|
|
10070
|
-
const parseNode = (node) => {
|
|
10094
|
+
const parseNode = (node, nestingLevel = 1) => {
|
|
10071
10095
|
const isLinkNode = node.tagName.toLowerCase() === "a";
|
|
10072
10096
|
if (node.tagName.toLowerCase() === "span" || isLinkNode && node.children.length === 0) {
|
|
10073
10097
|
const isSingleSpace = node.textContent?.length === 1 && node.textContent?.trim() === "";
|
|
@@ -10090,7 +10114,7 @@ function parseHTMLRichText(el, options) {
|
|
|
10090
10114
|
superscript: false
|
|
10091
10115
|
};
|
|
10092
10116
|
}
|
|
10093
|
-
const children2 = Array.from(node.children).map((child) => parseNode(child));
|
|
10117
|
+
const children2 = Array.from(node.children).map((child) => parseNode(child, nestingLevel + 1));
|
|
10094
10118
|
const tagName = node.tagName.toLowerCase();
|
|
10095
10119
|
const extractCommonProps = () => ({
|
|
10096
10120
|
horisontalAlignment: node.style.textAlign || "left",
|
|
@@ -10098,23 +10122,19 @@ function parseHTMLRichText(el, options) {
|
|
|
10098
10122
|
paddingBottom: parseFloat(node.style.paddingBottom) || undefined
|
|
10099
10123
|
});
|
|
10100
10124
|
switch (tagName) {
|
|
10101
|
-
case "blockquote":
|
|
10102
|
-
return {
|
|
10103
|
-
type: "block-quote",
|
|
10104
|
-
...extractCommonProps(),
|
|
10105
|
-
children: children2
|
|
10106
|
-
};
|
|
10107
10125
|
case "ul":
|
|
10108
10126
|
return {
|
|
10109
10127
|
type: "ul_list",
|
|
10110
10128
|
...extractCommonProps(),
|
|
10111
|
-
children: children2
|
|
10129
|
+
children: children2,
|
|
10130
|
+
listLevel: nestingLevel
|
|
10112
10131
|
};
|
|
10113
10132
|
case "ol":
|
|
10114
10133
|
return {
|
|
10115
10134
|
type: "ol_list",
|
|
10116
10135
|
...extractCommonProps(),
|
|
10117
|
-
children: children2
|
|
10136
|
+
children: children2,
|
|
10137
|
+
listLevel: nestingLevel
|
|
10118
10138
|
};
|
|
10119
10139
|
case "li":
|
|
10120
10140
|
return {
|
|
@@ -10136,11 +10156,9 @@ function parseHTMLRichText(el, options) {
|
|
|
10136
10156
|
case "h2":
|
|
10137
10157
|
case "h3":
|
|
10138
10158
|
case "h4":
|
|
10139
|
-
case "h5":
|
|
10140
|
-
case "h6": {
|
|
10141
|
-
const headingType = `heading_${["one", "two", "three", "four", "five", "six"][parseInt(tagName[1]) - 1]}`;
|
|
10159
|
+
case "h5": {
|
|
10142
10160
|
return {
|
|
10143
|
-
type:
|
|
10161
|
+
type: headingTagsMap[tagName],
|
|
10144
10162
|
...extractCommonProps(),
|
|
10145
10163
|
children: children2
|
|
10146
10164
|
};
|
|
@@ -10344,6 +10362,7 @@ function parseHTMLConnector(el) {
|
|
|
10344
10362
|
...endPointType === "FixedConnector" ? { segment: startSegment, tangent: endTangent } : {}
|
|
10345
10363
|
};
|
|
10346
10364
|
const connectorData = {
|
|
10365
|
+
middlePoint: null,
|
|
10347
10366
|
id: el.id,
|
|
10348
10367
|
itemType: "Connector",
|
|
10349
10368
|
transformation,
|
|
@@ -10404,6 +10423,7 @@ function parseHTMLDrawing(el) {
|
|
|
10404
10423
|
}
|
|
10405
10424
|
function parseHTMLAINode(el) {
|
|
10406
10425
|
const aiNodeData = {
|
|
10426
|
+
threadDirection: 3,
|
|
10407
10427
|
id: el.id,
|
|
10408
10428
|
itemType: "AINode",
|
|
10409
10429
|
parentNodeId: el.getAttribute("parent-node-id") || undefined,
|
|
@@ -10732,17 +10752,18 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
10732
10752
|
break;
|
|
10733
10753
|
default:
|
|
10734
10754
|
if ("text" in child && typeof child.text === "string") {
|
|
10735
|
-
const
|
|
10755
|
+
const textNode = child;
|
|
10756
|
+
const fontScale2 = (textNode.fontSize === "auto" ? 14 : textNode.fontSize ?? 14) / 14;
|
|
10736
10757
|
handleTextNode({
|
|
10737
10758
|
isFrame,
|
|
10738
|
-
child,
|
|
10759
|
+
child: textNode,
|
|
10739
10760
|
node,
|
|
10740
10761
|
maxWidth,
|
|
10741
10762
|
paddingTop: i === 0 ? 16 * (data.paddingTop || 0) : 0,
|
|
10742
10763
|
marginLeft: (listData ? fontScale2 * 16 : 0) + (listData?.level || 0) * fontScale2 * 24,
|
|
10743
10764
|
newLine: i === 0 ? newLine : false,
|
|
10744
10765
|
listMark: i === 0 ? listMark : undefined,
|
|
10745
|
-
link:
|
|
10766
|
+
link: textNode.link
|
|
10746
10767
|
});
|
|
10747
10768
|
} else {
|
|
10748
10769
|
const blockNode = getBlockNode(child, maxWidth, isFrame, listData, i === 0 ? listMark : undefined, true);
|
|
@@ -10786,7 +10807,8 @@ function getTextNode(data) {
|
|
|
10786
10807
|
type: "text",
|
|
10787
10808
|
text,
|
|
10788
10809
|
style: getTextStyle(data),
|
|
10789
|
-
blocks: []
|
|
10810
|
+
blocks: [],
|
|
10811
|
+
newLine: false
|
|
10790
10812
|
};
|
|
10791
10813
|
return node;
|
|
10792
10814
|
}
|
|
@@ -11032,7 +11054,7 @@ function setBlockNodeCoordinates(blockNode) {
|
|
|
11032
11054
|
}
|
|
11033
11055
|
lineBottom += maxFontSize * lineHeight;
|
|
11034
11056
|
leading = maxFontSize * lineHeight - maxFontSize;
|
|
11035
|
-
yOffset = lineBottom - leading / 2 - highestBlock
|
|
11057
|
+
yOffset = lineBottom - leading / 2 - (highestBlock?.measure.descent || 0);
|
|
11036
11058
|
for (const block of line) {
|
|
11037
11059
|
block.y = yOffset;
|
|
11038
11060
|
}
|
|
@@ -11056,7 +11078,7 @@ function getTextBlock({
|
|
|
11056
11078
|
x: 0,
|
|
11057
11079
|
y: 0,
|
|
11058
11080
|
measure,
|
|
11059
|
-
fontSize: style.fontSize,
|
|
11081
|
+
fontSize: style.fontSize === "auto" ? 14 : style.fontSize,
|
|
11060
11082
|
paddingTop,
|
|
11061
11083
|
marginLeft,
|
|
11062
11084
|
listMark,
|
|
@@ -11362,7 +11384,7 @@ function handleListMerge(editor) {
|
|
|
11362
11384
|
return false;
|
|
11363
11385
|
}
|
|
11364
11386
|
const [textNode, textNodePath] = import_slate2.Editor.node(editor, anchor.path);
|
|
11365
|
-
if (!textNode || textNode.type !== "text" ||
|
|
11387
|
+
if (!textNode || import_slate2.Editor.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
|
|
11366
11388
|
return false;
|
|
11367
11389
|
}
|
|
11368
11390
|
const paragraphPath = import_slate2.Path.parent(textNodePath);
|
|
@@ -11372,12 +11394,12 @@ function handleListMerge(editor) {
|
|
|
11372
11394
|
}
|
|
11373
11395
|
const listItemPath = import_slate2.Path.parent(paragraphPath);
|
|
11374
11396
|
const [listItem] = import_slate2.Editor.node(editor, listItemPath);
|
|
11375
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
11397
|
+
if (!listItem || import_slate2.Editor.isEditor(listItem) || listItem.type !== "list_item") {
|
|
11376
11398
|
return false;
|
|
11377
11399
|
}
|
|
11378
11400
|
const listPath = import_slate2.Path.parent(listItemPath);
|
|
11379
11401
|
const [list] = import_slate2.Editor.node(editor, listPath);
|
|
11380
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11402
|
+
if (!list || import_slate2.Editor.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11381
11403
|
return false;
|
|
11382
11404
|
}
|
|
11383
11405
|
const listItemIndex = listItemPath[listItemPath.length - 1];
|
|
@@ -11411,6 +11433,9 @@ function handleListMerge(editor) {
|
|
|
11411
11433
|
} else {
|
|
11412
11434
|
const previousItemPath = import_slate2.Path.previous(listItemPath);
|
|
11413
11435
|
const [previousItem] = import_slate2.Editor.node(editor, previousItemPath);
|
|
11436
|
+
if ("text" in previousItem) {
|
|
11437
|
+
return false;
|
|
11438
|
+
}
|
|
11414
11439
|
currentListItemChildren.forEach((childNode, index) => {
|
|
11415
11440
|
const copiedNode = structuredClone(childNode);
|
|
11416
11441
|
copiedNode.paddingTop = 0;
|
|
@@ -11442,7 +11467,18 @@ function createParagraphNode(text, editor, horisontalAlignment) {
|
|
|
11442
11467
|
const marks = import_slate3.Editor.marks(editor) || {};
|
|
11443
11468
|
const pargaraph = {
|
|
11444
11469
|
type: "paragraph",
|
|
11445
|
-
children: [{
|
|
11470
|
+
children: [{
|
|
11471
|
+
type: "text",
|
|
11472
|
+
text,
|
|
11473
|
+
...marks,
|
|
11474
|
+
bold: false,
|
|
11475
|
+
italic: false,
|
|
11476
|
+
underline: false,
|
|
11477
|
+
overline: false,
|
|
11478
|
+
"line-through": false,
|
|
11479
|
+
subscript: false,
|
|
11480
|
+
superscript: false
|
|
11481
|
+
}]
|
|
11446
11482
|
};
|
|
11447
11483
|
if (horisontalAlignment) {
|
|
11448
11484
|
pargaraph.horisontalAlignment = horisontalAlignment;
|
|
@@ -11496,6 +11532,9 @@ function handleSplitListItem(editor) {
|
|
|
11496
11532
|
if (isBlockEmpty && isOnlyChildParagraph) {
|
|
11497
11533
|
const listItemIndex = listItemPath[listItemPath.length - 1];
|
|
11498
11534
|
const [parentList, parentListPath] = import_slate4.Editor.parent(editor, listItemPath);
|
|
11535
|
+
if (import_slate4.Editor.isEditor(parentList) || parentList.type !== "ol_list" && parentList.type !== "ul_list") {
|
|
11536
|
+
return false;
|
|
11537
|
+
}
|
|
11499
11538
|
const listType = parentList.type;
|
|
11500
11539
|
import_slate4.Editor.withoutNormalizing(editor, () => {
|
|
11501
11540
|
const nextPath = import_slate4.Path.next(parentListPath);
|
|
@@ -11520,6 +11559,9 @@ function handleSplitListItem(editor) {
|
|
|
11520
11559
|
match: (n, path2) => path2[path2.length - 1] >= listItemIndex
|
|
11521
11560
|
});
|
|
11522
11561
|
const [updatedParentList] = import_slate4.Editor.node(editor, parentListPath);
|
|
11562
|
+
if (import_slate4.Editor.isEditor(updatedParentList)) {
|
|
11563
|
+
return false;
|
|
11564
|
+
}
|
|
11523
11565
|
if (getAreAllChildrenEmpty(updatedParentList)) {
|
|
11524
11566
|
import_slate4.Transforms.removeNodes(editor, { at: parentListPath });
|
|
11525
11567
|
}
|
|
@@ -11551,7 +11593,7 @@ var import_slate6 = require("slate");
|
|
|
11551
11593
|
var import_slate5 = require("slate");
|
|
11552
11594
|
function clearAllTextNodes(editor) {
|
|
11553
11595
|
for (const [node, path2] of import_slate5.Editor.nodes(editor, {
|
|
11554
|
-
match: (n) => n.type === "text"
|
|
11596
|
+
match: (n) => !import_slate5.Editor.isEditor(n) && n.type === "text"
|
|
11555
11597
|
})) {
|
|
11556
11598
|
import_slate5.Transforms.removeNodes(editor, { at: path2 });
|
|
11557
11599
|
import_slate5.Transforms.setNodes(editor, { ...node, text: "" }, { at: path2 });
|
|
@@ -11586,7 +11628,7 @@ function handleWrapIntoNestedList(editor) {
|
|
|
11586
11628
|
}
|
|
11587
11629
|
const { anchor } = selection;
|
|
11588
11630
|
const [textNode, textNodePath] = import_slate7.Editor.node(editor, anchor.path);
|
|
11589
|
-
if (!textNode || textNode.type !== "text" ||
|
|
11631
|
+
if (!textNode || import_slate7.Editor.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
|
|
11590
11632
|
return false;
|
|
11591
11633
|
}
|
|
11592
11634
|
const paragraphPath = import_slate7.Path.parent(textNodePath);
|
|
@@ -11596,12 +11638,12 @@ function handleWrapIntoNestedList(editor) {
|
|
|
11596
11638
|
}
|
|
11597
11639
|
const listItemPath = import_slate7.Path.parent(paragraphPath);
|
|
11598
11640
|
const [listItem] = import_slate7.Editor.node(editor, listItemPath);
|
|
11599
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
11641
|
+
if (!listItem || import_slate7.Editor.isEditor(listItem) || listItem.type !== "list_item") {
|
|
11600
11642
|
return false;
|
|
11601
11643
|
}
|
|
11602
11644
|
const listPath = import_slate7.Path.parent(listItemPath);
|
|
11603
11645
|
const [list] = import_slate7.Editor.node(editor, listPath);
|
|
11604
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11646
|
+
if (!list || import_slate7.Editor.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11605
11647
|
return false;
|
|
11606
11648
|
}
|
|
11607
11649
|
import_slate7.Transforms.wrapNodes(editor, { type: "list_item", children: [] }, { at: paragraphPath });
|
|
@@ -11631,12 +11673,12 @@ var import_slate9 = require("slate");
|
|
|
11631
11673
|
function getBlockParentList(editor, blockPath) {
|
|
11632
11674
|
const listItemPath = import_slate9.Path.parent(blockPath);
|
|
11633
11675
|
const [listItem] = import_slate9.Editor.node(editor, listItemPath);
|
|
11634
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
11676
|
+
if (!listItem || import_slate9.Editor.isEditor(listItem) || listItem.type !== "list_item") {
|
|
11635
11677
|
return null;
|
|
11636
11678
|
}
|
|
11637
11679
|
const listPath = import_slate9.Path.parent(listItemPath);
|
|
11638
11680
|
const [list] = import_slate9.Editor.node(editor, listPath);
|
|
11639
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11681
|
+
if (!list || import_slate9.Editor.isEditor(listItem) || "type" in list && list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11640
11682
|
return null;
|
|
11641
11683
|
}
|
|
11642
11684
|
return [list, listPath];
|
|
@@ -11649,17 +11691,16 @@ function toggleListTypeForSelection(editor, targetListType) {
|
|
|
11649
11691
|
return false;
|
|
11650
11692
|
}
|
|
11651
11693
|
import_slate10.Editor.withoutNormalizing(editor, () => {
|
|
11652
|
-
const [start, end] = import_slate10.Range.edges(selection);
|
|
11653
|
-
const commonAncestorPath = import_slate10.Path.common(start.path, end.path);
|
|
11654
11694
|
const nodes = Array.from(import_slate10.Editor.nodes(editor, {
|
|
11655
11695
|
at: selection,
|
|
11656
11696
|
mode: "lowest",
|
|
11657
|
-
match: (n) => import_slate10.Editor.isBlock(editor, n)
|
|
11697
|
+
match: (n) => !import_slate10.Editor.isEditor(n) && n.type !== "text" && import_slate10.Editor.isBlock(editor, n)
|
|
11658
11698
|
}));
|
|
11659
11699
|
const nodesWithLists = {};
|
|
11660
11700
|
const unwrapCandidates = [];
|
|
11661
11701
|
nodes.forEach(([node, path2]) => {
|
|
11662
11702
|
const parentList = getBlockParentList(editor, path2);
|
|
11703
|
+
node = node;
|
|
11663
11704
|
if (parentList) {
|
|
11664
11705
|
unwrapCandidates.push(node);
|
|
11665
11706
|
if (!nodesWithLists[parentList[1].length]) {
|
|
@@ -11769,7 +11810,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
11769
11810
|
import_slate11.Editor.withoutNormalizing(editor, () => {
|
|
11770
11811
|
const { anchor } = selection;
|
|
11771
11812
|
const [textNode, textNodePath] = import_slate11.Editor.node(editor, anchor.path);
|
|
11772
|
-
if (!textNode || textNode.type !== "text" ||
|
|
11813
|
+
if (!textNode || import_slate11.Editor.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode)) {
|
|
11773
11814
|
result = false;
|
|
11774
11815
|
return;
|
|
11775
11816
|
}
|
|
@@ -11781,7 +11822,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
11781
11822
|
}
|
|
11782
11823
|
const listItemPath = import_slate11.Path.parent(paragraphPath);
|
|
11783
11824
|
const [listItem] = import_slate11.Editor.node(editor, listItemPath);
|
|
11784
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
11825
|
+
if (!listItem || import_slate11.Editor.isEditor(listItem) || listItem.type !== "list_item") {
|
|
11785
11826
|
if (shouldWrap) {
|
|
11786
11827
|
wrapIntoList(editor, targetListType, selection);
|
|
11787
11828
|
return;
|
|
@@ -11791,7 +11832,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
11791
11832
|
}
|
|
11792
11833
|
const listPath = import_slate11.Path.parent(listItemPath);
|
|
11793
11834
|
const [list] = import_slate11.Editor.node(editor, listPath);
|
|
11794
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11835
|
+
if (!list || import_slate11.Editor.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11795
11836
|
if (shouldWrap) {
|
|
11796
11837
|
wrapIntoList(editor, targetListType, selection);
|
|
11797
11838
|
return;
|
|
@@ -11873,7 +11914,7 @@ function getListTypeAtSelectionStart(editor) {
|
|
|
11873
11914
|
const startPoint = import_slate13.Range.start(selection);
|
|
11874
11915
|
const listEntry = import_slate13.Editor.above(editor, {
|
|
11875
11916
|
at: startPoint,
|
|
11876
|
-
match: (n) => n.type === "ol_list" || n.type === "ul_list"
|
|
11917
|
+
match: (n) => !import_slate13.Editor.isEditor(n) && (n.type === "ol_list" || n.type === "ul_list")
|
|
11877
11918
|
});
|
|
11878
11919
|
if (listEntry) {
|
|
11879
11920
|
const [listNode] = listEntry;
|
|
@@ -11896,11 +11937,11 @@ var setLink = (editor, link, selection) => {
|
|
|
11896
11937
|
const format = link ? "rgba(71, 120, 245, 1)" : "rgb(20, 21, 26)";
|
|
11897
11938
|
import_slate14.Editor.addMark(editor, "fontColor", format);
|
|
11898
11939
|
for (const [node, path2] of import_slate14.Editor.nodes(editor, {
|
|
11899
|
-
match: (n) => n.type === "text"
|
|
11940
|
+
match: (n) => !import_slate14.Editor.isEditor(n) && n.type === "text"
|
|
11900
11941
|
})) {
|
|
11901
11942
|
const nodeRange = import_slate14.Editor.range(editor, path2);
|
|
11902
11943
|
import_slate14.Transforms.select(editor, nodeRange);
|
|
11903
|
-
import_slate14.Transforms.setNodes(editor, { link }, { split: false, match: (n) => n.type === "text" });
|
|
11944
|
+
import_slate14.Transforms.setNodes(editor, { link }, { split: false, match: (n) => !import_slate14.Editor.isEditor(n) && n.type === "text" });
|
|
11904
11945
|
}
|
|
11905
11946
|
};
|
|
11906
11947
|
|
|
@@ -19738,7 +19779,9 @@ function setNodeChildrenStyles({
|
|
|
19738
19779
|
}) {
|
|
19739
19780
|
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
19740
19781
|
if (editor) {
|
|
19741
|
-
|
|
19782
|
+
const marks = import_slate18.Editor.marks(editor);
|
|
19783
|
+
const fontSize = marks?.fontSize ? marks.fontSize === "auto" ? conf.DEFAULT_TEXT_STYLES.fontSize : marks.fontSize : conf.DEFAULT_TEXT_STYLES.fontSize;
|
|
19784
|
+
fontStyles = marks ? { ...conf.DEFAULT_TEXT_STYLES, ...marks, fontSize } : conf.DEFAULT_TEXT_STYLES;
|
|
19742
19785
|
}
|
|
19743
19786
|
switch (node2.type) {
|
|
19744
19787
|
case "heading_one":
|
|
@@ -19788,6 +19831,9 @@ function setNodeStyles({
|
|
|
19788
19831
|
editor,
|
|
19789
19832
|
horisontalAlignment
|
|
19790
19833
|
}) {
|
|
19834
|
+
if (node2.type === "list_item") {
|
|
19835
|
+
return;
|
|
19836
|
+
}
|
|
19791
19837
|
if (node2.type === "ol_list" || node2.type === "ul_list") {
|
|
19792
19838
|
node2.listLevel = listLevel;
|
|
19793
19839
|
for (const listItem of node2.children) {
|
|
@@ -19938,9 +19984,10 @@ class MarkdownProcessor {
|
|
|
19938
19984
|
} else {
|
|
19939
19985
|
const lastParagraphPath = this.getText().length - 1;
|
|
19940
19986
|
const lastParagraph = this.getText()[lastParagraphPath];
|
|
19987
|
+
const lastParagraphText = lastParagraph.children[lastParagraph.children.length - 1];
|
|
19941
19988
|
const insertLocation = {
|
|
19942
19989
|
path: [lastParagraphPath, lastParagraph.children.length - 1],
|
|
19943
|
-
offset:
|
|
19990
|
+
offset: lastParagraphText.text.length
|
|
19944
19991
|
};
|
|
19945
19992
|
import_slate19.Transforms.insertText(this.editor, combinedText, {
|
|
19946
19993
|
at: insertLocation
|
|
@@ -20005,7 +20052,7 @@ function getFirstSelectionLink(editor, selection) {
|
|
|
20005
20052
|
}
|
|
20006
20053
|
for (const [node2] of import_slate22.Editor.nodes(editor, {
|
|
20007
20054
|
at: selection,
|
|
20008
|
-
match: (n) => !!n.link
|
|
20055
|
+
match: (n) => ("link" in n) && !!n.link
|
|
20009
20056
|
})) {
|
|
20010
20057
|
return node2.link;
|
|
20011
20058
|
}
|
|
@@ -20955,14 +21002,6 @@ class RichTextCommand {
|
|
|
20955
21002
|
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
20956
21003
|
}
|
|
20957
21004
|
}));
|
|
20958
|
-
case "setBlockType":
|
|
20959
|
-
return items.map((id) => ({
|
|
20960
|
-
item: id,
|
|
20961
|
-
operation: {
|
|
20962
|
-
...this.operation,
|
|
20963
|
-
type: this.board.items.getById(id)?.getRichText()?.getBlockType() || "paragraph"
|
|
20964
|
-
}
|
|
20965
|
-
}));
|
|
20966
21005
|
case "setFontStyle":
|
|
20967
21006
|
return items.map((id) => ({
|
|
20968
21007
|
item: id,
|
|
@@ -21065,7 +21104,8 @@ class RichTextGroupCommand {
|
|
|
21065
21104
|
class: "RichText",
|
|
21066
21105
|
method: "edit",
|
|
21067
21106
|
item: [richText.getId() ?? ""],
|
|
21068
|
-
ops
|
|
21107
|
+
ops,
|
|
21108
|
+
selection: null
|
|
21069
21109
|
}
|
|
21070
21110
|
});
|
|
21071
21111
|
}
|
|
@@ -21082,7 +21122,8 @@ class RichTextGroupCommand {
|
|
|
21082
21122
|
class: "RichText",
|
|
21083
21123
|
method: "edit",
|
|
21084
21124
|
item: [richText.getId() ?? ""],
|
|
21085
|
-
ops: ops.map((op) => import_slate33.Operation.inverse(op)).reverse()
|
|
21125
|
+
ops: ops.map((op) => import_slate33.Operation.inverse(op)).reverse(),
|
|
21126
|
+
selection: null
|
|
21086
21127
|
}
|
|
21087
21128
|
});
|
|
21088
21129
|
}
|
|
@@ -21731,6 +21772,9 @@ class Comment2 {
|
|
|
21731
21772
|
const anchor = this.anchor.copy();
|
|
21732
21773
|
return new Mbr(anchor.x, anchor.y, anchor.x, anchor.y);
|
|
21733
21774
|
}
|
|
21775
|
+
getPathMbr() {
|
|
21776
|
+
return this.getMbr();
|
|
21777
|
+
}
|
|
21734
21778
|
getNearestEdgePointTo(point3) {
|
|
21735
21779
|
return this.anchor;
|
|
21736
21780
|
}
|
|
@@ -22218,6 +22262,9 @@ class BaseItem extends Mbr {
|
|
|
22218
22262
|
onRemove() {
|
|
22219
22263
|
this.onRemoveCallbacks.forEach((cb) => cb());
|
|
22220
22264
|
}
|
|
22265
|
+
getPathMbr() {
|
|
22266
|
+
return this.getMbr().copy();
|
|
22267
|
+
}
|
|
22221
22268
|
render(context) {}
|
|
22222
22269
|
renderHTML(documentFactory) {
|
|
22223
22270
|
return documentFactory.createElement("div");
|
|
@@ -22743,7 +22790,10 @@ class RichText extends BaseItem {
|
|
|
22743
22790
|
}
|
|
22744
22791
|
getFontSize() {
|
|
22745
22792
|
const marks = this.editor.getSelectionMarks();
|
|
22746
|
-
|
|
22793
|
+
let fontSize = marks?.fontSize ?? this.initialTextStyles.fontSize;
|
|
22794
|
+
if (fontSize === "auto") {
|
|
22795
|
+
fontSize = this.initialTextStyles.fontSize;
|
|
22796
|
+
}
|
|
22747
22797
|
if (this.autoSize) {
|
|
22748
22798
|
return fontSize * this.autoSizeScale;
|
|
22749
22799
|
}
|
|
@@ -22761,7 +22811,7 @@ class RichText extends BaseItem {
|
|
|
22761
22811
|
for (const [node2] of textNodes) {
|
|
22762
22812
|
const fontSize = node2.fontSize || node2 && node2.fontSize;
|
|
22763
22813
|
if (fontSize) {
|
|
22764
|
-
fontSizes.push(fontSize);
|
|
22814
|
+
fontSizes.push(fontSize === "auto" ? this.initialTextStyles.fontSize : fontSize);
|
|
22765
22815
|
}
|
|
22766
22816
|
}
|
|
22767
22817
|
if (fontSizes.length > 0) {
|
|
@@ -22774,7 +22824,7 @@ class RichText extends BaseItem {
|
|
|
22774
22824
|
return marks?.fontHighlight ?? this.initialTextStyles.fontHighlight;
|
|
22775
22825
|
}
|
|
22776
22826
|
getBlockType() {
|
|
22777
|
-
const blockNode = getSelectedBlockNode(this.editor);
|
|
22827
|
+
const blockNode = getSelectedBlockNode(this.editor.editor);
|
|
22778
22828
|
return blockNode ? blockNode.type : "paragraph";
|
|
22779
22829
|
}
|
|
22780
22830
|
getHorisontalAlignment() {
|
|
@@ -22805,16 +22855,18 @@ class RichText extends BaseItem {
|
|
|
22805
22855
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
22806
22856
|
if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
22807
22857
|
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
22815
|
-
|
|
22816
|
-
|
|
22817
|
-
|
|
22858
|
+
if (domRange) {
|
|
22859
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
22860
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
22861
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
22862
|
+
exactMatch: false,
|
|
22863
|
+
suppressThrow: false
|
|
22864
|
+
});
|
|
22865
|
+
if (slatePoint) {
|
|
22866
|
+
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
22867
|
+
this.editorTransforms.select(this.editor.editor, nRange);
|
|
22868
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
22869
|
+
}
|
|
22818
22870
|
}
|
|
22819
22871
|
} else {
|
|
22820
22872
|
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
@@ -40023,6 +40075,9 @@ class Shape extends BaseItem {
|
|
|
40023
40075
|
getMbr() {
|
|
40024
40076
|
return this.mbr.copy();
|
|
40025
40077
|
}
|
|
40078
|
+
getPathMbr() {
|
|
40079
|
+
return this.getPath().getMbr();
|
|
40080
|
+
}
|
|
40026
40081
|
getNearestEdgePointTo(point5) {
|
|
40027
40082
|
return this.path.getNearestEdgePointTo(point5);
|
|
40028
40083
|
}
|
|
@@ -45803,13 +45858,8 @@ function createCanvasDrawer(board) {
|
|
|
45803
45858
|
// src/Selection/QuickAddButtons/quickAddHelpers.ts
|
|
45804
45859
|
function getControlPointData(item, index2, isRichText = false) {
|
|
45805
45860
|
const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
|
|
45806
|
-
const width2 = item.
|
|
45807
|
-
let height3;
|
|
45808
|
-
if (item.itemType === "Shape" && index2 !== 2 && index2 !== 3) {
|
|
45809
|
-
height3 = item.getPath().getMbr().getHeight();
|
|
45810
|
-
} else {
|
|
45811
|
-
height3 = item.getMbr().getHeight();
|
|
45812
|
-
}
|
|
45861
|
+
const width2 = item.getPathMbr().getWidth();
|
|
45862
|
+
let height3 = item.getPathMbr().getHeight();
|
|
45813
45863
|
const adjMapScaled = {
|
|
45814
45864
|
0: { x: 0, y: height3 / 2 / itemScale.y },
|
|
45815
45865
|
1: {
|
|
@@ -45842,7 +45892,7 @@ function quickAddItem(board, type, connector) {
|
|
|
45842
45892
|
optionalItem = new Sticker(board);
|
|
45843
45893
|
break;
|
|
45844
45894
|
case "AINode":
|
|
45845
|
-
optionalItem = createAINode2(board, startPoint?.item?.getId()
|
|
45895
|
+
optionalItem = createAINode2(board, 3, "item" in startPoint ? startPoint?.item?.getId() : undefined);
|
|
45846
45896
|
break;
|
|
45847
45897
|
}
|
|
45848
45898
|
let itemMbr = optionalItem.getMbr();
|
|
@@ -45869,20 +45919,25 @@ function quickAddItem(board, type, connector) {
|
|
|
45869
45919
|
if ("text" in guarded && guarded.itemType !== "AINode" && guarded.itemType !== "RichText") {
|
|
45870
45920
|
delete guarded.text;
|
|
45871
45921
|
}
|
|
45922
|
+
if (!itemData.transformation) {
|
|
45923
|
+
itemData.transformation = new DefaultTransformationData;
|
|
45924
|
+
}
|
|
45872
45925
|
itemData.transformation.translateX = endPoint.x;
|
|
45873
45926
|
itemData.transformation.translateY = endPoint.y;
|
|
45874
45927
|
const lines = connector.lines.getSegments();
|
|
45875
45928
|
const lastLine = lines[lines.length - 1];
|
|
45876
|
-
|
|
45929
|
+
const lastLineStart = lastLine.getStartPoint();
|
|
45930
|
+
const lastLineEnd = lastLine.getEndPoint();
|
|
45931
|
+
let dir2 = getDirection(lastLineStart, lastLineEnd);
|
|
45932
|
+
const firstLineStart = lines[0].getEndPoint();
|
|
45877
45933
|
if (!dir2) {
|
|
45878
|
-
const
|
|
45879
|
-
const
|
|
45880
|
-
const yDiff = Math.abs(firstLine.start.y - lastLine.end.y);
|
|
45934
|
+
const xDiff = Math.abs(firstLineStart.x - lastLineEnd.x);
|
|
45935
|
+
const yDiff = Math.abs(firstLineStart.y - lastLineEnd.y);
|
|
45881
45936
|
dir2 = xDiff > yDiff ? "horizontal" : "vertical";
|
|
45882
45937
|
}
|
|
45883
45938
|
let dirIndex = -1;
|
|
45884
45939
|
if (dir2 === "vertical") {
|
|
45885
|
-
if (
|
|
45940
|
+
if (firstLineStart.y > lastLineEnd.y) {
|
|
45886
45941
|
itemData.transformation.translateX -= itemMbr.getWidth() / 2;
|
|
45887
45942
|
itemData.transformation.translateY -= itemMbr.getHeight();
|
|
45888
45943
|
dirIndex = 3;
|
|
@@ -45891,7 +45946,7 @@ function quickAddItem(board, type, connector) {
|
|
|
45891
45946
|
dirIndex = 2;
|
|
45892
45947
|
}
|
|
45893
45948
|
} else if (dir2 === "horizontal") {
|
|
45894
|
-
if (
|
|
45949
|
+
if (firstLineStart.x > lastLineEnd.x) {
|
|
45895
45950
|
itemData.transformation.translateX -= itemMbr.getWidth();
|
|
45896
45951
|
itemData.transformation.translateY -= itemMbr.getHeight() / 2;
|
|
45897
45952
|
dirIndex = 1;
|
|
@@ -45913,7 +45968,7 @@ function quickAddItem(board, type, connector) {
|
|
|
45913
45968
|
connector.setEndPoint(newEndPoint);
|
|
45914
45969
|
board.selection.removeAll();
|
|
45915
45970
|
board.selection.add(added);
|
|
45916
|
-
if (added
|
|
45971
|
+
if (added instanceof RichText || added instanceof AINode) {
|
|
45917
45972
|
const text5 = added.getRichText();
|
|
45918
45973
|
text5.editor.setMaxWidth(text5.editor.maxWidth || 600);
|
|
45919
45974
|
board.selection.editText();
|
|
@@ -45921,7 +45976,7 @@ function quickAddItem(board, type, connector) {
|
|
|
45921
45976
|
board.selection.setContext("EditUnderPointer");
|
|
45922
45977
|
}
|
|
45923
45978
|
}
|
|
45924
|
-
function createAINode2(board,
|
|
45979
|
+
function createAINode2(board, directionIndex, parentNodeId) {
|
|
45925
45980
|
const node2 = new AINode(board, true, parentNodeId, undefined, directionIndex);
|
|
45926
45981
|
const nodeRichText = node2.getRichText();
|
|
45927
45982
|
nodeRichText.applyMaxWidth(600);
|
|
@@ -45955,17 +46010,17 @@ function getQuickAddButtons(selection, board) {
|
|
|
45955
46010
|
let quickAddItems = undefined;
|
|
45956
46011
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
45957
46012
|
const connectorStorage = new SessionStorage;
|
|
45958
|
-
const currMbr = selectedItem.
|
|
46013
|
+
const currMbr = selectedItem.getPathMbr();
|
|
45959
46014
|
const selectedItemData = selectedItem.serialize();
|
|
45960
|
-
const width2 =
|
|
45961
|
-
const height3 =
|
|
46015
|
+
const width2 = currMbr.getWidth();
|
|
46016
|
+
const height3 = currMbr.getHeight();
|
|
45962
46017
|
let offsetX = width2;
|
|
45963
46018
|
let offsetY = height3;
|
|
45964
46019
|
let newWidth = width2;
|
|
45965
46020
|
let newHeight = height3;
|
|
45966
46021
|
let itemData;
|
|
45967
46022
|
if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
|
|
45968
|
-
const item = selectedItem.itemType === "AINode" ? createAINode2(board, selectedItem.getId()
|
|
46023
|
+
const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
|
|
45969
46024
|
newWidth = item.getMbr().getWidth();
|
|
45970
46025
|
newHeight = item.getMbr().getHeight();
|
|
45971
46026
|
itemData = item.serialize();
|
|
@@ -46014,9 +46069,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
46014
46069
|
const endPoints = getQuickButtonsPositions(newMbr);
|
|
46015
46070
|
const reverseIndexMap = { 0: 1, 1: 0, 2: 3, 3: 2 };
|
|
46016
46071
|
const connectorEndPoint = endPoints?.positions[reverseIndexMap[index2]] || new Point;
|
|
46017
|
-
const fontSize = selectedItem
|
|
46072
|
+
const fontSize = selectedItem instanceof RichText ? selectedItem.getFontSize() : 14;
|
|
46018
46073
|
const newItem = board.createItem(board.getNewItemId(), newItemData);
|
|
46019
|
-
if (newItem
|
|
46074
|
+
if (newItem instanceof RichText) {
|
|
46020
46075
|
const storage = new SessionStorage;
|
|
46021
46076
|
storage.setFontSize("RichText", fontSize);
|
|
46022
46077
|
newItem.editor.selectWholeText();
|
|
@@ -46029,6 +46084,10 @@ function getQuickAddButtons(selection, board) {
|
|
|
46029
46084
|
const scaleX = newItemMbr.getWidth() / 100;
|
|
46030
46085
|
const scaleY = newItemMbr.getHeight() / 100;
|
|
46031
46086
|
shapeData.transformation = {
|
|
46087
|
+
isLocked: false,
|
|
46088
|
+
rotate: 0,
|
|
46089
|
+
translateX: 0,
|
|
46090
|
+
translateY: 0,
|
|
46032
46091
|
...newItemData.transformation,
|
|
46033
46092
|
scaleX,
|
|
46034
46093
|
scaleY
|
|
@@ -46085,7 +46144,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
46085
46144
|
}
|
|
46086
46145
|
let pathCenter;
|
|
46087
46146
|
if (single.itemType === "Shape") {
|
|
46088
|
-
pathCenter = single.
|
|
46147
|
+
pathCenter = single.getPathMbr().getCenter();
|
|
46089
46148
|
}
|
|
46090
46149
|
const center = itemMbr.getCenter();
|
|
46091
46150
|
const width2 = itemMbr.getWidth();
|
|
@@ -50454,7 +50513,7 @@ class Presence {
|
|
|
50454
50513
|
};
|
|
50455
50514
|
});
|
|
50456
50515
|
ctx2.restore();
|
|
50457
|
-
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop);
|
|
50516
|
+
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop) || null;
|
|
50458
50517
|
};
|
|
50459
50518
|
renderLoop();
|
|
50460
50519
|
}
|
|
@@ -51754,7 +51813,7 @@ class SpatialIndex {
|
|
|
51754
51813
|
return this.itemsIndex.getRectsEnclosedOrCrossedBy(new Mbr(left, top, right, bottom));
|
|
51755
51814
|
}
|
|
51756
51815
|
getComments() {
|
|
51757
|
-
return this.itemsArray.filter((item) => item instanceof
|
|
51816
|
+
return this.itemsArray.filter((item) => item instanceof Comment2);
|
|
51758
51817
|
}
|
|
51759
51818
|
getMbr() {
|
|
51760
51819
|
return this.Mbr;
|
|
@@ -51878,10 +51937,10 @@ class Items {
|
|
|
51878
51937
|
}
|
|
51879
51938
|
const { nearest } = enclosed.reduce((acc, item) => {
|
|
51880
51939
|
const area = item.getMbr().getHeight() * item.getMbr().getWidth();
|
|
51881
|
-
if (item
|
|
51940
|
+
if (item instanceof Drawing && !item.isPointNearLine(this.pointer.point)) {
|
|
51882
51941
|
return acc;
|
|
51883
51942
|
}
|
|
51884
|
-
const isItemTransparent = item
|
|
51943
|
+
const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
|
|
51885
51944
|
const itemZIndex = this.getZIndex(item);
|
|
51886
51945
|
const accZIndex = this.getZIndex(acc.nearest);
|
|
51887
51946
|
if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
|
|
@@ -51912,7 +51971,7 @@ class Items {
|
|
|
51912
51971
|
}
|
|
51913
51972
|
getLinkedConnectorsById(id) {
|
|
51914
51973
|
return this.listAll().filter((item) => {
|
|
51915
|
-
if (item
|
|
51974
|
+
if (!(item instanceof Connector2)) {
|
|
51916
51975
|
return false;
|
|
51917
51976
|
}
|
|
51918
51977
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -51927,7 +51986,7 @@ class Items {
|
|
|
51927
51986
|
return [];
|
|
51928
51987
|
}
|
|
51929
51988
|
return this.listAll().filter((item) => {
|
|
51930
|
-
if (item
|
|
51989
|
+
if (!(item instanceof Connector2) || !item.isConnected()) {
|
|
51931
51990
|
return false;
|
|
51932
51991
|
}
|
|
51933
51992
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -52102,7 +52161,7 @@ class SelectionItems {
|
|
|
52102
52161
|
return ids;
|
|
52103
52162
|
}
|
|
52104
52163
|
getSingle() {
|
|
52105
|
-
return this.isSingle() ? this.items.values().next().value : null;
|
|
52164
|
+
return this.isSingle() ? this.items.values().next().value || null : null;
|
|
52106
52165
|
}
|
|
52107
52166
|
listByIds(itemIdList) {
|
|
52108
52167
|
return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
|
|
@@ -52150,7 +52209,7 @@ class ConnectorTransformer extends Tool {
|
|
|
52150
52209
|
getConnector(items) {
|
|
52151
52210
|
if (items.isSingle()) {
|
|
52152
52211
|
const connector = items.getSingle();
|
|
52153
|
-
if (connector
|
|
52212
|
+
if (connector instanceof Connector2) {
|
|
52154
52213
|
return connector;
|
|
52155
52214
|
}
|
|
52156
52215
|
}
|
|
@@ -53620,10 +53679,10 @@ class BoardSelection {
|
|
|
53620
53679
|
}
|
|
53621
53680
|
copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
|
|
53622
53681
|
}
|
|
53623
|
-
copy(skipImageBlobCopy
|
|
53682
|
+
copy(skipImageBlobCopy) {
|
|
53624
53683
|
const copiedItemsMap = {};
|
|
53625
53684
|
const single = this.items.getSingle();
|
|
53626
|
-
if (!skipImageBlobCopy && single && single
|
|
53685
|
+
if (!skipImageBlobCopy && single && single instanceof ImageItem) {
|
|
53627
53686
|
this.handleItemCopy(single, copiedItemsMap);
|
|
53628
53687
|
return { imageElement: single.image, imageData: copiedItemsMap };
|
|
53629
53688
|
}
|
|
@@ -53648,7 +53707,7 @@ class BoardSelection {
|
|
|
53648
53707
|
return copiedItemsMap;
|
|
53649
53708
|
}
|
|
53650
53709
|
cut() {
|
|
53651
|
-
const items = this.copy();
|
|
53710
|
+
const items = this.copy(true);
|
|
53652
53711
|
this.removeFromBoard();
|
|
53653
53712
|
return items;
|
|
53654
53713
|
}
|
|
@@ -53799,7 +53858,7 @@ class BoardSelection {
|
|
|
53799
53858
|
});
|
|
53800
53859
|
Object.values(selectedMap).forEach((val) => {
|
|
53801
53860
|
const parentFrame = this.board.items.getById(val.item.parent);
|
|
53802
|
-
const isParentFrame = parentFrame
|
|
53861
|
+
const isParentFrame = parentFrame instanceof Frame;
|
|
53803
53862
|
const parentFrameId = isParentFrame ? parentFrame.getId() : null;
|
|
53804
53863
|
if (val.nested) {
|
|
53805
53864
|
const isRemoveChildFromFrame = Object.values(selectedMap).some((val2) => val2.nested && val2.nested.getId() !== parentFrameId);
|
|
@@ -53814,7 +53873,7 @@ class BoardSelection {
|
|
|
53814
53873
|
console.warn(`Didnt find frame with id ${val.item.parent}`);
|
|
53815
53874
|
}
|
|
53816
53875
|
}
|
|
53817
|
-
if (val.item
|
|
53876
|
+
if (val.item instanceof Frame && checkFrames) {
|
|
53818
53877
|
const currFrame = val.item;
|
|
53819
53878
|
const currMbr = currFrame.getMbr();
|
|
53820
53879
|
const children = val.item.getChildrenIds().map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
|
|
@@ -54222,12 +54281,6 @@ class BoardSelection {
|
|
|
54222
54281
|
text5.setEditorFocus(this.context);
|
|
54223
54282
|
}
|
|
54224
54283
|
}
|
|
54225
|
-
getMediaStorageIds() {
|
|
54226
|
-
return this.items.list().filter((item) => {
|
|
54227
|
-
const shouldClearStorageUsage = item.itemType === "Image" || item.itemType === "Video" && item.getIsStorageUrl() || item.itemType === "Audio" && item.getIsStorageUrl();
|
|
54228
|
-
return shouldClearStorageUsage;
|
|
54229
|
-
}).map((item) => item.getStorageId());
|
|
54230
|
-
}
|
|
54231
54284
|
removeFromBoard() {
|
|
54232
54285
|
const isLocked = this.items.list().some((item) => item.transformation.isLocked);
|
|
54233
54286
|
if (isLocked) {
|
|
@@ -54242,7 +54295,6 @@ class BoardSelection {
|
|
|
54242
54295
|
const connectors = itemIds.flatMap((id) => {
|
|
54243
54296
|
return this.board.items.getLinkedConnectorsById(id);
|
|
54244
54297
|
}).map((connector) => connector.getId());
|
|
54245
|
-
conf.hooks.beforeMediaRemove(this.getMediaStorageIds(), this.board.getBoardId());
|
|
54246
54298
|
this.emit({
|
|
54247
54299
|
class: "Board",
|
|
54248
54300
|
method: "remove",
|
|
@@ -54279,7 +54331,15 @@ class BoardSelection {
|
|
|
54279
54331
|
this.board.sendToBack(this.items.list());
|
|
54280
54332
|
}
|
|
54281
54333
|
async duplicate() {
|
|
54282
|
-
const mediaIds =
|
|
54334
|
+
const mediaIds = [];
|
|
54335
|
+
this.items.list().forEach((item) => {
|
|
54336
|
+
if ("getStorageId" in item) {
|
|
54337
|
+
const storageId = item.getStorageId();
|
|
54338
|
+
if (storageId) {
|
|
54339
|
+
mediaIds.push(storageId);
|
|
54340
|
+
}
|
|
54341
|
+
}
|
|
54342
|
+
});
|
|
54283
54343
|
const canDuplicate = mediaIds.length ? await conf.hooks.beforeMediaUpload(mediaIds, this.board.getBoardId()) : true;
|
|
54284
54344
|
if (!canDuplicate) {
|
|
54285
54345
|
return;
|
|
@@ -54347,7 +54407,7 @@ class BoardSelection {
|
|
|
54347
54407
|
}
|
|
54348
54408
|
}
|
|
54349
54409
|
const contextItems = [];
|
|
54350
|
-
if (single && single
|
|
54410
|
+
if (single && single instanceof AINode) {
|
|
54351
54411
|
const contextItemsIds = single.getContextItems();
|
|
54352
54412
|
if (contextItemsIds.length) {
|
|
54353
54413
|
const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
|
|
@@ -54369,7 +54429,7 @@ class BoardSelection {
|
|
|
54369
54429
|
}
|
|
54370
54430
|
}
|
|
54371
54431
|
contextItems.forEach((item) => {
|
|
54372
|
-
if (item
|
|
54432
|
+
if (item instanceof AINode) {
|
|
54373
54433
|
const path2 = item.getPath();
|
|
54374
54434
|
path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
|
|
54375
54435
|
path2.setBorderWidth(2);
|
|
@@ -54384,6 +54444,416 @@ class BoardSelection {
|
|
|
54384
54444
|
});
|
|
54385
54445
|
}
|
|
54386
54446
|
}
|
|
54447
|
+
// src/public/customWebComponents.js
|
|
54448
|
+
var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
|
|
54449
|
+
class RichTextElement extends HTMLElement {
|
|
54450
|
+
constructor() {
|
|
54451
|
+
super();
|
|
54452
|
+
}
|
|
54453
|
+
}
|
|
54454
|
+
|
|
54455
|
+
class ShapeItemElement extends HTMLElement {
|
|
54456
|
+
constructor() {
|
|
54457
|
+
super();
|
|
54458
|
+
}
|
|
54459
|
+
}
|
|
54460
|
+
|
|
54461
|
+
class StickerElement extends HTMLElement {
|
|
54462
|
+
constructor() {
|
|
54463
|
+
super();
|
|
54464
|
+
}
|
|
54465
|
+
}
|
|
54466
|
+
|
|
54467
|
+
class DrawingElement extends HTMLElement {
|
|
54468
|
+
constructor() {
|
|
54469
|
+
super();
|
|
54470
|
+
}
|
|
54471
|
+
}
|
|
54472
|
+
|
|
54473
|
+
class ConnectorElement extends HTMLElement {
|
|
54474
|
+
constructor() {
|
|
54475
|
+
super();
|
|
54476
|
+
}
|
|
54477
|
+
}
|
|
54478
|
+
|
|
54479
|
+
class FrameItemElement extends HTMLElement {
|
|
54480
|
+
constructor() {
|
|
54481
|
+
super();
|
|
54482
|
+
}
|
|
54483
|
+
}
|
|
54484
|
+
|
|
54485
|
+
class ImageItemElement extends HTMLElement {
|
|
54486
|
+
constructor() {
|
|
54487
|
+
super();
|
|
54488
|
+
}
|
|
54489
|
+
}
|
|
54490
|
+
|
|
54491
|
+
class LinkItemElement extends HTMLElement {
|
|
54492
|
+
constructor() {
|
|
54493
|
+
super();
|
|
54494
|
+
}
|
|
54495
|
+
}
|
|
54496
|
+
|
|
54497
|
+
class AINodeItemElement extends HTMLElement {
|
|
54498
|
+
constructor() {
|
|
54499
|
+
super();
|
|
54500
|
+
}
|
|
54501
|
+
}
|
|
54502
|
+
|
|
54503
|
+
class VideoItemElement extends HTMLElement {
|
|
54504
|
+
constructor() {
|
|
54505
|
+
super();
|
|
54506
|
+
}
|
|
54507
|
+
}
|
|
54508
|
+
|
|
54509
|
+
class CommentElement extends HTMLElement {
|
|
54510
|
+
constructor() {
|
|
54511
|
+
super();
|
|
54512
|
+
}
|
|
54513
|
+
}
|
|
54514
|
+
|
|
54515
|
+
class AudioItemElement extends HTMLElement {
|
|
54516
|
+
constructor() {
|
|
54517
|
+
super();
|
|
54518
|
+
}
|
|
54519
|
+
}
|
|
54520
|
+
|
|
54521
|
+
customElements.define("rich-text", RichTextElement);
|
|
54522
|
+
customElements.define("shape-item", ShapeItemElement);
|
|
54523
|
+
customElements.define("sticker-item", StickerElement);
|
|
54524
|
+
customElements.define("drawing-item", DrawingElement);
|
|
54525
|
+
customElements.define("connector-item", ConnectorElement);
|
|
54526
|
+
customElements.define("frame-item", FrameItemElement);
|
|
54527
|
+
customElements.define("image-item", ImageItemElement);
|
|
54528
|
+
customElements.define("link-item", LinkItemElement);
|
|
54529
|
+
customElements.define("ainode-item", AINodeItemElement);
|
|
54530
|
+
customElements.define("video-item", VideoItemElement);
|
|
54531
|
+
customElements.define("comment-item", CommentElement);
|
|
54532
|
+
customElements.define("audio-item", AudioItemElement);
|
|
54533
|
+
|
|
54534
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
54535
|
+
const itemsDiv = document.querySelector("#items");
|
|
54536
|
+
if (!itemsDiv) {
|
|
54537
|
+
console.error("ITEMS DIV NOT FOUND!");
|
|
54538
|
+
return;
|
|
54539
|
+
}
|
|
54540
|
+
let isDragging = false;
|
|
54541
|
+
let startX, startY;
|
|
54542
|
+
let translateX = 0;
|
|
54543
|
+
let translateY = 0;
|
|
54544
|
+
let scale = 1;
|
|
54545
|
+
|
|
54546
|
+
itemsDiv.style.transformOrigin = "0 0";
|
|
54547
|
+
document.body.style.cursor = "grab";
|
|
54548
|
+
|
|
54549
|
+
function updateTransform() {
|
|
54550
|
+
itemsDiv.style.transform =
|
|
54551
|
+
"translate(" +
|
|
54552
|
+
translateX +
|
|
54553
|
+
"px, " +
|
|
54554
|
+
translateY +
|
|
54555
|
+
"px) scale(" +
|
|
54556
|
+
scale +
|
|
54557
|
+
")";
|
|
54558
|
+
}
|
|
54559
|
+
|
|
54560
|
+
function handleMouseDown(ev) {
|
|
54561
|
+
isDragging = true;
|
|
54562
|
+
startX = ev.clientX;
|
|
54563
|
+
startY = ev.clientY;
|
|
54564
|
+
itemsDiv.style.cursor = "grabbing";
|
|
54565
|
+
}
|
|
54566
|
+
|
|
54567
|
+
function handleMouseMove(ev) {
|
|
54568
|
+
if (!isDragging) {
|
|
54569
|
+
return;
|
|
54570
|
+
}
|
|
54571
|
+
const dx = ev.clientX - startX;
|
|
54572
|
+
const dy = ev.clientY - startY;
|
|
54573
|
+
startX += dx;
|
|
54574
|
+
startY += dy;
|
|
54575
|
+
translateX += dx;
|
|
54576
|
+
translateY += dy;
|
|
54577
|
+
updateTransform();
|
|
54578
|
+
}
|
|
54579
|
+
|
|
54580
|
+
function handleMouseUp(ev) {
|
|
54581
|
+
if (!isDragging) {
|
|
54582
|
+
return;
|
|
54583
|
+
}
|
|
54584
|
+
isDragging = false;
|
|
54585
|
+
itemsDiv.style.cursor = "grab";
|
|
54586
|
+
}
|
|
54587
|
+
|
|
54588
|
+
function handleWheel(ev) {
|
|
54589
|
+
ev.preventDefault();
|
|
54590
|
+
const factor = ev.deltaY < 0 ? 1.1 : 0.9;
|
|
54591
|
+
translateX = ev.clientX - (ev.clientX - translateX) * factor;
|
|
54592
|
+
translateY = ev.clientY - (ev.clientY - translateY) * factor;
|
|
54593
|
+
scale *= factor;
|
|
54594
|
+
updateTransform();
|
|
54595
|
+
}
|
|
54596
|
+
|
|
54597
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
54598
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
54599
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
54600
|
+
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
54601
|
+
|
|
54602
|
+
const titlePanel = document.createElement("div");
|
|
54603
|
+
titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
|
|
54604
|
+
titlePanel.style.position = "fixed";
|
|
54605
|
+
titlePanel.style.left = "12px";
|
|
54606
|
+
titlePanel.style.top = "12px";
|
|
54607
|
+
titlePanel.style.borderRadius = "12px";
|
|
54608
|
+
titlePanel.style.backgroundColor = "#ffff";
|
|
54609
|
+
titlePanel.style.display = "flex";
|
|
54610
|
+
titlePanel.style.alignItems = "center";
|
|
54611
|
+
titlePanel.style.gap = "8px";
|
|
54612
|
+
titlePanel.style.padding = "0 12px";
|
|
54613
|
+
titlePanel.style.height = "48px";
|
|
54614
|
+
const editButton = document.createElement("button");
|
|
54615
|
+
const editIcon = document.createElementNS(
|
|
54616
|
+
"http://www.w3.org/2000/svg",
|
|
54617
|
+
"svg",
|
|
54618
|
+
);
|
|
54619
|
+
editIcon.setAttribute("width", "13");
|
|
54620
|
+
editIcon.setAttribute("height", "13");
|
|
54621
|
+
editIcon.setAttribute("viewBox", "0 0 13 13");
|
|
54622
|
+
editIcon.setAttribute("fill", "none");
|
|
54623
|
+
editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
54624
|
+
const editIconPath = document.createElementNS(
|
|
54625
|
+
"http://www.w3.org/2000/svg",
|
|
54626
|
+
"path",
|
|
54627
|
+
);
|
|
54628
|
+
editIconPath.setAttribute(
|
|
54629
|
+
"d",
|
|
54630
|
+
"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",
|
|
54631
|
+
);
|
|
54632
|
+
editIconPath.setAttribute("fill", "#ffff");
|
|
54633
|
+
editIcon.appendChild(editIconPath);
|
|
54634
|
+
editButton.appendChild(editIcon);
|
|
54635
|
+
const editFileText = document.createElement("p");
|
|
54636
|
+
const isSnapshotInIframe =
|
|
54637
|
+
window.parent &&
|
|
54638
|
+
window.parent !== window &&
|
|
54639
|
+
window.parent.location.href.includes("/snapshots/");
|
|
54640
|
+
editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
|
|
54641
|
+
editButton.appendChild(editFileText);
|
|
54642
|
+
|
|
54643
|
+
editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
|
|
54644
|
+
editButton.style.cursor = "pointer";
|
|
54645
|
+
editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
|
|
54646
|
+
editButton.style.color = "#ffff";
|
|
54647
|
+
editButton.style.fontSize = "14px";
|
|
54648
|
+
editButton.style.lineHeight = "20px";
|
|
54649
|
+
editButton.style.display = "flex";
|
|
54650
|
+
editButton.style.alignItems = "center";
|
|
54651
|
+
editButton.style.gap = "8px";
|
|
54652
|
+
editButton.style.padding = "8px";
|
|
54653
|
+
editButton.style.borderRadius = "10px";
|
|
54654
|
+
const separator = document.createElement("div");
|
|
54655
|
+
separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
|
|
54656
|
+
separator.style.height = "100%";
|
|
54657
|
+
const boardName = document.createElement("div");
|
|
54658
|
+
const fileIcon = document.createElementNS(
|
|
54659
|
+
"http://www.w3.org/2000/svg",
|
|
54660
|
+
"svg",
|
|
54661
|
+
);
|
|
54662
|
+
fileIcon.setAttribute("width", "16");
|
|
54663
|
+
fileIcon.setAttribute("height", "18");
|
|
54664
|
+
fileIcon.setAttribute("viewBox", "0 0 16 18");
|
|
54665
|
+
fileIcon.setAttribute("fill", "none");
|
|
54666
|
+
fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
54667
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
54668
|
+
path.setAttribute(
|
|
54669
|
+
"d",
|
|
54670
|
+
"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",
|
|
54671
|
+
);
|
|
54672
|
+
path.setAttribute("fill", "#696B76");
|
|
54673
|
+
fileIcon.appendChild(path);
|
|
54674
|
+
boardName.appendChild(fileIcon);
|
|
54675
|
+
const boardNameTag = document.querySelector('meta[name="board-name"]');
|
|
54676
|
+
let boardNameStr = "Untitled";
|
|
54677
|
+
if (boardNameTag) {
|
|
54678
|
+
boardNameStr = boardNameTag.getAttribute("content");
|
|
54679
|
+
}
|
|
54680
|
+
const p = document.createElement("p");
|
|
54681
|
+
p.textContent = boardNameStr;
|
|
54682
|
+
p.style.fontSize = "16px";
|
|
54683
|
+
p.style.lineHeight = "24px";
|
|
54684
|
+
boardName.appendChild(p);
|
|
54685
|
+
const cloudIcon = document.createElementNS(
|
|
54686
|
+
"http://www.w3.org/2000/svg",
|
|
54687
|
+
"svg",
|
|
54688
|
+
);
|
|
54689
|
+
cloudIcon.setAttribute("width", "20");
|
|
54690
|
+
cloudIcon.setAttribute("height", "18");
|
|
54691
|
+
cloudIcon.setAttribute("viewBox", "0 0 20 18");
|
|
54692
|
+
cloudIcon.setAttribute("fill", "none");
|
|
54693
|
+
cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
54694
|
+
const cloudIconPath = document.createElementNS(
|
|
54695
|
+
"http://www.w3.org/2000/svg",
|
|
54696
|
+
"path",
|
|
54697
|
+
);
|
|
54698
|
+
cloudIconPath.setAttribute(
|
|
54699
|
+
"d",
|
|
54700
|
+
"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",
|
|
54701
|
+
);
|
|
54702
|
+
cloudIconPath.setAttribute("fill", "#696B76");
|
|
54703
|
+
cloudIcon.appendChild(cloudIconPath);
|
|
54704
|
+
boardName.appendChild(cloudIcon);
|
|
54705
|
+
boardName.style.display = "flex";
|
|
54706
|
+
boardName.style.alignItems = "center";
|
|
54707
|
+
boardName.style.gap = "8px";
|
|
54708
|
+
titlePanel.appendChild(boardName);
|
|
54709
|
+
titlePanel.appendChild(separator);
|
|
54710
|
+
titlePanel.appendChild(editButton);
|
|
54711
|
+
document.body.appendChild(titlePanel);
|
|
54712
|
+
|
|
54713
|
+
editButton.onclick = async () => {
|
|
54714
|
+
editButton.disabled = true;
|
|
54715
|
+
editButton.textContent = "Loading...";
|
|
54716
|
+
|
|
54717
|
+
try {
|
|
54718
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
54719
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
54720
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
54721
|
+
document.removeEventListener("wheel", handleWheel, {
|
|
54722
|
+
passive: false,
|
|
54723
|
+
});
|
|
54724
|
+
translateX = 0;
|
|
54725
|
+
translateY = 0;
|
|
54726
|
+
scale = 1;
|
|
54727
|
+
updateTransform();
|
|
54728
|
+
|
|
54729
|
+
const { initBrowserSettings } = await import(
|
|
54730
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
54731
|
+
);
|
|
54732
|
+
initBrowserSettings();
|
|
54733
|
+
|
|
54734
|
+
const { createApp } = await import(
|
|
54735
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
54736
|
+
);
|
|
54737
|
+
|
|
54738
|
+
const app = createApp();
|
|
54739
|
+
window.app = app;
|
|
54740
|
+
const stringed = await app.openAndEditFile();
|
|
54741
|
+
|
|
54742
|
+
if (stringed) {
|
|
54743
|
+
await app.openBoardFromFile();
|
|
54744
|
+
app.getBoard().deserializeHTML(stringed);
|
|
54745
|
+
app.localRender("items");
|
|
54746
|
+
}
|
|
54747
|
+
|
|
54748
|
+
const response = await fetch(
|
|
54749
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
|
|
54750
|
+
);
|
|
54751
|
+
const cssText = await response.text();
|
|
54752
|
+
const styleEl = document.createElement("style");
|
|
54753
|
+
styleEl.textContent = cssText;
|
|
54754
|
+
document.body.appendChild(styleEl);
|
|
54755
|
+
|
|
54756
|
+
const responseSvg = await fetch(
|
|
54757
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
|
|
54758
|
+
);
|
|
54759
|
+
const svgText = await responseSvg.text();
|
|
54760
|
+
const div = document.createElement("div");
|
|
54761
|
+
div.style.display = "none";
|
|
54762
|
+
div.id = "sprite";
|
|
54763
|
+
div.innerHTML = svgText;
|
|
54764
|
+
document.body.appendChild(div);
|
|
54765
|
+
} finally {
|
|
54766
|
+
editButton.disabled = false;
|
|
54767
|
+
editButton.textContent = "Edit board";
|
|
54768
|
+
}
|
|
54769
|
+
};
|
|
54770
|
+
});
|
|
54771
|
+
`;
|
|
54772
|
+
|
|
54773
|
+
// src/public/loadLinkImages.js
|
|
54774
|
+
var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
|
|
54775
|
+
document.querySelectorAll(".link-object").forEach(linkItem => {
|
|
54776
|
+
const linkImage = linkItem.querySelector(".link-image");
|
|
54777
|
+
const linkContainer = linkItem.querySelector("a");
|
|
54778
|
+
linkImage.onerror = () => {
|
|
54779
|
+
linkImage.onerror = null;
|
|
54780
|
+
linkImage.style.display = "none";
|
|
54781
|
+
const svgNamespace = "http://www.w3.org/2000/svg";
|
|
54782
|
+
const svg = document.createElementNS(svgNamespace, "svg");
|
|
54783
|
+
svg.setAttribute("width", "20");
|
|
54784
|
+
svg.setAttribute("height", "20");
|
|
54785
|
+
svg.setAttribute("viewBox", "0 0 13 14");
|
|
54786
|
+
svg.setAttribute("fill", "none");
|
|
54787
|
+
|
|
54788
|
+
const path = document.createElementNS(svgNamespace, "path");
|
|
54789
|
+
path.setAttribute(
|
|
54790
|
+
"d",
|
|
54791
|
+
"M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
|
|
54792
|
+
);
|
|
54793
|
+
path.setAttribute("fill", "#924FE8");
|
|
54794
|
+
svg.appendChild(path);
|
|
54795
|
+
|
|
54796
|
+
linkContainer.appendChild(svg);
|
|
54797
|
+
};
|
|
54798
|
+
});
|
|
54799
|
+
});
|
|
54800
|
+
`;
|
|
54801
|
+
|
|
54802
|
+
// src/public/index.css
|
|
54803
|
+
var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
|
|
54804
|
+
@import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
|
|
54805
|
+
|
|
54806
|
+
/* ../src/index.css */
|
|
54807
|
+
:root {
|
|
54808
|
+
--background-surface-default: rgb(255, 255, 255);
|
|
54809
|
+
--background-button-secondary: rgb(255, 255, 255);
|
|
54810
|
+
--background-button-secondary-hover: rgb(247, 247, 248);
|
|
54811
|
+
--background-badge-purple-disabled: rgb(247, 241, 253);
|
|
54812
|
+
--background-badge-gray: rgb(233, 234, 236);
|
|
54813
|
+
--background-accent-purple: rgb(146, 79, 232);
|
|
54814
|
+
--border-action-normal: rgb(222, 223, 227);
|
|
54815
|
+
--border-action-focus: rgb(146, 79, 232);
|
|
54816
|
+
--border-select-primary: rgb(146, 79, 232);
|
|
54817
|
+
--text-base-primary: rgb(20, 21, 26);
|
|
54818
|
+
--text-base-secondary: rgba(15, 19, 36, 0.6);
|
|
54819
|
+
--text-base-quaternary: rgb(10, 15, 41, 0.25);
|
|
54820
|
+
--text-accent-purple: rgb(152, 89, 233);
|
|
54821
|
+
--icon-base-primary: rgb(20, 21, 26);
|
|
54822
|
+
--icon-base-secondary: rgb(105, 107, 118);
|
|
54823
|
+
--icon-accent-purple: rgb(146, 79, 232);
|
|
54824
|
+
--absolute-position-panel-padding: 12px;
|
|
54825
|
+
}
|
|
54826
|
+
* {
|
|
54827
|
+
box-sizing: border-box;
|
|
54828
|
+
padding: 0;
|
|
54829
|
+
margin: 0;
|
|
54830
|
+
border: none;
|
|
54831
|
+
background: none;
|
|
54832
|
+
font-family: inherit;
|
|
54833
|
+
}
|
|
54834
|
+
html {
|
|
54835
|
+
font-size: 62.5%;
|
|
54836
|
+
}
|
|
54837
|
+
body {
|
|
54838
|
+
color: var(--text-base-primary);
|
|
54839
|
+
font-size: 1.6rem;
|
|
54840
|
+
font-optical-sizing: auto;
|
|
54841
|
+
font-style: normal;
|
|
54842
|
+
font-family: "Manrope", sans-serif;
|
|
54843
|
+
}
|
|
54844
|
+
html,
|
|
54845
|
+
body {
|
|
54846
|
+
overscroll-behavior-x: none;
|
|
54847
|
+
-webkit-user-select: none;
|
|
54848
|
+
}
|
|
54849
|
+
input:-webkit-autofill,
|
|
54850
|
+
input:-webkit-autofill:hover,
|
|
54851
|
+
input:-webkit-autofill:focus,
|
|
54852
|
+
input:-webkit-autofill:active {
|
|
54853
|
+
-webkit-box-shadow: 0 0 0 30px white inset !important;
|
|
54854
|
+
}
|
|
54855
|
+
`;
|
|
54856
|
+
|
|
54387
54857
|
// src/Board.ts
|
|
54388
54858
|
class Board {
|
|
54389
54859
|
boardId;
|
|
@@ -54766,9 +55236,9 @@ class Board {
|
|
|
54766
55236
|
return this.copy();
|
|
54767
55237
|
}
|
|
54768
55238
|
serializeHTML() {
|
|
54769
|
-
const customTagsScript =
|
|
54770
|
-
const loadLinksImagesScript =
|
|
54771
|
-
const css =
|
|
55239
|
+
const customTagsScript = customWebComponents_default;
|
|
55240
|
+
const loadLinksImagesScript = loadLinkImages_default;
|
|
55241
|
+
const css = public_default;
|
|
54772
55242
|
const boardName = this.getName() || this.getBoardId();
|
|
54773
55243
|
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
54774
55244
|
const itemsDiv = `<div id="items">${items}</div>`;
|