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/index.js
CHANGED
|
@@ -1467,6 +1467,9 @@ class Line {
|
|
|
1467
1467
|
getStartPoint() {
|
|
1468
1468
|
return this.start;
|
|
1469
1469
|
}
|
|
1470
|
+
getEndPoint() {
|
|
1471
|
+
return this.end;
|
|
1472
|
+
}
|
|
1470
1473
|
getLength() {
|
|
1471
1474
|
const { start, end } = this;
|
|
1472
1475
|
const deltaX = end.x - start.x;
|
|
@@ -3064,6 +3067,9 @@ class QuadraticBezier extends BaseCurve {
|
|
|
3064
3067
|
getStartPoint() {
|
|
3065
3068
|
return this.start;
|
|
3066
3069
|
}
|
|
3070
|
+
getEndPoint() {
|
|
3071
|
+
return this.end;
|
|
3072
|
+
}
|
|
3067
3073
|
moveToStart(ctx) {
|
|
3068
3074
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3069
3075
|
}
|
|
@@ -3107,6 +3113,9 @@ class CubicBezier extends BaseCurve {
|
|
|
3107
3113
|
getStartPoint() {
|
|
3108
3114
|
return this.start;
|
|
3109
3115
|
}
|
|
3116
|
+
getEndPoint() {
|
|
3117
|
+
return this.end;
|
|
3118
|
+
}
|
|
3110
3119
|
moveToStart(ctx) {
|
|
3111
3120
|
ctx.moveTo(this.start.x, this.start.y);
|
|
3112
3121
|
}
|
|
@@ -7209,25 +7218,33 @@ class TransformationCommand {
|
|
|
7209
7218
|
x: 1 / op2.x,
|
|
7210
7219
|
y: 1 / op2.y
|
|
7211
7220
|
};
|
|
7221
|
+
} else {
|
|
7222
|
+
reverseOp = {
|
|
7223
|
+
...op2,
|
|
7224
|
+
x: 1,
|
|
7225
|
+
y: 1
|
|
7226
|
+
};
|
|
7212
7227
|
}
|
|
7213
7228
|
return { item: currTrans, operation: reverseOp };
|
|
7214
7229
|
});
|
|
7215
7230
|
}
|
|
7216
7231
|
case "locked": {
|
|
7232
|
+
const op2 = this.operation;
|
|
7217
7233
|
return mapItemsByOperation(this.transformation, () => {
|
|
7218
7234
|
return {
|
|
7219
|
-
...
|
|
7220
|
-
item: [...
|
|
7235
|
+
...op2,
|
|
7236
|
+
item: [...op2.item],
|
|
7221
7237
|
method: "unlocked",
|
|
7222
7238
|
locked: false
|
|
7223
7239
|
};
|
|
7224
7240
|
});
|
|
7225
7241
|
}
|
|
7226
7242
|
case "unlocked": {
|
|
7243
|
+
const op2 = this.operation;
|
|
7227
7244
|
return mapItemsByOperation(this.transformation, () => {
|
|
7228
7245
|
return {
|
|
7229
|
-
...
|
|
7230
|
-
item: [...
|
|
7246
|
+
...op2,
|
|
7247
|
+
item: [...op2.item],
|
|
7231
7248
|
method: "locked",
|
|
7232
7249
|
locked: true
|
|
7233
7250
|
};
|
|
@@ -8838,6 +8855,13 @@ var tagByType = {
|
|
|
8838
8855
|
Comment: "comment-item",
|
|
8839
8856
|
Group: ""
|
|
8840
8857
|
};
|
|
8858
|
+
var headingTagsMap = {
|
|
8859
|
+
h1: "heading_one",
|
|
8860
|
+
h2: "heading_two",
|
|
8861
|
+
h3: "heading_three",
|
|
8862
|
+
h4: "heading_four",
|
|
8863
|
+
h5: "heading_five"
|
|
8864
|
+
};
|
|
8841
8865
|
var parsersHTML = {
|
|
8842
8866
|
"sticker-item": parseHTMLSticker,
|
|
8843
8867
|
"shape-item": parseHTMLShape,
|
|
@@ -8862,12 +8886,12 @@ function getTransformationData(el) {
|
|
|
8862
8886
|
if (transformMatch) {
|
|
8863
8887
|
const [, translateX, translateY, scaleX, scaleY] = transformMatch.map(Number);
|
|
8864
8888
|
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
8865
|
-
return { ...matrix, rotate: 0 };
|
|
8889
|
+
return { ...matrix, rotate: 0, isLocked: false };
|
|
8866
8890
|
}
|
|
8867
|
-
return { ...new Matrix2, rotate: 0 };
|
|
8891
|
+
return { ...new Matrix2, rotate: 0, isLocked: false };
|
|
8868
8892
|
}
|
|
8869
8893
|
function parseHTMLRichText(el, options) {
|
|
8870
|
-
const parseNode = (node) => {
|
|
8894
|
+
const parseNode = (node, nestingLevel = 1) => {
|
|
8871
8895
|
const isLinkNode = node.tagName.toLowerCase() === "a";
|
|
8872
8896
|
if (node.tagName.toLowerCase() === "span" || isLinkNode && node.children.length === 0) {
|
|
8873
8897
|
const isSingleSpace = node.textContent?.length === 1 && node.textContent?.trim() === "";
|
|
@@ -8890,7 +8914,7 @@ function parseHTMLRichText(el, options) {
|
|
|
8890
8914
|
superscript: false
|
|
8891
8915
|
};
|
|
8892
8916
|
}
|
|
8893
|
-
const children2 = Array.from(node.children).map((child) => parseNode(child));
|
|
8917
|
+
const children2 = Array.from(node.children).map((child) => parseNode(child, nestingLevel + 1));
|
|
8894
8918
|
const tagName = node.tagName.toLowerCase();
|
|
8895
8919
|
const extractCommonProps = () => ({
|
|
8896
8920
|
horisontalAlignment: node.style.textAlign || "left",
|
|
@@ -8898,23 +8922,19 @@ function parseHTMLRichText(el, options) {
|
|
|
8898
8922
|
paddingBottom: parseFloat(node.style.paddingBottom) || undefined
|
|
8899
8923
|
});
|
|
8900
8924
|
switch (tagName) {
|
|
8901
|
-
case "blockquote":
|
|
8902
|
-
return {
|
|
8903
|
-
type: "block-quote",
|
|
8904
|
-
...extractCommonProps(),
|
|
8905
|
-
children: children2
|
|
8906
|
-
};
|
|
8907
8925
|
case "ul":
|
|
8908
8926
|
return {
|
|
8909
8927
|
type: "ul_list",
|
|
8910
8928
|
...extractCommonProps(),
|
|
8911
|
-
children: children2
|
|
8929
|
+
children: children2,
|
|
8930
|
+
listLevel: nestingLevel
|
|
8912
8931
|
};
|
|
8913
8932
|
case "ol":
|
|
8914
8933
|
return {
|
|
8915
8934
|
type: "ol_list",
|
|
8916
8935
|
...extractCommonProps(),
|
|
8917
|
-
children: children2
|
|
8936
|
+
children: children2,
|
|
8937
|
+
listLevel: nestingLevel
|
|
8918
8938
|
};
|
|
8919
8939
|
case "li":
|
|
8920
8940
|
return {
|
|
@@ -8936,11 +8956,9 @@ function parseHTMLRichText(el, options) {
|
|
|
8936
8956
|
case "h2":
|
|
8937
8957
|
case "h3":
|
|
8938
8958
|
case "h4":
|
|
8939
|
-
case "h5":
|
|
8940
|
-
case "h6": {
|
|
8941
|
-
const headingType = `heading_${["one", "two", "three", "four", "five", "six"][parseInt(tagName[1]) - 1]}`;
|
|
8959
|
+
case "h5": {
|
|
8942
8960
|
return {
|
|
8943
|
-
type:
|
|
8961
|
+
type: headingTagsMap[tagName],
|
|
8944
8962
|
...extractCommonProps(),
|
|
8945
8963
|
children: children2
|
|
8946
8964
|
};
|
|
@@ -9144,6 +9162,7 @@ function parseHTMLConnector(el) {
|
|
|
9144
9162
|
...endPointType === "FixedConnector" ? { segment: startSegment, tangent: endTangent } : {}
|
|
9145
9163
|
};
|
|
9146
9164
|
const connectorData = {
|
|
9165
|
+
middlePoint: null,
|
|
9147
9166
|
id: el.id,
|
|
9148
9167
|
itemType: "Connector",
|
|
9149
9168
|
transformation,
|
|
@@ -9204,6 +9223,7 @@ function parseHTMLDrawing(el) {
|
|
|
9204
9223
|
}
|
|
9205
9224
|
function parseHTMLAINode(el) {
|
|
9206
9225
|
const aiNodeData = {
|
|
9226
|
+
threadDirection: 3,
|
|
9207
9227
|
id: el.id,
|
|
9208
9228
|
itemType: "AINode",
|
|
9209
9229
|
parentNodeId: el.getAttribute("parent-node-id") || undefined,
|
|
@@ -17065,7 +17085,9 @@ function setNodeChildrenStyles({
|
|
|
17065
17085
|
}) {
|
|
17066
17086
|
let fontStyles = conf.DEFAULT_TEXT_STYLES;
|
|
17067
17087
|
if (editor) {
|
|
17068
|
-
|
|
17088
|
+
const marks = Editor16.marks(editor);
|
|
17089
|
+
const fontSize = marks?.fontSize ? marks.fontSize === "auto" ? conf.DEFAULT_TEXT_STYLES.fontSize : marks.fontSize : conf.DEFAULT_TEXT_STYLES.fontSize;
|
|
17090
|
+
fontStyles = marks ? { ...conf.DEFAULT_TEXT_STYLES, ...marks, fontSize } : conf.DEFAULT_TEXT_STYLES;
|
|
17069
17091
|
}
|
|
17070
17092
|
switch (node2.type) {
|
|
17071
17093
|
case "heading_one":
|
|
@@ -17115,6 +17137,9 @@ function setNodeStyles({
|
|
|
17115
17137
|
editor,
|
|
17116
17138
|
horisontalAlignment
|
|
17117
17139
|
}) {
|
|
17140
|
+
if (node2.type === "list_item") {
|
|
17141
|
+
return;
|
|
17142
|
+
}
|
|
17118
17143
|
if (node2.type === "ol_list" || node2.type === "ul_list") {
|
|
17119
17144
|
node2.listLevel = listLevel;
|
|
17120
17145
|
for (const listItem of node2.children) {
|
|
@@ -17265,9 +17290,10 @@ class MarkdownProcessor {
|
|
|
17265
17290
|
} else {
|
|
17266
17291
|
const lastParagraphPath = this.getText().length - 1;
|
|
17267
17292
|
const lastParagraph = this.getText()[lastParagraphPath];
|
|
17293
|
+
const lastParagraphText = lastParagraph.children[lastParagraph.children.length - 1];
|
|
17268
17294
|
const insertLocation = {
|
|
17269
17295
|
path: [lastParagraphPath, lastParagraph.children.length - 1],
|
|
17270
|
-
offset:
|
|
17296
|
+
offset: lastParagraphText.text.length
|
|
17271
17297
|
};
|
|
17272
17298
|
Transforms13.insertText(this.editor, combinedText, {
|
|
17273
17299
|
at: insertLocation
|
|
@@ -18282,14 +18308,6 @@ class RichTextCommand {
|
|
|
18282
18308
|
fontColor: this.board.items.getById(id)?.getRichText()?.getFontColor() || conf.DEFAULT_TEXT_STYLES.fontColor
|
|
18283
18309
|
}
|
|
18284
18310
|
}));
|
|
18285
|
-
case "setBlockType":
|
|
18286
|
-
return items.map((id) => ({
|
|
18287
|
-
item: id,
|
|
18288
|
-
operation: {
|
|
18289
|
-
...this.operation,
|
|
18290
|
-
type: this.board.items.getById(id)?.getRichText()?.getBlockType() || "paragraph"
|
|
18291
|
-
}
|
|
18292
|
-
}));
|
|
18293
18311
|
case "setFontStyle":
|
|
18294
18312
|
return items.map((id) => ({
|
|
18295
18313
|
item: id,
|
|
@@ -18392,7 +18410,8 @@ class RichTextGroupCommand {
|
|
|
18392
18410
|
class: "RichText",
|
|
18393
18411
|
method: "edit",
|
|
18394
18412
|
item: [richText.getId() ?? ""],
|
|
18395
|
-
ops
|
|
18413
|
+
ops,
|
|
18414
|
+
selection: null
|
|
18396
18415
|
}
|
|
18397
18416
|
});
|
|
18398
18417
|
}
|
|
@@ -18409,7 +18428,8 @@ class RichTextGroupCommand {
|
|
|
18409
18428
|
class: "RichText",
|
|
18410
18429
|
method: "edit",
|
|
18411
18430
|
item: [richText.getId() ?? ""],
|
|
18412
|
-
ops: ops.map((op) => Operation3.inverse(op)).reverse()
|
|
18431
|
+
ops: ops.map((op) => Operation3.inverse(op)).reverse(),
|
|
18432
|
+
selection: null
|
|
18413
18433
|
}
|
|
18414
18434
|
});
|
|
18415
18435
|
}
|
|
@@ -18779,7 +18799,7 @@ var v4_default = v4;
|
|
|
18779
18799
|
// src/Items/Comment/Comment.ts
|
|
18780
18800
|
var ANONYMOUS_ID = 9999999999;
|
|
18781
18801
|
|
|
18782
|
-
class
|
|
18802
|
+
class Comment {
|
|
18783
18803
|
anchor;
|
|
18784
18804
|
events;
|
|
18785
18805
|
id;
|
|
@@ -19059,6 +19079,9 @@ class Comment2 {
|
|
|
19059
19079
|
const anchor = this.anchor.copy();
|
|
19060
19080
|
return new Mbr(anchor.x, anchor.y, anchor.x, anchor.y);
|
|
19061
19081
|
}
|
|
19082
|
+
getPathMbr() {
|
|
19083
|
+
return this.getMbr();
|
|
19084
|
+
}
|
|
19062
19085
|
getNearestEdgePointTo(point3) {
|
|
19063
19086
|
return this.anchor;
|
|
19064
19087
|
}
|
|
@@ -19546,6 +19569,12 @@ class BaseItem extends Mbr {
|
|
|
19546
19569
|
onRemove() {
|
|
19547
19570
|
this.onRemoveCallbacks.forEach((cb) => cb());
|
|
19548
19571
|
}
|
|
19572
|
+
getPathMbr() {
|
|
19573
|
+
return this.getMbr().copy();
|
|
19574
|
+
}
|
|
19575
|
+
getPath() {
|
|
19576
|
+
return new Path(this.getMbr().getLines());
|
|
19577
|
+
}
|
|
19549
19578
|
render(context) {}
|
|
19550
19579
|
renderHTML(documentFactory) {
|
|
19551
19580
|
return documentFactory.createElement("div");
|
|
@@ -20071,7 +20100,10 @@ class RichText extends BaseItem {
|
|
|
20071
20100
|
}
|
|
20072
20101
|
getFontSize() {
|
|
20073
20102
|
const marks = this.editor.getSelectionMarks();
|
|
20074
|
-
|
|
20103
|
+
let fontSize = marks?.fontSize ?? this.initialTextStyles.fontSize;
|
|
20104
|
+
if (fontSize === "auto") {
|
|
20105
|
+
fontSize = this.initialTextStyles.fontSize;
|
|
20106
|
+
}
|
|
20075
20107
|
if (this.autoSize) {
|
|
20076
20108
|
return fontSize * this.autoSizeScale;
|
|
20077
20109
|
}
|
|
@@ -20089,7 +20121,7 @@ class RichText extends BaseItem {
|
|
|
20089
20121
|
for (const [node2] of textNodes) {
|
|
20090
20122
|
const fontSize = node2.fontSize || node2 && node2.fontSize;
|
|
20091
20123
|
if (fontSize) {
|
|
20092
|
-
fontSizes.push(fontSize);
|
|
20124
|
+
fontSizes.push(fontSize === "auto" ? this.initialTextStyles.fontSize : fontSize);
|
|
20093
20125
|
}
|
|
20094
20126
|
}
|
|
20095
20127
|
if (fontSizes.length > 0) {
|
|
@@ -20102,7 +20134,7 @@ class RichText extends BaseItem {
|
|
|
20102
20134
|
return marks?.fontHighlight ?? this.initialTextStyles.fontHighlight;
|
|
20103
20135
|
}
|
|
20104
20136
|
getBlockType() {
|
|
20105
|
-
const blockNode = getSelectedBlockNode(this.editor);
|
|
20137
|
+
const blockNode = getSelectedBlockNode(this.editor.editor);
|
|
20106
20138
|
return blockNode ? blockNode.type : "paragraph";
|
|
20107
20139
|
}
|
|
20108
20140
|
getHorisontalAlignment() {
|
|
@@ -20133,16 +20165,18 @@ class RichText extends BaseItem {
|
|
|
20133
20165
|
const refMbr = new Mbr(domMbr.left, domMbr.top, domMbr.right, domMbr.bottom);
|
|
20134
20166
|
if (refMbr.isInside(point3) && (conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
20135
20167
|
const domRange = conf.documentFactory.caretPositionFromPoint ? conf.documentFactory.caretPositionFromPoint(point3.x, point3.y) : conf.documentFactory.caretRangeFromPoint(point3.x, point3.y);
|
|
20136
|
-
|
|
20137
|
-
|
|
20138
|
-
|
|
20139
|
-
|
|
20140
|
-
|
|
20141
|
-
|
|
20142
|
-
|
|
20143
|
-
|
|
20144
|
-
|
|
20145
|
-
|
|
20168
|
+
if (domRange) {
|
|
20169
|
+
const textNode = conf.documentFactory.caretPositionFromPoint ? domRange.offsetNode : domRange.startContainer;
|
|
20170
|
+
const offset = conf.documentFactory.caretPositionFromPoint ? domRange.offset : domRange.startOffset;
|
|
20171
|
+
const slatePoint = conf.reactEditorToSlatePoint(this.editor.editor, textNode, offset, {
|
|
20172
|
+
exactMatch: false,
|
|
20173
|
+
suppressThrow: false
|
|
20174
|
+
});
|
|
20175
|
+
if (slatePoint) {
|
|
20176
|
+
const nRange = { anchor: slatePoint, focus: slatePoint };
|
|
20177
|
+
this.editorTransforms.select(this.editor.editor, nRange);
|
|
20178
|
+
conf.reactEditorFocus(this.editor.editor);
|
|
20179
|
+
}
|
|
20146
20180
|
}
|
|
20147
20181
|
} else {
|
|
20148
20182
|
if (!(conf.documentFactory.caretPositionFromPoint || conf.documentFactory.caretRangeFromPoint)) {
|
|
@@ -37350,6 +37384,9 @@ class Shape extends BaseItem {
|
|
|
37350
37384
|
getMbr() {
|
|
37351
37385
|
return this.mbr.copy();
|
|
37352
37386
|
}
|
|
37387
|
+
getPathMbr() {
|
|
37388
|
+
return this.getPath().getMbr();
|
|
37389
|
+
}
|
|
37353
37390
|
getNearestEdgePointTo(point5) {
|
|
37354
37391
|
return this.path.getNearestEdgePointTo(point5);
|
|
37355
37392
|
}
|
|
@@ -38309,10 +38346,6 @@ class Frame extends BaseItem {
|
|
|
38309
38346
|
return this.mbr.copy();
|
|
38310
38347
|
}
|
|
38311
38348
|
doResize(resizeType, pointer, mbr, opposite, startMbr, timeStamp) {
|
|
38312
|
-
if (this.transformation.isLocked) {
|
|
38313
|
-
this.board?.pointer.setCursor("default");
|
|
38314
|
-
return false;
|
|
38315
|
-
}
|
|
38316
38349
|
const res = this.getCanChangeRatio() ? getResize(resizeType, pointer, mbr, opposite) : getProportionalResize(resizeType, pointer, mbr, opposite);
|
|
38317
38350
|
if (!res) {
|
|
38318
38351
|
return {
|
|
@@ -40890,7 +40923,7 @@ function createComment(id, data, board) {
|
|
|
40890
40923
|
if (!isCommentData(data)) {
|
|
40891
40924
|
throw new Error("Invalid data for Comment");
|
|
40892
40925
|
}
|
|
40893
|
-
const comment2 = new
|
|
40926
|
+
const comment2 = new Comment(new Point, board.events).setId(id).deserialize(data);
|
|
40894
40927
|
return comment2;
|
|
40895
40928
|
}
|
|
40896
40929
|
function createAINode(id, data, board) {
|
|
@@ -41094,7 +41127,7 @@ class AddComment extends BoardTool {
|
|
|
41094
41127
|
leftButtonUp() {
|
|
41095
41128
|
this.isDown = false;
|
|
41096
41129
|
this.board.selection.removeAll();
|
|
41097
|
-
this.comment = this.board.add(
|
|
41130
|
+
this.comment = this.board.add(new Comment(this.board.pointer.point));
|
|
41098
41131
|
this.board.tools.publish();
|
|
41099
41132
|
return true;
|
|
41100
41133
|
}
|
|
@@ -41414,7 +41447,6 @@ class ConnectorSnap {
|
|
|
41414
41447
|
|
|
41415
41448
|
// src/Tools/AddConnector/AddConnector.ts
|
|
41416
41449
|
class AddConnector extends BoardTool {
|
|
41417
|
-
board;
|
|
41418
41450
|
connector = null;
|
|
41419
41451
|
lineStyle = "curved";
|
|
41420
41452
|
startPointer;
|
|
@@ -41429,7 +41461,6 @@ class AddConnector extends BoardTool {
|
|
|
41429
41461
|
isQuickAdd = false;
|
|
41430
41462
|
constructor(board, itemToStart, position4) {
|
|
41431
41463
|
super(board);
|
|
41432
|
-
this.board = board;
|
|
41433
41464
|
this.snap = new ConnectorSnap(this.board);
|
|
41434
41465
|
this.setCursor();
|
|
41435
41466
|
const storage = new SessionStorage;
|
|
@@ -41491,16 +41522,16 @@ class AddConnector extends BoardTool {
|
|
|
41491
41522
|
this.board.tools.publish();
|
|
41492
41523
|
return true;
|
|
41493
41524
|
}
|
|
41494
|
-
|
|
41525
|
+
leftButtonUp() {
|
|
41495
41526
|
this.isDown = false;
|
|
41496
41527
|
if (!this.connector) {
|
|
41497
41528
|
return true;
|
|
41498
41529
|
}
|
|
41499
41530
|
if (this.isDoneSecondPoint) {
|
|
41500
|
-
|
|
41531
|
+
this.board.add(this.connector);
|
|
41501
41532
|
this.board.tools.select();
|
|
41502
41533
|
} else if (this.isDraggingFromFirstToSecond) {
|
|
41503
|
-
const addedConnector =
|
|
41534
|
+
const addedConnector = this.board.add(this.connector);
|
|
41504
41535
|
const endPoint = this.connector.getEndPoint();
|
|
41505
41536
|
this.board.tools.select();
|
|
41506
41537
|
if (this.isQuickAdd && endPoint.pointType === "Board") {
|
|
@@ -43130,13 +43161,8 @@ function createCanvasDrawer(board) {
|
|
|
43130
43161
|
// src/Selection/QuickAddButtons/quickAddHelpers.ts
|
|
43131
43162
|
function getControlPointData(item, index2, isRichText = false) {
|
|
43132
43163
|
const itemScale = isRichText ? { x: 1, y: 1 } : item.transformation.getScale();
|
|
43133
|
-
const width2 = item.
|
|
43134
|
-
let height3;
|
|
43135
|
-
if (item.itemType === "Shape" && index2 !== 2 && index2 !== 3) {
|
|
43136
|
-
height3 = item.getPath().getMbr().getHeight();
|
|
43137
|
-
} else {
|
|
43138
|
-
height3 = item.getMbr().getHeight();
|
|
43139
|
-
}
|
|
43164
|
+
const width2 = item.getPathMbr().getWidth();
|
|
43165
|
+
let height3 = item.getPathMbr().getHeight();
|
|
43140
43166
|
const adjMapScaled = {
|
|
43141
43167
|
0: { x: 0, y: height3 / 2 / itemScale.y },
|
|
43142
43168
|
1: {
|
|
@@ -43169,7 +43195,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43169
43195
|
optionalItem = new Sticker(board);
|
|
43170
43196
|
break;
|
|
43171
43197
|
case "AINode":
|
|
43172
|
-
optionalItem = createAINode2(board, startPoint?.item?.getId()
|
|
43198
|
+
optionalItem = createAINode2(board, 3, "item" in startPoint ? startPoint?.item?.getId() : undefined);
|
|
43173
43199
|
break;
|
|
43174
43200
|
}
|
|
43175
43201
|
let itemMbr = optionalItem.getMbr();
|
|
@@ -43196,20 +43222,25 @@ function quickAddItem(board, type, connector) {
|
|
|
43196
43222
|
if ("text" in guarded && guarded.itemType !== "AINode" && guarded.itemType !== "RichText") {
|
|
43197
43223
|
delete guarded.text;
|
|
43198
43224
|
}
|
|
43225
|
+
if (!itemData.transformation) {
|
|
43226
|
+
itemData.transformation = new DefaultTransformationData;
|
|
43227
|
+
}
|
|
43199
43228
|
itemData.transformation.translateX = endPoint.x;
|
|
43200
43229
|
itemData.transformation.translateY = endPoint.y;
|
|
43201
43230
|
const lines = connector.lines.getSegments();
|
|
43202
43231
|
const lastLine = lines[lines.length - 1];
|
|
43203
|
-
|
|
43232
|
+
const lastLineStart = lastLine.getStartPoint();
|
|
43233
|
+
const lastLineEnd = lastLine.getEndPoint();
|
|
43234
|
+
let dir2 = getDirection(lastLineStart, lastLineEnd);
|
|
43235
|
+
const firstLineStart = lines[0].getEndPoint();
|
|
43204
43236
|
if (!dir2) {
|
|
43205
|
-
const
|
|
43206
|
-
const
|
|
43207
|
-
const yDiff = Math.abs(firstLine.start.y - lastLine.end.y);
|
|
43237
|
+
const xDiff = Math.abs(firstLineStart.x - lastLineEnd.x);
|
|
43238
|
+
const yDiff = Math.abs(firstLineStart.y - lastLineEnd.y);
|
|
43208
43239
|
dir2 = xDiff > yDiff ? "horizontal" : "vertical";
|
|
43209
43240
|
}
|
|
43210
43241
|
let dirIndex = -1;
|
|
43211
43242
|
if (dir2 === "vertical") {
|
|
43212
|
-
if (
|
|
43243
|
+
if (firstLineStart.y > lastLineEnd.y) {
|
|
43213
43244
|
itemData.transformation.translateX -= itemMbr.getWidth() / 2;
|
|
43214
43245
|
itemData.transformation.translateY -= itemMbr.getHeight();
|
|
43215
43246
|
dirIndex = 3;
|
|
@@ -43218,7 +43249,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43218
43249
|
dirIndex = 2;
|
|
43219
43250
|
}
|
|
43220
43251
|
} else if (dir2 === "horizontal") {
|
|
43221
|
-
if (
|
|
43252
|
+
if (firstLineStart.x > lastLineEnd.x) {
|
|
43222
43253
|
itemData.transformation.translateX -= itemMbr.getWidth();
|
|
43223
43254
|
itemData.transformation.translateY -= itemMbr.getHeight() / 2;
|
|
43224
43255
|
dirIndex = 1;
|
|
@@ -43240,7 +43271,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43240
43271
|
connector.setEndPoint(newEndPoint);
|
|
43241
43272
|
board.selection.removeAll();
|
|
43242
43273
|
board.selection.add(added);
|
|
43243
|
-
if (added
|
|
43274
|
+
if (added instanceof RichText || added instanceof AINode) {
|
|
43244
43275
|
const text5 = added.getRichText();
|
|
43245
43276
|
text5.editor.setMaxWidth(text5.editor.maxWidth || 600);
|
|
43246
43277
|
board.selection.editText();
|
|
@@ -43248,7 +43279,7 @@ function quickAddItem(board, type, connector) {
|
|
|
43248
43279
|
board.selection.setContext("EditUnderPointer");
|
|
43249
43280
|
}
|
|
43250
43281
|
}
|
|
43251
|
-
function createAINode2(board,
|
|
43282
|
+
function createAINode2(board, directionIndex, parentNodeId) {
|
|
43252
43283
|
const node2 = new AINode(board, true, parentNodeId, undefined, directionIndex);
|
|
43253
43284
|
const nodeRichText = node2.getRichText();
|
|
43254
43285
|
nodeRichText.applyMaxWidth(600);
|
|
@@ -43282,17 +43313,17 @@ function getQuickAddButtons(selection, board) {
|
|
|
43282
43313
|
let quickAddItems = undefined;
|
|
43283
43314
|
function calculateQuickAddPosition(index2, selectedItem, connectorStartPoint) {
|
|
43284
43315
|
const connectorStorage = new SessionStorage;
|
|
43285
|
-
const currMbr = selectedItem.
|
|
43316
|
+
const currMbr = selectedItem.getPathMbr();
|
|
43286
43317
|
const selectedItemData = selectedItem.serialize();
|
|
43287
|
-
const width2 =
|
|
43288
|
-
const height3 =
|
|
43318
|
+
const width2 = currMbr.getWidth();
|
|
43319
|
+
const height3 = currMbr.getHeight();
|
|
43289
43320
|
let offsetX = width2;
|
|
43290
43321
|
let offsetY = height3;
|
|
43291
43322
|
let newWidth = width2;
|
|
43292
43323
|
let newHeight = height3;
|
|
43293
43324
|
let itemData;
|
|
43294
43325
|
if (selectedItem.itemType === "AINode" || selectedItem.itemType === "RichText") {
|
|
43295
|
-
const item = selectedItem.itemType === "AINode" ? createAINode2(board, selectedItem.getId()
|
|
43326
|
+
const item = selectedItem.itemType === "AINode" ? createAINode2(board, index2, selectedItem.getId()) : createRichText2(board);
|
|
43296
43327
|
newWidth = item.getMbr().getWidth();
|
|
43297
43328
|
newHeight = item.getMbr().getHeight();
|
|
43298
43329
|
itemData = item.serialize();
|
|
@@ -43341,9 +43372,9 @@ function getQuickAddButtons(selection, board) {
|
|
|
43341
43372
|
const endPoints = getQuickButtonsPositions(newMbr);
|
|
43342
43373
|
const reverseIndexMap = { 0: 1, 1: 0, 2: 3, 3: 2 };
|
|
43343
43374
|
const connectorEndPoint = endPoints?.positions[reverseIndexMap[index2]] || new Point;
|
|
43344
|
-
const fontSize = selectedItem
|
|
43375
|
+
const fontSize = selectedItem instanceof RichText ? selectedItem.getFontSize() : 14;
|
|
43345
43376
|
const newItem = board.createItem(board.getNewItemId(), newItemData);
|
|
43346
|
-
if (newItem
|
|
43377
|
+
if (newItem instanceof RichText) {
|
|
43347
43378
|
const storage = new SessionStorage;
|
|
43348
43379
|
storage.setFontSize("RichText", fontSize);
|
|
43349
43380
|
newItem.editor.selectWholeText();
|
|
@@ -43356,6 +43387,10 @@ function getQuickAddButtons(selection, board) {
|
|
|
43356
43387
|
const scaleX = newItemMbr.getWidth() / 100;
|
|
43357
43388
|
const scaleY = newItemMbr.getHeight() / 100;
|
|
43358
43389
|
shapeData.transformation = {
|
|
43390
|
+
isLocked: false,
|
|
43391
|
+
rotate: 0,
|
|
43392
|
+
translateX: 0,
|
|
43393
|
+
translateY: 0,
|
|
43359
43394
|
...newItemData.transformation,
|
|
43360
43395
|
scaleX,
|
|
43361
43396
|
scaleY
|
|
@@ -43412,7 +43447,7 @@ function getQuickAddButtons(selection, board) {
|
|
|
43412
43447
|
}
|
|
43413
43448
|
let pathCenter;
|
|
43414
43449
|
if (single.itemType === "Shape") {
|
|
43415
|
-
pathCenter = single.
|
|
43450
|
+
pathCenter = single.getPathMbr().getCenter();
|
|
43416
43451
|
}
|
|
43417
43452
|
const center = itemMbr.getCenter();
|
|
43418
43453
|
const width2 = itemMbr.getWidth();
|
|
@@ -43607,7 +43642,7 @@ class AlignmentHelper {
|
|
|
43607
43642
|
if (i === 0) {
|
|
43608
43643
|
return acc;
|
|
43609
43644
|
}
|
|
43610
|
-
const itemMbr = item.
|
|
43645
|
+
const itemMbr = item.getPathMbr();
|
|
43611
43646
|
return acc.combine(itemMbr);
|
|
43612
43647
|
}, items[0].getMbr());
|
|
43613
43648
|
}
|
|
@@ -43926,9 +43961,11 @@ class AlignmentHelper {
|
|
|
43926
43961
|
const translation = this.board.selection.getManyItemsTranslation(x, y);
|
|
43927
43962
|
this.board.selection.transformMany(translation, timeStamp);
|
|
43928
43963
|
} else {
|
|
43929
|
-
const
|
|
43964
|
+
const id = item.getId();
|
|
43930
43965
|
const transformMap = {};
|
|
43931
|
-
transformMap[
|
|
43966
|
+
transformMap[id] = {
|
|
43967
|
+
class: "Transformation",
|
|
43968
|
+
item: [id],
|
|
43932
43969
|
method: "translateBy",
|
|
43933
43970
|
x,
|
|
43934
43971
|
y,
|
|
@@ -44233,7 +44270,7 @@ class Select extends Tool {
|
|
|
44233
44270
|
const itemCenter = this.downOnItem.getMbr().getCenter();
|
|
44234
44271
|
this.initialCursorPos = new Point(this.board.pointer.point.x - itemCenter.x, this.board.pointer.point.y - itemCenter.y);
|
|
44235
44272
|
}
|
|
44236
|
-
if (this.downOnItem
|
|
44273
|
+
if (this.downOnItem instanceof Connector2 && this.downOnItem.isConnectedOnePoint() && !this.board.keyboard.isCtrl) {
|
|
44237
44274
|
this.board.selection.editUnderPointer();
|
|
44238
44275
|
this.board.tools.publish();
|
|
44239
44276
|
this.clear();
|
|
@@ -44282,7 +44319,7 @@ class Select extends Tool {
|
|
|
44282
44319
|
const isDrawingSelectionMbr = this.isDrawingRectangle && this.line && this.rect;
|
|
44283
44320
|
if (isDrawingSelectionMbr) {
|
|
44284
44321
|
const point5 = this.board.pointer.point.copy();
|
|
44285
|
-
this.line = new Line(this.line
|
|
44322
|
+
this.line = new Line(this.line?.start, point5);
|
|
44286
44323
|
this.rect = this.line.getMbr();
|
|
44287
44324
|
this.rect.borderColor = conf.SELECTION_COLOR;
|
|
44288
44325
|
this.rect.backgroundColor = conf.SELECTION_BACKGROUND;
|
|
@@ -44523,7 +44560,7 @@ class Select extends Tool {
|
|
|
44523
44560
|
const isNotInSelection = this.board.selection.items.findById(underPointer.getId()) === null;
|
|
44524
44561
|
if (isNotInSelection) {
|
|
44525
44562
|
this.board.selection.add(underPointer);
|
|
44526
|
-
if (underPointer
|
|
44563
|
+
if (underPointer instanceof Frame) {
|
|
44527
44564
|
const { left, right, top, bottom } = underPointer.getMbr();
|
|
44528
44565
|
const itemsInFrame = this.board.items.getEnclosedOrCrossed(left, top, right, bottom).filter((item) => underPointer.getChildrenIds().includes(item.getId()));
|
|
44529
44566
|
this.board.selection.add(itemsInFrame);
|
|
@@ -44651,13 +44688,13 @@ class Select extends Tool {
|
|
|
44651
44688
|
}
|
|
44652
44689
|
onConfirm() {
|
|
44653
44690
|
const single = this.board.selection.items.getSingle();
|
|
44654
|
-
if (this.board.selection.showQuickAddPanel && single && single
|
|
44655
|
-
quickAddItem(this.board, "
|
|
44691
|
+
if (this.board.selection.showQuickAddPanel && single && single instanceof Connector2) {
|
|
44692
|
+
quickAddItem(this.board, "Rectangle", single);
|
|
44656
44693
|
} else if (single && this.board.selection.getContext() !== "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
|
|
44657
44694
|
this.board.selection.editText(undefined, true);
|
|
44658
44695
|
} else if (isSafari() && this.board.selection.getContext() === "EditTextUnderPointer" && !this.board.selection.getIsLockedSelection()) {
|
|
44659
|
-
if (single && "text" in single || single
|
|
44660
|
-
const text5 = single
|
|
44696
|
+
if (single && "text" in single || single instanceof RichText) {
|
|
44697
|
+
const text5 = single instanceof RichText ? single : single.text;
|
|
44661
44698
|
text5.editor.splitNode();
|
|
44662
44699
|
}
|
|
44663
44700
|
}
|
|
@@ -47781,7 +47818,7 @@ class Presence {
|
|
|
47781
47818
|
};
|
|
47782
47819
|
});
|
|
47783
47820
|
ctx2.restore();
|
|
47784
|
-
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop);
|
|
47821
|
+
this.pointerAnimationId = safeRequestAnimationFrame(renderLoop) || null;
|
|
47785
47822
|
};
|
|
47786
47823
|
renderLoop();
|
|
47787
47824
|
}
|
|
@@ -49272,10 +49309,10 @@ class Items {
|
|
|
49272
49309
|
}
|
|
49273
49310
|
const { nearest } = enclosed.reduce((acc, item) => {
|
|
49274
49311
|
const area = item.getMbr().getHeight() * item.getMbr().getWidth();
|
|
49275
|
-
if (item
|
|
49312
|
+
if (item instanceof Drawing && !item.isPointNearLine(this.pointer.point)) {
|
|
49276
49313
|
return acc;
|
|
49277
49314
|
}
|
|
49278
|
-
const isItemTransparent = item
|
|
49315
|
+
const isItemTransparent = item instanceof Shape && item?.getBackgroundColor() === "none";
|
|
49279
49316
|
const itemZIndex = this.getZIndex(item);
|
|
49280
49317
|
const accZIndex = this.getZIndex(acc.nearest);
|
|
49281
49318
|
if (itemZIndex > accZIndex && (!isItemTransparent || area === acc.area) || area < acc.area) {
|
|
@@ -49306,7 +49343,7 @@ class Items {
|
|
|
49306
49343
|
}
|
|
49307
49344
|
getLinkedConnectorsById(id) {
|
|
49308
49345
|
return this.listAll().filter((item) => {
|
|
49309
|
-
if (item
|
|
49346
|
+
if (!(item instanceof Connector2)) {
|
|
49310
49347
|
return false;
|
|
49311
49348
|
}
|
|
49312
49349
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -49321,7 +49358,7 @@ class Items {
|
|
|
49321
49358
|
return [];
|
|
49322
49359
|
}
|
|
49323
49360
|
return this.listAll().filter((item) => {
|
|
49324
|
-
if (item
|
|
49361
|
+
if (!(item instanceof Connector2) || !item.isConnected()) {
|
|
49325
49362
|
return false;
|
|
49326
49363
|
}
|
|
49327
49364
|
const { startItem, endItem } = item.getConnectedItems();
|
|
@@ -49496,7 +49533,7 @@ class SelectionItems {
|
|
|
49496
49533
|
return ids;
|
|
49497
49534
|
}
|
|
49498
49535
|
getSingle() {
|
|
49499
|
-
return this.isSingle() ? this.items.values().next().value : null;
|
|
49536
|
+
return this.isSingle() ? this.items.values().next().value || null : null;
|
|
49500
49537
|
}
|
|
49501
49538
|
listByIds(itemIdList) {
|
|
49502
49539
|
return itemIdList.map((id) => this.items.get(id)).filter((item) => item !== undefined);
|
|
@@ -49544,7 +49581,7 @@ class ConnectorTransformer extends Tool {
|
|
|
49544
49581
|
getConnector(items) {
|
|
49545
49582
|
if (items.isSingle()) {
|
|
49546
49583
|
const connector = items.getSingle();
|
|
49547
|
-
if (connector
|
|
49584
|
+
if (connector instanceof Connector2) {
|
|
49548
49585
|
return connector;
|
|
49549
49586
|
}
|
|
49550
49587
|
}
|
|
@@ -49850,7 +49887,7 @@ function getItemTranslation({
|
|
|
49850
49887
|
scale: { x: 1, y: 1 }
|
|
49851
49888
|
};
|
|
49852
49889
|
} else {
|
|
49853
|
-
if (item
|
|
49890
|
+
if (item instanceof Frame && item.getCanChangeRatio() && isShiftPressed && item.getFrameType() !== "Custom") {
|
|
49854
49891
|
item.setFrameType("Custom");
|
|
49855
49892
|
}
|
|
49856
49893
|
return {
|
|
@@ -49863,7 +49900,7 @@ function getItemTranslation({
|
|
|
49863
49900
|
}
|
|
49864
49901
|
}
|
|
49865
49902
|
|
|
49866
|
-
// src/Selection/Transformer/TransformerHelpers/
|
|
49903
|
+
// src/Selection/Transformer/TransformerHelpers/transformShape.ts
|
|
49867
49904
|
function transformShape({
|
|
49868
49905
|
mbr,
|
|
49869
49906
|
board,
|
|
@@ -50133,7 +50170,7 @@ function transformItems({
|
|
|
50133
50170
|
if (includesProportionalItem && (isWidth || isHeight)) {
|
|
50134
50171
|
return null;
|
|
50135
50172
|
}
|
|
50136
|
-
const isIncludesFixedFrame = items.some((item) => item
|
|
50173
|
+
const isIncludesFixedFrame = items.some((item) => item instanceof Frame && !item.getCanChangeRatio());
|
|
50137
50174
|
const shouldBeProportionalResize = isIncludesFixedFrame || includesProportionalItem || isShiftPressed || !isWidth && !isHeight;
|
|
50138
50175
|
const resize = shouldBeProportionalResize ? getProportionalResize(resizeType, board.pointer.point, mbr, oppositePoint) : getResize(resizeType, board.pointer.point, mbr, oppositePoint);
|
|
50139
50176
|
if (canvasDrawer.getLastCreatedCanvas() && !debounceUpd.shouldUpd()) {
|
|
@@ -50305,7 +50342,7 @@ class Transformer extends Tool {
|
|
|
50305
50342
|
return resizeType;
|
|
50306
50343
|
}
|
|
50307
50344
|
updateAlignmentBySnapLines(single) {
|
|
50308
|
-
if (single) {
|
|
50345
|
+
if (single && this.resizeType) {
|
|
50309
50346
|
this.snapLines = this.alignmentHelper.checkAlignment(single);
|
|
50310
50347
|
const snapped = this.alignmentHelper.snapToSide(single, this.snapLines, this.beginTimeStamp, this.resizeType);
|
|
50311
50348
|
if (snapped) {
|
|
@@ -51014,10 +51051,10 @@ class BoardSelection {
|
|
|
51014
51051
|
}
|
|
51015
51052
|
copiedItemsMap[item.getId()] = { ...serializedData, zIndex };
|
|
51016
51053
|
}
|
|
51017
|
-
copy(skipImageBlobCopy
|
|
51054
|
+
copy(skipImageBlobCopy) {
|
|
51018
51055
|
const copiedItemsMap = {};
|
|
51019
51056
|
const single = this.items.getSingle();
|
|
51020
|
-
if (!skipImageBlobCopy && single && single
|
|
51057
|
+
if (!skipImageBlobCopy && single && single instanceof ImageItem) {
|
|
51021
51058
|
this.handleItemCopy(single, copiedItemsMap);
|
|
51022
51059
|
return { imageElement: single.image, imageData: copiedItemsMap };
|
|
51023
51060
|
}
|
|
@@ -51042,7 +51079,7 @@ class BoardSelection {
|
|
|
51042
51079
|
return copiedItemsMap;
|
|
51043
51080
|
}
|
|
51044
51081
|
cut() {
|
|
51045
|
-
const items = this.copy();
|
|
51082
|
+
const items = this.copy(true);
|
|
51046
51083
|
this.removeFromBoard();
|
|
51047
51084
|
return items;
|
|
51048
51085
|
}
|
|
@@ -51193,7 +51230,7 @@ class BoardSelection {
|
|
|
51193
51230
|
});
|
|
51194
51231
|
Object.values(selectedMap).forEach((val) => {
|
|
51195
51232
|
const parentFrame = this.board.items.getById(val.item.parent);
|
|
51196
|
-
const isParentFrame = parentFrame
|
|
51233
|
+
const isParentFrame = parentFrame instanceof Frame;
|
|
51197
51234
|
const parentFrameId = isParentFrame ? parentFrame.getId() : null;
|
|
51198
51235
|
if (val.nested) {
|
|
51199
51236
|
const isRemoveChildFromFrame = Object.values(selectedMap).some((val2) => val2.nested && val2.nested.getId() !== parentFrameId);
|
|
@@ -51208,7 +51245,7 @@ class BoardSelection {
|
|
|
51208
51245
|
console.warn(`Didnt find frame with id ${val.item.parent}`);
|
|
51209
51246
|
}
|
|
51210
51247
|
}
|
|
51211
|
-
if (val.item
|
|
51248
|
+
if (val.item instanceof Frame && checkFrames) {
|
|
51212
51249
|
const currFrame = val.item;
|
|
51213
51250
|
const currMbr = currFrame.getMbr();
|
|
51214
51251
|
const children = val.item.getChildrenIds().map((childId) => this.board.items.getById(childId)).filter((item) => !!item);
|
|
@@ -51616,12 +51653,6 @@ class BoardSelection {
|
|
|
51616
51653
|
text5.setEditorFocus(this.context);
|
|
51617
51654
|
}
|
|
51618
51655
|
}
|
|
51619
|
-
getMediaStorageIds() {
|
|
51620
|
-
return this.items.list().filter((item) => {
|
|
51621
|
-
const shouldClearStorageUsage = item.itemType === "Image" || item.itemType === "Video" && item.getIsStorageUrl() || item.itemType === "Audio" && item.getIsStorageUrl();
|
|
51622
|
-
return shouldClearStorageUsage;
|
|
51623
|
-
}).map((item) => item.getStorageId());
|
|
51624
|
-
}
|
|
51625
51656
|
removeFromBoard() {
|
|
51626
51657
|
const isLocked = this.items.list().some((item) => item.transformation.isLocked);
|
|
51627
51658
|
if (isLocked) {
|
|
@@ -51636,7 +51667,6 @@ class BoardSelection {
|
|
|
51636
51667
|
const connectors = itemIds.flatMap((id) => {
|
|
51637
51668
|
return this.board.items.getLinkedConnectorsById(id);
|
|
51638
51669
|
}).map((connector) => connector.getId());
|
|
51639
|
-
conf.hooks.beforeMediaRemove(this.getMediaStorageIds(), this.board.getBoardId());
|
|
51640
51670
|
this.emit({
|
|
51641
51671
|
class: "Board",
|
|
51642
51672
|
method: "remove",
|
|
@@ -51673,7 +51703,15 @@ class BoardSelection {
|
|
|
51673
51703
|
this.board.sendToBack(this.items.list());
|
|
51674
51704
|
}
|
|
51675
51705
|
async duplicate() {
|
|
51676
|
-
const mediaIds =
|
|
51706
|
+
const mediaIds = [];
|
|
51707
|
+
this.items.list().forEach((item) => {
|
|
51708
|
+
if ("getStorageId" in item) {
|
|
51709
|
+
const storageId = item.getStorageId();
|
|
51710
|
+
if (storageId) {
|
|
51711
|
+
mediaIds.push(storageId);
|
|
51712
|
+
}
|
|
51713
|
+
}
|
|
51714
|
+
});
|
|
51677
51715
|
const canDuplicate = mediaIds.length ? await conf.hooks.beforeMediaUpload(mediaIds, this.board.getBoardId()) : true;
|
|
51678
51716
|
if (!canDuplicate) {
|
|
51679
51717
|
return;
|
|
@@ -51741,7 +51779,7 @@ class BoardSelection {
|
|
|
51741
51779
|
}
|
|
51742
51780
|
}
|
|
51743
51781
|
const contextItems = [];
|
|
51744
|
-
if (single && single
|
|
51782
|
+
if (single && single instanceof AINode) {
|
|
51745
51783
|
const contextItemsIds = single.getContextItems();
|
|
51746
51784
|
if (contextItemsIds.length) {
|
|
51747
51785
|
const newContextItems = this.board.items.listAll().filter((item) => contextItemsIds.includes(item.getId()));
|
|
@@ -51763,7 +51801,7 @@ class BoardSelection {
|
|
|
51763
51801
|
}
|
|
51764
51802
|
}
|
|
51765
51803
|
contextItems.forEach((item) => {
|
|
51766
|
-
if (item
|
|
51804
|
+
if (item instanceof AINode) {
|
|
51767
51805
|
const path2 = item.getPath();
|
|
51768
51806
|
path2.setBorderColor(CONTEXT_NODE_HIGHLIGHT_COLOR);
|
|
51769
51807
|
path2.setBorderWidth(2);
|
|
@@ -51778,6 +51816,416 @@ class BoardSelection {
|
|
|
51778
51816
|
});
|
|
51779
51817
|
}
|
|
51780
51818
|
}
|
|
51819
|
+
// src/public/customWebComponents.js
|
|
51820
|
+
var customWebComponents_default = `/* eslint-disable max-classes-per-file, @typescript-eslint/no-useless-constructor */
|
|
51821
|
+
class RichTextElement extends HTMLElement {
|
|
51822
|
+
constructor() {
|
|
51823
|
+
super();
|
|
51824
|
+
}
|
|
51825
|
+
}
|
|
51826
|
+
|
|
51827
|
+
class ShapeItemElement extends HTMLElement {
|
|
51828
|
+
constructor() {
|
|
51829
|
+
super();
|
|
51830
|
+
}
|
|
51831
|
+
}
|
|
51832
|
+
|
|
51833
|
+
class StickerElement extends HTMLElement {
|
|
51834
|
+
constructor() {
|
|
51835
|
+
super();
|
|
51836
|
+
}
|
|
51837
|
+
}
|
|
51838
|
+
|
|
51839
|
+
class DrawingElement extends HTMLElement {
|
|
51840
|
+
constructor() {
|
|
51841
|
+
super();
|
|
51842
|
+
}
|
|
51843
|
+
}
|
|
51844
|
+
|
|
51845
|
+
class ConnectorElement extends HTMLElement {
|
|
51846
|
+
constructor() {
|
|
51847
|
+
super();
|
|
51848
|
+
}
|
|
51849
|
+
}
|
|
51850
|
+
|
|
51851
|
+
class FrameItemElement extends HTMLElement {
|
|
51852
|
+
constructor() {
|
|
51853
|
+
super();
|
|
51854
|
+
}
|
|
51855
|
+
}
|
|
51856
|
+
|
|
51857
|
+
class ImageItemElement extends HTMLElement {
|
|
51858
|
+
constructor() {
|
|
51859
|
+
super();
|
|
51860
|
+
}
|
|
51861
|
+
}
|
|
51862
|
+
|
|
51863
|
+
class LinkItemElement extends HTMLElement {
|
|
51864
|
+
constructor() {
|
|
51865
|
+
super();
|
|
51866
|
+
}
|
|
51867
|
+
}
|
|
51868
|
+
|
|
51869
|
+
class AINodeItemElement extends HTMLElement {
|
|
51870
|
+
constructor() {
|
|
51871
|
+
super();
|
|
51872
|
+
}
|
|
51873
|
+
}
|
|
51874
|
+
|
|
51875
|
+
class VideoItemElement extends HTMLElement {
|
|
51876
|
+
constructor() {
|
|
51877
|
+
super();
|
|
51878
|
+
}
|
|
51879
|
+
}
|
|
51880
|
+
|
|
51881
|
+
class CommentElement extends HTMLElement {
|
|
51882
|
+
constructor() {
|
|
51883
|
+
super();
|
|
51884
|
+
}
|
|
51885
|
+
}
|
|
51886
|
+
|
|
51887
|
+
class AudioItemElement extends HTMLElement {
|
|
51888
|
+
constructor() {
|
|
51889
|
+
super();
|
|
51890
|
+
}
|
|
51891
|
+
}
|
|
51892
|
+
|
|
51893
|
+
customElements.define("rich-text", RichTextElement);
|
|
51894
|
+
customElements.define("shape-item", ShapeItemElement);
|
|
51895
|
+
customElements.define("sticker-item", StickerElement);
|
|
51896
|
+
customElements.define("drawing-item", DrawingElement);
|
|
51897
|
+
customElements.define("connector-item", ConnectorElement);
|
|
51898
|
+
customElements.define("frame-item", FrameItemElement);
|
|
51899
|
+
customElements.define("image-item", ImageItemElement);
|
|
51900
|
+
customElements.define("link-item", LinkItemElement);
|
|
51901
|
+
customElements.define("ainode-item", AINodeItemElement);
|
|
51902
|
+
customElements.define("video-item", VideoItemElement);
|
|
51903
|
+
customElements.define("comment-item", CommentElement);
|
|
51904
|
+
customElements.define("audio-item", AudioItemElement);
|
|
51905
|
+
|
|
51906
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
51907
|
+
const itemsDiv = document.querySelector("#items");
|
|
51908
|
+
if (!itemsDiv) {
|
|
51909
|
+
console.error("ITEMS DIV NOT FOUND!");
|
|
51910
|
+
return;
|
|
51911
|
+
}
|
|
51912
|
+
let isDragging = false;
|
|
51913
|
+
let startX, startY;
|
|
51914
|
+
let translateX = 0;
|
|
51915
|
+
let translateY = 0;
|
|
51916
|
+
let scale = 1;
|
|
51917
|
+
|
|
51918
|
+
itemsDiv.style.transformOrigin = "0 0";
|
|
51919
|
+
document.body.style.cursor = "grab";
|
|
51920
|
+
|
|
51921
|
+
function updateTransform() {
|
|
51922
|
+
itemsDiv.style.transform =
|
|
51923
|
+
"translate(" +
|
|
51924
|
+
translateX +
|
|
51925
|
+
"px, " +
|
|
51926
|
+
translateY +
|
|
51927
|
+
"px) scale(" +
|
|
51928
|
+
scale +
|
|
51929
|
+
")";
|
|
51930
|
+
}
|
|
51931
|
+
|
|
51932
|
+
function handleMouseDown(ev) {
|
|
51933
|
+
isDragging = true;
|
|
51934
|
+
startX = ev.clientX;
|
|
51935
|
+
startY = ev.clientY;
|
|
51936
|
+
itemsDiv.style.cursor = "grabbing";
|
|
51937
|
+
}
|
|
51938
|
+
|
|
51939
|
+
function handleMouseMove(ev) {
|
|
51940
|
+
if (!isDragging) {
|
|
51941
|
+
return;
|
|
51942
|
+
}
|
|
51943
|
+
const dx = ev.clientX - startX;
|
|
51944
|
+
const dy = ev.clientY - startY;
|
|
51945
|
+
startX += dx;
|
|
51946
|
+
startY += dy;
|
|
51947
|
+
translateX += dx;
|
|
51948
|
+
translateY += dy;
|
|
51949
|
+
updateTransform();
|
|
51950
|
+
}
|
|
51951
|
+
|
|
51952
|
+
function handleMouseUp(ev) {
|
|
51953
|
+
if (!isDragging) {
|
|
51954
|
+
return;
|
|
51955
|
+
}
|
|
51956
|
+
isDragging = false;
|
|
51957
|
+
itemsDiv.style.cursor = "grab";
|
|
51958
|
+
}
|
|
51959
|
+
|
|
51960
|
+
function handleWheel(ev) {
|
|
51961
|
+
ev.preventDefault();
|
|
51962
|
+
const factor = ev.deltaY < 0 ? 1.1 : 0.9;
|
|
51963
|
+
translateX = ev.clientX - (ev.clientX - translateX) * factor;
|
|
51964
|
+
translateY = ev.clientY - (ev.clientY - translateY) * factor;
|
|
51965
|
+
scale *= factor;
|
|
51966
|
+
updateTransform();
|
|
51967
|
+
}
|
|
51968
|
+
|
|
51969
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
51970
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
51971
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
51972
|
+
document.addEventListener("wheel", handleWheel, { passive: false });
|
|
51973
|
+
|
|
51974
|
+
const titlePanel = document.createElement("div");
|
|
51975
|
+
titlePanel.style.boxShadow = "0px 10px 16px -3px rgba(20, 21, 26, 0.08)";
|
|
51976
|
+
titlePanel.style.position = "fixed";
|
|
51977
|
+
titlePanel.style.left = "12px";
|
|
51978
|
+
titlePanel.style.top = "12px";
|
|
51979
|
+
titlePanel.style.borderRadius = "12px";
|
|
51980
|
+
titlePanel.style.backgroundColor = "#ffff";
|
|
51981
|
+
titlePanel.style.display = "flex";
|
|
51982
|
+
titlePanel.style.alignItems = "center";
|
|
51983
|
+
titlePanel.style.gap = "8px";
|
|
51984
|
+
titlePanel.style.padding = "0 12px";
|
|
51985
|
+
titlePanel.style.height = "48px";
|
|
51986
|
+
const editButton = document.createElement("button");
|
|
51987
|
+
const editIcon = document.createElementNS(
|
|
51988
|
+
"http://www.w3.org/2000/svg",
|
|
51989
|
+
"svg",
|
|
51990
|
+
);
|
|
51991
|
+
editIcon.setAttribute("width", "13");
|
|
51992
|
+
editIcon.setAttribute("height", "13");
|
|
51993
|
+
editIcon.setAttribute("viewBox", "0 0 13 13");
|
|
51994
|
+
editIcon.setAttribute("fill", "none");
|
|
51995
|
+
editIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
51996
|
+
const editIconPath = document.createElementNS(
|
|
51997
|
+
"http://www.w3.org/2000/svg",
|
|
51998
|
+
"path",
|
|
51999
|
+
);
|
|
52000
|
+
editIconPath.setAttribute(
|
|
52001
|
+
"d",
|
|
52002
|
+
"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",
|
|
52003
|
+
);
|
|
52004
|
+
editIconPath.setAttribute("fill", "#ffff");
|
|
52005
|
+
editIcon.appendChild(editIconPath);
|
|
52006
|
+
editButton.appendChild(editIcon);
|
|
52007
|
+
const editFileText = document.createElement("p");
|
|
52008
|
+
const isSnapshotInIframe =
|
|
52009
|
+
window.parent &&
|
|
52010
|
+
window.parent !== window &&
|
|
52011
|
+
window.parent.location.href.includes("/snapshots/");
|
|
52012
|
+
editFileText.textContent = isSnapshotInIframe ? "Edit copy" : "Edit file";
|
|
52013
|
+
editButton.appendChild(editFileText);
|
|
52014
|
+
|
|
52015
|
+
editButton.style.backgroundColor = "rgba(20, 21, 26, 1)";
|
|
52016
|
+
editButton.style.cursor = "pointer";
|
|
52017
|
+
editButton.style.boxShadow = "0px 1px 2px 0px rgba(20, 21, 26, 0.05)";
|
|
52018
|
+
editButton.style.color = "#ffff";
|
|
52019
|
+
editButton.style.fontSize = "14px";
|
|
52020
|
+
editButton.style.lineHeight = "20px";
|
|
52021
|
+
editButton.style.display = "flex";
|
|
52022
|
+
editButton.style.alignItems = "center";
|
|
52023
|
+
editButton.style.gap = "8px";
|
|
52024
|
+
editButton.style.padding = "8px";
|
|
52025
|
+
editButton.style.borderRadius = "10px";
|
|
52026
|
+
const separator = document.createElement("div");
|
|
52027
|
+
separator.style.borderRight = "1px solid rgba(222, 224, 227, 1)";
|
|
52028
|
+
separator.style.height = "100%";
|
|
52029
|
+
const boardName = document.createElement("div");
|
|
52030
|
+
const fileIcon = document.createElementNS(
|
|
52031
|
+
"http://www.w3.org/2000/svg",
|
|
52032
|
+
"svg",
|
|
52033
|
+
);
|
|
52034
|
+
fileIcon.setAttribute("width", "16");
|
|
52035
|
+
fileIcon.setAttribute("height", "18");
|
|
52036
|
+
fileIcon.setAttribute("viewBox", "0 0 16 18");
|
|
52037
|
+
fileIcon.setAttribute("fill", "none");
|
|
52038
|
+
fileIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52039
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
52040
|
+
path.setAttribute(
|
|
52041
|
+
"d",
|
|
52042
|
+
"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",
|
|
52043
|
+
);
|
|
52044
|
+
path.setAttribute("fill", "#696B76");
|
|
52045
|
+
fileIcon.appendChild(path);
|
|
52046
|
+
boardName.appendChild(fileIcon);
|
|
52047
|
+
const boardNameTag = document.querySelector('meta[name="board-name"]');
|
|
52048
|
+
let boardNameStr = "Untitled";
|
|
52049
|
+
if (boardNameTag) {
|
|
52050
|
+
boardNameStr = boardNameTag.getAttribute("content");
|
|
52051
|
+
}
|
|
52052
|
+
const p = document.createElement("p");
|
|
52053
|
+
p.textContent = boardNameStr;
|
|
52054
|
+
p.style.fontSize = "16px";
|
|
52055
|
+
p.style.lineHeight = "24px";
|
|
52056
|
+
boardName.appendChild(p);
|
|
52057
|
+
const cloudIcon = document.createElementNS(
|
|
52058
|
+
"http://www.w3.org/2000/svg",
|
|
52059
|
+
"svg",
|
|
52060
|
+
);
|
|
52061
|
+
cloudIcon.setAttribute("width", "20");
|
|
52062
|
+
cloudIcon.setAttribute("height", "18");
|
|
52063
|
+
cloudIcon.setAttribute("viewBox", "0 0 20 18");
|
|
52064
|
+
cloudIcon.setAttribute("fill", "none");
|
|
52065
|
+
cloudIcon.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
52066
|
+
const cloudIconPath = document.createElementNS(
|
|
52067
|
+
"http://www.w3.org/2000/svg",
|
|
52068
|
+
"path",
|
|
52069
|
+
);
|
|
52070
|
+
cloudIconPath.setAttribute(
|
|
52071
|
+
"d",
|
|
52072
|
+
"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",
|
|
52073
|
+
);
|
|
52074
|
+
cloudIconPath.setAttribute("fill", "#696B76");
|
|
52075
|
+
cloudIcon.appendChild(cloudIconPath);
|
|
52076
|
+
boardName.appendChild(cloudIcon);
|
|
52077
|
+
boardName.style.display = "flex";
|
|
52078
|
+
boardName.style.alignItems = "center";
|
|
52079
|
+
boardName.style.gap = "8px";
|
|
52080
|
+
titlePanel.appendChild(boardName);
|
|
52081
|
+
titlePanel.appendChild(separator);
|
|
52082
|
+
titlePanel.appendChild(editButton);
|
|
52083
|
+
document.body.appendChild(titlePanel);
|
|
52084
|
+
|
|
52085
|
+
editButton.onclick = async () => {
|
|
52086
|
+
editButton.disabled = true;
|
|
52087
|
+
editButton.textContent = "Loading...";
|
|
52088
|
+
|
|
52089
|
+
try {
|
|
52090
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
52091
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
52092
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
52093
|
+
document.removeEventListener("wheel", handleWheel, {
|
|
52094
|
+
passive: false,
|
|
52095
|
+
});
|
|
52096
|
+
translateX = 0;
|
|
52097
|
+
translateY = 0;
|
|
52098
|
+
scale = 1;
|
|
52099
|
+
updateTransform();
|
|
52100
|
+
|
|
52101
|
+
const { initBrowserSettings } = await import(
|
|
52102
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
52103
|
+
);
|
|
52104
|
+
initBrowserSettings();
|
|
52105
|
+
|
|
52106
|
+
const { createApp } = await import(
|
|
52107
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.js"
|
|
52108
|
+
);
|
|
52109
|
+
|
|
52110
|
+
const app = createApp();
|
|
52111
|
+
window.app = app;
|
|
52112
|
+
const stringed = await app.openAndEditFile();
|
|
52113
|
+
|
|
52114
|
+
if (stringed) {
|
|
52115
|
+
await app.openBoardFromFile();
|
|
52116
|
+
app.getBoard().deserializeHTML(stringed);
|
|
52117
|
+
app.localRender("items");
|
|
52118
|
+
}
|
|
52119
|
+
|
|
52120
|
+
const response = await fetch(
|
|
52121
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/bundle.css",
|
|
52122
|
+
);
|
|
52123
|
+
const cssText = await response.text();
|
|
52124
|
+
const styleEl = document.createElement("style");
|
|
52125
|
+
styleEl.textContent = cssText;
|
|
52126
|
+
document.body.appendChild(styleEl);
|
|
52127
|
+
|
|
52128
|
+
const responseSvg = await fetch(
|
|
52129
|
+
"https://www.unpkg.com/test_package_board@0.0.99/dist/sprite.svg",
|
|
52130
|
+
);
|
|
52131
|
+
const svgText = await responseSvg.text();
|
|
52132
|
+
const div = document.createElement("div");
|
|
52133
|
+
div.style.display = "none";
|
|
52134
|
+
div.id = "sprite";
|
|
52135
|
+
div.innerHTML = svgText;
|
|
52136
|
+
document.body.appendChild(div);
|
|
52137
|
+
} finally {
|
|
52138
|
+
editButton.disabled = false;
|
|
52139
|
+
editButton.textContent = "Edit board";
|
|
52140
|
+
}
|
|
52141
|
+
};
|
|
52142
|
+
});
|
|
52143
|
+
`;
|
|
52144
|
+
|
|
52145
|
+
// src/public/loadLinkImages.js
|
|
52146
|
+
var loadLinkImages_default = `document.addEventListener("DOMContentLoaded", function () {
|
|
52147
|
+
document.querySelectorAll(".link-object").forEach(linkItem => {
|
|
52148
|
+
const linkImage = linkItem.querySelector(".link-image");
|
|
52149
|
+
const linkContainer = linkItem.querySelector("a");
|
|
52150
|
+
linkImage.onerror = () => {
|
|
52151
|
+
linkImage.onerror = null;
|
|
52152
|
+
linkImage.style.display = "none";
|
|
52153
|
+
const svgNamespace = "http://www.w3.org/2000/svg";
|
|
52154
|
+
const svg = document.createElementNS(svgNamespace, "svg");
|
|
52155
|
+
svg.setAttribute("width", "20");
|
|
52156
|
+
svg.setAttribute("height", "20");
|
|
52157
|
+
svg.setAttribute("viewBox", "0 0 13 14");
|
|
52158
|
+
svg.setAttribute("fill", "none");
|
|
52159
|
+
|
|
52160
|
+
const path = document.createElementNS(svgNamespace, "path");
|
|
52161
|
+
path.setAttribute(
|
|
52162
|
+
"d",
|
|
52163
|
+
"M11.0054 3.414L2.39838 12.021L0.984375 10.607L9.59037 2H2.00538V0H13.0054V11H11.0054V3.414Z",
|
|
52164
|
+
);
|
|
52165
|
+
path.setAttribute("fill", "#924FE8");
|
|
52166
|
+
svg.appendChild(path);
|
|
52167
|
+
|
|
52168
|
+
linkContainer.appendChild(svg);
|
|
52169
|
+
};
|
|
52170
|
+
});
|
|
52171
|
+
});
|
|
52172
|
+
`;
|
|
52173
|
+
|
|
52174
|
+
// src/public/index.css
|
|
52175
|
+
var public_default = `@import "https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap";
|
|
52176
|
+
@import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap";
|
|
52177
|
+
|
|
52178
|
+
/* ../src/index.css */
|
|
52179
|
+
:root {
|
|
52180
|
+
--background-surface-default: rgb(255, 255, 255);
|
|
52181
|
+
--background-button-secondary: rgb(255, 255, 255);
|
|
52182
|
+
--background-button-secondary-hover: rgb(247, 247, 248);
|
|
52183
|
+
--background-badge-purple-disabled: rgb(247, 241, 253);
|
|
52184
|
+
--background-badge-gray: rgb(233, 234, 236);
|
|
52185
|
+
--background-accent-purple: rgb(146, 79, 232);
|
|
52186
|
+
--border-action-normal: rgb(222, 223, 227);
|
|
52187
|
+
--border-action-focus: rgb(146, 79, 232);
|
|
52188
|
+
--border-select-primary: rgb(146, 79, 232);
|
|
52189
|
+
--text-base-primary: rgb(20, 21, 26);
|
|
52190
|
+
--text-base-secondary: rgba(15, 19, 36, 0.6);
|
|
52191
|
+
--text-base-quaternary: rgb(10, 15, 41, 0.25);
|
|
52192
|
+
--text-accent-purple: rgb(152, 89, 233);
|
|
52193
|
+
--icon-base-primary: rgb(20, 21, 26);
|
|
52194
|
+
--icon-base-secondary: rgb(105, 107, 118);
|
|
52195
|
+
--icon-accent-purple: rgb(146, 79, 232);
|
|
52196
|
+
--absolute-position-panel-padding: 12px;
|
|
52197
|
+
}
|
|
52198
|
+
* {
|
|
52199
|
+
box-sizing: border-box;
|
|
52200
|
+
padding: 0;
|
|
52201
|
+
margin: 0;
|
|
52202
|
+
border: none;
|
|
52203
|
+
background: none;
|
|
52204
|
+
font-family: inherit;
|
|
52205
|
+
}
|
|
52206
|
+
html {
|
|
52207
|
+
font-size: 62.5%;
|
|
52208
|
+
}
|
|
52209
|
+
body {
|
|
52210
|
+
color: var(--text-base-primary);
|
|
52211
|
+
font-size: 1.6rem;
|
|
52212
|
+
font-optical-sizing: auto;
|
|
52213
|
+
font-style: normal;
|
|
52214
|
+
font-family: "Manrope", sans-serif;
|
|
52215
|
+
}
|
|
52216
|
+
html,
|
|
52217
|
+
body {
|
|
52218
|
+
overscroll-behavior-x: none;
|
|
52219
|
+
-webkit-user-select: none;
|
|
52220
|
+
}
|
|
52221
|
+
input:-webkit-autofill,
|
|
52222
|
+
input:-webkit-autofill:hover,
|
|
52223
|
+
input:-webkit-autofill:focus,
|
|
52224
|
+
input:-webkit-autofill:active {
|
|
52225
|
+
-webkit-box-shadow: 0 0 0 30px white inset !important;
|
|
52226
|
+
}
|
|
52227
|
+
`;
|
|
52228
|
+
|
|
51781
52229
|
// src/Board.ts
|
|
51782
52230
|
class Board {
|
|
51783
52231
|
boardId;
|
|
@@ -52160,9 +52608,9 @@ class Board {
|
|
|
52160
52608
|
return this.copy();
|
|
52161
52609
|
}
|
|
52162
52610
|
serializeHTML() {
|
|
52163
|
-
const customTagsScript =
|
|
52164
|
-
const loadLinksImagesScript =
|
|
52165
|
-
const css =
|
|
52611
|
+
const customTagsScript = customWebComponents_default;
|
|
52612
|
+
const loadLinksImagesScript = loadLinkImages_default;
|
|
52613
|
+
const css = public_default;
|
|
52166
52614
|
const boardName = this.getName() || this.getBoardId();
|
|
52167
52615
|
const items = this.items.getWholeHTML(conf.documentFactory);
|
|
52168
52616
|
const itemsDiv = `<div id="items">${items}</div>`;
|
|
@@ -52575,7 +53023,7 @@ class Board {
|
|
|
52575
53023
|
}
|
|
52576
53024
|
removeVoidComments() {
|
|
52577
53025
|
const voidComments = this.items.listAll().filter((item) => {
|
|
52578
|
-
return item instanceof
|
|
53026
|
+
return item instanceof Comment && !item.getThread().length;
|
|
52579
53027
|
});
|
|
52580
53028
|
if (voidComments) {
|
|
52581
53029
|
for (const comment2 of voidComments) {
|
|
@@ -55335,7 +55783,7 @@ export {
|
|
|
55335
55783
|
ConnectorData2 as ConnectorData,
|
|
55336
55784
|
Connector2 as Connector,
|
|
55337
55785
|
ConnectionLineWidths,
|
|
55338
|
-
|
|
55786
|
+
Comment,
|
|
55339
55787
|
Camera,
|
|
55340
55788
|
CURSORS_IDLE_CLEANUP_DELAY,
|
|
55341
55789
|
CURSORS_ANIMATION_DURATION,
|