hookehuyr

fix

......@@ -57,8 +57,7 @@ export function clickSelect(G6) {
if (item.get('type') === 'node') {
selectChangeFlag = true
item.getEdges().forEach(edge => {
// TODO: 暂时屏蔽边的选中状态,因为会影响删除节点时判断逻辑,后面处理
// graph.setItemState(edge, SELECTED_STATE, true);
graph.setItemState(edge, SELECTED_STATE, true);
});
} else {
this.onCanvasClick();
......
......@@ -264,6 +264,7 @@ export function useEditorCommander(editorState) {
let before;
let after;
let select;
return {
redo: async () => {
......@@ -271,8 +272,14 @@ export function useEditorCommander(editorState) {
const { beforeDelete, afterDelete } = editorState.props;
before = clone(graph.save());
select = getSelected(graph);
// TAG: 处理节点和边的删除问题,当节点和边都存在时,只判断节点的关系
if (select.nodes.length && select.edges.length) {
select.edges = [];
}
await Promise.all(
flatten(Object.values(getSelected(graph))).map(async (i) => {
flatten(Object.values(select)).map(async (i) => {
const model = i.get("model");
const type = i.get("type");
try {
......
......@@ -22,7 +22,7 @@ export default {
toolbarButtonHandler: {type: Function}, // 工具栏按钮格式化函数
loading: {type: Boolean}, // 是否开启编辑器的loading状态
multipleSelect: {type: Boolean, default: true}, // 是否可以多选
multipleSelect: {type: Boolean, default: false}, // 是否可以多选
beforeDelete: {type: Function}, // 删除前校验
afterDelete: {type: Function}, // 删除后动作
......