Skip to content

Commit

Permalink
fix: SENSEBEE-7610: 线条的侧边栏并未检查文本输入
Browse files Browse the repository at this point in the history
  • Loading branch information
lijingchi committed Sep 24, 2021
1 parent 8e6ff49 commit a1024c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
}
Expand All @@ -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();
};
}

Expand Down
15 changes: 11 additions & 4 deletions packages/lb-demo/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a1024c9

Please sign in to comment.