@plait/mind 0.70.0 → 0.72.0
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/constants/default.d.ts +0 -1
- package/esm2022/constants/default.mjs +1 -2
- package/esm2022/interfaces/element.mjs +1 -1
- package/esm2022/mind-node.component.mjs +5 -7
- package/esm2022/plugins/with-mind-fragment.mjs +8 -12
- package/esm2022/plugins/with-mind.mjs +6 -6
- package/esm2022/utils/draw/node-link/abstract-link.mjs +9 -3
- package/esm2022/utils/draw/node-link/draw-link.mjs +4 -4
- package/esm2022/utils/draw/node-link/indented-link.mjs +10 -7
- package/esm2022/utils/draw/node-link/logic-link.mjs +18 -8
- package/esm2022/utils/draw/node-shape.mjs +8 -4
- package/esm2022/utils/mind.mjs +1 -1
- package/esm2022/utils/node/create-node.mjs +2 -1
- package/esm2022/utils/node-style/branch.mjs +7 -7
- package/esm2022/utils/node-style/shape.mjs +6 -2
- package/fesm2022/plait-mind.mjs +63 -48
- package/fesm2022/plait-mind.mjs.map +1 -1
- package/interfaces/element.d.ts +2 -0
- package/package.json +1 -1
- package/utils/draw/node-link/draw-link.d.ts +2 -1
- package/utils/draw/node-link/indented-link.d.ts +2 -1
- package/utils/draw/node-link/logic-link.d.ts +2 -1
- package/utils/node/create-node.d.ts +1 -0
- package/utils/node-style/branch.d.ts +2 -2
- package/utils/node-style/shape.d.ts +3 -1
package/fesm2022/plait-mind.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DefaultThemeColor, DEFAULT_COLOR, ColorfulThemeColor, SoftThemeColor, RetroThemeColor, DarkThemeColor, StarryThemeColor, PlaitElement, PlaitNode, Path, isNullOrUndefined, PlaitBoard, getSelectedElements, idCreator, Transforms, clearSelectedElement, addSelectedElement, distanceBetweenPointAndRectangle, RectangleClient, setDragging, depthFirstRecursion, getIsRecursionFunc, drawRoundRectangle, drawLinearPath, drawBezierPath, createG, createForeignObject, updateForeignObject, getRectangleByElements,
|
|
1
|
+
import { DefaultThemeColor, DEFAULT_COLOR, ColorfulThemeColor, SoftThemeColor, RetroThemeColor, DarkThemeColor, StarryThemeColor, PlaitElement, PlaitNode, Path, isNullOrUndefined, PlaitBoard, getSelectedElements, idCreator, Transforms, clearSelectedElement, addSelectedElement, distanceBetweenPointAndRectangle, RectangleClient, setDragging, depthFirstRecursion, getIsRecursionFunc, drawRoundRectangle, drawLinearPath, drawBezierPath, setStrokeLinecap, createG, createForeignObject, updateForeignObject, getRectangleByElements, ACTIVE_STROKE_WIDTH, SELECTION_RECTANGLE_CLASS_NAME, NODE_TO_PARENT, removeSelectedElement, PlaitHistoryBoard, createText, PlaitPointerType, NODE_TO_INDEX, isMainPointer, toViewBoxPoint, toHostPoint, getHitElementByPoint, distanceBetweenPointAndPoint, isDragging, CoreTransforms, BOARD_TO_HOST, BoardTransforms, throttleRAF, isContextmenu, temporaryDisableSelection, hotkeys, createClipboardContext, WritableClipboardType, ResizeCursorClass, Point, WritableClipboardOperationType, addOrCreateClipboardContext } from '@plait/core';
|
|
2
2
|
import { MindLayoutType, AbstractNode, isIndentedLayout, isHorizontalLayout, isHorizontalLogicLayout, ConnectingPosition, getNonAbstractChildren, isStandardLayout, isLeftLayout, isRightLayout, isVerticalLogicLayout, isTopLayout, isBottomLayout, getCorrectStartEnd, getAbstractLayout, GlobalLayout } from '@plait/layouts';
|
|
3
|
-
import { getFirstTextManage, buildText, getFirstTextEditor, RESIZE_HANDLE_DIAMETER, getRectangleResizeHandleRefs, addElementOfFocusedImage, ImageGenerator, removeElementOfFocusedImage, Generator, PropertyTransforms, CommonElementFlavour, WithTextPluginKey, TextManage, isDrawingMode, isDndMode, setCreationMode, BoardCreationMode, isExpandHotkey, isTabHotkey, isEnterHotkey, isVirtualKey, isDelete, isSpaceHotkey, getElementOfFocusedImage, acceptImageTypes, buildImage, withResize, measureElement, getElementsText } from '@plait/common';
|
|
3
|
+
import { StrokeStyle, getFirstTextManage, buildText, getFirstTextEditor, RESIZE_HANDLE_DIAMETER, getRectangleResizeHandleRefs, addElementOfFocusedImage, ImageGenerator, removeElementOfFocusedImage, getStrokeLineDash, Generator, PropertyTransforms, CommonElementFlavour, WithTextPluginKey, TextManage, isDrawingMode, isDndMode, setCreationMode, BoardCreationMode, isExpandHotkey, isTabHotkey, isEnterHotkey, isVirtualKey, isDelete, isSpaceHotkey, getElementOfFocusedImage, acceptImageTypes, buildImage, withResize, measureElement, getElementsText } from '@plait/common';
|
|
4
4
|
import { TEXT_DEFAULT_HEIGHT, PlaitMarkEditor, MarkTypes, DEFAULT_FONT_SIZE } from '@plait/text-plugins';
|
|
5
5
|
import { Node as Node$1, Path as Path$1 } from 'slate';
|
|
6
6
|
import { pointsOnBezierCurves } from 'points-on-curve';
|
|
@@ -180,7 +180,6 @@ const BASE = 4;
|
|
|
180
180
|
const PRIMARY_COLOR = '#6698FF';
|
|
181
181
|
const GRAY_COLOR = '#AAAAAA';
|
|
182
182
|
const STROKE_WIDTH = 3;
|
|
183
|
-
const BRANCH_WIDTH = 3;
|
|
184
183
|
const EXTEND_OFFSET = 8;
|
|
185
184
|
const EXTEND_DIAMETER = 16;
|
|
186
185
|
const QUICK_INSERT_CIRCLE_OFFSET = 9;
|
|
@@ -402,7 +401,7 @@ const getBranchColorByMindElement = (board, element) => {
|
|
|
402
401
|
if (AbstractNode.isAbstract(element) || isChildOfAbstract(board, element)) {
|
|
403
402
|
return getAbstractBranchColor(board, element);
|
|
404
403
|
}
|
|
405
|
-
const branchColor = getAvailableProperty(board, element, 'branchColor');
|
|
404
|
+
const branchColor = getAvailableProperty(board, element, 'branchColor') || getAvailableProperty(board, element, 'strokeColor');
|
|
406
405
|
return branchColor || getDefaultBranchColor(board, element);
|
|
407
406
|
};
|
|
408
407
|
const getBranchShapeByMindElement = (board, element) => {
|
|
@@ -410,8 +409,8 @@ const getBranchShapeByMindElement = (board, element) => {
|
|
|
410
409
|
return branchShape || BranchShape.bight;
|
|
411
410
|
};
|
|
412
411
|
const getBranchWidthByMindElement = (board, element) => {
|
|
413
|
-
const branchWidth = getAvailableProperty(board, element, 'branchWidth');
|
|
414
|
-
return branchWidth ||
|
|
412
|
+
const branchWidth = getAvailableProperty(board, element, 'branchWidth') || getAvailableProperty(board, element, 'strokeWidth');
|
|
413
|
+
return branchWidth || STROKE_WIDTH;
|
|
415
414
|
};
|
|
416
415
|
const getAbstractBranchWidth = (board, element) => {
|
|
417
416
|
if (!isNullOrUndefined(element.branchWidth)) {
|
|
@@ -420,8 +419,8 @@ const getAbstractBranchWidth = (board, element) => {
|
|
|
420
419
|
return DefaultAbstractNodeStyle.branch.width;
|
|
421
420
|
};
|
|
422
421
|
const getAbstractBranchColor = (board, element) => {
|
|
423
|
-
if (element.branchColor) {
|
|
424
|
-
return element.branchColor;
|
|
422
|
+
if (element.branchColor || element.strokeColor) {
|
|
423
|
+
return element.branchColor || element.strokeColor;
|
|
425
424
|
}
|
|
426
425
|
return DefaultAbstractNodeStyle.branch.color;
|
|
427
426
|
};
|
|
@@ -450,7 +449,7 @@ const getMindThemeColor = (board) => {
|
|
|
450
449
|
}
|
|
451
450
|
};
|
|
452
451
|
|
|
453
|
-
const
|
|
452
|
+
const getStrokeColorByElement = (board, element) => {
|
|
454
453
|
if (PlaitMind.isMind(element)) {
|
|
455
454
|
const defaultRootStroke = getMindThemeColor(board).rootFill;
|
|
456
455
|
return element.strokeColor || defaultRootStroke;
|
|
@@ -460,6 +459,9 @@ const getStrokeByMindElement = (board, element) => {
|
|
|
460
459
|
}
|
|
461
460
|
return getAvailableProperty(board, element, 'strokeColor') || getDefaultBranchColor(board, element);
|
|
462
461
|
};
|
|
462
|
+
const getStrokeStyleByElement = (board, element) => {
|
|
463
|
+
return element.strokeStyle || StrokeStyle.solid;
|
|
464
|
+
};
|
|
463
465
|
const getStrokeWidthByElement = (board, element) => {
|
|
464
466
|
const strokeWidth = element.strokeWidth ||
|
|
465
467
|
(AbstractNode.isAbstract(element) ? DefaultAbstractNodeStyle.shape.strokeWidth : DefaultNodeStyle.shape.strokeWidth);
|
|
@@ -710,6 +712,7 @@ const INHERIT_ATTRIBUTE_KEYS = [
|
|
|
710
712
|
'fill',
|
|
711
713
|
'strokeColor',
|
|
712
714
|
'strokeWidth',
|
|
715
|
+
'strokeStyle',
|
|
713
716
|
'shape',
|
|
714
717
|
'layout',
|
|
715
718
|
'branchColor',
|
|
@@ -1328,14 +1331,17 @@ function drawRoundRectangleByNode(board, node) {
|
|
|
1328
1331
|
}
|
|
1329
1332
|
function drawRoundRectangleByElement(board, nodeRectangle, element) {
|
|
1330
1333
|
const fill = getFillByElement(board, element);
|
|
1331
|
-
const stroke =
|
|
1334
|
+
const stroke = getStrokeColorByElement(board, element);
|
|
1332
1335
|
const strokeWidth = getStrokeWidthByElement(board, element);
|
|
1336
|
+
const strokeStyle = getStrokeStyleByElement(board, element);
|
|
1337
|
+
const strokeLineDash = getStrokeLineDash(strokeStyle, strokeWidth);
|
|
1333
1338
|
const newNodeRectangle = RectangleClient.inflate(nodeRectangle, -strokeWidth);
|
|
1334
1339
|
const nodeG = drawRoundRectangle(PlaitBoard.getRoughSVG(board), newNodeRectangle.x, newNodeRectangle.y, newNodeRectangle.x + newNodeRectangle.width, newNodeRectangle.y + newNodeRectangle.height, {
|
|
1335
1340
|
stroke,
|
|
1336
1341
|
strokeWidth,
|
|
1337
1342
|
fill,
|
|
1338
|
-
fillStyle: 'solid'
|
|
1343
|
+
fillStyle: 'solid',
|
|
1344
|
+
strokeLineDash
|
|
1339
1345
|
}, false, DefaultNodeStyle.shape.rectangleRadius);
|
|
1340
1346
|
return nodeG;
|
|
1341
1347
|
}
|
|
@@ -1475,10 +1481,11 @@ const transformPlacement = (placement, direction) => {
|
|
|
1475
1481
|
}
|
|
1476
1482
|
};
|
|
1477
1483
|
|
|
1478
|
-
function drawIndentedLink(board, parent, child,
|
|
1484
|
+
function drawIndentedLink(board, parent, child, needDrawUnderline = true, defaultStrokeColor = null, defaultStrokeWidth, defaultStrokeStyle) {
|
|
1479
1485
|
const branchShape = getBranchShapeByMindElement(board, parent.origin);
|
|
1480
|
-
const branchWidth = defaultStrokeWidth || getBranchWidthByMindElement(board,
|
|
1481
|
-
const branchColor =
|
|
1486
|
+
const branchWidth = defaultStrokeWidth || getBranchWidthByMindElement(board, child.origin);
|
|
1487
|
+
const branchColor = defaultStrokeColor || getBranchColorByMindElement(board, child.origin);
|
|
1488
|
+
const strokeStyle = defaultStrokeStyle || getStrokeStyleByElement(board, child.origin);
|
|
1482
1489
|
const isUnderlineShape = getShapeByElement(board, child.origin) === MindElementShape.underline;
|
|
1483
1490
|
let beginX, beginY, endX, endY, beginNode = parent, endNode = child;
|
|
1484
1491
|
const beginRectangle = getRectangleByNode(beginNode);
|
|
@@ -1500,6 +1507,7 @@ function drawIndentedLink(board, parent, child, defaultStroke = null, needDrawUn
|
|
|
1500
1507
|
isUnderlineShape && needDrawUnderline ? [endX + (endNode.width - endNode.hGap * 2) * plusMinus[0], endY] : [endX, endY],
|
|
1501
1508
|
isUnderlineShape && needDrawUnderline ? [endX + (endNode.width - endNode.hGap * 2) * plusMinus[0], endY] : [endX, endY]
|
|
1502
1509
|
];
|
|
1510
|
+
const strokeLineDash = getStrokeLineDash(strokeStyle, branchWidth);
|
|
1503
1511
|
if (branchShape === BranchShape.polyline) {
|
|
1504
1512
|
const polylinePoints = [
|
|
1505
1513
|
[beginX, beginY],
|
|
@@ -1507,16 +1515,17 @@ function drawIndentedLink(board, parent, child, defaultStroke = null, needDrawUn
|
|
|
1507
1515
|
[endX, endY],
|
|
1508
1516
|
isUnderlineShape && needDrawUnderline ? [endX + (endNode.width - endNode.hGap * 2) * plusMinus[0], endY] : [endX, endY]
|
|
1509
1517
|
];
|
|
1510
|
-
return drawLinearPath(polylinePoints, { stroke: branchColor, strokeWidth: branchWidth });
|
|
1518
|
+
return drawLinearPath(polylinePoints, { stroke: branchColor, strokeWidth: branchWidth, strokeLineDash });
|
|
1511
1519
|
}
|
|
1512
1520
|
const points = pointsOnBezierCurves(curve, 0.001);
|
|
1513
|
-
return drawBezierPath(points, { stroke: branchColor, strokeWidth: branchWidth });
|
|
1521
|
+
return drawBezierPath(points, { stroke: branchColor, strokeWidth: branchWidth, strokeLineDash });
|
|
1514
1522
|
}
|
|
1515
1523
|
|
|
1516
|
-
function drawLogicLink(board, parent, node, isHorizontal,
|
|
1524
|
+
function drawLogicLink(board, parent, node, isHorizontal, defaultStrokeColor = null, defaultStrokeWidth, defaultStrokeStyle) {
|
|
1517
1525
|
const branchShape = getBranchShapeByMindElement(board, parent.origin);
|
|
1518
|
-
const branchColor =
|
|
1519
|
-
const branchWidth = defaultStrokeWidth || getBranchWidthByMindElement(board,
|
|
1526
|
+
const branchColor = defaultStrokeColor || getBranchColorByMindElement(board, node.origin);
|
|
1527
|
+
const branchWidth = defaultStrokeWidth || getBranchWidthByMindElement(board, node.origin);
|
|
1528
|
+
const strokeStyle = defaultStrokeStyle || getStrokeStyleByElement(board, node.origin);
|
|
1520
1529
|
const hasStraightLine = branchShape === BranchShape.polyline ? true : !parent.origin.isRoot;
|
|
1521
1530
|
const parentShape = getShapeByElement(board, parent.origin);
|
|
1522
1531
|
const shape = getShapeByElement(board, node.origin);
|
|
@@ -1557,6 +1566,8 @@ function drawLogicLink(board, parent, node, isHorizontal, defaultStroke = null,
|
|
|
1557
1566
|
const underlineEnd = moveXOfPoint(endPoint, nodeClient.width, linkDirection);
|
|
1558
1567
|
const underline = hasUnderlineShape && isHorizontal ? [underlineEnd, underlineEnd, underlineEnd] : [];
|
|
1559
1568
|
const points = pointsOnBezierCurves([...straightLine, ...curve, ...underline]);
|
|
1569
|
+
const strokeLineDash = getStrokeLineDash(strokeStyle, branchWidth);
|
|
1570
|
+
let linkG;
|
|
1560
1571
|
if (branchShape === BranchShape.polyline) {
|
|
1561
1572
|
const buffer = 8;
|
|
1562
1573
|
const movePoint = moveXOfPoint(beginPoint2, buffer, linkDirection);
|
|
@@ -1567,15 +1578,21 @@ function drawLogicLink(board, parent, node, isHorizontal, defaultStroke = null,
|
|
|
1567
1578
|
endPoint,
|
|
1568
1579
|
...underline
|
|
1569
1580
|
];
|
|
1570
|
-
|
|
1581
|
+
linkG = drawLinearPath(polylinePoints, { stroke: branchColor, strokeWidth: branchWidth, strokeLineDash });
|
|
1582
|
+
}
|
|
1583
|
+
else {
|
|
1584
|
+
linkG = PlaitBoard.getRoughSVG(board).curve(points, { stroke: branchColor, strokeWidth: branchWidth, strokeLineDash });
|
|
1585
|
+
}
|
|
1586
|
+
if (strokeStyle === StrokeStyle.dotted) {
|
|
1587
|
+
setStrokeLinecap(linkG, 'round');
|
|
1571
1588
|
}
|
|
1572
|
-
return
|
|
1589
|
+
return linkG;
|
|
1573
1590
|
}
|
|
1574
1591
|
|
|
1575
|
-
function drawLink(board, parentNode, node, isHorizontal, needDrawUnderline,
|
|
1592
|
+
function drawLink(board, parentNode, node, isHorizontal, needDrawUnderline, defaultStrokeColor, defaultStrokeWidth, defaultStrokeStyle) {
|
|
1576
1593
|
return MindElement.isIndentedLayout(parentNode.origin)
|
|
1577
|
-
? drawIndentedLink(board, parentNode, node,
|
|
1578
|
-
: drawLogicLink(board, parentNode, node, isHorizontal,
|
|
1594
|
+
? drawIndentedLink(board, parentNode, node, needDrawUnderline, defaultStrokeColor, defaultStrokeWidth, defaultStrokeStyle)
|
|
1595
|
+
: drawLogicLink(board, parentNode, node, isHorizontal, defaultStrokeColor, defaultStrokeWidth, defaultStrokeStyle);
|
|
1579
1596
|
}
|
|
1580
1597
|
|
|
1581
1598
|
const FOREIGN_OBJECT_EMOJI_CLASS_NAME = 'foreign-object-emoji';
|
|
@@ -2381,6 +2398,7 @@ function drawAbstractLink(board, node, isHorizontal) {
|
|
|
2381
2398
|
const linkPadding = 15;
|
|
2382
2399
|
const branchWidth = getAbstractBranchWidth(board, node.origin);
|
|
2383
2400
|
const branchColor = getAbstractBranchColor(board, node.origin);
|
|
2401
|
+
const strokeStyle = getStrokeStyleByElement(board, node.origin);
|
|
2384
2402
|
const parent = node.parent;
|
|
2385
2403
|
const branchShape = getBranchShapeByMindElement(board, node.origin);
|
|
2386
2404
|
const abstractRectangle = getRectangleByNode(node);
|
|
@@ -2404,6 +2422,7 @@ function drawAbstractLink(board, node, isHorizontal) {
|
|
|
2404
2422
|
bezierEndPoint = moveXOfPoint(bezierEndPoint, linkPadding, linkDirection);
|
|
2405
2423
|
let c2 = moveXOfPoint(bezierEndPoint, curveDistance, linkDirection);
|
|
2406
2424
|
let bezierConnectorPoint = moveXOfPoint(abstractConnectorPoint, -linkPadding, linkDirection);
|
|
2425
|
+
const strokeLineDash = getStrokeLineDash(strokeStyle, branchWidth);
|
|
2407
2426
|
if (branchShape === BranchShape.polyline) {
|
|
2408
2427
|
const g = createG();
|
|
2409
2428
|
const polyline = drawLinearPath([bezierBeginPoint, c1, bezierConnectorPoint, c2, bezierEndPoint], {
|
|
@@ -2412,7 +2431,8 @@ function drawAbstractLink(board, node, isHorizontal) {
|
|
|
2412
2431
|
});
|
|
2413
2432
|
const straightLine = drawLinearPath([abstractConnectorPoint, bezierConnectorPoint], {
|
|
2414
2433
|
stroke: branchColor,
|
|
2415
|
-
strokeWidth: branchWidth
|
|
2434
|
+
strokeWidth: branchWidth,
|
|
2435
|
+
strokeLineDash
|
|
2416
2436
|
});
|
|
2417
2437
|
g.appendChild(polyline);
|
|
2418
2438
|
g.appendChild(straightLine);
|
|
@@ -2420,7 +2440,8 @@ function drawAbstractLink(board, node, isHorizontal) {
|
|
|
2420
2440
|
}
|
|
2421
2441
|
const link = PlaitBoard.getRoughSVG(board).path(`M${bezierBeginPoint[0]},${bezierBeginPoint[1]} Q${c1[0]},${c1[1]} ${bezierConnectorPoint[0]},${bezierConnectorPoint[1]} Q${c2[0]},${c2[1]} ${bezierEndPoint[0]},${bezierEndPoint[1]} M${abstractConnectorPoint[0]},${abstractConnectorPoint[1]} L${bezierConnectorPoint[0]},${bezierConnectorPoint[1]}`, {
|
|
2422
2442
|
stroke: branchColor,
|
|
2423
|
-
strokeWidth: branchWidth
|
|
2443
|
+
strokeWidth: branchWidth,
|
|
2444
|
+
strokeLineDash
|
|
2424
2445
|
});
|
|
2425
2446
|
return link;
|
|
2426
2447
|
}
|
|
@@ -2912,7 +2933,7 @@ class NodeShapeGenerator extends Generator {
|
|
|
2912
2933
|
|
|
2913
2934
|
class MindNodeComponent extends CommonElementFlavour {
|
|
2914
2935
|
get textManage() {
|
|
2915
|
-
return this.getTextManages()[0];
|
|
2936
|
+
return this.getRef().getTextManages()[0];
|
|
2916
2937
|
}
|
|
2917
2938
|
constructor() {
|
|
2918
2939
|
super();
|
|
@@ -2961,10 +2982,10 @@ class MindNodeComponent extends CommonElementFlavour {
|
|
|
2961
2982
|
},
|
|
2962
2983
|
textPlugins: plugins || []
|
|
2963
2984
|
});
|
|
2964
|
-
this.initializeTextManages([textManage]);
|
|
2965
2985
|
this.getRef().addGenerator(NodeActiveGenerator.key, this.activeGenerator);
|
|
2966
2986
|
this.getRef().addGenerator(NodeEmojisGenerator.key, this.nodeEmojisGenerator);
|
|
2967
2987
|
this.getRef().addGenerator(ImageGenerator.key, this.imageGenerator);
|
|
2988
|
+
this.getRef().initializeTextManage(textManage);
|
|
2968
2989
|
}
|
|
2969
2990
|
initialize() {
|
|
2970
2991
|
super.initialize();
|
|
@@ -2986,12 +3007,10 @@ class MindNodeComponent extends CommonElementFlavour {
|
|
|
2986
3007
|
}
|
|
2987
3008
|
}
|
|
2988
3009
|
onContextChanged(value, previous) {
|
|
2989
|
-
this.initializeWeakMap();
|
|
2990
3010
|
const newNode = MindElement.getNode(value.element);
|
|
2991
3011
|
const isEqualNode = RectangleClient.isEqual(this.node, newNode);
|
|
2992
3012
|
this.node = newNode;
|
|
2993
|
-
|
|
2994
|
-
if (!isEqualNode || value.element !== previous.element || isChangeTheme) {
|
|
3013
|
+
if (!isEqualNode || value.element !== previous.element || value.hasThemeChanged) {
|
|
2995
3014
|
this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), {
|
|
2996
3015
|
selected: this.selected
|
|
2997
3016
|
});
|
|
@@ -3078,7 +3097,7 @@ class MindNodeComponent extends CommonElementFlavour {
|
|
|
3078
3097
|
if (ELEMENT_TO_NODE.get(this.element) === this.node) {
|
|
3079
3098
|
ELEMENT_TO_NODE.delete(this.element);
|
|
3080
3099
|
}
|
|
3081
|
-
this.
|
|
3100
|
+
this.getRef().destroyTextManage();
|
|
3082
3101
|
}
|
|
3083
3102
|
}
|
|
3084
3103
|
|
|
@@ -3948,16 +3967,12 @@ const withMindFragment = (baseBoard) => {
|
|
|
3948
3967
|
if (firstLevelElements.length) {
|
|
3949
3968
|
const elements = buildClipboardData(board, firstLevelElements, rectangle ? [rectangle.x, rectangle.y] : [0, 0]);
|
|
3950
3969
|
const text = getElementsText(targetMindElements);
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
type: WritableClipboardType.elements,
|
|
3958
|
-
elements
|
|
3959
|
-
});
|
|
3960
|
-
}
|
|
3970
|
+
const addition = {
|
|
3971
|
+
text,
|
|
3972
|
+
type: WritableClipboardType.elements,
|
|
3973
|
+
elements: elements
|
|
3974
|
+
};
|
|
3975
|
+
clipboardContext = addOrCreateClipboardContext(clipboardContext, addition);
|
|
3961
3976
|
}
|
|
3962
3977
|
return buildFragment(clipboardContext, rectangle, operationType, originData);
|
|
3963
3978
|
};
|
|
@@ -4020,7 +4035,7 @@ const withEmoji = (board) => {
|
|
|
4020
4035
|
|
|
4021
4036
|
const withMind = (baseBoard) => {
|
|
4022
4037
|
const board = baseBoard;
|
|
4023
|
-
const { drawElement, dblClick, isRectangleHit, isHit, getRectangle, isMovable, isRecursion, isAlign, isImageBindingAllowed, canAddToGroup, canSetZIndex, isExpanded,
|
|
4038
|
+
const { drawElement, dblClick, isRectangleHit, isHit, getRectangle, isMovable, isRecursion, isAlign, isImageBindingAllowed, canAddToGroup, canSetZIndex, isExpanded, getOneHitElement } = board;
|
|
4024
4039
|
board.drawElement = (context) => {
|
|
4025
4040
|
if (PlaitMind.isMind(context.element)) {
|
|
4026
4041
|
return PlaitMindComponent;
|
|
@@ -4081,12 +4096,12 @@ const withMind = (baseBoard) => {
|
|
|
4081
4096
|
}
|
|
4082
4097
|
return isHit(element, point);
|
|
4083
4098
|
};
|
|
4084
|
-
board.
|
|
4085
|
-
const
|
|
4086
|
-
if (
|
|
4099
|
+
board.getOneHitElement = elements => {
|
|
4100
|
+
const isAllMindElements = elements.every(item => MindElement.isMindElement(board, item));
|
|
4101
|
+
if (isAllMindElements) {
|
|
4087
4102
|
return elements[0];
|
|
4088
4103
|
}
|
|
4089
|
-
return
|
|
4104
|
+
return getOneHitElement(elements);
|
|
4090
4105
|
};
|
|
4091
4106
|
board.isMovable = element => {
|
|
4092
4107
|
if (PlaitMind.isMind(element) && element.isRoot) {
|
|
@@ -4149,5 +4164,5 @@ class MindEmojiBaseComponent {
|
|
|
4149
4164
|
* Generated bundle index. Do not edit.
|
|
4150
4165
|
*/
|
|
4151
4166
|
|
|
4152
|
-
export { ABSTRACT_HANDLE_COLOR, ABSTRACT_HANDLE_LENGTH, ABSTRACT_HANDLE_MASK_WIDTH, ABSTRACT_INCLUDED_OUTLINE_OFFSET, AbstractHandlePosition, AbstractResizeState, BASE, BRANCH_FONT_FAMILY,
|
|
4167
|
+
export { ABSTRACT_HANDLE_COLOR, ABSTRACT_HANDLE_LENGTH, ABSTRACT_HANDLE_MASK_WIDTH, ABSTRACT_INCLUDED_OUTLINE_OFFSET, AbstractHandlePosition, AbstractResizeState, BASE, BRANCH_FONT_FAMILY, BranchShape, DEFAULT_FONT_FAMILY, DEFAULT_MIND_IMAGE_WIDTH, DefaultAbstractNodeStyle, DefaultNodeStyle, ELEMENT_TO_NODE, EXTEND_DIAMETER, EXTEND_OFFSET, GRAY_COLOR, INHERIT_ATTRIBUTE_KEYS, LayoutDirection, LayoutDirectionsMap, MindColorfulThemeColor, MindDarkThemeColor, MindDefaultThemeColor, MindElement, MindElementShape, MindEmojiBaseComponent, MindNode, MindNodeComponent, MindPointerType, MindQueries, MindRetroThemeColor, MindSoftThemeColor, MindStarryThemeColor, MindThemeColor, MindThemeColors, MindTransforms, NodeSpace, NodeTopicThreshold, PRIMARY_COLOR, PlaitMind, PlaitMindComponent, QUICK_INSERT_CIRCLE_COLOR, QUICK_INSERT_CIRCLE_OFFSET, QUICK_INSERT_INNER_CROSS_COLOR, ROOT_TOPIC_FONT_SIZE, ROOT_TOPIC_HEIGHT, ROOT_TOPIC_WIDTH, STROKE_WIDTH, TOPIC_DEFAULT_MAX_WORD_COUNT, TOPIC_FONT_SIZE, WithMindPluginKey, addActiveOnDragOrigin, addImageFocus, adjustAbstractToNode, adjustNodeToRoot, adjustRootToNode, canSetAbstract, copyNewNode, correctLayoutByDirection, createDefaultMind, createEmptyMind, createMindElement, deleteElementHandleAbstract, deleteElementsHandleRightNodeCount, detectDropTarget, directionCorrector, directionDetector, divideElementByParent, drawFakeDragNode, drawFakeDropNode, editTopic, findLastChild, findLocationLeftIndex, findNewChildNodePath, findNewSiblingNodePath, getAbstractBranchColor, getAbstractBranchWidth, getAbstractHandleRectangle, getAllowedDirection, getAvailableSubLayoutsByLayoutDirections, getBehindAbstracts, getBranchColorByMindElement, getBranchDirectionsByLayouts, getBranchShapeByMindElement, getBranchWidthByMindElement, getChildrenCount, getCorrespondingAbstract, getDefaultBranchColor, getDefaultBranchColorByIndex, getDefaultLayout, getDefaultMindElementFontSize, getEmojiFontSize, getEmojiForeignRectangle, getEmojiRectangle, getEmojisWidthHeight, getFillByElement, getFirstLevelElement, getFontSizeBySlateElement, getHitAbstractHandle, getHitImageResizeHandleDirection, getImageForeignRectangle, getInCorrectLayoutDirection, getLayoutDirection$1 as getLayoutDirection, getLayoutOptions, getLayoutReverseDirection, getLocationScope, getMindThemeColor, getNewNodeHeight, getNextBranchColor, getOverallAbstracts, getPathByDropTarget, getRectangleByElement, getRectangleByNode, getRectangleByResizingLocation, getRelativeStartEndByAbstractRef, getRootLayout, getSelectedMindElements, getShapeByElement, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getTopicRectangleByElement, getTopicRectangleByNode, getValidAbstractRefs, handleTouchedAbstract, hasPreviousOrNextOfDropPath, insertElementHandleAbstract, insertElementHandleRightNodeCount, insertMindElement, isChildElement, isChildOfAbstract, isChildRight, isChildUp, isCorrectLayout, isDropStandardRight, isHitEmojis, isHitImage, isHitMindElement, isInRightBranchOfStandardLayout, isMixedLayout, isSetAbstract, isValidTarget, removeActiveOnDragOrigin, removeImageFocus, separateChildren, setMindDragging, withEmoji, withMind, withMindExtend };
|
|
4153
4168
|
//# sourceMappingURL=plait-mind.mjs.map
|