Browse Source

fix: avoid flowchart listening dblclick many times

master
smallstonesk 4 years ago
parent
commit
a1cf8c63b2
  1. 10
      packages/core/src/mods/settingBar/components/code/index.tsx

10
packages/core/src/mods/settingBar/components/code/index.tsx

@ -12,17 +12,19 @@ interface IProps {
value: any; value: any;
name: string; name: string;
title: string; title: string;
onValueChange: (value: string) => void;
flowChart: Graph; flowChart: Graph;
onValueChange: (value: string) => void;
} }
const Code: React.FC<IProps> = (props) => { const Code: React.FC<IProps> = (props) => {
const { title, value, onValueChange, flowChart } = props; const { title, value, onValueChange, flowChart } = props;
const [visible, setVisible] = useState<boolean>(false); const [visible, setVisible] = useState<boolean>(false);
flowChart.on('cell:dblclick', (args) => { useEffect(() => {
onClickEdit() flowChart.on('node:dblclick', () => {
}); onClickEdit();
});
}, []);
// events // events
const onClickEdit = (): void => { const onClickEdit = (): void => {

Loading…
Cancel
Save