fix(脑图): 脑图节点文本修改问题修复

This commit is contained in:
baiqi 2024-08-20 16:15:57 +08:00 committed by Craftsman
parent e65069f90b
commit ec43b88870
4 changed files with 31 additions and 6 deletions

View File

@ -265,6 +265,13 @@
}
);
watch(
() => props.activeCase.name,
() => {
baseInfoForm.value.name = props.activeCase.name;
}
);
defineExpose({
makeParams,
});

View File

@ -31,7 +31,7 @@
single-tag
tag-enable
sequence-enable
@content-change="handleContentChange"
@content-change="handleMinderNodeContentChange"
@node-select="handleNodeSelect"
@action="handleAction"
@before-exec-command="handleBeforeExecCommand"
@ -272,6 +272,17 @@
});
const activeExtraKey = ref<'baseInfo' | 'attachment' | 'comments' | 'bug'>('baseInfo');
function handleMinderNodeContentChange(node?: MinderJsonNode) {
if (extraVisible.value) {
//
activeCase.value = {
...activeCase.value,
name: node?.data?.text || window.minder.getNodeById(activeCase.value.id)?.data?.text || '',
};
}
handleContentChange(node);
}
const fileList = ref<MsFileItem[]>([]);
const checkUpdateFileIds = ref<string[]>([]);

View File

@ -933,6 +933,7 @@
node.data = {
...node.data,
...cloneDeep(configForm.value),
text: node.data.text, //
};
}
configFormValidResult = true;

View File

@ -8,6 +8,7 @@
* @author: techird
* @copyright: Baidu FEX, 2014
*/
import type { MinderJsonNode, MinderJsonNodeData } from '../../props';
import Debug from '../tool/debug';
import { isDisableNode, markChangeNode } from '../tool/utils';
@ -299,10 +300,10 @@ function InputRuntime(this: any) {
* @Editor: Naixor
* @Date: 2015.9.16
*/
const commitInputNode = (node: any, text: string) => {
const commitInputNode = (node: MinderJsonNode, text: string) => {
try {
this.minder.decodeData('text', text).then((json: any) => {
function importText(nodeT: any, jsonT: any, minder: any) {
this.minder.decodeData('text', text).then((json: MinderJsonNodeData) => {
function importText(nodeT: MinderJsonNode, jsonT: MinderJsonNodeData, minder: any) {
const { data } = jsonT;
nodeT.setText(data.text || '');
const childrenTreeData = jsonT.children || [];
@ -314,8 +315,13 @@ function InputRuntime(this: any) {
}
importText(node, json, this.minder);
this.minder.fire('contentchange');
this.minder.getRoot().renderTree();
this.minder.layout(300);
if (node.parent) {
node.parent.renderTree();
node.parent.layout();
} else {
this.minder.getRoot().renderTree();
this.minder.layout(300);
}
});
} catch (e: any) {
this.minder.fire('contentchange');