Merge pull request #927 from opencv/bs/paste_labels

Ability to copy labels to clipboard without IDs
main
Nikita Manovich 6 years ago committed by GitHub
commit 310ee37b53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -509,8 +509,3 @@ class LabelForm extends React.PureComponent<Props, {}> {
}
export default Form.create<Props>()(LabelForm);
// add validators
// add initial values
// add readonly fields

@ -3,11 +3,15 @@ import React from 'react';
import {
Tabs,
Icon,
Button,
Tooltip,
notification,
} from 'antd';
import Text from 'antd/lib/typography/Text';
import copy from 'copy-to-clipboard';
import RawViewer from './raw-viewer';
import ConstructorViewer from './constructor-viewer';
import ConstructorCreator from './constructor-creator';
@ -225,7 +229,35 @@ export default class LabelsEditor
} = this.state;
return (
<Tabs defaultActiveKey='2' type='card' tabBarStyle={{ marginBottom: '0px' }}>
<Tabs
defaultActiveKey='2'
type='card'
tabBarStyle={{ marginBottom: '0px' }}
tabBarExtraContent={(
<>
<Tooltip overlay='Copied to clipboard!' trigger='click'>
<Button
type='link'
icon='copy'
onClick={(): void => {
copy(JSON.stringify(
savedLabels.concat(unsavedLabels).map((label): any => ({
...label,
id: undefined,
attributes: label.attributes.map((attribute): any => ({
...attribute,
id: undefined,
})),
})), null, 4,
));
}}
>
Copy
</Button>
</Tooltip>
</>
)}
>
<Tabs.TabPane
tab={
(

Loading…
Cancel
Save