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/browser.js
CHANGED
|
@@ -1630,6 +1630,9 @@ class Line {
|
|
|
1630
1630
|
getStartPoint() {
|
|
1631
1631
|
return this.start;
|
|
1632
1632
|
}
|
|
1633
|
+
getEndPoint() {
|
|
1634
|
+
return this.end;
|
|
1635
|
+
}
|
|
1633
1636
|
getLength() {
|
|
1634
1637
|
const { start, end } = this;
|
|
1635
1638
|
const deltaX = end.x - start.x;
|
|
@@ -3227,6 +3230,9 @@ class QuadraticBezier extends BaseCurve {
|
|
|
3227
3230
|
getStartPoint() {
|
|
3228
3231
|
return this.start;
|
|
3229
3232
|
}
|
|
3233
|
+
getEndPoint() {
|
|
3234
|
+
return this.end;
|
|
3235
|
+
}
|
|
3230
3236
|
moveToStart(ctx) {
|
|
3231
3237
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3232
3238
|
}
|
|
@@ -3270,6 +3276,9 @@ class CubicBezier extends BaseCurve {
|
|
|
3270
3276
|
getStartPoint() {
|
|
3271
3277
|
return this.start;
|
|
3272
3278
|
}
|
|
3279
|
+
getEndPoint() {
|
|
3280
|
+
return this.end;
|
|
3281
|
+
}
|
|
3273
3282
|
moveToStart(ctx) {
|
|
3274
3283
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3275
3284
|
}
|
|
@@ -7372,25 +7381,33 @@ class TransformationCommand {
|
|
|
7372
7381
|
x: 1 / op2.x,
|
|
7373
7382
|
y: 1 / op2.y
|
|
7374
7383
|
};
|
|
7384
|
+
} else {
|
|
7385
|
+
reverseOp = {
|
|
7386
|
+
...op2,
|
|
7387
|
+
x: 1,
|
|
7388
|
+
y: 1
|
|
7389
|
+
};
|
|
7375
7390
|
}
|
|
7376
7391
|
return { item: currTrans, operation: reverseOp };
|
|
7377
7392
|
});
|
|
7378
7393
|
}
|
|
7379
7394
|
case "locked": {
|
|
7395
|
+
const op2 = this.operation;
|
|
7380
7396
|
return mapItemsByOperation(this.transformation, () => {
|
|
7381
7397
|
return {
|
|
7382
|
-
...
|
|
7383
|
-
item: [...
|
|
7398
|
+
...op2,
|
|
7399
|
+
item: [...op2.item],
|
|
7384
7400
|
method: "unlocked",
|
|
7385
7401
|
locked: false
|
|
7386
7402
|
};
|
|
7387
7403
|
});
|
|
7388
7404
|
}
|
|
7389
7405
|
case "unlocked": {
|
|
7406
|
+
const op2 = this.operation;
|
|
7390
7407
|
return mapItemsByOperation(this.transformation, () => {
|
|
7391
7408
|
return {
|
|
7392
|
-
...
|
|
7393
|
-
item: [...
|
|
7409
|
+
...op2,
|
|
7410
|
+
item: [...op2.item],
|
|
7394
7411
|
method: "locked",
|
|
7395
7412
|
locked: true
|
|
7396
7413
|
};
|
|
@@ -9001,6 +9018,13 @@ var tagByType = {
|
|
|
9001
9018
|
Comment: "comment-item",
|
|
9002
9019
|
Group: ""
|
|
9003
9020
|
};
|
|
9021
|
+
var headingTagsMap = {
|
|
9022
|
+
h1: "heading_one",
|
|
9023
|
+
h2: "heading_two",
|
|
9024
|
+
h3: "heading_three",
|
|
9025
|
+
h4: "heading_four",
|
|
9026
|
+
h5: "heading_five"
|
|
9027
|
+
};
|
|
9004
9028
|
var parsersHTML = {
|
|
9005
9029
|
"sticker-item": parseHTMLSticker,
|
|
9006
9030
|
"shape-item": parseHTMLShape,
|
|
@@ -9025,12 +9049,12 @@ function getTransformationData(el) {
|
|
|
9025
9049
|
if (transformMatch) {
|
|
9026
9050
|
const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
|
|
9027
9051
|
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
9028
|
-
return { ...matrix, rotate: 0 };
|
|
9052
|
+
return { ...matrix, rotate: 0, isLocked: false };
|
|
9029
9053
|
}
|
|
9030
|
-
return { ...new Matrix2, rotate: 0 };
|
|
9054
|
+
return { ...new Matrix2, rotate: 0, isLocked: false };
|
|
9031
9055
|
}
|
|
9032
9056
|
function parseHTMLRichText(el, options) {
|
|
9033
|
-
const parseNode = (node) => {
|
|
9057
|
+
const parseNode = (node, nestingLevel = 1) => {
|
|
9034
9058
|
const isLinkNode = node.tagName.toLowerCase() === "a";
|
|
9035
9059
|
if (node.tagName.toLowerCase() === "span" || isLinkNode && node.children.length === 0) {
|
|
9036
9060
|
const isSingleSpace = node.textContent?.length === 1 && node.textContent?.trim() === "";
|
|
@@ -9053,7 +9077,7 @@ function parseHTMLRichText(el, options) {
|
|
|
9053
9077
|
superscript: false
|
|
9054
9078
|
};
|
|
9055
9079
|
}
|
|
9056
|
-
const children2 = Array.from(node.children).map((child) => parseNode(child));
|
|
9080
|
+
const children2 = Array.from(node.children).map((child) => parseNode(child, nestingLevel + 1));
|
|
9057
9081
|
const tagName = node.tagName.toLowerCase();
|
|
9058
9082
|
const extractCommonProps = () => ({
|
|
9059
9083
|
horisontalAlignment: node.style.textAlign || "left",
|
|
@@ -9061,23 +9085,19 @@ function parseHTMLRichText(el, options) {
|
|
|
9061
9085
|
paddingBottom: parseFloat(node.style.paddingBottom) || undefined
|
|
9062
9086
|
});
|
|
9063
9087
|
switch (tagName) {
|
|
9064
|
-
case "blockquote":
|
|
9065
|
-
return {
|
|
9066
|
-
type: "block-quote",
|
|
9067
|
-
...extractCommonProps(),
|
|
9068
|
-
children: children2
|
|
9069
|
-
};
|
|
9070
9088
|
case "ul":
|
|
9071
9089
|
return {
|
|
9072
9090
|
type: "ul_list",
|
|
9073
9091
|
...extractCommonProps(),
|
|
9074
|
-
children: children2
|
|
9092
|
+
children: children2,
|
|
9093
|
+
listLevel: nestingLevel
|
|
9075
9094
|
};
|
|
9076
9095
|
case "ol":
|
|
9077
9096
|
return {
|
|
9078
9097
|
type: "ol_list",
|
|
9079
9098
|
...extractCommonProps(),
|
|
9080
|
-
children: children2
|
|
9099
|
+
children: children2,
|
|
9100
|
+
listLevel: nestingLevel
|
|
9081
9101
|
};
|
|
9082
9102
|
case "li":
|
|
9083
9103
|
return {
|
|
@@ -9099,11 +9119,9 @@ function parseHTMLRichText(el, options) {
|
|
|
9099
9119
|
case "h2":
|
|
9100
9120
|
case "h3":
|
|
9101
9121
|
case "h4":
|
|
9102
|
-
case "h5":
|
|
9103
|
-
case "h6": {
|
|
9104
|
-
const headingType = `heading_${["one", "two", "three", "four", "five", "six"][parseInt(tagName[1]) - 1]}`;
|
|
9122
|
+
case "h5": {
|
|
9105
9123
|
return {
|
|
9106
|
-
type:
|
|
9124
|
+
type: headingTagsMap[tagName],
|
|
9107
9125
|
...extractCommonProps(),
|
|
9108
9126
|
children: children2
|
|
9109
9127
|
};
|
|
@@ -9307,6 +9325,7 @@ function parseHTMLConnector(el) {
|
|
|
9307
9325
|
...endPointType === "FixedConnector" ? { segment: startSegment, tangent: endTangent } : {}
|
|
9308
9326
|
};
|
|
9309
9327
|
const connectorData = {
|
|
9328
|
+
middlePoint: null,
|
|
9310
9329
|
id: el.id,
|
|
9311
9330
|
itemType: "Connector",
|
|
9312
9331
|
transformation,
|
|
@@ -9367,6 +9386,7 @@ function parseHTMLDrawing(el) {
|
|
|
9367
9386
|
}
|
|
9368
9387
|
function parseHTMLAINode(el) {
|
|
9369
9388
|
const aiNodeData = {
|
|
9389
|
+
threadDirection: 3,
|
|
9370
9390
|
id: el.id,
|
|
9371
9391
|
itemType: "AINode",
|
|
9372
9392
|
parentNodeId: el.getAttribute("parent-node-id") || undefined,
|
|
@@ -9695,17 +9715,18 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
|
|
|
9695
9715
|
break;
|
|
9696
9716
|
default:
|
|
9697
9717
|
if ("text" in child && typeof child.text === "string") {
|
|
9698
|
-
const
|
|
9718
|
+
const textNode = child;
|
|
9719
|
+
const fontScale2 = (textNode.fontSize === "auto" ? 14 : textNode.fontSize ?? 14) / 14;
|
|
9699
9720
|
handleTextNode({
|
|
9700
9721
|
isFrame,
|
|
9701
|
-
child,
|
|
9722
|
+
child: textNode,
|
|
9702
9723
|
node,
|
|
9703
9724
|
maxWidth,
|
|
9704
9725
|
paddingTop: i === 0 ? 16 * (data.paddingTop || 0) : 0,
|
|
9705
9726
|
marginLeft: (listData ? fontScale2 * 16 : 0) + (listData?.level || 0) * fontScale2 * 24,
|
|
9706
9727
|
newLine: i === 0 ? newLine : false,
|
|
9707
9728
|
listMark: i === 0 ? listMark : undefined,
|
|
9708
|
-
link:
|
|
9729
|
+
link: textNode.link
|
|
9709
9730
|
});
|
|
9710
9731
|
} else {
|
|
9711
9732
|
const blockNode = getBlockNode(child, maxWidth, isFrame, listData, i === 0 ? listMark : undefined, true);
|
|
@@ -9749,7 +9770,8 @@ function getTextNode(data) {
|
|
|
9749
9770
|
type: "text",
|
|
9750
9771
|
text,
|
|
9751
9772
|
style: getTextStyle(data),
|
|
9752
|
-
blocks: []
|
|
9773
|
+
blocks: [],
|
|
9774
|
+
newLine: false
|
|
9753
9775
|
};
|
|
9754
9776
|
return node;
|
|
9755
9777
|
}
|
|
@@ -9995,7 +10017,7 @@ function setBlockNodeCoordinates(blockNode) {
|
|
|
9995
10017
|
}
|
|
9996
10018
|
lineBottom += maxFontSize * lineHeight;
|
|
9997
10019
|
leading = maxFontSize * lineHeight - maxFontSize;
|
|
9998
|
-
yOffset = lineBottom - leading / 2 - highestBlock
|
|
10020
|
+
yOffset = lineBottom - leading / 2 - (highestBlock?.measure.descent || 0);
|
|
9999
10021
|
for (const block of line) {
|
|
10000
10022
|
block.y = yOffset;
|
|
10001
10023
|
}
|
|
@@ -10019,7 +10041,7 @@ function getTextBlock({
|
|
|
10019
10041
|
x: 0,
|
|
10020
10042
|
y: 0,
|
|
10021
10043
|
measure,
|
|
10022
|
-
fontSize: style.fontSize,
|
|
10044
|
+
fontSize: style.fontSize === "auto" ? 14 : style.fontSize,
|
|
10023
10045
|
paddingTop,
|
|
10024
10046
|
marginLeft,
|
|
10025
10047
|
listMark,
|
|
@@ -10537,7 +10559,7 @@ function handleListMerge(editor) {
|
|
|
10537
10559
|
return false;
|
|
10538
10560
|
}
|
|
10539
10561
|
const [textNode, textNodePath] = import_slate3.Editor.node(editor, anchor.path);
|
|
10540
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10562
|
+
if (!textNode || import_slate3.Editor.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
|
|
10541
10563
|
return false;
|
|
10542
10564
|
}
|
|
10543
10565
|
const paragraphPath = import_slate3.Path.parent(textNodePath);
|
|
@@ -10547,12 +10569,12 @@ function handleListMerge(editor) {
|
|
|
10547
10569
|
}
|
|
10548
10570
|
const listItemPath = import_slate3.Path.parent(paragraphPath);
|
|
10549
10571
|
const [listItem] = import_slate3.Editor.node(editor, listItemPath);
|
|
10550
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10572
|
+
if (!listItem || import_slate3.Editor.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10551
10573
|
return false;
|
|
10552
10574
|
}
|
|
10553
10575
|
const listPath = import_slate3.Path.parent(listItemPath);
|
|
10554
10576
|
const [list] = import_slate3.Editor.node(editor, listPath);
|
|
10555
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10577
|
+
if (!list || import_slate3.Editor.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10556
10578
|
return false;
|
|
10557
10579
|
}
|
|
10558
10580
|
const listItemIndex = listItemPath[listItemPath.length - 1];
|
|
@@ -10586,6 +10608,9 @@ function handleListMerge(editor) {
|
|
|
10586
10608
|
} else {
|
|
10587
10609
|
const previousItemPath = import_slate3.Path.previous(listItemPath);
|
|
10588
10610
|
const [previousItem] = import_slate3.Editor.node(editor, previousItemPath);
|
|
10611
|
+
if ("text" in previousItem) {
|
|
10612
|
+
return false;
|
|
10613
|
+
}
|
|
10589
10614
|
currentListItemChildren.forEach((childNode, index) => {
|
|
10590
10615
|
const copiedNode = structuredClone(childNode);
|
|
10591
10616
|
copiedNode.paddingTop = 0;
|
|
@@ -10617,7 +10642,18 @@ function createParagraphNode(text, editor, horisontalAlignment) {
|
|
|
10617
10642
|
const marks = import_slate4.Editor.marks(editor) || {};
|
|
10618
10643
|
const pargaraph = {
|
|
10619
10644
|
type: "paragraph",
|
|
10620
|
-
children: [{
|
|
10645
|
+
children: [{
|
|
10646
|
+
type: "text",
|
|
10647
|
+
text,
|
|
10648
|
+
...marks,
|
|
10649
|
+
bold: false,
|
|
10650
|
+
italic: false,
|
|
10651
|
+
underline: false,
|
|
10652
|
+
overline: false,
|
|
10653
|
+
"line-through": false,
|
|
10654
|
+
subscript: false,
|
|
10655
|
+
superscript: false
|
|
10656
|
+
}]
|
|
10621
10657
|
};
|
|
10622
10658
|
if (horisontalAlignment) {
|
|
10623
10659
|
pargaraph.horisontalAlignment = horisontalAlignment;
|
|
@@ -10671,6 +10707,9 @@ function handleSplitListItem(editor) {
|
|
|
10671
10707
|
if (isBlockEmpty && isOnlyChildParagraph) {
|
|
10672
10708
|
const listItemIndex = listItemPath[listItemPath.length - 1];
|
|
10673
10709
|
const [parentList, parentListPath] = import_slate5.Editor.parent(editor, listItemPath);
|
|
10710
|
+
if (import_slate5.Editor.isEditor(parentList) || parentList.type !== "ol_list" && parentList.type !== "ul_list") {
|
|
10711
|
+
return false;
|
|
10712
|
+
}
|
|
10674
10713
|
const listType = parentList.type;
|
|
10675
10714
|
import_slate5.Editor.withoutNormalizing(editor, () => {
|
|
10676
10715
|
const nextPath = import_slate5.Path.next(parentListPath);
|
|
@@ -10695,6 +10734,9 @@ function handleSplitListItem(editor) {
|
|
|
10695
10734
|
match: (n, path2) => path2[path2.length - 1] >= listItemIndex
|
|
10696
10735
|
});
|
|
10697
10736
|
const [updatedParentList] = import_slate5.Editor.node(editor, parentListPath);
|
|
10737
|
+
if (import_slate5.Editor.isEditor(updatedParentList)) {
|
|
10738
|
+
return false;
|
|
10739
|
+
}
|
|
10698
10740
|
if (getAreAllChildrenEmpty(updatedParentList)) {
|
|
10699
10741
|
import_slate5.Transforms.removeNodes(editor, { at: parentListPath });
|
|
10700
10742
|
}
|
|
@@ -10726,7 +10768,7 @@ var import_slate7 = require("slate");
|
|
|
10726
10768
|
var import_slate6 = require("slate");
|
|
10727
10769
|
function clearAllTextNodes(editor) {
|
|
10728
10770
|
for (const [node, path2] of import_slate6.Editor.nodes(editor, {
|
|
10729
|
-
match: (n) => n.type === "text"
|
|
10771
|
+
match: (n) => !import_slate6.Editor.isEditor(n) && n.type === "text"
|
|
10730
10772
|
})) {
|
|
10731
10773
|
import_slate6.Transforms.removeNodes(editor, { at: path2 });
|
|
10732
10774
|
import_slate6.Transforms.setNodes(editor, { ...node, text: "" }, { at: path2 });
|
|
@@ -10761,7 +10803,7 @@ function handleWrapIntoNestedList(editor) {
|
|
|
10761
10803
|
}
|
|
10762
10804
|
const { anchor } = selection;
|
|
10763
10805
|
const [textNode, textNodePath] = import_slate8.Editor.node(editor, anchor.path);
|
|
10764
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10806
|
+
if (!textNode || import_slate8.Editor.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
|
|
10765
10807
|
return false;
|
|
10766
10808
|
}
|
|
10767
10809
|
const paragraphPath = import_slate8.Path.parent(textNodePath);
|
|
@@ -10771,12 +10813,12 @@ function handleWrapIntoNestedList(editor) {
|
|
|
10771
10813
|
}
|
|
10772
10814
|
const listItemPath = import_slate8.Path.parent(paragraphPath);
|
|
10773
10815
|
const [listItem] = import_slate8.Editor.node(editor, listItemPath);
|
|
10774
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10816
|
+
if (!listItem || import_slate8.Editor.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10775
10817
|
return false;
|
|
10776
10818
|
}
|
|
10777
10819
|
const listPath = import_slate8.Path.parent(listItemPath);
|
|
10778
10820
|
const [list] = import_slate8.Editor.node(editor, listPath);
|
|
10779
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10821
|
+
if (!list || import_slate8.Editor.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10780
10822
|
return false;
|
|
10781
10823
|
}
|
|
10782
10824
|
import_slate8.Transforms.wrapNodes(editor, { type: "list_item", children: [] }, { at: paragraphPath });
|
|
@@ -10806,12 +10848,12 @@ var import_slate10 = require("slate");
|
|
|
10806
10848
|
function getBlockParentList(editor, blockPath) {
|
|
10807
10849
|
const listItemPath = import_slate10.Path.parent(blockPath);
|
|
10808
10850
|
const [listItem] = import_slate10.Editor.node(editor, listItemPath);
|
|
10809
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
10851
|
+
if (!listItem || import_slate10.Editor.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10810
10852
|
return null;
|
|
10811
10853
|
}
|
|
10812
10854
|
const listPath = import_slate10.Path.parent(listItemPath);
|
|
10813
10855
|
const [list] = import_slate10.Editor.node(editor, listPath);
|
|
10814
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10856
|
+
if (!list || import_slate10.Editor.isEditor(listItem) || "type" in list && list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10815
10857
|
return null;
|
|
10816
10858
|
}
|
|
10817
10859
|
return [list, listPath];
|
|
@@ -10824,17 +10866,16 @@ function toggleListTypeForSelection(editor, targetListType) {
|
|
|
10824
10866
|
return false;
|
|
10825
10867
|
}
|
|
10826
10868
|
import_slate11.Editor.withoutNormalizing(editor, () => {
|
|
10827
|
-
const [start, end] = import_slate11.Range.edges(selection);
|
|
10828
|
-
const commonAncestorPath = import_slate11.Path.common(start.path, end.path);
|
|
10829
10869
|
const nodes = Array.from(import_slate11.Editor.nodes(editor, {
|
|
10830
10870
|
at: selection,
|
|
10831
10871
|
mode: "lowest",
|
|
10832
|
-
match: (n) => import_slate11.Editor.isBlock(editor, n)
|
|
10872
|
+
match: (n) => !import_slate11.Editor.isEditor(n) && n.type !== "text" && import_slate11.Editor.isBlock(editor, n)
|
|
10833
10873
|
}));
|
|
10834
10874
|
const nodesWithLists = {};
|
|
10835
10875
|
const unwrapCandidates = [];
|
|
10836
10876
|
nodes.forEach(([node, path2]) => {
|
|
10837
10877
|
const parentList = getBlockParentList(editor, path2);
|
|
10878
|
+
node = node;
|
|
10838
10879
|
if (parentList) {
|
|
10839
10880
|
unwrapCandidates.push(node);
|
|
10840
10881
|
if (!nodesWithLists[parentList[1].length]) {
|
|
@@ -10944,7 +10985,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10944
10985
|
import_slate12.Editor.withoutNormalizing(editor, () => {
|
|
10945
10986
|
const { anchor } = selection;
|
|
10946
10987
|
const [textNode, textNodePath] = import_slate12.Editor.node(editor, anchor.path);
|
|
10947
|
-
if (!textNode || textNode.type !== "text" ||
|
|
10988
|
+
if (!textNode || import_slate12.Editor.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode)) {
|
|
10948
10989
|
result = false;
|
|
10949
10990
|
return;
|
|
10950
10991
|
}
|
|
@@ -10956,7 +10997,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10956
10997
|
}
|
|
10957
10998
|
const listItemPath = import_slate12.Path.parent(paragraphPath);
|
|
10958
10999
|
const [listItem] = import_slate12.Editor.node(editor, listItemPath);
|
|
10959
|
-
if (!listItem || listItem.type !== "list_item") {
|
|
11000
|
+
if (!listItem || import_slate12.Editor.isEditor(listItem) || listItem.type !== "list_item") {
|
|
10960
11001
|
if (shouldWrap) {
|
|
10961
11002
|
wrapIntoList(editor, targetListType, selection);
|
|
10962
11003
|
return;
|
|
@@ -10966,7 +11007,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
|
|
|
10966
11007
|
}
|
|
10967
11008
|
const listPath = import_slate12.Path.parent(listItemPath);
|
|
10968
11009
|
const [list] = import_slate12.Editor.node(editor, listPath);
|
|
10969
|
-
if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
11010
|
+
if (!list || import_slate12.Editor.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
|
|
10970
11011
|
if (shouldWrap) {
|
|
10971
11012
|
wrapIntoList(editor, targetListType, selection);
|
|
10972
11013
|
return;
|
|
@@ -11048,7 +11089,7 @@ function getListTypeAtSelectionStart(editor) {
|
|
|
11048
11089
|
const startPoint = import_slate14.Range.start(selection);
|
|
11049
11090
|
const listEntry = import_slate14.Editor.above(editor, {
|
|
11050
11091
|
at: startPoint,
|
|
11051
|
-
match: (n) => n.type === "ol_list" || n.type === "ul_list"
|
|
11092
|
+
match: (n) => !import_slate14.Editor.isEditor(n) && (n.type === "ol_list" || n.type === "ul_list")
|
|
11052
11093
|
});
|
|
11053
11094
|
if (listEntry) {
|
|
11054
11095
|
const [listNode] = listEntry;
|
|
@@ -11071,11 +11112,11 @@ var setLink = (editor, link, selection) => {
|
|
|
11071
11112
|
const format = link ? "rgba(71, 120, 245, 1)" : "rgb(20, 21, 26)";
|
|
11072
11113
|
import_slate15.Editor.addMark(editor, "fontColor", format);
|
|
11073
11114
|
for (const [node, path2] of import_slate15.Editor.nodes(editor, {
|
|
11074
|
-
match: (n) => n.type === "text"
|
|
11115
|
+
match: (n) => !import_slate15.Editor.isEditor(n) && n.type === "text"
|
|
11075
11116
|
})) {
|
|
11076
11117
|
const nodeRange = import_slate15.Editor.range(editor, path2);
|
|
11077
11118
|
import_slate15.Transforms.select(editor, nodeRange);
|
|
11078
|
-
import_slate15.Transforms.setNodes(editor, { link }, { split: false, match: (n) => n.type === "text" });
|
|
11119
|
+
import_slate15.Transforms.setNodes(editor, { link }, { split: false, match: (n) => !import_slate15.Editor.isEditor(n) && n.type === "text" });
|
|
11079
11120
|
}
|
|
11080
11121
|
};
|
|
11081
11122
|
|
|
@@ -17198,7 +17239,9 @@ function setNodeChildrenStyles({
|
|
|
17198
17239
|
}) {
|
|
17199
17240
|
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
17200
17241
|
if (editor) {
|
|
17201
|
-
|
|
17242
|
+
const marks = import_slate19.Editor.marks(editor);
|
|
17243
|
+
const fontSize = marks?.fontSize ? marks.fontSize === "auto" ? conf.DEFAULT_TEXT_STYLES.fontSize : marks.fontSize : conf.DEFAULT_TEXT_STYLES.fontSize;
|
|
17244
|
+
fontStyles = marks ? { ...conf.DEFAULT_TEXT_STYLES, ...marks, fontSize } : conf.DEFAULT_TEXT_STYLES;
|
|
17202
17245
|
}
|
|
17203
17246
|
switch (node2.type) {
|
|
17204
17247
|
case "heading_one":
|
|
@@ -17248,6 +17291,9 @@ function setNodeStyles({
|
|
|
17248
17291
|
editor,
|
|
17249
17292
|
horisontalAlignment
|
|
17250
17293
|
}) {
|
|
17294
|
+
if (node2.type === "list_item") {
|
|
17295
|
+
return;
|
|
17296
|
+
}
|
|
17251
17297
|
if (node2.type === "ol_list" || node2.type === "ul_list") {
|
|
17252
17298
|
node2.listLevel = listLevel;
|
|
17253
17299
|
for (const listItem of node2.children) {
|
|
@@ -17398,9 +17444,10 @@ class MarkdownProcessor {
|
|
|
17398
17444
|
} else {
|
|
17399
17445
|
const lastParagraphPath = this.getText().length - 1;
|
|
17400
17446
|
const lastParagraph = this.getText()[lastParagraphPath];
|
|
17447
|
+
const lastParagraphText = lastParagraph.children[lastParagraph.children.length - 1];
|
|
17401
17448
|
const insertLocation = {
|
|
17402
17449
|
path: [lastParagraphPath, lastParagraph.children.length - 1],
|
|
17403
|
-
offset:
|
|
17450
|
+
offset: lastParagraphText.text.length
|
|
17404
17451
|
};
|
|
17405
17452
|
import_slate20.Transforms.insertText(this.editor, combinedText, {
|
|
17406
17453
|
at: insertLocation
|
|
@@ -17465,7 +17512,7 @@ function getFirstSelectionLink(editor, selection) {
|
|
|
17465
17512
|
}
|
|
17466
17513
|
for (const [node2] of import_slate23.Editor.nodes(editor, {
|
|
17467
17514
|
at: selection,
|
|
17468
|
-
match: (n) => !!n.link
|
|
17515
|
+
match: (n) => ("link" in n) && !!n.link
|
|
17469
17516
|
})) {
|
|
17470
17517
|
return node2.link;
|
|
17471
17518
|
}
|
|
@@ -18415,14 +18462,6 @@ class RichTextCommand {
|
|
|
18415
18462
|
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
18416
18463
|
}
|
|
18417
18464
|
}));
|
|
18418
|
-
case "setBlockType":
|
|
18419
|
-
return items.map((id) => ({
|
|
18420
|
-
item: id,
|
|
18421
|
-
operation: {
|
|
18422
|
-
...this.operation,
|
|
18423
|
-
type: this.board.items.getById(id)?.getRichText()?.getBlockType() || "paragraph"
|
|
18424
|
-
}
|
|
18425
|
-
}));
|
|
18426
18465
|
case "setFontStyle":
|
|
18427
18466
|
return items.map((id) => ({
|
|
18428
18467
|
item: id,
|
|
@@ -18525,7 +18564,8 @@ class RichTextGroupCommand {
|
|
|
18525
18564
|
class: "RichText",
|
|
18526
18565
|
method: "edit",
|
|
18527
18566
|
item: [richText.getId() ?? ""],
|
|
18528
|
-
ops
|
|
18567
|
+
ops,
|
|
18568
|
+
selection: null
|
|
18529
18569
|
}
|
|
18530
18570
|
});
|
|
18531
18571
|
}
|
|
@@ -18542,7 +18582,8 @@ class RichTextGroupCommand {
|
|
|
18542
18582
|
class: "RichText",
|
|
18543
18583
|
method: "edit",
|
|
18544
18584
|
item: [richText.getId() ?? ""],
|
|
18545
|
-
ops: ops.map((op) => import_slate34.Operation.inverse(op)).reverse()
|
|
18585
|
+
ops: ops.map((op) => import_slate34.Operation.inverse(op)).reverse(),
|
|
18586
|
+
selection: null
|
|
18546
18587
|
}
|
|
18547
18588
|
});
|
|
18548
18589
|
}
|
|
@@ -19192,6 +19233,9 @@ class Comment2 {
|
|
|
19192
19233
|
const anchor = this.anchor.copy();
|
|
19193
19234
|
return new Mbr(anchor.x, anchor.y, anchor.x, anchor.y);
|
|
19194
19235
|
}
|
|
19236
|
+
getPathMbr() {
|
|
19237
|
+
return this.getMbr();
|
|
19238
|
+
}
|
|
19195
19239
|
getNearestEdgePointTo(point3) {
|
|
19196
19240
|
return this.anchor;
|
|
19197
19241
|
}
|
|
@@ -19679,6 +19723,9 @@ class BaseItem extends Mbr {
|
|
|
19679
19723
|
onRemove() {
|
|
19680
19724
|
this.onRemoveCallbacks.forEach((cb) => cb());
|
|
19681
19725
|
}
|
|
19726
|
+
getPathMbr() {
|
|
19727
|
+
return this.getMbr().copy();
|
|
19728
|
+
}
|
|
19682
19729
|
render(context) {}
|
|
19683
19730
|
renderHTML(documentFactory) {
|
|
19684
19731
|
return documentFactory.createElement("div");
|
|
@@ -20204,7 +20251,10 @@ class RichText extends BaseItem {
|
|
|
20204
20251
|
}
|
|
20205
20252
|
getFontSize() {
|
|
20206
20253
|
const marks = this.editor.getSelectionMarks();
|
|
20207
|
-
|
|
20254
|
+
let fontSize = marks?.fontSize ?? this.initialTextStyles.fontSize;
|
|
20255
|
+
if (fontSize === "auto") {
|
|
20256
|
+
fontSize = this.initialTextStyles.fontSize;
|
|
20257
|
+
}
|
|
20208
20258
|
if (this.autoSize) {
|
|
20209
20259
|
return fontSize * this.autoSizeScale;
|
|
20210
20260
|
}
|
|
@@ -20222,7 +20272,7 @@ class RichText extends BaseItem {
|
|
|
20222
20272
|
for (const [node2] of textNodes) {
|
|
20223
20273
|
const fontSize = node2.fontSize || node2 && node2.fontSize;
|
|
20224
20274
|
if (fontSize) {
|
|
20225
|
-
fontSizes.push(fontSize);
|
|
20275
|
+
fontSizes.push(fontSize === "auto" ? this.initialTextStyles.fontSize : fontSize);
|
|
20226
20276
|
}
|
|
20227
20277
|
}
|
|
20228
20278
|
if (fontSizes.length > 0) {
|
|
@@ -20235,7 +20285,7 @@ class RichText extends BaseItem {
|
|
|
20235
20285
|
return marks?.fontHighlight ?? this.initialTextStyles.fontHighlight;
|
|
20236
20286
|
}
|
|
20237
20287
|
getBlockType() {
|
|
20238
|
-
const blockNode = getSelectedBlockNode(this.editor);
|
|
20288
|
+
const blockNode = getSelectedBlockNode(this.editor.editor);
|
|
20239
20289
|
return blockNode ? blockNode.type : "paragraph";
|
|
20240
20290
|
}
|
|
20241
20291
|
getHorisontalAlignment() {
|
|
@@ -20266,16 +20316,18 @@ class RichText extends BaseItem {
|
|
|
20266
20316
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
20267
20317
|
if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
20268
20318
|
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20319
|
+
if (domRange) {
|
|
20320
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
20321
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
20322
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
20323
|
+
exactMatch: false,
|
|
20324
|
+
suppressThrow: false
|
|
20325
|
+
});
|
|
20326
|
+
if (slatePoint) {
|
|
20327
|
+
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
20328
|
+
this.editorTransforms.select(this.editor.editor, nRange);
|
|
20329
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
20330
|
+
}
|
|
20279
20331
|
}
|
|
20280
20332
|
} else {
|
|
20281
20333
|
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
@@ -37483,6 +37535,9 @@ class Shape extends BaseItem {
|
|
|
37483
37535
|
getMbr() {
|
|
37484
37536
|
return this.mbr.copy();
|
|
37485
37537
|
}
|
|
37538
|
+
getPathMbr() {
|
|
37539
|
+
return this.getPath().getMbr();
|
|
37540
|
+
}
|
|
37486
37541
|
getNearestEdgePointTo(point5) {
|
|
37487
37542
|
return this.path.getNearestEdgePointTo(point5);
|
|
37488
37543
|
}
|
|
@@ -43263,13 +43318,8 @@ function createCanvasDrawer(board) {
|
|
|
43263
43318
|
// src/Selection/QuickAddButtons/quickAddHelpers.ts
|
|
43264
43319
|
function getControlPointData(item, index2, isRichText = false) {
|
|
43265
43320
|
const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
|
|
43266
|
-
const width2 = item.
|
|
43267
|
-
let height3;
|
|
43268
|
-
if (item.itemType === "Shape" && index2 !== 2 && index2 !== 3) {
|
|
43269
|
-
height3 = item.getPath().getMbr().getHeight();
|
|
43270
|
-
} else {
|
|
43271
|
-
height3 = item.getMbr().getHeight();
|
|
43272
|
-
}
|
|
43321
|
+
const width2 = item.getPathMbr().getWidth();
|
|
43322
|
+
let height3 = item.getPathMbr().getHeight();
|
|
43273
43323
|
const adjMapScaled = {
|
|
43274
43324
|
0: { x: 0, y: height3 / 2 / itemScale.y },
|
|
43275
43325
|
1: {
|
|
@@ -43302,7 +43352,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43302
43352
|
optionalItem = new Sticker(board);
|
|
43303
43353
|
break;
|
|
43304
43354
|
case "AINode":
|
|
43305
|
-
optionalItem = createAINode2(board, startPoint?.item?.getId()
|
|
43355
|
+
optionalItem = createAINode2(board, 3, "item" in startPoint ? startPoint?.item?.getId() : undefined);
|
|
43306
43356
|
break;
|
|
43307
43357
|
}
|
|
43308
43358
|
let itemMbr = optionalItem.getMbr();
|
|
@@ -43329,20 +43379,25 @@ function quickAddItem(board, type, connector) {
|
|
|
43329
43379
|
if ("text" in guarded && guarded.itemType !== "AINode" && guarded.itemType !== "RichText") {
|
|
43330
43380
|
delete guarded.text;
|
|
43331
43381
|
}
|
|
43382
|
+
if (!itemData.transformation) {
|
|
43383
|
+
itemData.transformation = new DefaultTransformationData;
|
|
43384
|
+
}
|
|
43332
43385
|
itemData.transformation.translateX = endPoint.x;
|
|
43333
43386
|
itemData.transformation.translateY = endPoint.y;
|
|
43334
43387
|
const lines = connector.lines.getSegments();
|
|
43335
43388
|
const lastLine = lines[lines.length - 1];
|
|
43336
|
-
|
|
43389
|
+
const lastLineStart = lastLine.getStartPoint();
|
|
43390
|
+
const lastLineEnd = lastLine.getEndPoint();
|
|
43391
|
+
let dir2 = getDirection(lastLineStart, lastLineEnd);
|
|
43392
|
+
const firstLineStart = lines[0].getEndPoint();
|
|
43337
43393
|
if (!dir2) {
|
|
43338
|
-
const
|
|
43339
|
-
const
|
|
43340
|
-
const yDiff = Math.abs(firstLine.start.y - lastLine.end.y);
|
|
43394
|
+
const xDiff = Math.abs(firstLineStart.x - lastLineEnd.x);
|
|
43395
|
+
const yDiff = Math.abs(firstLineStart.y - lastLineEnd.y);
|
|
43341
43396
|
dir2 = xDiff > yDiff ? "horizontal" : "vertical";
|
|
43342
43397
|
}
|
|
43343
43398
|
let dirIndex = -1;
|
|
43344
43399
|
if (dir2 === "vertical") {
|
|
43345
|
-
if (
|
|
43400
|
+
if (firstLineStart.y > lastLineEnd.y) {
|
|
43346
43401
|
itemData.transformation.translateX -= itemMbr.getWidth() / 2;
|
|
43347
43402
|
itemData.transformation.translateY -= itemMbr.getHeight();
|
|
43348
43403
|
dirIndex = 3;
|
|
@@ -43351,7 +43406,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43351
43406
|
dirIndex = 2;
|
|
43352
43407
|
}
|
|
43353
43408
|
} else if (dir2 === "horizontal") {
|
|
43354
|
-
if (
|
|
43409
|
+
if (firstLineStart.x > lastLineEnd.x) {
|
|
43355
43410
|
itemData.transformation.translateX -= itemMbr.getWidth();
|
|
43356
43411
|
itemData.transformation.translateY -= itemMbr.getHeight() / 2;
|
|
43357
43412
|
dirIndex = 1;
|
|
@@ -43373,7 +43428,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43373
43428
|
connector.setEndPoint(newEndPoint);
|
|
43374
43429
|
board.selection.removeAll();
|
|
43375
43430
|
board.selection.add(added);
|
|
43376
|
-
if (added
|
|
43431
|
+
if (added instanceof RichText || added instanceof AINode) {
|
|
43377
43432
|
const text5 = added.getRichText();
|
|
43378
43433
|
text5.editor.setMaxWidth(text5.editor.maxWidth || 600);
|
|
43379
43434
|
board.selection.editText();
|
|
@@ -43381,7 +43436,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43381
43436
|
board.selection.setContext("EditUnderPointer");
|
|
43382
43437
|
}
|
|
43383
43438
|
}
|
|
43384
|
-
function createAINode2(board,
|
|
43439
|
+
function createAINode2(board, directionIndex, parentNodeId) {
|
|
43385
43440
|
const node2 = new AINode(board, true, parentNodeId, undefined, directionIndex);
|
|
43386
43441
|
const nodeRichText = node2.getRichText();
|
|
43387
43442
|
nodeRichText.applyMaxWidth(600);
|
|
@@ -43415,17 +43470,17 @@ function getQuickAddButtons(selection, board) {
|
|
|
43415
43470
|
let quickAddItems = undefined;
|
|
43416
43471
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
43417
43472
|
const connectorStorage = new SessionStorage;
|
|
43418
|
-
const currMbr = selectedItem.
|
|
43473
|
+
const currMbr = selectedItem.getPathMbr();
|
|
43419
43474
|
const selectedItemData = selectedItem.serialize();
|
|
43420
|
-
const width2 =
|
|
43421
|
-
const height3 =
|
|
43475
|
+
const width2 = currMbr.getWidth();
|
|
43476
|
+
const height3 = currMbr.getHeight();
|
|
43422
43477
|
let offsetX = width2;
|
|
43423
43478
|
let offsetY = height3;
|
|
43424
43479
|
let newWidth = width2;
|
|
43425
43480
|
let newHeight = height3;
|
|
43426
43481
|
let itemData;
|
|
43427
43482
|
if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
|
|
43428
|
-
const item = selectedItem.itemType === "AINode" ? createAINode2(board, selectedItem.getId()
|
|
43483
|
+
const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
|
|
43429
43484
|
newWidth = item.getMbr().getWidth();
|
|
43430
43485
|
newHeight = item.getMbr().getHeight();
|
|
43431
43486
|
itemData = item.serialize();
|
|
@@ -43474,9 +43529,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
43474
43529
|
const endPoints = getQuickButtonsPositions(newMbr);
|
|
43475
43530
|
const reverseIndexMap = { 0: 1, 1: 0, 2: 3, 3: 2 };
|
|
43476
43531
|
const connectorEndPoint = endPoints?.positions[reverseIndexMap[index2]] || new Point;
|
|
43477
|
-
const fontSize = selectedItem
|
|
43532
|
+
const fontSize = selectedItem instanceof RichText ? selectedItem.getFontSize() : 14;
|
|
43478
43533
|
const newItem = board.createItem(board.getNewItemId(), newItemData);
|
|
43479
|
-
if (newItem
|
|
43534
|
+
if (newItem instanceof RichText) {
|
|
43480
43535
|
const storage = new SessionStorage;
|
|
43481
43536
|
storage.setFontSize("RichText", fontSize);
|
|
43482
43537
|
newItem.editor.selectWholeText();
|
|
@@ -43489,6 +43544,10 @@ function getQuickAddButtons(selection, board) {
|
|
|
43489
43544
|
const scaleX = newItemMbr.getWidth() / 100;
|
|
43490
43545
|
const scaleY = newItemMbr.getHeight() / 100;
|
|
43491
43546
|
shapeData.transformation = {
|
|
43547
|
+
isLocked: false,
|
|
43548
|
+
rotate: 0,
|
|
43549
|
+
translateX: 0,
|
|
43550
|
+
translateY: 0,
|
|
43492
43551
|
...newItemData.transformation,
|
|
43493
43552
|
scaleX,
|
|
43494
43553
|
scaleY
|
|
@@ -43545,7 +43604,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
43545
43604
|
}
|
|
43546
43605
|
let pathCenter;
|
|
43547
43606
|
if (single.itemType === "Shape") {
|
|
43548
|
-
pathCenter = single.
|
|
43607
|
+
pathCenter = single.getPathMbr().getCenter();
|
|
43549
43608
|
}
|
|
43550
43609
|
const center = itemMbr.getCenter();
|
|
43551
43610
|
const width2 = itemMbr.getWidth();
|
|
@@ -47914,7 +47973,7 @@ class Presence {
|
|
|
47914
47973
|
};
|
|
47915
47974
|
});
|
|
47916
47975
|
ctx2.restore();
|
|
47917
|
-
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop);
|
|
47976
|
+
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop) || null;
|
|
47918
47977
|
};
|
|
47919
47978
|
renderLoop();
|
|
47920
47979
|
}
|
|
@@ -49281,7 +49340,7 @@ class SpatialIndex {
|
|
|
49281
49340
|
return this.itemsIndex.getRectsEnclosedOrCrossedBy(new Mbr(left, top, right, bottom));
|
|
49282
49341
|
}
|
|
49283
49342
|
getComments() {
|
|
49284
|
-
return this.itemsArray.filter((item) => item instanceof
|
|
49343
|
+
return this.itemsArray.filter((item) => item instanceof Comment2);
|
|
49285
49344
|
}
|
|
49286
49345
|
getMbr() {
|
|
49287
49346
|
return this.Mbr;
|
|
@@ -49405,10 +49464,10 @@ class Items {
|
|
|
49405
49464
|
}
|
|
49406
49465
|
const { nearest } = enclosed.reduce((acc, item) => {
|
|
49407
49466
|
const area = item.getMbr().getHeight() * item.getMbr().getWidth();
|
|
49408
|
-
if (item
|
|
49467
|
+
if (item instanceof Drawing && !item.isPointNearLine(this.pointer.point)) {
|
|
49409
49468
|
return acc;
|
|
49410
49469
|
}
|
|
49411
|
-
const isItemTransparent = item
|
|
49470
|
+
const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
|
|
49412
49471
|
const itemZIndex = this.getZIndex(item);
|
|
49413
49472
|
const accZIndex = this.getZIndex(acc.nearest);
|
|
49414
49473
|
if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
|
|
@@ -49439,7 +49498,7 @@ class Items {
|
|
|
49439
49498
|
}
|
|
49440
49499
|
getLinkedConnectorsById(id) {
|
|
49441
49500
|
return this.listAll().filter((item) => {
|
|
49442
|
-
if (item
|
|
49501
|
+
if (!(item instanceof Connector2)) {
|
|
49443
49502
|
return false;
|
|
49444
49503
|
}
|
|
49445
49504
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -49454,7 +49513,7 @@ class Items {
|
|
|
49454
49513
|
return [];
|
|
49455
49514
|
}
|
|
49456
49515
|
return this.listAll().filter((item) => {
|
|
49457
|
-
if (item
|
|
49516
|
+
if (!(item instanceof Connector2) || !item.isConnected()) {
|
|
49458
49517
|
return false;
|
|
49459
49518
|
}
|
|
49460
49519
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -49629,7 +49688,7 @@ class SelectionItems {
|
|
|
49629
49688
|
return ids;
|
|
49630
49689
|
}
|
|
49631
49690
|
getSingle() {
|
|
49632
|
-
return this.isSingle() ? this.items.values().next().value : null;
|
|
49691
|
+
return this.isSingle() ? this.items.values().next().value || null : null;
|
|
49633
49692
|
}
|
|
49634
49693
|
listByIds(itemIdList) {
|
|
49635
49694
|
return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
|
|
@@ -49677,7 +49736,7 @@ class ConnectorTransformer extends Tool {
|
|
|
49677
49736
|
getConnector(items) {
|
|
49678
49737
|
if (items.isSingle()) {
|
|
49679
49738
|
const connector = items.getSingle();
|
|
49680
|
-
if (connector
|
|
49739
|
+
if (connector instanceof Connector2) {
|
|
49681
49740
|
return connector;
|
|
49682
49741
|
}
|
|
49683
49742
|
}
|
|
@@ -51147,10 +51206,10 @@ class BoardSelection {
|
|
|
51147
51206
|
}
|
|
51148
51207
|
copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
|
|
51149
51208
|
}
|
|
51150
|
-
copy(skipImageBlobCopy
|
|
51209
|
+
copy(skipImageBlobCopy) {
|
|
51151
51210
|
const copiedItemsMap = {};
|
|
51152
51211
|
const single = this.items.getSingle();
|
|
51153
|
-
if (!skipImageBlobCopy && single && single
|
|
51212
|
+
if (!skipImageBlobCopy && single && single instanceof ImageItem) {
|
|
51154
51213
|
this.handleItemCopy(single, copiedItemsMap);
|
|
51155
51214
|
return { imageElement: single.image, imageData: copiedItemsMap };
|
|
51156
51215
|
}
|
|
@@ -51175,7 +51234,7 @@ class BoardSelection {
|
|
|
51175
51234
|
return copiedItemsMap;
|
|
51176
51235
|
}
|
|
51177
51236
|
cut() {
|
|
51178
|
-
const items = this.copy();
|
|
51237
|
+
const items = this.copy(true);
|
|
51179
51238
|
this.removeFromBoard();
|
|
51180
51239
|
return items;
|
|
51181
51240
|
}
|
|
@@ -51326,7 +51385,7 @@ class BoardSelection {
|
|
|
51326
51385
|
});
|
|
51327
51386
|
Object.values(selectedMap).forEach((val) => {
|
|
51328
51387
|
const parentFrame = this.board.items.getById(val.item.parent);
|
|
51329
|
-
const isParentFrame = parentFrame
|
|
51388
|
+
const isParentFrame = parentFrame instanceof Frame;
|
|
51330
51389
|
const parentFrameId = isParentFrame ? parentFrame.getId() : null;
|
|
51331
51390
|
if (val.nested) {
|
|
51332
51391
|
const isRemoveChildFromFrame = Object.values(selectedMap).some((val2) => val2.nested && val2.nested.getId() !== parentFrameId);
|
|
@@ -51341,7 +51400,7 @@ class BoardSelection {
|
|
|
51341
51400
|
console.warn(`Didnt find frame with id ${val.item.parent}`);
|
|
51342
51401
|
}
|
|
51343
51402
|
}
|
|
51344
|
-
if (val.item
|
|
51403
|
+
if (val.item instanceof Frame && checkFrames) {
|
|
51345
51404
|
const currFrame = val.item;
|
|
51346
51405
|
const currMbr = currFrame.getMbr();
|
|
51347
51406
|
const children = val.item.getChildrenIds().map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
|
|
@@ -51749,12 +51808,6 @@ class BoardSelection {
|
|
|
51749
51808
|
text5.setEditorFocus(this.context);
|
|
51750
51809
|
}
|
|
51751
51810
|
}
|
|
51752
|
-
getMediaStorageIds() {
|
|
51753
|
-
return this.items.list().filter((item) => {
|
|
51754
|
-
const shouldClearStorageUsage = item.itemType === "Image" || item.itemType === "Video" && item.getIsStorageUrl() || item.itemType === "Audio" && item.getIsStorageUrl();
|
|
51755
|
-
return shouldClearStorageUsage;
|
|
51756
|
-
}).map((item) => item.getStorageId());
|
|
51757
|
-
}
|
|
51758
51811
|
removeFromBoard() {
|
|
51759
51812
|
const isLocked = this.items.list().some((item) => item.transformation.isLocked);
|
|
51760
51813
|
if (isLocked) {
|
|
@@ -51769,7 +51822,6 @@ class BoardSelection {
|
|
|
51769
51822
|
const connectors = itemIds.flatMap((id) => {
|
|
51770
51823
|
return this.board.items.getLinkedConnectorsById(id);
|
|
51771
51824
|
}).map((connector) => connector.getId());
|
|
51772
|
-
conf.hooks.beforeMediaRemove(this.getMediaStorageIds(), this.board.getBoardId());
|
|
51773
51825
|
this.emit({
|
|
51774
51826
|
class: "Board",
|
|
51775
51827
|
method: "remove",
|
|
@@ -51806,7 +51858,15 @@ class BoardSelection {
|
|
|
51806
51858
|
this.board.sendToBack(this.items.list());
|
|
51807
51859
|
}
|
|
51808
51860
|
async duplicate() {
|
|
51809
|
-
const mediaIds =
|
|
51861
|
+
const mediaIds = [];
|
|
51862
|
+
this.items.list().forEach((item) => {
|
|
51863
|
+
if ("getStorageId" in item) {
|
|
51864
|
+
const storageId = item.getStorageId();
|
|
51865
|
+
if (storageId) {
|
|
51866
|
+
mediaIds.push(storageId);
|
|
51867
|
+
}
|
|
51868
|
+
}
|
|
51869
|
+
});
|
|
51810
51870
|
const canDuplicate = mediaIds.length ? await conf.hooks.beforeMediaUpload(mediaIds, this.board.getBoardId()) : true;
|
|
51811
51871
|
if (!canDuplicate) {
|
|
51812
51872
|
return;
|
|
@@ -51874,7 +51934,7 @@ class BoardSelection {
|
|
|
51874
51934
|
}
|
|
51875
51935
|
}
|
|
51876
51936
|
const contextItems = [];
|
|
51877
|
-
if (single && single
|
|
51937
|
+
if (single && single instanceof AINode) {
|
|
51878
51938
|
const contextItemsIds = single.getContextItems();
|
|
51879
51939
|
if (contextItemsIds.length) {
|
|
51880
51940
|
const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
|
|
@@ -51896,7 +51956,7 @@ class BoardSelection {
|
|
|
51896
51956
|
}
|
|
51897
51957
|
}
|
|
51898
51958
|
contextItems.forEach((item) => {
|
|
51899
|
-
if (item
|
|
51959
|
+
if (item instanceof AINode) {
|
|
51900
51960
|
const path2 = item.getPath();
|
|
51901
51961
|
path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
|
|
51902
51962
|
path2.setBorderWidth(2);
|
|
@@ -51911,6 +51971,416 @@ class BoardSelection {
|
|
|
51911
51971
|
});
|
|
51912
51972
|
}
|
|
51913
51973
|
}
|
|
51974
|
+
// src/public/customWebComponents.js
|
|
51975
|
+
var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
|
|
51976
|
+
class RichTextElement extends HTMLElement {
|
|
51977
|
+
constructor() {
|
|
51978
|
+
super();
|
|
51979
|
+
}
|
|
51980
|
+
}
|
|
51981
|
+
|
|
51982
|
+
class ShapeItemElement extends HTMLElement {
|
|
51983
|
+
constructor() {
|
|
51984
|
+
super();
|
|
51985
|
+
}
|
|
51986
|
+
}
|
|
51987
|
+
|
|
51988
|
+
class StickerElement extends HTMLElement {
|
|
51989
|
+
constructor() {
|
|
51990
|
+
super();
|
|
51991
|
+
}
|
|
51992
|
+
}
|
|
51993
|
+
|
|
51994
|
+
class DrawingElement extends HTMLElement {
|
|
51995
|
+
constructor() {
|
|
51996
|
+
super();
|
|
51997
|
+
}
|
|
51998
|
+
}
|
|
51999
|
+
|
|
52000
|
+
class ConnectorElement extends HTMLElement {
|
|
52001
|
+
constructor() {
|
|
52002
|
+
super();
|
|
52003
|
+
}
|
|
52004
|
+
}
|
|
52005
|
+
|
|
52006
|
+
class FrameItemElement extends HTMLElement {
|
|
52007
|
+
constructor() {
|
|
52008
|
+
super();
|
|
52009
|
+
}
|
|
52010
|
+
}
|
|
52011
|
+
|
|
52012
|
+
class ImageItemElement extends HTMLElement {
|
|
52013
|
+
constructor() {
|
|
52014
|
+
super();
|
|
52015
|
+
}
|
|
52016
|
+
}
|
|
52017
|
+
|
|
52018
|
+
class LinkItemElement extends HTMLElement {
|
|
52019
|
+
constructor() {
|
|
52020
|
+
super();
|
|
52021
|
+
}
|
|
52022
|
+
}
|
|
52023
|
+
|
|
52024
|
+
class AINodeItemElement extends HTMLElement {
|
|
52025
|
+
constructor() {
|
|
52026
|
+
super();
|
|
52027
|
+
}
|
|
52028
|
+
}
|
|
52029
|
+
|
|
52030
|
+
class VideoItemElement extends HTMLElement {
|
|
52031
|
+
constructor() {
|
|
52032
|
+
super();
|
|
52033
|
+
}
|
|
52034
|
+
}
|
|
52035
|
+
|
|
52036
|
+
class CommentElement extends HTMLElement {
|
|
52037
|
+
constructor() {
|
|
52038
|
+
super();
|
|
52039
|
+
}
|
|
52040
|
+
}
|
|
52041
|
+
|
|
52042
|
+
class AudioItemElement extends HTMLElement {
|
|
52043
|
+
constructor() {
|
|
52044
|
+
super();
|
|
52045
|
+
}
|
|
52046
|
+
}
|
|
52047
|
+
|
|
52048
|
+
customElements.define("rich-text", RichTextElement);
|
|
52049
|
+
customElements.define("shape-item", ShapeItemElement);
|
|
52050
|
+
customElements.define("sticker-item", StickerElement);
|
|
52051
|
+
customElements.define("drawing-item", DrawingElement);
|
|
52052
|
+
customElements.define("connector-item", ConnectorElement);
|
|
52053
|
+
customElements.define("frame-item", FrameItemElement);
|
|
52054
|
+
customElements.define("image-item", ImageItemElement);
|
|
52055
|
+
customElements.define("link-item", LinkItemElement);
|
|
52056
|
+
customElements.define("ainode-item", AINodeItemElement);
|
|
52057
|
+
customElements.define("video-item", VideoItemElement);
|
|
52058
|
+
customElements.define("comment-item", CommentElement);
|
|
52059
|
+
customElements.define("audio-item", AudioItemElement);
|
|
52060
|
+
|
|
52061
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
52062
|
+
const itemsDiv = document.querySelector("#items");
|
|
52063
|
+
if (!itemsDiv) {
|
|
52064
|
+
console.error("ITEMS DIV NOT FOUND!");
|
|
52065
|
+
return;
|
|
52066
|
+
}
|
|
52067
|
+
let isDragging = false;
|
|
52068
|
+
let startX, startY;
|
|
52069
|
+
let translateX = 0;
|
|
52070
|
+
let translateY = 0;
|
|
52071
|
+
let scale = 1;
|
|
52072
|
+
|
|
52073
|
+
itemsDiv.style.transformOrigin = "0 0";
|
|
52074
|
+
document.body.style.cursor = "grab";
|
|
52075
|
+
|
|
52076
|
+
function updateTransform() {
|
|
52077
|
+
itemsDiv.style.transform =
|
|
52078
|
+
"translate(" +
|
|
52079
|
+
translateX +
|
|
52080
|
+
"px, " +
|
|
52081
|
+
translateY +
|
|
52082
|
+
"px) scale(" +
|
|
52083
|
+
scale +
|
|
52084
|
+
")";
|
|
52085
|
+
}
|
|
52086
|
+
|
|
52087
|
+
function handleMouseDown(ev) {
|
|
52088
|
+
isDragging = true;
|
|
52089
|
+
startX = ev.clientX;
|
|
52090
|
+
startY = ev.clientY;
|
|
52091
|
+
itemsDiv.style.cursor = "grabbing";
|
|
52092
|
+
}
|
|
52093
|
+
|
|
52094
|
+
function handleMouseMove(ev) {
|
|
52095
|
+
if (!isDragging) {
|
|
52096
|
+
return;
|
|
52097
|
+
}
|
|
52098
|
+
const dx = ev.clientX - startX;
|
|
52099
|
+
const dy = ev.clientY - startY;
|
|
52100
|
+
startX += dx;
|
|
52101
|
+
startY += dy;
|
|
52102
|
+
translateX += dx;
|
|
52103
|
+
translateY += dy;
|
|
52104
|
+
updateTransform();
|
|
52105
|
+
}
|
|
52106
|
+
|
|
52107
|
+
function handleMouseUp(ev) {
|
|
52108
|
+
if (!isDragging) {
|
|
52109
|
+
return;
|
|
52110
|
+
}
|
|
52111
|
+
isDragging = false;
|
|
52112
|
+
itemsDiv.style.cursor = "grab";
|
|
52113
|
+
}
|
|
52114
|
+
|
|
52115
|
+
function handleWheel(ev) {
|
|
52116
|
+
ev.preventDefault();
|
|
52117
|
+
const factor = ev.deltaY < 0 ? 1.1 : 0.9;
|
|
52118
|
+
translateX = ev.clientX - (ev.clientX - translateX) * factor;
|
|
52119
|
+
translateY = ev.clientY - (ev.clientY - translateY) * factor;
|
|
52120
|
+
scale *= factor;
|
|
52121
|
+
updateTransform();
|
|
52122
|
+
}
|
|
52123
|
+
|
|
52124
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
52125
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
52126
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
52127
|
+
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
52128
|
+
|
|
52129
|
+
const titlePanel = document.createElement("div");
|
|
52130
|
+
titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
|
|
52131
|
+
titlePanel.style.position = "fixed";
|
|
52132
|
+
titlePanel.style.left = "12px";
|
|
52133
|
+
titlePanel.style.top = "12px";
|
|
52134
|
+
titlePanel.style.borderRadius = "12px";
|
|
52135
|
+
titlePanel.style.backgroundColor = "#ffff";
|
|
52136
|
+
titlePanel.style.display = "flex";
|
|
52137
|
+
titlePanel.style.alignItems = "center";
|
|
52138
|
+
titlePanel.style.gap = "8px";
|
|
52139
|
+
titlePanel.style.padding = "0 12px";
|
|
52140
|
+
titlePanel.style.height = "48px";
|
|
52141
|
+
const editButton = document.createElement("button");
|
|
52142
|
+
const editIcon = document.createElementNS(
|
|
52143
|
+
"http://www.w3.org/2000/svg",
|
|
52144
|
+
"svg",
|
|
52145
|
+
);
|
|
52146
|
+
editIcon.setAttribute("width", "13");
|
|
52147
|
+
editIcon.setAttribute("height", "13");
|
|
52148
|
+
editIcon.setAttribute("viewBox", "0 0 13 13");
|
|
52149
|
+
editIcon.setAttribute("fill", "none");
|
|
52150
|
+
editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52151
|
+
const editIconPath = document.createElementNS(
|
|
52152
|
+
"http://www.w3.org/2000/svg",
|
|
52153
|
+
"path",
|
|
52154
|
+
);
|
|
52155
|
+
editIconPath.setAttribute(
|
|
52156
|
+
"d",
|
|
52157
|
+
"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",
|
|
52158
|
+
);
|
|
52159
|
+
editIconPath.setAttribute("fill", "#ffff");
|
|
52160
|
+
editIcon.appendChild(editIconPath);
|
|
52161
|
+
editButton.appendChild(editIcon);
|
|
52162
|
+
const editFileText = document.createElement("p");
|
|
52163
|
+
const isSnapshotInIframe =
|
|
52164
|
+
window.parent &&
|
|
52165
|
+
window.parent !== window &&
|
|
52166
|
+
window.parent.location.href.includes("/snapshots/");
|
|
52167
|
+
editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
|
|
52168
|
+
editButton.appendChild(editFileText);
|
|
52169
|
+
|
|
52170
|
+
editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
|
|
52171
|
+
editButton.style.cursor = "pointer";
|
|
52172
|
+
editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
|
|
52173
|
+
editButton.style.color = "#ffff";
|
|
52174
|
+
editButton.style.fontSize = "14px";
|
|
52175
|
+
editButton.style.lineHeight = "20px";
|
|
52176
|
+
editButton.style.display = "flex";
|
|
52177
|
+
editButton.style.alignItems = "center";
|
|
52178
|
+
editButton.style.gap = "8px";
|
|
52179
|
+
editButton.style.padding = "8px";
|
|
52180
|
+
editButton.style.borderRadius = "10px";
|
|
52181
|
+
const separator = document.createElement("div");
|
|
52182
|
+
separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
|
|
52183
|
+
separator.style.height = "100%";
|
|
52184
|
+
const boardName = document.createElement("div");
|
|
52185
|
+
const fileIcon = document.createElementNS(
|
|
52186
|
+
"http://www.w3.org/2000/svg",
|
|
52187
|
+
"svg",
|
|
52188
|
+
);
|
|
52189
|
+
fileIcon.setAttribute("width", "16");
|
|
52190
|
+
fileIcon.setAttribute("height", "18");
|
|
52191
|
+
fileIcon.setAttribute("viewBox", "0 0 16 18");
|
|
52192
|
+
fileIcon.setAttribute("fill", "none");
|
|
52193
|
+
fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52194
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
52195
|
+
path.setAttribute(
|
|
52196
|
+
"d",
|
|
52197
|
+
"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",
|
|
52198
|
+
);
|
|
52199
|
+
path.setAttribute("fill", "#696B76");
|
|
52200
|
+
fileIcon.appendChild(path);
|
|
52201
|
+
boardName.appendChild(fileIcon);
|
|
52202
|
+
const boardNameTag = document.querySelector('meta[name="board-name"]');
|
|
52203
|
+
let boardNameStr = "Untitled";
|
|
52204
|
+
if (boardNameTag) {
|
|
52205
|
+
boardNameStr = boardNameTag.getAttribute("content");
|
|
52206
|
+
}
|
|
52207
|
+
const p = document.createElement("p");
|
|
52208
|
+
p.textContent = boardNameStr;
|
|
52209
|
+
p.style.fontSize = "16px";
|
|
52210
|
+
p.style.lineHeight = "24px";
|
|
52211
|
+
boardName.appendChild(p);
|
|
52212
|
+
const cloudIcon = document.createElementNS(
|
|
52213
|
+
"http://www.w3.org/2000/svg",
|
|
52214
|
+
"svg",
|
|
52215
|
+
);
|
|
52216
|
+
cloudIcon.setAttribute("width", "20");
|
|
52217
|
+
cloudIcon.setAttribute("height", "18");
|
|
52218
|
+
cloudIcon.setAttribute("viewBox", "0 0 20 18");
|
|
52219
|
+
cloudIcon.setAttribute("fill", "none");
|
|
52220
|
+
cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52221
|
+
const cloudIconPath = document.createElementNS(
|
|
52222
|
+
"http://www.w3.org/2000/svg",
|
|
52223
|
+
"path",
|
|
52224
|
+
);
|
|
52225
|
+
cloudIconPath.setAttribute(
|
|
52226
|
+
"d",
|
|
52227
|
+
"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",
|
|
52228
|
+
);
|
|
52229
|
+
cloudIconPath.setAttribute("fill", "#696B76");
|
|
52230
|
+
cloudIcon.appendChild(cloudIconPath);
|
|
52231
|
+
boardName.appendChild(cloudIcon);
|
|
52232
|
+
boardName.style.display = "flex";
|
|
52233
|
+
boardName.style.alignItems = "center";
|
|
52234
|
+
boardName.style.gap = "8px";
|
|
52235
|
+
titlePanel.appendChild(boardName);
|
|
52236
|
+
titlePanel.appendChild(separator);
|
|
52237
|
+
titlePanel.appendChild(editButton);
|
|
52238
|
+
document.body.appendChild(titlePanel);
|
|
52239
|
+
|
|
52240
|
+
editButton.onclick = async () => {
|
|
52241
|
+
editButton.disabled = true;
|
|
52242
|
+
editButton.textContent = "Loading...";
|
|
52243
|
+
|
|
52244
|
+
try {
|
|
52245
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
52246
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
52247
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
52248
|
+
document.removeEventListener("wheel", handleWheel, {
|
|
52249
|
+
passive: false,
|
|
52250
|
+
});
|
|
52251
|
+
translateX = 0;
|
|
52252
|
+
translateY = 0;
|
|
52253
|
+
scale = 1;
|
|
52254
|
+
updateTransform();
|
|
52255
|
+
|
|
52256
|
+
const { initBrowserSettings } = await import(
|
|
52257
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
52258
|
+
);
|
|
52259
|
+
initBrowserSettings();
|
|
52260
|
+
|
|
52261
|
+
const { createApp } = await import(
|
|
52262
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
52263
|
+
);
|
|
52264
|
+
|
|
52265
|
+
const app = createApp();
|
|
52266
|
+
window.app = app;
|
|
52267
|
+
const stringed = await app.openAndEditFile();
|
|
52268
|
+
|
|
52269
|
+
if (stringed) {
|
|
52270
|
+
await app.openBoardFromFile();
|
|
52271
|
+
app.getBoard().deserializeHTML(stringed);
|
|
52272
|
+
app.localRender("items");
|
|
52273
|
+
}
|
|
52274
|
+
|
|
52275
|
+
const response = await fetch(
|
|
52276
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
|
|
52277
|
+
);
|
|
52278
|
+
const cssText = await response.text();
|
|
52279
|
+
const styleEl = document.createElement("style");
|
|
52280
|
+
styleEl.textContent = cssText;
|
|
52281
|
+
document.body.appendChild(styleEl);
|
|
52282
|
+
|
|
52283
|
+
const responseSvg = await fetch(
|
|
52284
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
|
|
52285
|
+
);
|
|
52286
|
+
const svgText = await responseSvg.text();
|
|
52287
|
+
const div = document.createElement("div");
|
|
52288
|
+
div.style.display = "none";
|
|
52289
|
+
div.id = "sprite";
|
|
52290
|
+
div.innerHTML = svgText;
|
|
52291
|
+
document.body.appendChild(div);
|
|
52292
|
+
} finally {
|
|
52293
|
+
editButton.disabled = false;
|
|
52294
|
+
editButton.textContent = "Edit board";
|
|
52295
|
+
}
|
|
52296
|
+
};
|
|
52297
|
+
});
|
|
52298
|
+
`;
|
|
52299
|
+
|
|
52300
|
+
// src/public/loadLinkImages.js
|
|
52301
|
+
var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
|
|
52302
|
+
document.querySelectorAll(".link-object").forEach(linkItem => {
|
|
52303
|
+
const linkImage = linkItem.querySelector(".link-image");
|
|
52304
|
+
const linkContainer = linkItem.querySelector("a");
|
|
52305
|
+
linkImage.onerror = () => {
|
|
52306
|
+
linkImage.onerror = null;
|
|
52307
|
+
linkImage.style.display = "none";
|
|
52308
|
+
const svgNamespace = "http://www.w3.org/2000/svg";
|
|
52309
|
+
const svg = document.createElementNS(svgNamespace, "svg");
|
|
52310
|
+
svg.setAttribute("width", "20");
|
|
52311
|
+
svg.setAttribute("height", "20");
|
|
52312
|
+
svg.setAttribute("viewBox", "0 0 13 14");
|
|
52313
|
+
svg.setAttribute("fill", "none");
|
|
52314
|
+
|
|
52315
|
+
const path = document.createElementNS(svgNamespace, "path");
|
|
52316
|
+
path.setAttribute(
|
|
52317
|
+
"d",
|
|
52318
|
+
"M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
|
|
52319
|
+
);
|
|
52320
|
+
path.setAttribute("fill", "#924FE8");
|
|
52321
|
+
svg.appendChild(path);
|
|
52322
|
+
|
|
52323
|
+
linkContainer.appendChild(svg);
|
|
52324
|
+
};
|
|
52325
|
+
});
|
|
52326
|
+
});
|
|
52327
|
+
`;
|
|
52328
|
+
|
|
52329
|
+
// src/public/index.css
|
|
52330
|
+
var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
|
|
52331
|
+
@import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
|
|
52332
|
+
|
|
52333
|
+
/* ../src/index.css */
|
|
52334
|
+
:root {
|
|
52335
|
+
--background-surface-default: rgb(255, 255, 255);
|
|
52336
|
+
--background-button-secondary: rgb(255, 255, 255);
|
|
52337
|
+
--background-button-secondary-hover: rgb(247, 247, 248);
|
|
52338
|
+
--background-badge-purple-disabled: rgb(247, 241, 253);
|
|
52339
|
+
--background-badge-gray: rgb(233, 234, 236);
|
|
52340
|
+
--background-accent-purple: rgb(146, 79, 232);
|
|
52341
|
+
--border-action-normal: rgb(222, 223, 227);
|
|
52342
|
+
--border-action-focus: rgb(146, 79, 232);
|
|
52343
|
+
--border-select-primary: rgb(146, 79, 232);
|
|
52344
|
+
--text-base-primary: rgb(20, 21, 26);
|
|
52345
|
+
--text-base-secondary: rgba(15, 19, 36, 0.6);
|
|
52346
|
+
--text-base-quaternary: rgb(10, 15, 41, 0.25);
|
|
52347
|
+
--text-accent-purple: rgb(152, 89, 233);
|
|
52348
|
+
--icon-base-primary: rgb(20, 21, 26);
|
|
52349
|
+
--icon-base-secondary: rgb(105, 107, 118);
|
|
52350
|
+
--icon-accent-purple: rgb(146, 79, 232);
|
|
52351
|
+
--absolute-position-panel-padding: 12px;
|
|
52352
|
+
}
|
|
52353
|
+
* {
|
|
52354
|
+
box-sizing: border-box;
|
|
52355
|
+
padding: 0;
|
|
52356
|
+
margin: 0;
|
|
52357
|
+
border: none;
|
|
52358
|
+
background: none;
|
|
52359
|
+
font-family: inherit;
|
|
52360
|
+
}
|
|
52361
|
+
html {
|
|
52362
|
+
font-size: 62.5%;
|
|
52363
|
+
}
|
|
52364
|
+
body {
|
|
52365
|
+
color: var(--text-base-primary);
|
|
52366
|
+
font-size: 1.6rem;
|
|
52367
|
+
font-optical-sizing: auto;
|
|
52368
|
+
font-style: normal;
|
|
52369
|
+
font-family: "Manrope", sans-serif;
|
|
52370
|
+
}
|
|
52371
|
+
html,
|
|
52372
|
+
body {
|
|
52373
|
+
overscroll-behavior-x: none;
|
|
52374
|
+
-webkit-user-select: none;
|
|
52375
|
+
}
|
|
52376
|
+
input:-webkit-autofill,
|
|
52377
|
+
input:-webkit-autofill:hover,
|
|
52378
|
+
input:-webkit-autofill:focus,
|
|
52379
|
+
input:-webkit-autofill:active {
|
|
52380
|
+
-webkit-box-shadow: 0 0 0 30px white inset !important;
|
|
52381
|
+
}
|
|
52382
|
+
`;
|
|
52383
|
+
|
|
51914
52384
|
// src/Board.ts
|
|
51915
52385
|
class Board {
|
|
51916
52386
|
boardId;
|
|
@@ -52293,9 +52763,9 @@ class Board {
|
|
|
52293
52763
|
return this.copy();
|
|
52294
52764
|
}
|
|
52295
52765
|
serializeHTML() {
|
|
52296
|
-
const customTagsScript =
|
|
52297
|
-
const loadLinksImagesScript =
|
|
52298
|
-
const css =
|
|
52766
|
+
const customTagsScript = customWebComponents_default;
|
|
52767
|
+
const loadLinksImagesScript = loadLinkImages_default;
|
|
52768
|
+
const css = public_default;
|
|
52299
52769
|
const boardName = this.getName() || this.getBoardId();
|
|
52300
52770
|
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
52301
52771
|
const itemsDiv = `<div id="items">${items}</div>`;
|