@plait/mind 0.84.0 → 0.86.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/node-topic-style.d.ts +0 -3
- package/fesm2022/plait-mind.mjs +91 -183
- package/fesm2022/plait-mind.mjs.map +1 -1
- package/interfaces/element.d.ts +9 -9
- package/package.json +1 -1
- package/styles/styles.scss +1 -12
- package/transforms/index.d.ts +2 -3
- package/transforms/node.d.ts +2 -3
- package/utils/clipboard.d.ts +0 -4
- package/utils/common.d.ts +0 -5
- package/utils/mind.d.ts +2 -2
- package/utils/node/create-node.d.ts +1 -1
- package/utils/normalize.d.ts +0 -2
- package/utils/space/emoji.d.ts +1 -1
- package/utils/space/node-space.d.ts +2 -6
- package/utils/weak-maps.d.ts +1 -1
package/fesm2022/plait-mind.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DEFAULT_COLOR, DefaultThemeColor, ColorfulThemeColor, SoftThemeColor, RetroThemeColor, DarkThemeColor, StarryThemeColor, rgbaToHEX, PlaitElement, PlaitNode, Path, isNullOrUndefined, PlaitBoard, getSelectedElements, getI18nValue, idCreator, Transforms, clearSelectedElement, addSelectedElement, distanceBetweenPointAndRectangle, RectangleClient, setDragging, depthFirstRecursion, getIsRecursionFunc, drawRoundRectangle, drawLinearPath, drawBezierPath, setStrokeLinecap, createG, createForeignObject, updateForeignObject, getRectangleByElements, toActiveRectangleFromViewBoxRectangle, ACTIVE_STROKE_WIDTH, SELECTION_RECTANGLE_CLASS_NAME, NODE_TO_PARENT, removeSelectedElement, PlaitHistoryBoard, isSelectedElement, createText, isSelectionMoving, isDragging, isMovingElements, NODE_TO_INDEX, PlaitPointerType, isMainPointer, toViewBoxPoint, toHostPoint, getHitElementByPoint, distanceBetweenPointAndPoint, CoreTransforms, toActivePointFromViewBoxPoint, BoardTransforms, throttleRAF, isContextmenu, temporaryDisableSelection, hotkeys, createClipboardContext, WritableClipboardType, Point, ResizeCursorClass, WritableClipboardOperationType, addOrCreateClipboardContext } from '@plait/core';
|
|
2
2
|
import { MindLayoutType, AbstractNode, isIndentedLayout, isHorizontalLogicLayout, ConnectingPosition, isHorizontalLayout, getNonAbstractChildren, isStandardLayout, isLeftLayout, isRightLayout, isVerticalLogicLayout, isTopLayout, isBottomLayout, getCorrectStartEnd, getAbstractLayout, GlobalLayout } from '@plait/layouts';
|
|
3
|
-
import { StrokeStyle, getFirstTextManage,
|
|
4
|
-
import {
|
|
3
|
+
import { StrokeStyle, getFirstTextManage, buildText, getElementSize, DEFAULT_FONT_FAMILY, RESIZE_HANDLE_DIAMETER, getRectangleResizeHandleRefs, addElementOfFocusedImage, ImageGenerator, removeElementOfFocusedImage, getStrokeLineDash, getXDistanceBetweenPoint, moveXOfPoint, moveYOfPoint, Generator, PropertyTransforms, TRANSPARENT, measureElement, isResizing, CommonElementFlavour, WithTextPluginKey, TextManage, isDrawingMode, isDndMode, setCreationMode, BoardCreationMode, isExpandHotkey, isTabHotkey, isEnterHotkey, isVirtualKey, isDelete, isSpaceHotkey, getElementOfFocusedImage, acceptImageTypes, buildImage, withResize, getElementsText } from '@plait/common';
|
|
4
|
+
import { DEFAULT_FONT_SIZE, PlaitMarkEditor, MarkTypes, FontSizes } 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';
|
|
7
7
|
import { isHotkey } from 'is-hotkey';
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const MIND_ELEMENT_TO_NODE = new WeakMap();
|
|
10
10
|
|
|
11
11
|
const MindNode = {
|
|
12
12
|
get(root, path) {
|
|
@@ -478,7 +478,7 @@ const getFillByElement = (board, element) => {
|
|
|
478
478
|
return element.fill;
|
|
479
479
|
}
|
|
480
480
|
const defaultRootFill = getMindThemeColor(board).rootFill;
|
|
481
|
-
return element
|
|
481
|
+
return PlaitMind.isMind(element) ? defaultRootFill : DefaultNodeStyle.shape.fill;
|
|
482
482
|
};
|
|
483
483
|
const getShapeByElement = (board, element) => {
|
|
484
484
|
const shape = getAvailableProperty(board, element, 'shape');
|
|
@@ -602,7 +602,7 @@ const getRootLayout = (root) => {
|
|
|
602
602
|
|
|
603
603
|
const getLayoutOptions = (board) => {
|
|
604
604
|
function getMainAxle(element, parent) {
|
|
605
|
-
if (element
|
|
605
|
+
if (PlaitMind.isMind(element)) {
|
|
606
606
|
return BASE * 12;
|
|
607
607
|
}
|
|
608
608
|
if (parent && parent.isRoot()) {
|
|
@@ -611,7 +611,7 @@ const getLayoutOptions = (board) => {
|
|
|
611
611
|
return BASE * 3;
|
|
612
612
|
}
|
|
613
613
|
function getSecondAxle(element, parent) {
|
|
614
|
-
if (element
|
|
614
|
+
if (PlaitMind.isMind(element)) {
|
|
615
615
|
return BASE * 12;
|
|
616
616
|
}
|
|
617
617
|
return BASE * 8.5;
|
|
@@ -664,18 +664,6 @@ const getLayoutOptions = (board) => {
|
|
|
664
664
|
};
|
|
665
665
|
};
|
|
666
666
|
|
|
667
|
-
const TOPIC_FONT_SIZE = 14;
|
|
668
|
-
const ROOT_TOPIC_FONT_SIZE = 18;
|
|
669
|
-
const TOPIC_DEFAULT_MAX_WORD_COUNT = 34;
|
|
670
|
-
const NodeTopicThreshold = {
|
|
671
|
-
defaultTextMaxWidth: 34 * 14
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
const ABSTRACT_HANDLE_COLOR = '#6698FF80'; //primary color 50% opacity
|
|
675
|
-
const ABSTRACT_INCLUDED_OUTLINE_OFFSET = 3.5;
|
|
676
|
-
const ABSTRACT_HANDLE_LENGTH = 10;
|
|
677
|
-
const ABSTRACT_HANDLE_MASK_WIDTH = 8;
|
|
678
|
-
|
|
679
667
|
const MIND_CENTRAL_TEXT = '中心主题';
|
|
680
668
|
const ABSTRACT_NODE_TEXT = '概要';
|
|
681
669
|
const getDefaultMindNameText = (board) => {
|
|
@@ -684,40 +672,24 @@ const getDefaultMindNameText = (board) => {
|
|
|
684
672
|
const getAbstractNodeText = (board) => {
|
|
685
673
|
return getI18nValue(board, MindI18nKey.abstractNodeText, ABSTRACT_NODE_TEXT);
|
|
686
674
|
};
|
|
687
|
-
const getTopicSize = (board, isRoot, isBranch, topic, manualWidth) => {
|
|
688
|
-
let fontFamily = DEFAULT_FONT_FAMILY;
|
|
689
|
-
let fontSize = TOPIC_FONT_SIZE;
|
|
690
|
-
if (isRoot) {
|
|
691
|
-
fontFamily = DEFAULT_FONT_FAMILY;
|
|
692
|
-
fontSize = ROOT_TOPIC_FONT_SIZE;
|
|
693
|
-
}
|
|
694
|
-
else if (isBranch) {
|
|
695
|
-
fontFamily = DEFAULT_FONT_FAMILY;
|
|
696
|
-
}
|
|
697
|
-
const maxWidth = fontSize * TOPIC_DEFAULT_MAX_WORD_COUNT;
|
|
698
|
-
return measureElement(board, topic, { fontSize, fontFamily }, manualWidth ? manualWidth : maxWidth);
|
|
699
|
-
};
|
|
700
675
|
|
|
701
676
|
const createEmptyMind = (board, point) => {
|
|
702
677
|
const text = getDefaultMindNameText(board);
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
element.isRoot = true;
|
|
706
|
-
element.type = 'mindmap';
|
|
678
|
+
const element = createMindElement(text, { layout: MindLayoutType.right });
|
|
679
|
+
element.type = 'mind';
|
|
707
680
|
const width = NodeSpace.getNodeWidth(board, element);
|
|
708
681
|
const height = NodeSpace.getNodeHeight(board, element);
|
|
709
682
|
element.points = [[point[0] - width / 2, point[1] - height / 2]];
|
|
710
683
|
return element;
|
|
711
684
|
};
|
|
712
|
-
const createMindElement = (text,
|
|
685
|
+
const createMindElement = (text, options) => {
|
|
713
686
|
const newElement = {
|
|
714
687
|
id: idCreator(),
|
|
688
|
+
type: 'mind_child',
|
|
715
689
|
data: {
|
|
716
690
|
topic: buildText(text)
|
|
717
691
|
},
|
|
718
|
-
children: []
|
|
719
|
-
width,
|
|
720
|
-
height
|
|
692
|
+
children: []
|
|
721
693
|
};
|
|
722
694
|
let key;
|
|
723
695
|
for (key in options) {
|
|
@@ -739,6 +711,10 @@ const INHERIT_ATTRIBUTE_KEYS = [
|
|
|
739
711
|
'branchShape'
|
|
740
712
|
];
|
|
741
713
|
|
|
714
|
+
const TOPIC_FONT_SIZE = 14;
|
|
715
|
+
const ROOT_TOPIC_FONT_SIZE = 18;
|
|
716
|
+
const TOPIC_DEFAULT_MAX_WORD_COUNT = 34;
|
|
717
|
+
|
|
742
718
|
const getChildrenCount = (element) => {
|
|
743
719
|
const count = element.children.reduce((p, c) => {
|
|
744
720
|
return p + getChildrenCount(c);
|
|
@@ -757,8 +733,8 @@ const isChildElement = (origin, child) => {
|
|
|
757
733
|
};
|
|
758
734
|
const getFirstLevelElement = (elements) => {
|
|
759
735
|
let result = [];
|
|
760
|
-
elements.forEach(element => {
|
|
761
|
-
const isChild = elements.some(node => {
|
|
736
|
+
elements.forEach((element) => {
|
|
737
|
+
const isChild = elements.some((node) => {
|
|
762
738
|
return isChildElement(node, element);
|
|
763
739
|
});
|
|
764
740
|
if (!isChild) {
|
|
@@ -784,13 +760,13 @@ const copyNewNode = (node) => {
|
|
|
784
760
|
};
|
|
785
761
|
const insertMindElement = (board, inheritNode, path) => {
|
|
786
762
|
const newNode = {};
|
|
787
|
-
if (!inheritNode
|
|
788
|
-
INHERIT_ATTRIBUTE_KEYS.forEach(attr => {
|
|
763
|
+
if (!PlaitMind.isMind(inheritNode)) {
|
|
764
|
+
INHERIT_ATTRIBUTE_KEYS.forEach((attr) => {
|
|
789
765
|
newNode[attr] = inheritNode[attr];
|
|
790
766
|
});
|
|
791
767
|
delete newNode.layout;
|
|
792
768
|
}
|
|
793
|
-
const newElement = createMindElement('',
|
|
769
|
+
const newElement = createMindElement('', newNode);
|
|
794
770
|
Transforms.insertNode(board, newElement, path);
|
|
795
771
|
clearSelectedElement(board);
|
|
796
772
|
addSelectedElement(board, newElement);
|
|
@@ -821,16 +797,21 @@ const divideElementByParent = (elements) => {
|
|
|
821
797
|
}
|
|
822
798
|
return { parentElements, abstractIncludedGroups };
|
|
823
799
|
};
|
|
824
|
-
const
|
|
800
|
+
const getDefaultFontSizeForMindElement = (element) => {
|
|
825
801
|
if (PlaitMind.isMind(element)) {
|
|
826
802
|
return ROOT_TOPIC_FONT_SIZE;
|
|
827
803
|
}
|
|
828
|
-
if (MindElement.isMindElement(
|
|
804
|
+
if (MindElement.isMindElement(null, element)) {
|
|
829
805
|
return TOPIC_FONT_SIZE;
|
|
830
806
|
}
|
|
831
807
|
throw new Error('can not find default font-size');
|
|
832
808
|
};
|
|
833
809
|
|
|
810
|
+
const ABSTRACT_HANDLE_COLOR = '#6698FF80'; //primary color 50% opacity
|
|
811
|
+
const ABSTRACT_INCLUDED_OUTLINE_OFFSET = 3.5;
|
|
812
|
+
const ABSTRACT_HANDLE_LENGTH = 10;
|
|
813
|
+
const ABSTRACT_HANDLE_MASK_WIDTH = 8;
|
|
814
|
+
|
|
834
815
|
const NodeDefaultSpace = {
|
|
835
816
|
horizontal: {
|
|
836
817
|
nodeAndText: BASE * 2.5,
|
|
@@ -890,7 +871,7 @@ const NodeSpace = {
|
|
|
890
871
|
return nodeAndText + normalizedSize.height + nodeAndText;
|
|
891
872
|
},
|
|
892
873
|
getTopicDynamicWidth(board, element) {
|
|
893
|
-
const topicSize = getElementSize(board, element.data.topic, { fontSize:
|
|
874
|
+
const topicSize = getElementSize(board, element.data.topic, { fontSize: getDefaultFontSizeForMindElement(element), fontFamily: DEFAULT_FONT_FAMILY }, NodeSpace.getTopicMaxDynamicWidth(board, element));
|
|
894
875
|
const normalizedSize = normalizeWidthAndHeight(board, element, topicSize.width, topicSize.width);
|
|
895
876
|
const width = element.manualWidth || normalizedSize.width;
|
|
896
877
|
const imageWidth = MindElement.hasImage(element) ? element.data.image?.width : 0;
|
|
@@ -902,14 +883,11 @@ const NodeSpace = {
|
|
|
902
883
|
return normalizedSize.height;
|
|
903
884
|
},
|
|
904
885
|
getTopicMaxDynamicWidth(board, element) {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
getNodeNewDynamicWidth(board, element, imageWidth) {
|
|
911
|
-
const width = element.manualWidth || element.width;
|
|
912
|
-
return Math.max(width, imageWidth);
|
|
886
|
+
const fontSize = getDefaultFontSizeForMindElement(element);
|
|
887
|
+
if (element.manualWidth) {
|
|
888
|
+
return Math.max(element.manualWidth, MindElement.hasImage(element) ? element.data.image?.width : 0);
|
|
889
|
+
}
|
|
890
|
+
return Math.max(fontSize * TOPIC_DEFAULT_MAX_WORD_COUNT, MindElement.hasImage(element) ? element.data.image?.width : 0);
|
|
913
891
|
},
|
|
914
892
|
getNodeResizableMinWidth(board, element) {
|
|
915
893
|
const minTopicWidth = NodeSpace.getNodeTopicMinWidth(board, element);
|
|
@@ -921,10 +899,7 @@ const NodeSpace = {
|
|
|
921
899
|
}
|
|
922
900
|
},
|
|
923
901
|
getNodeTopicMinWidth(board, element) {
|
|
924
|
-
|
|
925
|
-
const firstText = getFirstTextMarks(element.data.topic);
|
|
926
|
-
const fontSize = (firstText[MarkTypes.fontSize] ? Number(firstText[MarkTypes.fontSize]) : null) || defaultFontSize;
|
|
927
|
-
return fontSize;
|
|
902
|
+
return getFontSizeByMindElement(board, element);
|
|
928
903
|
},
|
|
929
904
|
getTextLeftSpace(board, element) {
|
|
930
905
|
const nodeAndText = getHorizontalSpaceBetweenNodeAndText(board, element);
|
|
@@ -958,12 +933,9 @@ const NodeSpace = {
|
|
|
958
933
|
return nodeAndText;
|
|
959
934
|
}
|
|
960
935
|
};
|
|
961
|
-
const
|
|
962
|
-
const defaultFontSize =
|
|
963
|
-
|
|
964
|
-
return defaultFontSize;
|
|
965
|
-
}
|
|
966
|
-
const marks = PlaitMarkEditor.getMarksByElement(text);
|
|
936
|
+
const getFontSizeByMindElement = (board, element) => {
|
|
937
|
+
const defaultFontSize = getDefaultFontSizeForMindElement(element);
|
|
938
|
+
const marks = PlaitMarkEditor.getMarksByElement(element.data.topic);
|
|
967
939
|
const fontSize = marks[MarkTypes.fontSize] || defaultFontSize;
|
|
968
940
|
return fontSize;
|
|
969
941
|
};
|
|
@@ -997,7 +969,7 @@ function getRectangleByElement(board, element) {
|
|
|
997
969
|
return nodeRectangle;
|
|
998
970
|
}
|
|
999
971
|
function isHitMindElement(board, point, element) {
|
|
1000
|
-
const node =
|
|
972
|
+
const node = MIND_ELEMENT_TO_NODE.get(element);
|
|
1001
973
|
if (node && distanceBetweenPointAndRectangle(point[0], point[1], getRectangleByNode(node)) === 0) {
|
|
1002
974
|
return true;
|
|
1003
975
|
}
|
|
@@ -1078,9 +1050,8 @@ const getHitImageResizeHandleDirection = (board, element, point) => {
|
|
|
1078
1050
|
|
|
1079
1051
|
const adjustRootToNode = (board, node) => {
|
|
1080
1052
|
const newNode = { ...node };
|
|
1081
|
-
delete newNode.isRoot;
|
|
1082
1053
|
delete newNode.rightNodeCount;
|
|
1083
|
-
|
|
1054
|
+
newNode.type = 'mind_child';
|
|
1084
1055
|
if (newNode.layout === MindLayoutType.standard) {
|
|
1085
1056
|
delete newNode.layout;
|
|
1086
1057
|
}
|
|
@@ -1105,8 +1076,7 @@ const adjustNodeToRoot = (board, node) => {
|
|
|
1105
1076
|
return {
|
|
1106
1077
|
...newElement,
|
|
1107
1078
|
layout: newElement.layout ?? MindLayoutType.right,
|
|
1108
|
-
|
|
1109
|
-
type: 'mindmap'
|
|
1079
|
+
type: 'mind'
|
|
1110
1080
|
};
|
|
1111
1081
|
};
|
|
1112
1082
|
|
|
@@ -1192,10 +1162,10 @@ const isDropStandardRight = (parent, dropTarget) => {
|
|
|
1192
1162
|
};
|
|
1193
1163
|
|
|
1194
1164
|
const directionCorrector = (board, node, detectResults) => {
|
|
1195
|
-
if (!node.origin
|
|
1165
|
+
if (!PlaitMind.isMind(node.origin) && !AbstractNode.isAbstract(node.origin)) {
|
|
1196
1166
|
const parentLayout = MindQueries.getCorrectLayoutByElement(board, node?.parent.origin);
|
|
1197
1167
|
if (isStandardLayout(parentLayout)) {
|
|
1198
|
-
const idx = node.parent.children.findIndex(x => x === node);
|
|
1168
|
+
const idx = node.parent.children.findIndex((x) => x === node);
|
|
1199
1169
|
const isLeft = idx >= (node.parent.origin.rightNodeCount || 0);
|
|
1200
1170
|
return getAllowedDirection(detectResults, [isLeft ? 'right' : 'left']);
|
|
1201
1171
|
}
|
|
@@ -1234,8 +1204,8 @@ const directionCorrector = (board, node, detectResults) => {
|
|
|
1234
1204
|
};
|
|
1235
1205
|
const getAllowedDirection = (detectResults, illegalDirections) => {
|
|
1236
1206
|
const directions = detectResults;
|
|
1237
|
-
illegalDirections.forEach(item => {
|
|
1238
|
-
const bottomDirectionIndex = directions.findIndex(direction => direction === item);
|
|
1207
|
+
illegalDirections.forEach((item) => {
|
|
1208
|
+
const bottomDirectionIndex = directions.findIndex((direction) => direction === item);
|
|
1239
1209
|
if (bottomDirectionIndex !== -1) {
|
|
1240
1210
|
directions.splice(bottomDirectionIndex, 1);
|
|
1241
1211
|
}
|
|
@@ -1244,7 +1214,7 @@ const getAllowedDirection = (detectResults, illegalDirections) => {
|
|
|
1244
1214
|
};
|
|
1245
1215
|
const detectDropTarget = (board, detectPoint, dropTarget, activeElements) => {
|
|
1246
1216
|
let detectResult = null;
|
|
1247
|
-
depthFirstRecursion(board, element => {
|
|
1217
|
+
depthFirstRecursion(board, (element) => {
|
|
1248
1218
|
if (!MindElement.isMindElement(board, element) || detectResult) {
|
|
1249
1219
|
return;
|
|
1250
1220
|
}
|
|
@@ -1254,7 +1224,7 @@ const detectDropTarget = (board, detectPoint, dropTarget, activeElements) => {
|
|
|
1254
1224
|
detectResult = directionCorrector(board, node, directions);
|
|
1255
1225
|
}
|
|
1256
1226
|
dropTarget = null;
|
|
1257
|
-
const isValid = activeElements.every(element => isValidTarget(element, node.origin));
|
|
1227
|
+
const isValid = activeElements.every((element) => isValidTarget(element, node.origin));
|
|
1258
1228
|
if (detectResult && isValid) {
|
|
1259
1229
|
dropTarget = { target: node.origin, detectResult: detectResult[0] };
|
|
1260
1230
|
}
|
|
@@ -1516,7 +1486,7 @@ function drawLogicLink(board, parent, node, isHorizontal, defaultStrokeColor = n
|
|
|
1516
1486
|
const branchColor = defaultStrokeColor || getBranchColorByMindElement(board, node.origin);
|
|
1517
1487
|
const branchWidth = defaultStrokeWidth || getBranchWidthByMindElement(board, node.origin);
|
|
1518
1488
|
const strokeStyle = defaultStrokeStyle || getStrokeStyleByElement(board, node.origin);
|
|
1519
|
-
const hasStraightLine = branchShape === BranchShape.polyline ? true : !parent.origin
|
|
1489
|
+
const hasStraightLine = branchShape === BranchShape.polyline ? true : !PlaitMind.isMind(parent.origin);
|
|
1520
1490
|
const parentShape = getShapeByElement(board, parent.origin);
|
|
1521
1491
|
const shape = getShapeByElement(board, node.origin);
|
|
1522
1492
|
const hasUnderlineShape = shape === MindElementShape.underline;
|
|
@@ -1531,7 +1501,7 @@ function drawLogicLink(board, parent, node, isHorizontal, defaultStrokeColor = n
|
|
|
1531
1501
|
transformPlacement(beginPlacement, linkDirection);
|
|
1532
1502
|
transformPlacement(endPlacement, linkDirection);
|
|
1533
1503
|
// underline shape and horizontal
|
|
1534
|
-
if (isHorizontal && hasUnderlineShapeOfParent && !parent.origin
|
|
1504
|
+
if (isHorizontal && hasUnderlineShapeOfParent && !PlaitMind.isMind(parent.origin)) {
|
|
1535
1505
|
beginPlacement[1] = VerticalPlacement.bottom;
|
|
1536
1506
|
}
|
|
1537
1507
|
if (isHorizontal && hasUnderlineShape) {
|
|
@@ -2140,8 +2110,8 @@ function handleTouchedAbstract(board, touchedAbstract, endPoint) {
|
|
|
2140
2110
|
const isInRightBranchOfStandardLayout = (selectedElement) => {
|
|
2141
2111
|
const parentElement = MindElement.findParent(selectedElement);
|
|
2142
2112
|
if (parentElement) {
|
|
2143
|
-
const nodeIndex = parentElement.children.findIndex(item => item.id === selectedElement.id);
|
|
2144
|
-
if (parentElement
|
|
2113
|
+
const nodeIndex = parentElement.children.findIndex((item) => item.id === selectedElement.id);
|
|
2114
|
+
if (PlaitMind.isMind(parentElement) &&
|
|
2145
2115
|
getRootLayout(parentElement) === MindLayoutType.standard &&
|
|
2146
2116
|
parentElement.rightNodeCount &&
|
|
2147
2117
|
nodeIndex <= parentElement.rightNodeCount - 1) {
|
|
@@ -2151,7 +2121,7 @@ const isInRightBranchOfStandardLayout = (selectedElement) => {
|
|
|
2151
2121
|
return false;
|
|
2152
2122
|
};
|
|
2153
2123
|
const insertElementHandleRightNodeCount = (board, path, insertCount, effectedRightNodeCount = []) => {
|
|
2154
|
-
let index = effectedRightNodeCount.findIndex(ref => Path.equals(ref.path, path));
|
|
2124
|
+
let index = effectedRightNodeCount.findIndex((ref) => Path.equals(ref.path, path));
|
|
2155
2125
|
const mind = PlaitNode.get(board, path);
|
|
2156
2126
|
if (index === -1) {
|
|
2157
2127
|
effectedRightNodeCount.push({ path, rightNodeCount: mind.rightNodeCount + insertCount });
|
|
@@ -2162,11 +2132,11 @@ const insertElementHandleRightNodeCount = (board, path, insertCount, effectedRig
|
|
|
2162
2132
|
return effectedRightNodeCount;
|
|
2163
2133
|
};
|
|
2164
2134
|
const deleteElementsHandleRightNodeCount = (board, deletableElements, effectedRightNodeCount = []) => {
|
|
2165
|
-
deletableElements.forEach(element => {
|
|
2135
|
+
deletableElements.forEach((element) => {
|
|
2166
2136
|
if (isInRightBranchOfStandardLayout(element)) {
|
|
2167
2137
|
const mind = MindElement.getParent(element);
|
|
2168
2138
|
const path = PlaitBoard.findPath(board, mind);
|
|
2169
|
-
let index = effectedRightNodeCount.findIndex(ref => Path.equals(ref.path, path));
|
|
2139
|
+
let index = effectedRightNodeCount.findIndex((ref) => Path.equals(ref.path, path));
|
|
2170
2140
|
if (index === -1) {
|
|
2171
2141
|
effectedRightNodeCount.push({ path, rightNodeCount: mind.rightNodeCount - 1 });
|
|
2172
2142
|
}
|
|
@@ -2289,9 +2259,10 @@ const MindQueries = {
|
|
|
2289
2259
|
getCorrectLayoutByElement
|
|
2290
2260
|
};
|
|
2291
2261
|
|
|
2262
|
+
const LEGACY_MIND_TYPE = 'mindmap';
|
|
2292
2263
|
const PlaitMind = {
|
|
2293
2264
|
isMind: (value) => {
|
|
2294
|
-
return value.type === '
|
|
2265
|
+
return value.type === 'mind' || value.type === LEGACY_MIND_TYPE;
|
|
2295
2266
|
}
|
|
2296
2267
|
};
|
|
2297
2268
|
const MindElement = {
|
|
@@ -2304,10 +2275,7 @@ const MindElement = {
|
|
|
2304
2275
|
return isIndentedLayout(_layout);
|
|
2305
2276
|
},
|
|
2306
2277
|
isMindElement(board, element) {
|
|
2307
|
-
|
|
2308
|
-
// Now it is very awkward whether it is dynamically calculated(query root node) or using other characteristic attributes(current).
|
|
2309
|
-
// Using dynamically calculated will cause more issue like pasting from clipboard, finding elements by id(isRecursion)
|
|
2310
|
-
if (element.data && element.data.topic && !isNullOrUndefined(element.width) && !isNullOrUndefined(element.height)) {
|
|
2278
|
+
if ((element.data && element.data.topic) || element.type === 'mind_child') {
|
|
2311
2279
|
return true;
|
|
2312
2280
|
}
|
|
2313
2281
|
else {
|
|
@@ -2344,7 +2312,7 @@ const MindElement = {
|
|
|
2344
2312
|
return parents;
|
|
2345
2313
|
},
|
|
2346
2314
|
getNode(element) {
|
|
2347
|
-
const node =
|
|
2315
|
+
const node = MIND_ELEMENT_TO_NODE.get(element);
|
|
2348
2316
|
if (!node) {
|
|
2349
2317
|
throw new Error(`can not get node from ${JSON.stringify(element)}`);
|
|
2350
2318
|
}
|
|
@@ -2493,8 +2461,7 @@ const setAbstractByElements = (board, groupParent, group) => {
|
|
|
2493
2461
|
};
|
|
2494
2462
|
const insertAbstractNode = (board, path, start, end) => {
|
|
2495
2463
|
const abstractNodeText = getAbstractNodeText(board);
|
|
2496
|
-
const
|
|
2497
|
-
const mindElement = createMindElement(abstractNodeText, width, height, {
|
|
2464
|
+
const mindElement = createMindElement(abstractNodeText, {
|
|
2498
2465
|
strokeWidth: DefaultAbstractNodeStyle.branch.width,
|
|
2499
2466
|
branchWidth: DefaultAbstractNodeStyle.branch.width
|
|
2500
2467
|
});
|
|
@@ -2505,34 +2472,22 @@ const insertAbstractNode = (board, path, start, end) => {
|
|
|
2505
2472
|
addSelectedElement(board, mindElement);
|
|
2506
2473
|
};
|
|
2507
2474
|
|
|
2508
|
-
const setTopic = (board, element, topic
|
|
2475
|
+
const setTopic = (board, element, topic) => {
|
|
2509
2476
|
const newElement = {
|
|
2510
|
-
data: { ...element.data
|
|
2511
|
-
...normalizeWidthAndHeight(board, element, width, height)
|
|
2477
|
+
data: { ...element.data }
|
|
2512
2478
|
};
|
|
2479
|
+
if (topic) {
|
|
2480
|
+
newElement.data.topic = topic;
|
|
2481
|
+
}
|
|
2513
2482
|
const path = PlaitBoard.findPath(board, element);
|
|
2514
2483
|
Transforms.setNode(board, newElement, path);
|
|
2515
2484
|
};
|
|
2516
|
-
const setNodeManualWidth = (board, element, width
|
|
2485
|
+
const setNodeManualWidth = (board, element, width) => {
|
|
2517
2486
|
const path = PlaitBoard.findPath(board, element);
|
|
2518
|
-
const { width: normalizedWidth
|
|
2519
|
-
const newElement = { manualWidth: normalizedWidth,
|
|
2487
|
+
const { width: normalizedWidth } = normalizeWidthAndHeight(board, element, width, 0);
|
|
2488
|
+
const newElement = { manualWidth: normalizedWidth, data: { ...element.data, topic: { ...element.data.topic } } };
|
|
2520
2489
|
Transforms.setNode(board, newElement, path);
|
|
2521
2490
|
};
|
|
2522
|
-
const setTopicSize = (board, element, width, height) => {
|
|
2523
|
-
const newElement = {
|
|
2524
|
-
...normalizeWidthAndHeight(board, element, width, height)
|
|
2525
|
-
};
|
|
2526
|
-
let isEqualWidth = Math.ceil(element.width) === Math.ceil(newElement.width);
|
|
2527
|
-
let isEqualHeight = Math.ceil(element.height) === Math.ceil(newElement.height);
|
|
2528
|
-
if (element.manualWidth) {
|
|
2529
|
-
isEqualWidth = true;
|
|
2530
|
-
}
|
|
2531
|
-
if (!isEqualWidth || !isEqualHeight) {
|
|
2532
|
-
const path = PlaitBoard.findPath(board, element);
|
|
2533
|
-
Transforms.setNode(board, newElement, path);
|
|
2534
|
-
}
|
|
2535
|
-
};
|
|
2536
2491
|
const insertNodes = (board, elements, path) => {
|
|
2537
2492
|
const pathRef = board.pathRef(path);
|
|
2538
2493
|
elements.forEach((element) => {
|
|
@@ -2632,26 +2587,16 @@ const replaceEmoji = (board, element, oldEmoji, newEmoji) => {
|
|
|
2632
2587
|
const removeImage = (board, element) => {
|
|
2633
2588
|
removeImageFocus(board, element);
|
|
2634
2589
|
const newElement = {
|
|
2635
|
-
data: { ...element.data }
|
|
2590
|
+
data: { ...element.data, topic: { ...element.data.topic } }
|
|
2636
2591
|
};
|
|
2637
2592
|
delete newElement.data.image;
|
|
2638
2593
|
const path = PlaitBoard.findPath(board, element);
|
|
2639
|
-
const newDynamicWidth = NodeSpace.getNodeNewDynamicWidth(board, element, 0);
|
|
2640
|
-
const newHeight = getNewNodeHeight(board, element, newDynamicWidth);
|
|
2641
|
-
if (newHeight) {
|
|
2642
|
-
newElement.height = newHeight;
|
|
2643
|
-
}
|
|
2644
2594
|
Transforms.setNode(board, newElement, path);
|
|
2645
2595
|
};
|
|
2646
2596
|
const setImage = (board, element, imageItem) => {
|
|
2647
2597
|
const newElement = {
|
|
2648
|
-
data: { ...element.data, image: imageItem }
|
|
2598
|
+
data: { ...element.data, image: imageItem, topic: { ...element.data.topic } }
|
|
2649
2599
|
};
|
|
2650
|
-
const newDynamicWidth = NodeSpace.getNodeNewDynamicWidth(board, element, imageItem.width);
|
|
2651
|
-
const newHeight = getNewNodeHeight(board, element, newDynamicWidth);
|
|
2652
|
-
if (newHeight) {
|
|
2653
|
-
newElement.height = newHeight;
|
|
2654
|
-
}
|
|
2655
2600
|
const path = PlaitBoard.findPath(board, element);
|
|
2656
2601
|
Transforms.setNode(board, newElement, path);
|
|
2657
2602
|
};
|
|
@@ -2708,7 +2653,6 @@ const MindTransforms = {
|
|
|
2708
2653
|
setBranchWidth,
|
|
2709
2654
|
setBranchColor,
|
|
2710
2655
|
setTopic,
|
|
2711
|
-
setTopicSize,
|
|
2712
2656
|
setNodeManualWidth,
|
|
2713
2657
|
addEmoji,
|
|
2714
2658
|
removeEmoji,
|
|
@@ -2907,7 +2851,7 @@ const getMoreStartAndEnd = (board, element, linkLineDirection) => {
|
|
|
2907
2851
|
// underline shape and horizontal
|
|
2908
2852
|
const layout = MindQueries.getLayoutByElement(element);
|
|
2909
2853
|
const isHorizontal = isHorizontalLayout(layout);
|
|
2910
|
-
if (isHorizontal && isUnderlineShape && !element
|
|
2854
|
+
if (isHorizontal && isUnderlineShape && !PlaitMind.isMind(element)) {
|
|
2911
2855
|
placement[1] = VerticalPlacement.bottom;
|
|
2912
2856
|
}
|
|
2913
2857
|
let startPoint = getPointByPlacement(nodeClient, placement);
|
|
@@ -2954,14 +2898,7 @@ class MindNodeComponent extends CommonElementFlavour {
|
|
|
2954
2898
|
return rect;
|
|
2955
2899
|
},
|
|
2956
2900
|
onChange: (data) => {
|
|
2957
|
-
|
|
2958
|
-
const height = data.height;
|
|
2959
|
-
if (data.newText) {
|
|
2960
|
-
MindTransforms.setTopic(this.board, this.element, data.newText, width, height);
|
|
2961
|
-
}
|
|
2962
|
-
else {
|
|
2963
|
-
MindTransforms.setTopicSize(this.board, this.element, width, height);
|
|
2964
|
-
}
|
|
2901
|
+
MindTransforms.setTopic(this.board, this.element, data.newText);
|
|
2965
2902
|
},
|
|
2966
2903
|
getMaxWidth: () => {
|
|
2967
2904
|
return NodeSpace.getTopicMaxDynamicWidth(this.board, this.element);
|
|
@@ -3074,8 +3011,8 @@ class MindNodeComponent extends CommonElementFlavour {
|
|
|
3074
3011
|
this.nodeEmojisGenerator.destroy();
|
|
3075
3012
|
this.imageGenerator.destroy();
|
|
3076
3013
|
this.activeGenerator.destroy();
|
|
3077
|
-
if (
|
|
3078
|
-
|
|
3014
|
+
if (MIND_ELEMENT_TO_NODE.get(this.element) === this.node) {
|
|
3015
|
+
MIND_ELEMENT_TO_NODE.delete(this.element);
|
|
3079
3016
|
}
|
|
3080
3017
|
this.getRef().destroyTextManage();
|
|
3081
3018
|
}
|
|
@@ -3104,7 +3041,7 @@ class PlaitMindComponent extends MindNodeComponent {
|
|
|
3104
3041
|
depthFirstRecursion(this.root, (node) => {
|
|
3105
3042
|
node.x = node.x - offsetX + element.points[0][0];
|
|
3106
3043
|
node.y = node.y - offsetY + element.points[0][1];
|
|
3107
|
-
|
|
3044
|
+
MIND_ELEMENT_TO_NODE.set(node.origin, node);
|
|
3108
3045
|
});
|
|
3109
3046
|
}
|
|
3110
3047
|
}
|
|
@@ -3134,7 +3071,7 @@ const withNodeDnd = (board) => {
|
|
|
3134
3071
|
MindElement.isMindElement(board, hitElement) &&
|
|
3135
3072
|
!PlaitMind.isMind(hitElement) &&
|
|
3136
3073
|
!AbstractNode.isAbstract(hitElement)) {
|
|
3137
|
-
const targetElements = selectedElements.filter(element => MindElement.isMindElement(board, element) && !element
|
|
3074
|
+
const targetElements = selectedElements.filter((element) => MindElement.isMindElement(board, element) && !PlaitMind.isMind(element) && !AbstractNode.isAbstract(element));
|
|
3138
3075
|
const isMultipleSelection = selectedElements.length > 0 && selectedElements.includes(hitElement);
|
|
3139
3076
|
if (isMultipleSelection) {
|
|
3140
3077
|
activeElements = targetElements;
|
|
@@ -3170,10 +3107,10 @@ const withNodeDnd = (board) => {
|
|
|
3170
3107
|
const offsetY = endPoint[1] - startPoint[1];
|
|
3171
3108
|
dragFakeNodeG?.remove();
|
|
3172
3109
|
dragFakeNodeG = createG();
|
|
3173
|
-
[...activeElements, ...correspondingElements].forEach(element => {
|
|
3110
|
+
[...activeElements, ...correspondingElements].forEach((element) => {
|
|
3174
3111
|
addActiveOnDragOrigin(element);
|
|
3175
3112
|
});
|
|
3176
|
-
activeElements.forEach(element => {
|
|
3113
|
+
activeElements.forEach((element) => {
|
|
3177
3114
|
const nodeG = drawFakeDragNode(board, element, offsetX, offsetY);
|
|
3178
3115
|
dragFakeNodeG?.appendChild(nodeG);
|
|
3179
3116
|
});
|
|
@@ -3187,7 +3124,7 @@ const withNodeDnd = (board) => {
|
|
|
3187
3124
|
if (!board.options.readonly && firstLevelElements.length) {
|
|
3188
3125
|
firstLevelElements.push(...correspondingElements);
|
|
3189
3126
|
if (isDragging(board)) {
|
|
3190
|
-
firstLevelElements.forEach(element => {
|
|
3127
|
+
firstLevelElements.forEach((element) => {
|
|
3191
3128
|
removeActiveOnDragOrigin(element);
|
|
3192
3129
|
});
|
|
3193
3130
|
}
|
|
@@ -3197,8 +3134,8 @@ const withNodeDnd = (board) => {
|
|
|
3197
3134
|
const targetElementPathRef = board.pathRef(PlaitBoard.findPath(board, dropTarget.target));
|
|
3198
3135
|
let abstractRefs = getValidAbstractRefs(board, firstLevelElements);
|
|
3199
3136
|
const normalElements = firstLevelElements
|
|
3200
|
-
.filter(element => !abstractRefs.some(refs => refs.abstract === element))
|
|
3201
|
-
.map(element => {
|
|
3137
|
+
.filter((element) => !abstractRefs.some((refs) => refs.abstract === element))
|
|
3138
|
+
.map((element) => {
|
|
3202
3139
|
if (AbstractNode.isAbstract(element)) {
|
|
3203
3140
|
return adjustAbstractToNode(element);
|
|
3204
3141
|
}
|
|
@@ -3210,7 +3147,7 @@ const withNodeDnd = (board) => {
|
|
|
3210
3147
|
const correspondingAbstract = getCorrespondingAbstract(previousElement);
|
|
3211
3148
|
const targetHasCorrespondAbstract = correspondingAbstract && correspondingAbstract.end !== targetPath[targetPath.length - 1] - 1;
|
|
3212
3149
|
if (targetHasCorrespondAbstract) {
|
|
3213
|
-
const adjustedNode = abstractRefs.map(ref => {
|
|
3150
|
+
const adjustedNode = abstractRefs.map((ref) => {
|
|
3214
3151
|
return adjustAbstractToNode(ref.abstract);
|
|
3215
3152
|
});
|
|
3216
3153
|
normalElements.push(...adjustedNode);
|
|
@@ -3255,8 +3192,8 @@ const withNodeDnd = (board) => {
|
|
|
3255
3192
|
targetElementPathRef.unref();
|
|
3256
3193
|
targetPathRef.unref();
|
|
3257
3194
|
let setActiveElements = [];
|
|
3258
|
-
depthFirstRecursion(board, node => {
|
|
3259
|
-
const isSelected = activeElements.some(element => element.id === node.id);
|
|
3195
|
+
depthFirstRecursion(board, (node) => {
|
|
3196
|
+
const isSelected = activeElements.some((element) => element.id === node.id);
|
|
3260
3197
|
if (isSelected) {
|
|
3261
3198
|
setActiveElements.push(node);
|
|
3262
3199
|
}
|
|
@@ -3825,9 +3762,7 @@ const withNodeResize = (board) => {
|
|
|
3825
3762
|
}
|
|
3826
3763
|
const newTarget = PlaitNode.get(board, targetElementRef.path);
|
|
3827
3764
|
if (newTarget && NodeSpace.getNodeTopicMinWidth(board, newTarget) !== resizedWidth) {
|
|
3828
|
-
|
|
3829
|
-
const { height } = targetElementRef.textManage.getSize(undefined, resizedWidth);
|
|
3830
|
-
MindTransforms.setNodeManualWidth(board, newTarget, resizedWidth, height);
|
|
3765
|
+
MindTransforms.setNodeManualWidth(board, newTarget, resizedWidth);
|
|
3831
3766
|
}
|
|
3832
3767
|
},
|
|
3833
3768
|
afterResize: (resizeRef) => {
|
|
@@ -3953,11 +3888,8 @@ const insertClipboardData = (board, elements, targetPoint, operationType) => {
|
|
|
3953
3888
|
elements.forEach((item, index) => {
|
|
3954
3889
|
newElement = copyNewNode(item);
|
|
3955
3890
|
if (hasTargetParent && operationType !== WritableClipboardOperationType.duplicate) {
|
|
3956
|
-
if (item
|
|
3891
|
+
if (PlaitMind.isMind(item)) {
|
|
3957
3892
|
newElement = adjustRootToNode(board, newElement);
|
|
3958
|
-
const { width, height } = getTopicSizeByElement(board, newElement, targetParent);
|
|
3959
|
-
newElement.width = width;
|
|
3960
|
-
newElement.height = height;
|
|
3961
3893
|
}
|
|
3962
3894
|
// handle abstract start and end
|
|
3963
3895
|
if (AbstractNode.isAbstract(newElement)) {
|
|
@@ -3972,11 +3904,8 @@ const insertClipboardData = (board, elements, targetPoint, operationType) => {
|
|
|
3972
3904
|
if (AbstractNode.isAbstract(item)) {
|
|
3973
3905
|
newElement = adjustAbstractToNode(newElement);
|
|
3974
3906
|
}
|
|
3975
|
-
if (!item
|
|
3907
|
+
if (!PlaitMind.isMind(item)) {
|
|
3976
3908
|
newElement = adjustNodeToRoot(board, newElement);
|
|
3977
|
-
const { width, height } = getTopicSizeByElement(board, newElement);
|
|
3978
|
-
newElement.width = width;
|
|
3979
|
-
newElement.height = height;
|
|
3980
3909
|
}
|
|
3981
3910
|
path = [board.children.length];
|
|
3982
3911
|
}
|
|
@@ -3987,14 +3916,10 @@ const insertClipboardData = (board, elements, targetPoint, operationType) => {
|
|
|
3987
3916
|
Transforms.addSelectionWithTemporaryElements(board, newELements);
|
|
3988
3917
|
};
|
|
3989
3918
|
const insertClipboardText = (board, targetParent, text) => {
|
|
3990
|
-
const
|
|
3991
|
-
const newElement = createMindElement(text, Math.max(width, getFontSizeBySlateElement(text)), height, {});
|
|
3919
|
+
const newElement = createMindElement(text, {});
|
|
3992
3920
|
Transforms.insertNode(board, newElement, findNewChildNodePath(board, targetParent));
|
|
3993
3921
|
Transforms.addSelectionWithTemporaryElements(board, [newElement]);
|
|
3994
3922
|
};
|
|
3995
|
-
const getTopicSizeByElement = (board, element, parentElement) => {
|
|
3996
|
-
return getTopicSize(board, PlaitMind.isMind(element), (parentElement && PlaitMind.isMind(parentElement)) || false, element.data.topic, element.manualWidth);
|
|
3997
|
-
};
|
|
3998
3923
|
|
|
3999
3924
|
const withMindFragment = (baseBoard) => {
|
|
4000
3925
|
const board = baseBoard;
|
|
@@ -4101,12 +4026,6 @@ const isNormalizedData = (element) => {
|
|
|
4101
4026
|
}
|
|
4102
4027
|
return true;
|
|
4103
4028
|
};
|
|
4104
|
-
const isNormalizedWidthAndHeight = (element) => {
|
|
4105
|
-
if (isNullOrUndefined(element.width) || isNullOrUndefined(element.height)) {
|
|
4106
|
-
return false;
|
|
4107
|
-
}
|
|
4108
|
-
return true;
|
|
4109
|
-
};
|
|
4110
4029
|
const fixMindElementData = (element) => {
|
|
4111
4030
|
const emptyTopic = {
|
|
4112
4031
|
children: [
|
|
@@ -4125,14 +4044,6 @@ const fixMindElementData = (element) => {
|
|
|
4125
4044
|
element.data.topic = emptyTopic;
|
|
4126
4045
|
}
|
|
4127
4046
|
};
|
|
4128
|
-
const fixMindElementWidthAndHeight = (element) => {
|
|
4129
|
-
if (isNullOrUndefined(element.width)) {
|
|
4130
|
-
element.width = 56;
|
|
4131
|
-
}
|
|
4132
|
-
if (isNullOrUndefined(element.height)) {
|
|
4133
|
-
element.width = 20;
|
|
4134
|
-
}
|
|
4135
|
-
};
|
|
4136
4047
|
|
|
4137
4048
|
const withMind = (baseBoard) => {
|
|
4138
4049
|
const board = baseBoard;
|
|
@@ -4143,9 +4054,6 @@ const withMind = (baseBoard) => {
|
|
|
4143
4054
|
if (!isNormalizedData(node)) {
|
|
4144
4055
|
fixMindElementData(node);
|
|
4145
4056
|
}
|
|
4146
|
-
if (!isNormalizedWidthAndHeight(node)) {
|
|
4147
|
-
fixMindElementWidthAndHeight(node);
|
|
4148
|
-
}
|
|
4149
4057
|
});
|
|
4150
4058
|
}
|
|
4151
4059
|
normalizeElement(context);
|
|
@@ -4177,13 +4085,13 @@ const withMind = (baseBoard) => {
|
|
|
4177
4085
|
return getRectangle(element);
|
|
4178
4086
|
};
|
|
4179
4087
|
board.canAddToGroup = (element) => {
|
|
4180
|
-
if (MindElement.isMindElement(board, element) && !element
|
|
4088
|
+
if (MindElement.isMindElement(board, element) && !PlaitMind.isMind(element)) {
|
|
4181
4089
|
return false;
|
|
4182
4090
|
}
|
|
4183
4091
|
return canAddToGroup(element);
|
|
4184
4092
|
};
|
|
4185
4093
|
board.canSetZIndex = (element) => {
|
|
4186
|
-
if (MindElement.isMindElement(board, element) && !element
|
|
4094
|
+
if (MindElement.isMindElement(board, element) && !PlaitMind.isMind(element)) {
|
|
4187
4095
|
return false;
|
|
4188
4096
|
}
|
|
4189
4097
|
return canSetZIndex(element);
|
|
@@ -4218,7 +4126,7 @@ const withMind = (baseBoard) => {
|
|
|
4218
4126
|
return getOneHitElement(elements);
|
|
4219
4127
|
};
|
|
4220
4128
|
board.isMovable = (element) => {
|
|
4221
|
-
if (PlaitMind.isMind(element)
|
|
4129
|
+
if (PlaitMind.isMind(element)) {
|
|
4222
4130
|
return true;
|
|
4223
4131
|
}
|
|
4224
4132
|
return isMovable(element);
|
|
@@ -4230,7 +4138,7 @@ const withMind = (baseBoard) => {
|
|
|
4230
4138
|
return isImageBindingAllowed(element);
|
|
4231
4139
|
};
|
|
4232
4140
|
board.isAlign = (element) => {
|
|
4233
|
-
if (PlaitMind.isMind(element)
|
|
4141
|
+
if (PlaitMind.isMind(element)) {
|
|
4234
4142
|
return true;
|
|
4235
4143
|
}
|
|
4236
4144
|
return isAlign(element);
|
|
@@ -4278,5 +4186,5 @@ class MindEmojiBaseComponent {
|
|
|
4278
4186
|
* Generated bundle index. Do not edit.
|
|
4279
4187
|
*/
|
|
4280
4188
|
|
|
4281
|
-
export { ABSTRACT_HANDLE_COLOR, ABSTRACT_HANDLE_LENGTH, ABSTRACT_HANDLE_MASK_WIDTH, ABSTRACT_INCLUDED_OUTLINE_OFFSET, ABSTRACT_NODE_TEXT, AbstractHandlePosition, AbstractResizeState, BASE, BranchShape, DEFAULT_MIND_IMAGE_WIDTH, DefaultAbstractNodeStyle, DefaultNodeStyle,
|
|
4189
|
+
export { ABSTRACT_HANDLE_COLOR, ABSTRACT_HANDLE_LENGTH, ABSTRACT_HANDLE_MASK_WIDTH, ABSTRACT_INCLUDED_OUTLINE_OFFSET, ABSTRACT_NODE_TEXT, AbstractHandlePosition, AbstractResizeState, BASE, BranchShape, DEFAULT_MIND_IMAGE_WIDTH, DefaultAbstractNodeStyle, DefaultNodeStyle, GRAY_COLOR, INHERIT_ATTRIBUTE_KEYS, LayoutDirection, LayoutDirectionsMap, MIND_CENTRAL_TEXT, MIND_ELEMENT_TO_NODE, MindColorfulThemeColor, MindDarkThemeColor, MindDefaultThemeColor, MindElement, MindElementShape, MindEmojiBaseComponent, MindI18nKey, MindNode, MindNodeComponent, MindPointerType, MindQueries, MindRetroThemeColor, MindSoftThemeColor, MindStarryThemeColor, MindThemeColor, MindThemeColors, MindTransforms, NODE_ADD_CIRCLE_COLOR, NODE_ADD_HOVER_COLOR, NODE_ADD_INNER_CROSS_COLOR, NODE_MORE_BRIDGE_DISTANCE, NODE_MORE_ICON_DIAMETER, NODE_MORE_LINE_DISTANCE, NODE_MORE_STROKE_WIDTH, NodeSpace, PRIMARY_COLOR, PlaitMind, PlaitMindComponent, RESIZE_HANDLE_BUFFER_DISTANCE, ROOT_TOPIC_FONT_SIZE, STROKE_WIDTH, TOPIC_DEFAULT_MAX_WORD_COUNT, TOPIC_FONT_SIZE, WithMindPluginKey, addActiveOnDragOrigin, addImageFocus, adjustAbstractToNode, adjustNodeToRoot, adjustRootToNode, canSetAbstract, copyNewNode, correctLayoutByDirection, createEmptyMind, createMindElement, deleteElementHandleAbstract, deleteElementsHandleRightNodeCount, detectDropTarget, directionCorrector, directionDetector, divideElementByParent, drawFakeDragNode, drawFakeDropNode, editTopic, findLastChild, findLocationLeftIndex, findNewChildNodePath, findNewSiblingNodePath, getAbstractBranchColor, getAbstractBranchWidth, getAbstractHandleRectangle, getAbstractNodeText, getAllowedDirection, getAvailableSubLayoutsByLayoutDirections, getBehindAbstracts, getBranchColorByMindElement, getBranchDirectionsByLayouts, getBranchShapeByMindElement, getBranchWidthByMindElement, getChildrenCount, getCorrespondingAbstract, getDefaultBranchColor, getDefaultBranchColorByIndex, getDefaultFontSizeForMindElement, getDefaultLayout, getDefaultMindNameText, getEmojiFontSize, getEmojiForeignRectangle, getEmojiRectangle, getEmojisWidthHeight, getFillByElement, getFirstLevelElement, getFontSizeByMindElement, 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, normalizeWidthAndHeight, removeActiveOnDragOrigin, removeImageFocus, separateChildren, setMindDragging, withEmoji, withMind, withMindExtend };
|
|
4282
4190
|
//# sourceMappingURL=plait-mind.mjs.map
|