diff --git a/packages/lb-annotation/src/core/toolOperation/LineToolOperation.ts b/packages/lb-annotation/src/core/toolOperation/LineToolOperation.ts index 7ea304658..56e94f5d6 100644 --- a/packages/lb-annotation/src/core/toolOperation/LineToolOperation.ts +++ b/packages/lb-annotation/src/core/toolOperation/LineToolOperation.ts @@ -1883,7 +1883,8 @@ class LineToolOperation extends BasicToolOperation { public updateSelectedTextAttribute(newTextAttribute?: string) { if (this._textAttributeInstance && newTextAttribute && this.selectedID) { let textAttribute = newTextAttribute; - if (AttributeUtils.textAttributeValidate(this.config.textCheckType, '', textAttribute) === false) { + const textAttributeInvalid = !AttributeUtils.textAttributeValidate(this.config.textCheckType, '', textAttribute); + if (textAttributeInvalid) { this.emit('messageError', AttributeUtils.getErrorNotice(this.config.textCheckType, this.lang)); textAttribute = ''; } @@ -1898,10 +1899,8 @@ class LineToolOperation extends BasicToolOperation { if (this.config.textConfigurable === false || !this.selectedID) { return; } - - this.setTextAttribute(v); + this.updateSelectedTextAttribute(v); this.emit('selectedChange'); // 触发外层的更新 - this.render(); }; } diff --git a/packages/lb-demo/src/App.js b/packages/lb-demo/src/App.js index b529c9a43..0bd865e0f 100644 --- a/packages/lb-demo/src/App.js +++ b/packages/lb-demo/src/App.js @@ -2,15 +2,22 @@ import React, { useState } from 'react'; import './App.css'; import 'antd/dist/antd.css'; import Annotation from './components/Annotation'; -import { mockFileList, getMockResult } from './mock/index'; +import { fileList as mockFileList, getMockResult } from './mock/index'; import { getStepList, getDependStepList } from './mock/taskConfig'; import qs from 'qs'; const App = () => { - const tools = qs.parse(window.location.search, { ignoreQueryPrefix: true, comma: true }).tool; - const stepList = Array.isArray(tools) ? getDependStepList(tools) : getStepList(tools); + const tool = qs.parse(window.location.search, { ignoreQueryPrefix: true, comma: true }).tool; + const isSingleTool = !Array.isArray(tool); + const stepList = isSingleTool ? getStepList(tool) : getDependStepList(tool); - const [fileList] = useState(mockFileList); + const [fileList] = useState( + mockFileList.map((url, i) => ({ + id: i + 1, + url, + result: isSingleTool ? getMockResult(tool) : '', + })), + ); const goBack = (data) => { console.log('goBack', data);