microboard-temp 0.4.6 → 0.4.8
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 +569 -121
- package/dist/cjs/index.js +569 -121
- package/dist/cjs/node.js +569 -121
- package/dist/esm/browser.js +569 -121
- package/dist/esm/index.js +569 -121
- package/dist/esm/node.js +569 -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 +3 -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/DrawingContext.d.ts +2 -2
- package/dist/types/Items/Frame/Frame.d.ts +1 -1
- package/dist/types/Items/Line/Line.d.ts +1 -0
- package/dist/types/Items/RichText/Editor/BlockNode.d.ts +1 -0
- 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/Selection/Transformer/Transformer.d.ts +1 -1
- package/dist/types/SpatialIndex/SpacialIndex.d.ts +3 -3
- package/dist/types/Tools/AddComment/AddComment.d.ts +1 -0
- package/dist/types/Tools/AddConnector/AddConnector.d.ts +1 -2
- 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/types/Selection/Transformer/TransformerHelpers/{ransformShape.d.ts → transformShape.d.ts} +0 -0
package/dist/esm/node.js
CHANGED
|
@@ -2251,6 +2251,9 @@ class Line {
|
|
|
2251
2251
|
getStartPoint() {
|
|
2252
2252
|
return this.start;
|
|
2253
2253
|
}
|
|
2254
|
+
getEndPoint() {
|
|
2255
|
+
return this.end;
|
|
2256
|
+
}
|
|
2254
2257
|
getLength() {
|
|
2255
2258
|
const { start, end } = this;
|
|
2256
2259
|
const deltaX = end.x - start.x;
|
|
@@ -3848,6 +3851,9 @@ class QuadraticBezier extends BaseCurve {
|
|
|
3848
3851
|
getStartPoint() {
|
|
3849
3852
|
return this.start;
|
|
3850
3853
|
}
|
|
3854
|
+
getEndPoint() {
|
|
3855
|
+
return this.end;
|
|
3856
|
+
}
|
|
3851
3857
|
moveToStart(ctx) {
|
|
3852
3858
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3853
3859
|
}
|
|
@@ -3891,6 +3897,9 @@ class CubicBezier extends BaseCurve {
|
|
|
3891
3897
|
getStartPoint() {
|
|
3892
3898
|
return this.start;
|
|
3893
3899
|
}
|
|
3900
|
+
getEndPoint() {
|
|
3901
|
+
return this.end;
|
|
3902
|
+
}
|
|
3894
3903
|
moveToStart(ctx) {
|
|
3895
3904
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3896
3905
|
}
|
|
@@ -7993,25 +8002,33 @@ class TransformationCommand {
|
|
|
7993
8002
|
x: 1 / op2.x,
|
|
7994
8003
|
y: 1 / op2.y
|
|
7995
8004
|
};
|
|
8005
|
+
} else {
|
|
8006
|
+
reverseOp = {
|
|
8007
|
+
...op2,
|
|
8008
|
+
x: 1,
|
|
8009
|
+
y: 1
|
|
8010
|
+
};
|
|
7996
8011
|
}
|
|
7997
8012
|
return { item: currTrans, operation: reverseOp };
|
|
7998
8013
|
});
|
|
7999
8014
|
}
|
|
8000
8015
|
case "locked": {
|
|
8016
|
+
const op2 = this.operation;
|
|
8001
8017
|
return mapItemsByOperation(this.transformation, () => {
|
|
8002
8018
|
return {
|
|
8003
|
-
...
|
|
8004
|
-
item: [...
|
|
8019
|
+
...op2,
|
|
8020
|
+
item: [...op2.item],
|
|
8005
8021
|
method: "unlocked",
|
|
8006
8022
|
locked: false
|
|
8007
8023
|
};
|
|
8008
8024
|
});
|
|
8009
8025
|
}
|
|
8010
8026
|
case "unlocked": {
|
|
8027
|
+
const op2 = this.operation;
|
|
8011
8028
|
return mapItemsByOperation(this.transformation, () => {
|
|
8012
8029
|
return {
|
|
8013
|
-
...
|
|
8014
|
-
item: [...
|
|
8030
|
+
...op2,
|
|
8031
|
+
item: [...op2.item],
|
|
8015
8032
|
method: "locked",
|
|
8016
8033
|
locked: true
|
|
8017
8034
|
};
|
|
@@ -9622,6 +9639,13 @@ var tagByType = {
|
|
|
9622
9639
|
Comment: "comment-item",
|
|
9623
9640
|
Group: ""
|
|
9624
9641
|
};
|
|
9642
|
+
var headingTagsMap = {
|
|
9643
|
+
h1: "heading_one",
|
|
9644
|
+
h2: "heading_two",
|
|
9645
|
+
h3: "heading_three",
|
|
9646
|
+
h4: "heading_four",
|
|
9647
|
+
h5: "heading_five"
|
|
9648
|
+
};
|
|
9625
9649
|
var parsersHTML = {
|
|
9626
9650
|
"sticker-item": parseHTMLSticker,
|
|
9627
9651
|
"shape-item": parseHTMLShape,
|
|
@@ -9646,12 +9670,12 @@ function getTransformationData(el) {
|
|
|
9646
9670
|
if (transformMatch) {
|
|
9647
9671
|
const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
|
|
9648
9672
|
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
9649
|
-
return { ...matrix, rotate: 0 };
|
|
9673
|
+
return { ...matrix, rotate: 0, isLocked: false };
|
|
9650
9674
|
}
|
|
9651
|
-
return { ...new Matrix2, rotate: 0 };
|
|
9675
|
+
return { ...new Matrix2, rotate: 0, isLocked: false };
|
|
9652
9676
|
}
|
|
9653
9677
|
function parseHTMLRichText(el, options) {
|
|
9654
|
-
const parseNode = (node) => {
|
|
9678
|
+
const parseNode = (node, nestingLevel = 1) => {
|
|
9655
9679
|
const isLinkNode = node.tagName.toLowerCase() === "a";
|
|
9656
9680
|
if (node.tagName.toLowerCase() === "span" || isLinkNode && node.children.length === 0) {
|
|
9657
9681
|
const isSingleSpace = node.textContent?.length === 1 && node.textContent?.trim() === "";
|
|
@@ -9674,7 +9698,7 @@ function parseHTMLRichText(el, options) {
|
|
|
9674
9698
|
superscript: false
|
|
9675
9699
|
};
|
|
9676
9700
|
}
|
|
9677
|
-
const children2 = Array.from(node.children).map((child) => parseNode(child));
|
|
9701
|
+
const children2 = Array.from(node.children).map((child) => parseNode(child, nestingLevel + 1));
|
|
9678
9702
|
const tagName = node.tagName.toLowerCase();
|
|
9679
9703
|
const extractCommonProps = () => ({
|
|
9680
9704
|
horisontalAlignment: node.style.textAlign || "left",
|
|
@@ -9682,23 +9706,19 @@ function parseHTMLRichText(el, options) {
|
|
|
9682
9706
|
paddingBottom: parseFloat(node.style.paddingBottom) || undefined
|
|
9683
9707
|
});
|
|
9684
9708
|
switch (tagName) {
|
|
9685
|
-
case "blockquote":
|
|
9686
|
-
return {
|
|
9687
|
-
type: "block-quote",
|
|
9688
|
-
...extractCommonProps(),
|
|
9689
|
-
children: children2
|
|
9690
|
-
};
|
|
9691
9709
|
case "ul":
|
|
9692
9710
|
return {
|
|
9693
9711
|
type: "ul_list",
|
|
9694
9712
|
...extractCommonProps(),
|
|
9695
|
-
children: children2
|
|
9713
|
+
children: children2,
|
|
9714
|
+
listLevel: nestingLevel
|
|
9696
9715
|
};
|
|
9697
9716
|
case "ol":
|
|
9698
9717
|
return {
|
|
9699
9718
|
type: "ol_list",
|
|
9700
9719
|
...extractCommonProps(),
|
|
9701
|
-
children: children2
|
|
9720
|
+
children: children2,
|
|
9721
|
+
listLevel: nestingLevel
|
|
9702
9722
|
};
|
|
9703
9723
|
case "li":
|
|
9704
9724
|
return {
|
|
@@ -9720,11 +9740,9 @@ function parseHTMLRichText(el, options) {
|
|
|
9720
9740
|
case "h2":
|
|
9721
9741
|
case "h3":
|
|
9722
9742
|
case "h4":
|
|
9723
|
-
case "h5":
|
|
9724
|
-
case "h6": {
|
|
9725
|
-
const headingType = `heading_${["one", "two", "three", "four", "five", "six"][parseInt(tagName[1]) - 1]}`;
|
|
9743
|
+
case "h5": {
|
|
9726
9744
|
return {
|
|
9727
|
-
type:
|
|
9745
|
+
type: headingTagsMap[tagName],
|
|
9728
9746
|
...extractCommonProps(),
|
|
9729
9747
|
children: children2
|
|
9730
9748
|
};
|
|
@@ -9928,6 +9946,7 @@ function parseHTMLConnector(el) {
|
|
|
9928
9946
|
...endPointType === "FixedConnector" ? { segment: startSegment, tangent: endTangent } : {}
|
|
9929
9947
|
};
|
|
9930
9948
|
const connectorData = {
|
|
9949
|
+
middlePoint: null,
|
|
9931
9950
|
id: el.id,
|
|
9932
9951
|
itemType: "Connector",
|
|
9933
9952
|
transformation,
|
|
@@ -9988,6 +10007,7 @@ function parseHTMLDrawing(el) {
|
|
|
9988
10007
|
}
|
|
9989
10008
|
function parseHTMLAINode(el) {
|
|
9990
10009
|
const aiNodeData = {
|
|
10010
|
+
threadDirection: 3,
|
|
9991
10011
|
id: el.id,
|
|
9992
10012
|
itemType: "AINode",
|
|
9993
10013
|
parentNodeId: el.getAttribute("parent-node-id") || undefined,
|
|
@@ -19600,7 +19620,9 @@ function setNodeChildrenStyles({
|
|
|
19600
19620
|
}) {
|
|
19601
19621
|
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
19602
19622
|
if (editor) {
|
|
19603
|
-
|
|
19623
|
+
const marks = Editor15.marks(editor);
|
|
19624
|
+
const fontSize = marks?.fontSize ? marks.fontSize === "auto" ? conf.DEFAULT_TEXT_STYLES.fontSize : marks.fontSize : conf.DEFAULT_TEXT_STYLES.fontSize;
|
|
19625
|
+
fontStyles = marks ? { ...conf.DEFAULT_TEXT_STYLES, ...marks, fontSize } : conf.DEFAULT_TEXT_STYLES;
|
|
19604
19626
|
}
|
|
19605
19627
|
switch (node2.type) {
|
|
19606
19628
|
case "heading_one":
|
|
@@ -19650,6 +19672,9 @@ function setNodeStyles({
|
|
|
19650
19672
|
editor,
|
|
19651
19673
|
horisontalAlignment
|
|
19652
19674
|
}) {
|
|
19675
|
+
if (node2.type === "list_item") {
|
|
19676
|
+
return;
|
|
19677
|
+
}
|
|
19653
19678
|
if (node2.type === "ol_list" || node2.type === "ul_list") {
|
|
19654
19679
|
node2.listLevel = listLevel;
|
|
19655
19680
|
for (const listItem of node2.children) {
|
|
@@ -19800,9 +19825,10 @@ class MarkdownProcessor {
|
|
|
19800
19825
|
} else {
|
|
19801
19826
|
const lastParagraphPath = this.getText().length - 1;
|
|
19802
19827
|
const lastParagraph = this.getText()[lastParagraphPath];
|
|
19828
|
+
const lastParagraphText = lastParagraph.children[lastParagraph.children.length - 1];
|
|
19803
19829
|
const insertLocation = {
|
|
19804
19830
|
path: [lastParagraphPath, lastParagraph.children.length - 1],
|
|
19805
|
-
offset:
|
|
19831
|
+
offset: lastParagraphText.text.length
|
|
19806
19832
|
};
|
|
19807
19833
|
Transforms12.insertText(this.editor, combinedText, {
|
|
19808
19834
|
at: insertLocation
|
|
@@ -20817,14 +20843,6 @@ class RichTextCommand {
|
|
|
20817
20843
|
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
20818
20844
|
}
|
|
20819
20845
|
}));
|
|
20820
|
-
case "setBlockType":
|
|
20821
|
-
return items.map((id) => ({
|
|
20822
|
-
item: id,
|
|
20823
|
-
operation: {
|
|
20824
|
-
...this.operation,
|
|
20825
|
-
type: this.board.items.getById(id)?.getRichText()?.getBlockType() || "paragraph"
|
|
20826
|
-
}
|
|
20827
|
-
}));
|
|
20828
20846
|
case "setFontStyle":
|
|
20829
20847
|
return items.map((id) => ({
|
|
20830
20848
|
item: id,
|
|
@@ -20927,7 +20945,8 @@ class RichTextGroupCommand {
|
|
|
20927
20945
|
class: "RichText",
|
|
20928
20946
|
method: "edit",
|
|
20929
20947
|
item: [richText.getId() ?? ""],
|
|
20930
|
-
ops
|
|
20948
|
+
ops,
|
|
20949
|
+
selection: null
|
|
20931
20950
|
}
|
|
20932
20951
|
});
|
|
20933
20952
|
}
|
|
@@ -20944,7 +20963,8 @@ class RichTextGroupCommand {
|
|
|
20944
20963
|
class: "RichText",
|
|
20945
20964
|
method: "edit",
|
|
20946
20965
|
item: [richText.getId() ?? ""],
|
|
20947
|
-
ops: ops.map((op) => Operation2.inverse(op)).reverse()
|
|
20966
|
+
ops: ops.map((op) => Operation2.inverse(op)).reverse(),
|
|
20967
|
+
selection: null
|
|
20948
20968
|
}
|
|
20949
20969
|
});
|
|
20950
20970
|
}
|
|
@@ -21313,7 +21333,7 @@ var v4_default = v4;
|
|
|
21313
21333
|
// src/Items/Comment/Comment.ts
|
|
21314
21334
|
var ANONYMOUS_ID = 9999999999;
|
|
21315
21335
|
|
|
21316
|
-
class
|
|
21336
|
+
class Comment {
|
|
21317
21337
|
anchor;
|
|
21318
21338
|
events;
|
|
21319
21339
|
id;
|
|
@@ -21593,6 +21613,9 @@ class Comment2 {
|
|
|
21593
21613
|
const anchor = this.anchor.copy();
|
|
21594
21614
|
return new Mbr(anchor.x, anchor.y, anchor.x, anchor.y);
|
|
21595
21615
|
}
|
|
21616
|
+
getPathMbr() {
|
|
21617
|
+
return this.getMbr();
|
|
21618
|
+
}
|
|
21596
21619
|
getNearestEdgePointTo(point3) {
|
|
21597
21620
|
return this.anchor;
|
|
21598
21621
|
}
|
|
@@ -22080,6 +22103,12 @@ class BaseItem extends Mbr {
|
|
|
22080
22103
|
onRemove() {
|
|
22081
22104
|
this.onRemoveCallbacks.forEach((cb) => cb());
|
|
22082
22105
|
}
|
|
22106
|
+
getPathMbr() {
|
|
22107
|
+
return this.getMbr().copy();
|
|
22108
|
+
}
|
|
22109
|
+
getPath() {
|
|
22110
|
+
return new Path(this.getMbr().getLines());
|
|
22111
|
+
}
|
|
22083
22112
|
render(context) {}
|
|
22084
22113
|
renderHTML(documentFactory) {
|
|
22085
22114
|
return documentFactory.createElement("div");
|
|
@@ -22605,7 +22634,10 @@ class RichText extends BaseItem {
|
|
|
22605
22634
|
}
|
|
22606
22635
|
getFontSize() {
|
|
22607
22636
|
const marks = this.editor.getSelectionMarks();
|
|
22608
|
-
|
|
22637
|
+
let fontSize = marks?.fontSize ?? this.initialTextStyles.fontSize;
|
|
22638
|
+
if (fontSize === "auto") {
|
|
22639
|
+
fontSize = this.initialTextStyles.fontSize;
|
|
22640
|
+
}
|
|
22609
22641
|
if (this.autoSize) {
|
|
22610
22642
|
return fontSize * this.autoSizeScale;
|
|
22611
22643
|
}
|
|
@@ -22623,7 +22655,7 @@ class RichText extends BaseItem {
|
|
|
22623
22655
|
for (const [node2] of textNodes) {
|
|
22624
22656
|
const fontSize = node2.fontSize || node2 && node2.fontSize;
|
|
22625
22657
|
if (fontSize) {
|
|
22626
|
-
fontSizes.push(fontSize);
|
|
22658
|
+
fontSizes.push(fontSize === "auto" ? this.initialTextStyles.fontSize : fontSize);
|
|
22627
22659
|
}
|
|
22628
22660
|
}
|
|
22629
22661
|
if (fontSizes.length > 0) {
|
|
@@ -22636,7 +22668,7 @@ class RichText extends BaseItem {
|
|
|
22636
22668
|
return marks?.fontHighlight ?? this.initialTextStyles.fontHighlight;
|
|
22637
22669
|
}
|
|
22638
22670
|
getBlockType() {
|
|
22639
|
-
const blockNode = getSelectedBlockNode(this.editor);
|
|
22671
|
+
const blockNode = getSelectedBlockNode(this.editor.editor);
|
|
22640
22672
|
return blockNode ? blockNode.type : "paragraph";
|
|
22641
22673
|
}
|
|
22642
22674
|
getHorisontalAlignment() {
|
|
@@ -22667,16 +22699,18 @@ class RichText extends BaseItem {
|
|
|
22667
22699
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
22668
22700
|
if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
22669
22701
|
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
22670
|
-
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22702
|
+
if (domRange) {
|
|
22703
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
22704
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
22705
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
22706
|
+
exactMatch: false,
|
|
22707
|
+
suppressThrow: false
|
|
22708
|
+
});
|
|
22709
|
+
if (slatePoint) {
|
|
22710
|
+
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
22711
|
+
this.editorTransforms.select(this.editor.editor, nRange);
|
|
22712
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
22713
|
+
}
|
|
22680
22714
|
}
|
|
22681
22715
|
} else {
|
|
22682
22716
|
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
@@ -39885,6 +39919,9 @@ class Shape extends BaseItem {
|
|
|
39885
39919
|
getMbr() {
|
|
39886
39920
|
return this.mbr.copy();
|
|
39887
39921
|
}
|
|
39922
|
+
getPathMbr() {
|
|
39923
|
+
return this.getPath().getMbr();
|
|
39924
|
+
}
|
|
39888
39925
|
getNearestEdgePointTo(point5) {
|
|
39889
39926
|
return this.path.getNearestEdgePointTo(point5);
|
|
39890
39927
|
}
|
|
@@ -40844,10 +40881,6 @@ class Frame extends BaseItem {
|
|
|
40844
40881
|
return this.mbr.copy();
|
|
40845
40882
|
}
|
|
40846
40883
|
doResize(resizeType, pointer, mbr, opposite, startMbr, timeStamp) {
|
|
40847
|
-
if (this.transformation.isLocked) {
|
|
40848
|
-
this.board?.pointer.setCursor("default");
|
|
40849
|
-
return false;
|
|
40850
|
-
}
|
|
40851
40884
|
const res = this.getCanChangeRatio() ? getResize(resizeType, pointer, mbr, opposite) : getProportionalResize(resizeType, pointer, mbr, opposite);
|
|
40852
40885
|
if (!res) {
|
|
40853
40886
|
return {
|
|
@@ -43425,7 +43458,7 @@ function createComment(id, data, board) {
|
|
|
43425
43458
|
if (!isCommentData(data)) {
|
|
43426
43459
|
throw new Error("Invalid data for Comment");
|
|
43427
43460
|
}
|
|
43428
|
-
const comment2 = new
|
|
43461
|
+
const comment2 = new Comment(new Point, board.events).setId(id).deserialize(data);
|
|
43429
43462
|
return comment2;
|
|
43430
43463
|
}
|
|
43431
43464
|
function createAINode(id, data, board) {
|
|
@@ -43629,7 +43662,7 @@ class AddComment extends BoardTool {
|
|
|
43629
43662
|
leftButtonUp() {
|
|
43630
43663
|
this.isDown = false;
|
|
43631
43664
|
this.board.selection.removeAll();
|
|
43632
|
-
this.comment = this.board.add(
|
|
43665
|
+
this.comment = this.board.add(new Comment(this.board.pointer.point));
|
|
43633
43666
|
this.board.tools.publish();
|
|
43634
43667
|
return true;
|
|
43635
43668
|
}
|
|
@@ -43949,7 +43982,6 @@ class ConnectorSnap {
|
|
|
43949
43982
|
|
|
43950
43983
|
// src/Tools/AddConnector/AddConnector.ts
|
|
43951
43984
|
class AddConnector extends BoardTool {
|
|
43952
|
-
board;
|
|
43953
43985
|
connector = null;
|
|
43954
43986
|
lineStyle = "curved";
|
|
43955
43987
|
startPointer;
|
|
@@ -43964,7 +43996,6 @@ class AddConnector extends BoardTool {
|
|
|
43964
43996
|
isQuickAdd = false;
|
|
43965
43997
|
constructor(board, itemToStart, position4) {
|
|
43966
43998
|
super(board);
|
|
43967
|
-
this.board = board;
|
|
43968
43999
|
this.snap = new ConnectorSnap(this.board);
|
|
43969
44000
|
this.setCursor();
|
|
43970
44001
|
const storage = new SessionStorage;
|
|
@@ -44026,16 +44057,16 @@ class AddConnector extends BoardTool {
|
|
|
44026
44057
|
this.board.tools.publish();
|
|
44027
44058
|
return true;
|
|
44028
44059
|
}
|
|
44029
|
-
|
|
44060
|
+
leftButtonUp() {
|
|
44030
44061
|
this.isDown = false;
|
|
44031
44062
|
if (!this.connector) {
|
|
44032
44063
|
return true;
|
|
44033
44064
|
}
|
|
44034
44065
|
if (this.isDoneSecondPoint) {
|
|
44035
|
-
|
|
44066
|
+
this.board.add(this.connector);
|
|
44036
44067
|
this.board.tools.select();
|
|
44037
44068
|
} else if (this.isDraggingFromFirstToSecond) {
|
|
44038
|
-
const addedConnector =
|
|
44069
|
+
const addedConnector = this.board.add(this.connector);
|
|
44039
44070
|
const endPoint = this.connector.getEndPoint();
|
|
44040
44071
|
this.board.tools.select();
|
|
44041
44072
|
if (this.isQuickAdd && endPoint.pointType === "Board") {
|
|
@@ -45665,13 +45696,8 @@ function createCanvasDrawer(board) {
|
|
|
45665
45696
|
// src/Selection/QuickAddButtons/quickAddHelpers.ts
|
|
45666
45697
|
function getControlPointData(item, index2, isRichText = false) {
|
|
45667
45698
|
const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
|
|
45668
|
-
const width2 = item.
|
|
45669
|
-
let height3;
|
|
45670
|
-
if (item.itemType === "Shape" && index2 !== 2 && index2 !== 3) {
|
|
45671
|
-
height3 = item.getPath().getMbr().getHeight();
|
|
45672
|
-
} else {
|
|
45673
|
-
height3 = item.getMbr().getHeight();
|
|
45674
|
-
}
|
|
45699
|
+
const width2 = item.getPathMbr().getWidth();
|
|
45700
|
+
let height3 = item.getPathMbr().getHeight();
|
|
45675
45701
|
const adjMapScaled = {
|
|
45676
45702
|
0: { x: 0, y: height3 / 2 / itemScale.y },
|
|
45677
45703
|
1: {
|
|
@@ -45704,7 +45730,7 @@ function quickAddItem(board, type, connector) {
|
|
|
45704
45730
|
optionalItem = new Sticker(board);
|
|
45705
45731
|
break;
|
|
45706
45732
|
case "AINode":
|
|
45707
|
-
optionalItem = createAINode2(board, startPoint?.item?.getId()
|
|
45733
|
+
optionalItem = createAINode2(board, 3, "item" in startPoint ? startPoint?.item?.getId() : undefined);
|
|
45708
45734
|
break;
|
|
45709
45735
|
}
|
|
45710
45736
|
let itemMbr = optionalItem.getMbr();
|
|
@@ -45731,20 +45757,25 @@ function quickAddItem(board, type, connector) {
|
|
|
45731
45757
|
if ("text" in guarded && guarded.itemType !== "AINode" && guarded.itemType !== "RichText") {
|
|
45732
45758
|
delete guarded.text;
|
|
45733
45759
|
}
|
|
45760
|
+
if (!itemData.transformation) {
|
|
45761
|
+
itemData.transformation = new DefaultTransformationData;
|
|
45762
|
+
}
|
|
45734
45763
|
itemData.transformation.translateX = endPoint.x;
|
|
45735
45764
|
itemData.transformation.translateY = endPoint.y;
|
|
45736
45765
|
const lines = connector.lines.getSegments();
|
|
45737
45766
|
const lastLine = lines[lines.length - 1];
|
|
45738
|
-
|
|
45767
|
+
const lastLineStart = lastLine.getStartPoint();
|
|
45768
|
+
const lastLineEnd = lastLine.getEndPoint();
|
|
45769
|
+
let dir2 = getDirection(lastLineStart, lastLineEnd);
|
|
45770
|
+
const firstLineStart = lines[0].getEndPoint();
|
|
45739
45771
|
if (!dir2) {
|
|
45740
|
-
const
|
|
45741
|
-
const
|
|
45742
|
-
const yDiff = Math.abs(firstLine.start.y - lastLine.end.y);
|
|
45772
|
+
const xDiff = Math.abs(firstLineStart.x - lastLineEnd.x);
|
|
45773
|
+
const yDiff = Math.abs(firstLineStart.y - lastLineEnd.y);
|
|
45743
45774
|
dir2 = xDiff > yDiff ? "horizontal" : "vertical";
|
|
45744
45775
|
}
|
|
45745
45776
|
let dirIndex = -1;
|
|
45746
45777
|
if (dir2 === "vertical") {
|
|
45747
|
-
if (
|
|
45778
|
+
if (firstLineStart.y > lastLineEnd.y) {
|
|
45748
45779
|
itemData.transformation.translateX -= itemMbr.getWidth() / 2;
|
|
45749
45780
|
itemData.transformation.translateY -= itemMbr.getHeight();
|
|
45750
45781
|
dirIndex = 3;
|
|
@@ -45753,7 +45784,7 @@ function quickAddItem(board, type, connector) {
|
|
|
45753
45784
|
dirIndex = 2;
|
|
45754
45785
|
}
|
|
45755
45786
|
} else if (dir2 === "horizontal") {
|
|
45756
|
-
if (
|
|
45787
|
+
if (firstLineStart.x > lastLineEnd.x) {
|
|
45757
45788
|
itemData.transformation.translateX -= itemMbr.getWidth();
|
|
45758
45789
|
itemData.transformation.translateY -= itemMbr.getHeight() / 2;
|
|
45759
45790
|
dirIndex = 1;
|
|
@@ -45775,7 +45806,7 @@ function quickAddItem(board, type, connector) {
|
|
|
45775
45806
|
connector.setEndPoint(newEndPoint);
|
|
45776
45807
|
board.selection.removeAll();
|
|
45777
45808
|
board.selection.add(added);
|
|
45778
|
-
if (added
|
|
45809
|
+
if (added instanceof RichText || added instanceof AINode) {
|
|
45779
45810
|
const text5 = added.getRichText();
|
|
45780
45811
|
text5.editor.setMaxWidth(text5.editor.maxWidth || 600);
|
|
45781
45812
|
board.selection.editText();
|
|
@@ -45783,7 +45814,7 @@ function quickAddItem(board, type, connector) {
|
|
|
45783
45814
|
board.selection.setContext("EditUnderPointer");
|
|
45784
45815
|
}
|
|
45785
45816
|
}
|
|
45786
|
-
function createAINode2(board,
|
|
45817
|
+
function createAINode2(board, directionIndex, parentNodeId) {
|
|
45787
45818
|
const node2 = new AINode(board, true, parentNodeId, undefined, directionIndex);
|
|
45788
45819
|
const nodeRichText = node2.getRichText();
|
|
45789
45820
|
nodeRichText.applyMaxWidth(600);
|
|
@@ -45817,17 +45848,17 @@ function getQuickAddButtons(selection, board) {
|
|
|
45817
45848
|
let quickAddItems = undefined;
|
|
45818
45849
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
45819
45850
|
const connectorStorage = new SessionStorage;
|
|
45820
|
-
const currMbr = selectedItem.
|
|
45851
|
+
const currMbr = selectedItem.getPathMbr();
|
|
45821
45852
|
const selectedItemData = selectedItem.serialize();
|
|
45822
|
-
const width2 =
|
|
45823
|
-
const height3 =
|
|
45853
|
+
const width2 = currMbr.getWidth();
|
|
45854
|
+
const height3 = currMbr.getHeight();
|
|
45824
45855
|
let offsetX = width2;
|
|
45825
45856
|
let offsetY = height3;
|
|
45826
45857
|
let newWidth = width2;
|
|
45827
45858
|
let newHeight = height3;
|
|
45828
45859
|
let itemData;
|
|
45829
45860
|
if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
|
|
45830
|
-
const item = selectedItem.itemType === "AINode" ? createAINode2(board, selectedItem.getId()
|
|
45861
|
+
const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
|
|
45831
45862
|
newWidth = item.getMbr().getWidth();
|
|
45832
45863
|
newHeight = item.getMbr().getHeight();
|
|
45833
45864
|
itemData = item.serialize();
|
|
@@ -45876,9 +45907,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
45876
45907
|
const endPoints = getQuickButtonsPositions(newMbr);
|
|
45877
45908
|
const reverseIndexMap = { 0: 1, 1: 0, 2: 3, 3: 2 };
|
|
45878
45909
|
const connectorEndPoint = endPoints?.positions[reverseIndexMap[index2]] || new Point;
|
|
45879
|
-
const fontSize = selectedItem
|
|
45910
|
+
const fontSize = selectedItem instanceof RichText ? selectedItem.getFontSize() : 14;
|
|
45880
45911
|
const newItem = board.createItem(board.getNewItemId(), newItemData);
|
|
45881
|
-
if (newItem
|
|
45912
|
+
if (newItem instanceof RichText) {
|
|
45882
45913
|
const storage = new SessionStorage;
|
|
45883
45914
|
storage.setFontSize("RichText", fontSize);
|
|
45884
45915
|
newItem.editor.selectWholeText();
|
|
@@ -45891,6 +45922,10 @@ function getQuickAddButtons(selection, board) {
|
|
|
45891
45922
|
const scaleX = newItemMbr.getWidth() / 100;
|
|
45892
45923
|
const scaleY = newItemMbr.getHeight() / 100;
|
|
45893
45924
|
shapeData.transformation = {
|
|
45925
|
+
isLocked: false,
|
|
45926
|
+
rotate: 0,
|
|
45927
|
+
translateX: 0,
|
|
45928
|
+
translateY: 0,
|
|
45894
45929
|
...newItemData.transformation,
|
|
45895
45930
|
scaleX,
|
|
45896
45931
|
scaleY
|
|
@@ -45947,7 +45982,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
45947
45982
|
}
|
|
45948
45983
|
let pathCenter;
|
|
45949
45984
|
if (single.itemType === "Shape") {
|
|
45950
|
-
pathCenter = single.
|
|
45985
|
+
pathCenter = single.getPathMbr().getCenter();
|
|
45951
45986
|
}
|
|
45952
45987
|
const center = itemMbr.getCenter();
|
|
45953
45988
|
const width2 = itemMbr.getWidth();
|
|
@@ -46142,7 +46177,7 @@ class AlignmentHelper {
|
|
|
46142
46177
|
if (i === 0) {
|
|
46143
46178
|
return acc;
|
|
46144
46179
|
}
|
|
46145
|
-
const itemMbr = item.
|
|
46180
|
+
const itemMbr = item.getPathMbr();
|
|
46146
46181
|
return acc.combine(itemMbr);
|
|
46147
46182
|
}, items[0].getMbr());
|
|
46148
46183
|
}
|
|
@@ -46461,9 +46496,11 @@ class AlignmentHelper {
|
|
|
46461
46496
|
const translation = this.board.selection.getManyItemsTranslation(x, y);
|
|
46462
46497
|
this.board.selection.transformMany(translation, timeStamp);
|
|
46463
46498
|
} else {
|
|
46464
|
-
const
|
|
46499
|
+
const id = item.getId();
|
|
46465
46500
|
const transformMap = {};
|
|
46466
|
-
transformMap[
|
|
46501
|
+
transformMap[id] = {
|
|
46502
|
+
class: "Transformation",
|
|
46503
|
+
item: [id],
|
|
46467
46504
|
method: "translateBy",
|
|
46468
46505
|
x,
|
|
46469
46506
|
y,
|
|
@@ -46768,7 +46805,7 @@ class Select extends Tool {
|
|
|
46768
46805
|
const itemCenter = this.downOnItem.getMbr().getCenter();
|
|
46769
46806
|
this.initialCursorPos = new Point(this.board.pointer.point.x - itemCenter.x, this.board.pointer.point.y - itemCenter.y);
|
|
46770
46807
|
}
|
|
46771
|
-
if (this.downOnItem
|
|
46808
|
+
if (this.downOnItem instanceof Connector2 && this.downOnItem.isConnectedOnePoint() && !this.board.keyboard.isCtrl) {
|
|
46772
46809
|
this.board.selection.editUnderPointer();
|
|
46773
46810
|
this.board.tools.publish();
|
|
46774
46811
|
this.clear();
|
|
@@ -46817,7 +46854,7 @@ class Select extends Tool {
|
|
|
46817
46854
|
const isDrawingSelectionMbr = this.isDrawingRectangle && this.line && this.rect;
|
|
46818
46855
|
if (isDrawingSelectionMbr) {
|
|
46819
46856
|
const point5 = this.board.pointer.point.copy();
|
|
46820
|
-
this.line = new Line(this.line
|
|
46857
|
+
this.line = new Line(this.line?.start, point5);
|
|
46821
46858
|
this.rect = this.line.getMbr();
|
|
46822
46859
|
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
46823
46860
|
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
@@ -47058,7 +47095,7 @@ class Select extends Tool {
|
|
|
47058
47095
|
const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
|
|
47059
47096
|
if (isNotInSelection) {
|
|
47060
47097
|
this.board.selection.add(underPointer);
|
|
47061
|
-
if (underPointer
|
|
47098
|
+
if (underPointer instanceof Frame) {
|
|
47062
47099
|
const { left, right, top, bottom } = underPointer.getMbr();
|
|
47063
47100
|
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => underPointer.getChildrenIds().includes(item.getId()));
|
|
47064
47101
|
this.board.selection.add(itemsInFrame);
|
|
@@ -47186,13 +47223,13 @@ class Select extends Tool {
|
|
|
47186
47223
|
}
|
|
47187
47224
|
onConfirm() {
|
|
47188
47225
|
const single = this.board.selection.items.getSingle();
|
|
47189
|
-
if (this.board.selection.showQuickAddPanel && single && single
|
|
47190
|
-
quickAddItem(this.board, "
|
|
47226
|
+
if (this.board.selection.showQuickAddPanel && single && single instanceof Connector2) {
|
|
47227
|
+
quickAddItem(this.board, "Rectangle", single);
|
|
47191
47228
|
} else if (single && this.board.selection.getContext() !== "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
|
|
47192
47229
|
this.board.selection.editText(undefined, true);
|
|
47193
47230
|
} else if (isSafari() && this.board.selection.getContext() === "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
|
|
47194
|
-
if (single && "text" in single || single
|
|
47195
|
-
const text5 = single
|
|
47231
|
+
if (single && "text" in single || single instanceof RichText) {
|
|
47232
|
+
const text5 = single instanceof RichText ? single : single.text;
|
|
47196
47233
|
text5.editor.splitNode();
|
|
47197
47234
|
}
|
|
47198
47235
|
}
|
|
@@ -50316,7 +50353,7 @@ class Presence {
|
|
|
50316
50353
|
};
|
|
50317
50354
|
});
|
|
50318
50355
|
ctx2.restore();
|
|
50319
|
-
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop);
|
|
50356
|
+
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop) || null;
|
|
50320
50357
|
};
|
|
50321
50358
|
renderLoop();
|
|
50322
50359
|
}
|
|
@@ -51740,10 +51777,10 @@ class Items {
|
|
|
51740
51777
|
}
|
|
51741
51778
|
const { nearest } = enclosed.reduce((acc, item) => {
|
|
51742
51779
|
const area = item.getMbr().getHeight() * item.getMbr().getWidth();
|
|
51743
|
-
if (item
|
|
51780
|
+
if (item instanceof Drawing && !item.isPointNearLine(this.pointer.point)) {
|
|
51744
51781
|
return acc;
|
|
51745
51782
|
}
|
|
51746
|
-
const isItemTransparent = item
|
|
51783
|
+
const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
|
|
51747
51784
|
const itemZIndex = this.getZIndex(item);
|
|
51748
51785
|
const accZIndex = this.getZIndex(acc.nearest);
|
|
51749
51786
|
if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
|
|
@@ -51774,7 +51811,7 @@ class Items {
|
|
|
51774
51811
|
}
|
|
51775
51812
|
getLinkedConnectorsById(id) {
|
|
51776
51813
|
return this.listAll().filter((item) => {
|
|
51777
|
-
if (item
|
|
51814
|
+
if (!(item instanceof Connector2)) {
|
|
51778
51815
|
return false;
|
|
51779
51816
|
}
|
|
51780
51817
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -51789,7 +51826,7 @@ class Items {
|
|
|
51789
51826
|
return [];
|
|
51790
51827
|
}
|
|
51791
51828
|
return this.listAll().filter((item) => {
|
|
51792
|
-
if (item
|
|
51829
|
+
if (!(item instanceof Connector2) || !item.isConnected()) {
|
|
51793
51830
|
return false;
|
|
51794
51831
|
}
|
|
51795
51832
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -51964,7 +52001,7 @@ class SelectionItems {
|
|
|
51964
52001
|
return ids;
|
|
51965
52002
|
}
|
|
51966
52003
|
getSingle() {
|
|
51967
|
-
return this.isSingle() ? this.items.values().next().value : null;
|
|
52004
|
+
return this.isSingle() ? this.items.values().next().value || null : null;
|
|
51968
52005
|
}
|
|
51969
52006
|
listByIds(itemIdList) {
|
|
51970
52007
|
return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
|
|
@@ -52012,7 +52049,7 @@ class ConnectorTransformer extends Tool {
|
|
|
52012
52049
|
getConnector(items) {
|
|
52013
52050
|
if (items.isSingle()) {
|
|
52014
52051
|
const connector = items.getSingle();
|
|
52015
|
-
if (connector
|
|
52052
|
+
if (connector instanceof Connector2) {
|
|
52016
52053
|
return connector;
|
|
52017
52054
|
}
|
|
52018
52055
|
}
|
|
@@ -52318,7 +52355,7 @@ function getItemTranslation({
|
|
|
52318
52355
|
scale: { x: 1, y: 1 }
|
|
52319
52356
|
};
|
|
52320
52357
|
} else {
|
|
52321
|
-
if (item
|
|
52358
|
+
if (item instanceof Frame && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
|
|
52322
52359
|
item.setFrameType("Custom");
|
|
52323
52360
|
}
|
|
52324
52361
|
return {
|
|
@@ -52331,7 +52368,7 @@ function getItemTranslation({
|
|
|
52331
52368
|
}
|
|
52332
52369
|
}
|
|
52333
52370
|
|
|
52334
|
-
// src/Selection/Transformer/TransformerHelpers/
|
|
52371
|
+
// src/Selection/Transformer/TransformerHelpers/transformShape.ts
|
|
52335
52372
|
function transformShape({
|
|
52336
52373
|
mbr,
|
|
52337
52374
|
board,
|
|
@@ -52601,7 +52638,7 @@ function transformItems({
|
|
|
52601
52638
|
if (includesProportionalItem && (isWidth || isHeight)) {
|
|
52602
52639
|
return null;
|
|
52603
52640
|
}
|
|
52604
|
-
const isIncludesFixedFrame = items.some((item) => item
|
|
52641
|
+
const isIncludesFixedFrame = items.some((item) => item instanceof Frame && !item.getCanChangeRatio());
|
|
52605
52642
|
const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
|
|
52606
52643
|
const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
|
|
52607
52644
|
if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
|
|
@@ -52773,7 +52810,7 @@ class Transformer extends Tool {
|
|
|
52773
52810
|
return resizeType;
|
|
52774
52811
|
}
|
|
52775
52812
|
updateAlignmentBySnapLines(single) {
|
|
52776
|
-
if (single) {
|
|
52813
|
+
if (single && this.resizeType) {
|
|
52777
52814
|
this.snapLines = this.alignmentHelper.checkAlignment(single);
|
|
52778
52815
|
const snapped = this.alignmentHelper.snapToSide(single, this.snapLines, this.beginTimeStamp, this.resizeType);
|
|
52779
52816
|
if (snapped) {
|
|
@@ -53482,10 +53519,10 @@ class BoardSelection {
|
|
|
53482
53519
|
}
|
|
53483
53520
|
copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
|
|
53484
53521
|
}
|
|
53485
|
-
copy(skipImageBlobCopy
|
|
53522
|
+
copy(skipImageBlobCopy) {
|
|
53486
53523
|
const copiedItemsMap = {};
|
|
53487
53524
|
const single = this.items.getSingle();
|
|
53488
|
-
if (!skipImageBlobCopy && single && single
|
|
53525
|
+
if (!skipImageBlobCopy && single && single instanceof ImageItem) {
|
|
53489
53526
|
this.handleItemCopy(single, copiedItemsMap);
|
|
53490
53527
|
return { imageElement: single.image, imageData: copiedItemsMap };
|
|
53491
53528
|
}
|
|
@@ -53510,7 +53547,7 @@ class BoardSelection {
|
|
|
53510
53547
|
return copiedItemsMap;
|
|
53511
53548
|
}
|
|
53512
53549
|
cut() {
|
|
53513
|
-
const items = this.copy();
|
|
53550
|
+
const items = this.copy(true);
|
|
53514
53551
|
this.removeFromBoard();
|
|
53515
53552
|
return items;
|
|
53516
53553
|
}
|
|
@@ -53661,7 +53698,7 @@ class BoardSelection {
|
|
|
53661
53698
|
});
|
|
53662
53699
|
Object.values(selectedMap).forEach((val) => {
|
|
53663
53700
|
const parentFrame = this.board.items.getById(val.item.parent);
|
|
53664
|
-
const isParentFrame = parentFrame
|
|
53701
|
+
const isParentFrame = parentFrame instanceof Frame;
|
|
53665
53702
|
const parentFrameId = isParentFrame ? parentFrame.getId() : null;
|
|
53666
53703
|
if (val.nested) {
|
|
53667
53704
|
const isRemoveChildFromFrame = Object.values(selectedMap).some((val2) => val2.nested && val2.nested.getId() !== parentFrameId);
|
|
@@ -53676,7 +53713,7 @@ class BoardSelection {
|
|
|
53676
53713
|
console.warn(`Didnt find frame with id ${val.item.parent}`);
|
|
53677
53714
|
}
|
|
53678
53715
|
}
|
|
53679
|
-
if (val.item
|
|
53716
|
+
if (val.item instanceof Frame && checkFrames) {
|
|
53680
53717
|
const currFrame = val.item;
|
|
53681
53718
|
const currMbr = currFrame.getMbr();
|
|
53682
53719
|
const children = val.item.getChildrenIds().map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
|
|
@@ -54084,12 +54121,6 @@ class BoardSelection {
|
|
|
54084
54121
|
text5.setEditorFocus(this.context);
|
|
54085
54122
|
}
|
|
54086
54123
|
}
|
|
54087
|
-
getMediaStorageIds() {
|
|
54088
|
-
return this.items.list().filter((item) => {
|
|
54089
|
-
const shouldClearStorageUsage = item.itemType === "Image" || item.itemType === "Video" && item.getIsStorageUrl() || item.itemType === "Audio" && item.getIsStorageUrl();
|
|
54090
|
-
return shouldClearStorageUsage;
|
|
54091
|
-
}).map((item) => item.getStorageId());
|
|
54092
|
-
}
|
|
54093
54124
|
removeFromBoard() {
|
|
54094
54125
|
const isLocked = this.items.list().some((item) => item.transformation.isLocked);
|
|
54095
54126
|
if (isLocked) {
|
|
@@ -54104,7 +54135,6 @@ class BoardSelection {
|
|
|
54104
54135
|
const connectors = itemIds.flatMap((id) => {
|
|
54105
54136
|
return this.board.items.getLinkedConnectorsById(id);
|
|
54106
54137
|
}).map((connector) => connector.getId());
|
|
54107
|
-
conf.hooks.beforeMediaRemove(this.getMediaStorageIds(), this.board.getBoardId());
|
|
54108
54138
|
this.emit({
|
|
54109
54139
|
class: "Board",
|
|
54110
54140
|
method: "remove",
|
|
@@ -54141,7 +54171,15 @@ class BoardSelection {
|
|
|
54141
54171
|
this.board.sendToBack(this.items.list());
|
|
54142
54172
|
}
|
|
54143
54173
|
async duplicate() {
|
|
54144
|
-
const mediaIds =
|
|
54174
|
+
const mediaIds = [];
|
|
54175
|
+
this.items.list().forEach((item) => {
|
|
54176
|
+
if ("getStorageId" in item) {
|
|
54177
|
+
const storageId = item.getStorageId();
|
|
54178
|
+
if (storageId) {
|
|
54179
|
+
mediaIds.push(storageId);
|
|
54180
|
+
}
|
|
54181
|
+
}
|
|
54182
|
+
});
|
|
54145
54183
|
const canDuplicate = mediaIds.length ? await conf.hooks.beforeMediaUpload(mediaIds, this.board.getBoardId()) : true;
|
|
54146
54184
|
if (!canDuplicate) {
|
|
54147
54185
|
return;
|
|
@@ -54209,7 +54247,7 @@ class BoardSelection {
|
|
|
54209
54247
|
}
|
|
54210
54248
|
}
|
|
54211
54249
|
const contextItems = [];
|
|
54212
|
-
if (single && single
|
|
54250
|
+
if (single && single instanceof AINode) {
|
|
54213
54251
|
const contextItemsIds = single.getContextItems();
|
|
54214
54252
|
if (contextItemsIds.length) {
|
|
54215
54253
|
const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
|
|
@@ -54231,7 +54269,7 @@ class BoardSelection {
|
|
|
54231
54269
|
}
|
|
54232
54270
|
}
|
|
54233
54271
|
contextItems.forEach((item) => {
|
|
54234
|
-
if (item
|
|
54272
|
+
if (item instanceof AINode) {
|
|
54235
54273
|
const path2 = item.getPath();
|
|
54236
54274
|
path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
|
|
54237
54275
|
path2.setBorderWidth(2);
|
|
@@ -54246,6 +54284,416 @@ class BoardSelection {
|
|
|
54246
54284
|
});
|
|
54247
54285
|
}
|
|
54248
54286
|
}
|
|
54287
|
+
// src/public/customWebComponents.js
|
|
54288
|
+
var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
|
|
54289
|
+
class RichTextElement extends HTMLElement {
|
|
54290
|
+
constructor() {
|
|
54291
|
+
super();
|
|
54292
|
+
}
|
|
54293
|
+
}
|
|
54294
|
+
|
|
54295
|
+
class ShapeItemElement extends HTMLElement {
|
|
54296
|
+
constructor() {
|
|
54297
|
+
super();
|
|
54298
|
+
}
|
|
54299
|
+
}
|
|
54300
|
+
|
|
54301
|
+
class StickerElement extends HTMLElement {
|
|
54302
|
+
constructor() {
|
|
54303
|
+
super();
|
|
54304
|
+
}
|
|
54305
|
+
}
|
|
54306
|
+
|
|
54307
|
+
class DrawingElement extends HTMLElement {
|
|
54308
|
+
constructor() {
|
|
54309
|
+
super();
|
|
54310
|
+
}
|
|
54311
|
+
}
|
|
54312
|
+
|
|
54313
|
+
class ConnectorElement extends HTMLElement {
|
|
54314
|
+
constructor() {
|
|
54315
|
+
super();
|
|
54316
|
+
}
|
|
54317
|
+
}
|
|
54318
|
+
|
|
54319
|
+
class FrameItemElement extends HTMLElement {
|
|
54320
|
+
constructor() {
|
|
54321
|
+
super();
|
|
54322
|
+
}
|
|
54323
|
+
}
|
|
54324
|
+
|
|
54325
|
+
class ImageItemElement extends HTMLElement {
|
|
54326
|
+
constructor() {
|
|
54327
|
+
super();
|
|
54328
|
+
}
|
|
54329
|
+
}
|
|
54330
|
+
|
|
54331
|
+
class LinkItemElement extends HTMLElement {
|
|
54332
|
+
constructor() {
|
|
54333
|
+
super();
|
|
54334
|
+
}
|
|
54335
|
+
}
|
|
54336
|
+
|
|
54337
|
+
class AINodeItemElement extends HTMLElement {
|
|
54338
|
+
constructor() {
|
|
54339
|
+
super();
|
|
54340
|
+
}
|
|
54341
|
+
}
|
|
54342
|
+
|
|
54343
|
+
class VideoItemElement extends HTMLElement {
|
|
54344
|
+
constructor() {
|
|
54345
|
+
super();
|
|
54346
|
+
}
|
|
54347
|
+
}
|
|
54348
|
+
|
|
54349
|
+
class CommentElement extends HTMLElement {
|
|
54350
|
+
constructor() {
|
|
54351
|
+
super();
|
|
54352
|
+
}
|
|
54353
|
+
}
|
|
54354
|
+
|
|
54355
|
+
class AudioItemElement extends HTMLElement {
|
|
54356
|
+
constructor() {
|
|
54357
|
+
super();
|
|
54358
|
+
}
|
|
54359
|
+
}
|
|
54360
|
+
|
|
54361
|
+
customElements.define("rich-text", RichTextElement);
|
|
54362
|
+
customElements.define("shape-item", ShapeItemElement);
|
|
54363
|
+
customElements.define("sticker-item", StickerElement);
|
|
54364
|
+
customElements.define("drawing-item", DrawingElement);
|
|
54365
|
+
customElements.define("connector-item", ConnectorElement);
|
|
54366
|
+
customElements.define("frame-item", FrameItemElement);
|
|
54367
|
+
customElements.define("image-item", ImageItemElement);
|
|
54368
|
+
customElements.define("link-item", LinkItemElement);
|
|
54369
|
+
customElements.define("ainode-item", AINodeItemElement);
|
|
54370
|
+
customElements.define("video-item", VideoItemElement);
|
|
54371
|
+
customElements.define("comment-item", CommentElement);
|
|
54372
|
+
customElements.define("audio-item", AudioItemElement);
|
|
54373
|
+
|
|
54374
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
54375
|
+
const itemsDiv = document.querySelector("#items");
|
|
54376
|
+
if (!itemsDiv) {
|
|
54377
|
+
console.error("ITEMS DIV NOT FOUND!");
|
|
54378
|
+
return;
|
|
54379
|
+
}
|
|
54380
|
+
let isDragging = false;
|
|
54381
|
+
let startX, startY;
|
|
54382
|
+
let translateX = 0;
|
|
54383
|
+
let translateY = 0;
|
|
54384
|
+
let scale = 1;
|
|
54385
|
+
|
|
54386
|
+
itemsDiv.style.transformOrigin = "0 0";
|
|
54387
|
+
document.body.style.cursor = "grab";
|
|
54388
|
+
|
|
54389
|
+
function updateTransform() {
|
|
54390
|
+
itemsDiv.style.transform =
|
|
54391
|
+
"translate(" +
|
|
54392
|
+
translateX +
|
|
54393
|
+
"px, " +
|
|
54394
|
+
translateY +
|
|
54395
|
+
"px) scale(" +
|
|
54396
|
+
scale +
|
|
54397
|
+
")";
|
|
54398
|
+
}
|
|
54399
|
+
|
|
54400
|
+
function handleMouseDown(ev) {
|
|
54401
|
+
isDragging = true;
|
|
54402
|
+
startX = ev.clientX;
|
|
54403
|
+
startY = ev.clientY;
|
|
54404
|
+
itemsDiv.style.cursor = "grabbing";
|
|
54405
|
+
}
|
|
54406
|
+
|
|
54407
|
+
function handleMouseMove(ev) {
|
|
54408
|
+
if (!isDragging) {
|
|
54409
|
+
return;
|
|
54410
|
+
}
|
|
54411
|
+
const dx = ev.clientX - startX;
|
|
54412
|
+
const dy = ev.clientY - startY;
|
|
54413
|
+
startX += dx;
|
|
54414
|
+
startY += dy;
|
|
54415
|
+
translateX += dx;
|
|
54416
|
+
translateY += dy;
|
|
54417
|
+
updateTransform();
|
|
54418
|
+
}
|
|
54419
|
+
|
|
54420
|
+
function handleMouseUp(ev) {
|
|
54421
|
+
if (!isDragging) {
|
|
54422
|
+
return;
|
|
54423
|
+
}
|
|
54424
|
+
isDragging = false;
|
|
54425
|
+
itemsDiv.style.cursor = "grab";
|
|
54426
|
+
}
|
|
54427
|
+
|
|
54428
|
+
function handleWheel(ev) {
|
|
54429
|
+
ev.preventDefault();
|
|
54430
|
+
const factor = ev.deltaY < 0 ? 1.1 : 0.9;
|
|
54431
|
+
translateX = ev.clientX - (ev.clientX - translateX) * factor;
|
|
54432
|
+
translateY = ev.clientY - (ev.clientY - translateY) * factor;
|
|
54433
|
+
scale *= factor;
|
|
54434
|
+
updateTransform();
|
|
54435
|
+
}
|
|
54436
|
+
|
|
54437
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
54438
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
54439
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
54440
|
+
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
54441
|
+
|
|
54442
|
+
const titlePanel = document.createElement("div");
|
|
54443
|
+
titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
|
|
54444
|
+
titlePanel.style.position = "fixed";
|
|
54445
|
+
titlePanel.style.left = "12px";
|
|
54446
|
+
titlePanel.style.top = "12px";
|
|
54447
|
+
titlePanel.style.borderRadius = "12px";
|
|
54448
|
+
titlePanel.style.backgroundColor = "#ffff";
|
|
54449
|
+
titlePanel.style.display = "flex";
|
|
54450
|
+
titlePanel.style.alignItems = "center";
|
|
54451
|
+
titlePanel.style.gap = "8px";
|
|
54452
|
+
titlePanel.style.padding = "0 12px";
|
|
54453
|
+
titlePanel.style.height = "48px";
|
|
54454
|
+
const editButton = document.createElement("button");
|
|
54455
|
+
const editIcon = document.createElementNS(
|
|
54456
|
+
"http://www.w3.org/2000/svg",
|
|
54457
|
+
"svg",
|
|
54458
|
+
);
|
|
54459
|
+
editIcon.setAttribute("width", "13");
|
|
54460
|
+
editIcon.setAttribute("height", "13");
|
|
54461
|
+
editIcon.setAttribute("viewBox", "0 0 13 13");
|
|
54462
|
+
editIcon.setAttribute("fill", "none");
|
|
54463
|
+
editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
54464
|
+
const editIconPath = document.createElementNS(
|
|
54465
|
+
"http://www.w3.org/2000/svg",
|
|
54466
|
+
"path",
|
|
54467
|
+
);
|
|
54468
|
+
editIconPath.setAttribute(
|
|
54469
|
+
"d",
|
|
54470
|
+
"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",
|
|
54471
|
+
);
|
|
54472
|
+
editIconPath.setAttribute("fill", "#ffff");
|
|
54473
|
+
editIcon.appendChild(editIconPath);
|
|
54474
|
+
editButton.appendChild(editIcon);
|
|
54475
|
+
const editFileText = document.createElement("p");
|
|
54476
|
+
const isSnapshotInIframe =
|
|
54477
|
+
window.parent &&
|
|
54478
|
+
window.parent !== window &&
|
|
54479
|
+
window.parent.location.href.includes("/snapshots/");
|
|
54480
|
+
editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
|
|
54481
|
+
editButton.appendChild(editFileText);
|
|
54482
|
+
|
|
54483
|
+
editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
|
|
54484
|
+
editButton.style.cursor = "pointer";
|
|
54485
|
+
editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
|
|
54486
|
+
editButton.style.color = "#ffff";
|
|
54487
|
+
editButton.style.fontSize = "14px";
|
|
54488
|
+
editButton.style.lineHeight = "20px";
|
|
54489
|
+
editButton.style.display = "flex";
|
|
54490
|
+
editButton.style.alignItems = "center";
|
|
54491
|
+
editButton.style.gap = "8px";
|
|
54492
|
+
editButton.style.padding = "8px";
|
|
54493
|
+
editButton.style.borderRadius = "10px";
|
|
54494
|
+
const separator = document.createElement("div");
|
|
54495
|
+
separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
|
|
54496
|
+
separator.style.height = "100%";
|
|
54497
|
+
const boardName = document.createElement("div");
|
|
54498
|
+
const fileIcon = document.createElementNS(
|
|
54499
|
+
"http://www.w3.org/2000/svg",
|
|
54500
|
+
"svg",
|
|
54501
|
+
);
|
|
54502
|
+
fileIcon.setAttribute("width", "16");
|
|
54503
|
+
fileIcon.setAttribute("height", "18");
|
|
54504
|
+
fileIcon.setAttribute("viewBox", "0 0 16 18");
|
|
54505
|
+
fileIcon.setAttribute("fill", "none");
|
|
54506
|
+
fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
54507
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
54508
|
+
path.setAttribute(
|
|
54509
|
+
"d",
|
|
54510
|
+
"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",
|
|
54511
|
+
);
|
|
54512
|
+
path.setAttribute("fill", "#696B76");
|
|
54513
|
+
fileIcon.appendChild(path);
|
|
54514
|
+
boardName.appendChild(fileIcon);
|
|
54515
|
+
const boardNameTag = document.querySelector('meta[name="board-name"]');
|
|
54516
|
+
let boardNameStr = "Untitled";
|
|
54517
|
+
if (boardNameTag) {
|
|
54518
|
+
boardNameStr = boardNameTag.getAttribute("content");
|
|
54519
|
+
}
|
|
54520
|
+
const p = document.createElement("p");
|
|
54521
|
+
p.textContent = boardNameStr;
|
|
54522
|
+
p.style.fontSize = "16px";
|
|
54523
|
+
p.style.lineHeight = "24px";
|
|
54524
|
+
boardName.appendChild(p);
|
|
54525
|
+
const cloudIcon = document.createElementNS(
|
|
54526
|
+
"http://www.w3.org/2000/svg",
|
|
54527
|
+
"svg",
|
|
54528
|
+
);
|
|
54529
|
+
cloudIcon.setAttribute("width", "20");
|
|
54530
|
+
cloudIcon.setAttribute("height", "18");
|
|
54531
|
+
cloudIcon.setAttribute("viewBox", "0 0 20 18");
|
|
54532
|
+
cloudIcon.setAttribute("fill", "none");
|
|
54533
|
+
cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
54534
|
+
const cloudIconPath = document.createElementNS(
|
|
54535
|
+
"http://www.w3.org/2000/svg",
|
|
54536
|
+
"path",
|
|
54537
|
+
);
|
|
54538
|
+
cloudIconPath.setAttribute(
|
|
54539
|
+
"d",
|
|
54540
|
+
"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",
|
|
54541
|
+
);
|
|
54542
|
+
cloudIconPath.setAttribute("fill", "#696B76");
|
|
54543
|
+
cloudIcon.appendChild(cloudIconPath);
|
|
54544
|
+
boardName.appendChild(cloudIcon);
|
|
54545
|
+
boardName.style.display = "flex";
|
|
54546
|
+
boardName.style.alignItems = "center";
|
|
54547
|
+
boardName.style.gap = "8px";
|
|
54548
|
+
titlePanel.appendChild(boardName);
|
|
54549
|
+
titlePanel.appendChild(separator);
|
|
54550
|
+
titlePanel.appendChild(editButton);
|
|
54551
|
+
document.body.appendChild(titlePanel);
|
|
54552
|
+
|
|
54553
|
+
editButton.onclick = async () => {
|
|
54554
|
+
editButton.disabled = true;
|
|
54555
|
+
editButton.textContent = "Loading...";
|
|
54556
|
+
|
|
54557
|
+
try {
|
|
54558
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
54559
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
54560
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
54561
|
+
document.removeEventListener("wheel", handleWheel, {
|
|
54562
|
+
passive: false,
|
|
54563
|
+
});
|
|
54564
|
+
translateX = 0;
|
|
54565
|
+
translateY = 0;
|
|
54566
|
+
scale = 1;
|
|
54567
|
+
updateTransform();
|
|
54568
|
+
|
|
54569
|
+
const { initBrowserSettings } = await import(
|
|
54570
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
54571
|
+
);
|
|
54572
|
+
initBrowserSettings();
|
|
54573
|
+
|
|
54574
|
+
const { createApp } = await import(
|
|
54575
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
54576
|
+
);
|
|
54577
|
+
|
|
54578
|
+
const app = createApp();
|
|
54579
|
+
window.app = app;
|
|
54580
|
+
const stringed = await app.openAndEditFile();
|
|
54581
|
+
|
|
54582
|
+
if (stringed) {
|
|
54583
|
+
await app.openBoardFromFile();
|
|
54584
|
+
app.getBoard().deserializeHTML(stringed);
|
|
54585
|
+
app.localRender("items");
|
|
54586
|
+
}
|
|
54587
|
+
|
|
54588
|
+
const response = await fetch(
|
|
54589
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
|
|
54590
|
+
);
|
|
54591
|
+
const cssText = await response.text();
|
|
54592
|
+
const styleEl = document.createElement("style");
|
|
54593
|
+
styleEl.textContent = cssText;
|
|
54594
|
+
document.body.appendChild(styleEl);
|
|
54595
|
+
|
|
54596
|
+
const responseSvg = await fetch(
|
|
54597
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
|
|
54598
|
+
);
|
|
54599
|
+
const svgText = await responseSvg.text();
|
|
54600
|
+
const div = document.createElement("div");
|
|
54601
|
+
div.style.display = "none";
|
|
54602
|
+
div.id = "sprite";
|
|
54603
|
+
div.innerHTML = svgText;
|
|
54604
|
+
document.body.appendChild(div);
|
|
54605
|
+
} finally {
|
|
54606
|
+
editButton.disabled = false;
|
|
54607
|
+
editButton.textContent = "Edit board";
|
|
54608
|
+
}
|
|
54609
|
+
};
|
|
54610
|
+
});
|
|
54611
|
+
`;
|
|
54612
|
+
|
|
54613
|
+
// src/public/loadLinkImages.js
|
|
54614
|
+
var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
|
|
54615
|
+
document.querySelectorAll(".link-object").forEach(linkItem => {
|
|
54616
|
+
const linkImage = linkItem.querySelector(".link-image");
|
|
54617
|
+
const linkContainer = linkItem.querySelector("a");
|
|
54618
|
+
linkImage.onerror = () => {
|
|
54619
|
+
linkImage.onerror = null;
|
|
54620
|
+
linkImage.style.display = "none";
|
|
54621
|
+
const svgNamespace = "http://www.w3.org/2000/svg";
|
|
54622
|
+
const svg = document.createElementNS(svgNamespace, "svg");
|
|
54623
|
+
svg.setAttribute("width", "20");
|
|
54624
|
+
svg.setAttribute("height", "20");
|
|
54625
|
+
svg.setAttribute("viewBox", "0 0 13 14");
|
|
54626
|
+
svg.setAttribute("fill", "none");
|
|
54627
|
+
|
|
54628
|
+
const path = document.createElementNS(svgNamespace, "path");
|
|
54629
|
+
path.setAttribute(
|
|
54630
|
+
"d",
|
|
54631
|
+
"M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
|
|
54632
|
+
);
|
|
54633
|
+
path.setAttribute("fill", "#924FE8");
|
|
54634
|
+
svg.appendChild(path);
|
|
54635
|
+
|
|
54636
|
+
linkContainer.appendChild(svg);
|
|
54637
|
+
};
|
|
54638
|
+
});
|
|
54639
|
+
});
|
|
54640
|
+
`;
|
|
54641
|
+
|
|
54642
|
+
// src/public/index.css
|
|
54643
|
+
var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
|
|
54644
|
+
@import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
|
|
54645
|
+
|
|
54646
|
+
/* ../src/index.css */
|
|
54647
|
+
:root {
|
|
54648
|
+
--background-surface-default: rgb(255, 255, 255);
|
|
54649
|
+
--background-button-secondary: rgb(255, 255, 255);
|
|
54650
|
+
--background-button-secondary-hover: rgb(247, 247, 248);
|
|
54651
|
+
--background-badge-purple-disabled: rgb(247, 241, 253);
|
|
54652
|
+
--background-badge-gray: rgb(233, 234, 236);
|
|
54653
|
+
--background-accent-purple: rgb(146, 79, 232);
|
|
54654
|
+
--border-action-normal: rgb(222, 223, 227);
|
|
54655
|
+
--border-action-focus: rgb(146, 79, 232);
|
|
54656
|
+
--border-select-primary: rgb(146, 79, 232);
|
|
54657
|
+
--text-base-primary: rgb(20, 21, 26);
|
|
54658
|
+
--text-base-secondary: rgba(15, 19, 36, 0.6);
|
|
54659
|
+
--text-base-quaternary: rgb(10, 15, 41, 0.25);
|
|
54660
|
+
--text-accent-purple: rgb(152, 89, 233);
|
|
54661
|
+
--icon-base-primary: rgb(20, 21, 26);
|
|
54662
|
+
--icon-base-secondary: rgb(105, 107, 118);
|
|
54663
|
+
--icon-accent-purple: rgb(146, 79, 232);
|
|
54664
|
+
--absolute-position-panel-padding: 12px;
|
|
54665
|
+
}
|
|
54666
|
+
* {
|
|
54667
|
+
box-sizing: border-box;
|
|
54668
|
+
padding: 0;
|
|
54669
|
+
margin: 0;
|
|
54670
|
+
border: none;
|
|
54671
|
+
background: none;
|
|
54672
|
+
font-family: inherit;
|
|
54673
|
+
}
|
|
54674
|
+
html {
|
|
54675
|
+
font-size: 62.5%;
|
|
54676
|
+
}
|
|
54677
|
+
body {
|
|
54678
|
+
color: var(--text-base-primary);
|
|
54679
|
+
font-size: 1.6rem;
|
|
54680
|
+
font-optical-sizing: auto;
|
|
54681
|
+
font-style: normal;
|
|
54682
|
+
font-family: "Manrope", sans-serif;
|
|
54683
|
+
}
|
|
54684
|
+
html,
|
|
54685
|
+
body {
|
|
54686
|
+
overscroll-behavior-x: none;
|
|
54687
|
+
-webkit-user-select: none;
|
|
54688
|
+
}
|
|
54689
|
+
input:-webkit-autofill,
|
|
54690
|
+
input:-webkit-autofill:hover,
|
|
54691
|
+
input:-webkit-autofill:focus,
|
|
54692
|
+
input:-webkit-autofill:active {
|
|
54693
|
+
-webkit-box-shadow: 0 0 0 30px white inset !important;
|
|
54694
|
+
}
|
|
54695
|
+
`;
|
|
54696
|
+
|
|
54249
54697
|
// src/Board.ts
|
|
54250
54698
|
class Board {
|
|
54251
54699
|
boardId;
|
|
@@ -54628,9 +55076,9 @@ class Board {
|
|
|
54628
55076
|
return this.copy();
|
|
54629
55077
|
}
|
|
54630
55078
|
serializeHTML() {
|
|
54631
|
-
const customTagsScript =
|
|
54632
|
-
const loadLinksImagesScript =
|
|
54633
|
-
const css =
|
|
55079
|
+
const customTagsScript = customWebComponents_default;
|
|
55080
|
+
const loadLinksImagesScript = loadLinkImages_default;
|
|
55081
|
+
const css = public_default;
|
|
54634
55082
|
const boardName = this.getName() || this.getBoardId();
|
|
54635
55083
|
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
54636
55084
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
@@ -55043,7 +55491,7 @@ class Board {
|
|
|
55043
55491
|
}
|
|
55044
55492
|
removeVoidComments() {
|
|
55045
55493
|
const voidComments = this.items.listAll().filter((item) => {
|
|
55046
|
-
return item instanceof
|
|
55494
|
+
return item instanceof Comment && !item.getThread().length;
|
|
55047
55495
|
});
|
|
55048
55496
|
if (voidComments) {
|
|
55049
55497
|
for (const comment2 of voidComments) {
|
|
@@ -57970,7 +58418,7 @@ export {
|
|
|
57970
58418
|
ConnectorData2 as ConnectorData,
|
|
57971
58419
|
Connector2 as Connector,
|
|
57972
58420
|
ConnectionLineWidths,
|
|
57973
|
-
|
|
58421
|
+
Comment,
|
|
57974
58422
|
Camera,
|
|
57975
58423
|
CURSORS_IDLE_CLEANUP_DELAY,
|
|
57976
58424
|
CURSORS_ANIMATION_DURATION,
|