Skip to content

Commit

Permalink
Merge pull request #927 from opencv/bs/paste_labels
Browse files Browse the repository at this point in the history
Ability to copy labels to clipboard without IDs
  • Loading branch information
nmanovic authored Dec 11, 2019
2 parents 0ae73d5 + a60af60 commit 310ee37
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
5 changes: 0 additions & 5 deletions cvat-ui/src/components/labels-editor/label-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,3 @@ class LabelForm extends React.PureComponent<Props, {}> {
}

export default Form.create<Props>()(LabelForm);


// add validators
// add initial values
// add readonly fields
34 changes: 33 additions & 1 deletion cvat-ui/src/components/labels-editor/labels-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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={
(
Expand Down

0 comments on commit 310ee37

Please sign in to comment.