Skip to content

Commit e54864d

Browse files
authored
Merge pull request mac-s-g#102 from mac-s-g/speed-boost
removed react-tooltip because performance was not good
2 parents 193a29b + c587c7c commit e54864d

File tree

3 files changed

+6
-47
lines changed

3 files changed

+6
-47
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-json-view",
33
"description": "Interactive react component for displaying javascript arrays and JSON objects.",
4-
"version": "1.11.7",
4+
"version": "1.11.8",
55
"main": "dist/main.js",
66
"files": [
77
"dist/"
@@ -10,8 +10,7 @@
1010
"clipboard": "^1.6.1",
1111
"flux": "^3.1.2",
1212
"radium":"^0.19.1",
13-
"react-base16-styling": "^0.5.3",
14-
"react-tooltip": "^3.3.0"
13+
"react-base16-styling": "^0.5.3"
1514
},
1615
"devDependencies": {
1716
"babel-core": "^6.21.0",

src/js/components/VariableEditor.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ import {
1414
//clibboard icon
1515
import {Edit, CheckCircle, RemoveCircle as Remove} from './icons';
1616

17-
//tooltip component
18-
import ReactTooltip from 'react-tooltip';
19-
2017
//theme
2118
import Theme from './../themes/getStyle';
2219
import Radium from 'radium';
@@ -37,10 +34,6 @@ class VariableEditor extends React.Component {
3734
super(props);
3835
}
3936

40-
componentDidMount() {
41-
ReactTooltip.rebuild();
42-
}
43-
4437
render() {
4538
const {
4639
variable, singleIndent, type, theme,
@@ -89,24 +82,14 @@ class VariableEditor extends React.Component {
8982
getEditIcon = () => {
9083
const {variable, namespace, theme} = this.props;
9184
const {editMode} = this.state;
92-
const tooltip_id = variable.name + '_'
93-
+ namespace + '-edit-tooltip';
9485
let display = 'inline-block';
9586

9687
if (editMode) {
9788
display = 'none';
9889
}
9990

10091
return (
101-
<div
102-
class="click-to-edit"
103-
data-tip='edit this value'
104-
data-for={tooltip_id} >
105-
<ReactTooltip
106-
effect="solid"
107-
id={tooltip_id}
108-
place="right"
109-
delayShow={1000} />
92+
<div class="click-to-edit" >
11093
<Edit
11194
class="click-to-edit-icon"
11295
{...Theme(theme, 'editVarIcon')}

src/js/components/VariableMeta.js

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
//clipboard library
1212
//https://www.npmjs.com/package/clipboard
1313
import Clipboard from 'clipboard';
14-
import ReactTooltip from 'react-tooltip';
1514

1615
//theme
1716
import Theme from './../themes/getStyle';
@@ -62,10 +61,7 @@ export default class extends React.Component {
6261
getCopyComponent = () => {
6362
const {id, copy_state} = this.state;
6463
const {src, size, theme, enableClipboard} = this.props;
65-
const tooltip_id = 'tooltip-' + id;
66-
//had to jump through some hoops to get the
67-
//react-tooltip to act like a react component should.
68-
//it does not support dynamic content updates
64+
6965
let style = Theme(theme, 'copy-to-clipboard').style;
7066
return (
7167
enableClipboard ?
@@ -76,35 +72,16 @@ export default class extends React.Component {
7672
display:copy_state=='success' ? 'none' : 'inline-block'
7773
}}
7874
data-clipboard-text={JSON.stringify(src, null, ' ')}
79-
id={"clipboard-container-" + id}
80-
data-tip='copy to clipboard'
81-
data-for={tooltip_id} >
75+
id={"clipboard-container-" + id} >
8276
<Clippy {...Theme(theme, 'copy-icon')} />
83-
<ReactTooltip
84-
effect="solid"
85-
class="rjv-tooltip"
86-
id={tooltip_id}
87-
place="right"
88-
delayShow={1000} />
8977
</span>
9078
<span
9179
style={{
9280
...style,
9381
display:copy_state == 'success'
9482
? 'inline-block' : 'none'
95-
}}
96-
data-tip='copied'
97-
data-for={tooltip_id + '-success'} >
83+
}} >
9884
<Clippy {...Theme(theme, 'copy-icon')} />
99-
<ReactTooltip
100-
effect="solid"
101-
class="rjv-tooltip"
102-
id={tooltip_id + '-success'}
103-
place="right"
104-
afterHide={()=>{
105-
this.setState({copy_state: null});
106-
}}
107-
delayShow={0} />
10885
</span>
10986
</span>
11087
: null

0 commit comments

Comments
 (0)