Skip to content

Commit 07ab814

Browse files
committed
copy literal to clipboard bugfix
1 parent 91b4c3c commit 07ab814

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

dev-server/src/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ import JsonViewer from './../../src/js/index';
1212
//render 2 different examples of the react-json-view component
1313
ReactDom.render(
1414
<div>
15+
<JsonViewer
16+
name="root"
17+
src={{
18+
key1: 8,
19+
key2: []
20+
}}
21+
enableClipboard={copy => console.log(copy)}
22+
/>
23+
<br />
24+
1525
{/* just pass in your JSON to the src attribute */}
1626
<JsonViewer
1727
sortKeys

src/js/components/VariableEditor.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class VariableEditor extends React.PureComponent {
4545
render() {
4646
const {
4747
variable,
48-
src,
4948
singleIndent,
5049
type,
5150
theme,
@@ -54,8 +53,7 @@ class VariableEditor extends React.PureComponent {
5453
enableClipboard,
5554
onEdit,
5655
onDelete,
57-
onSelect,
58-
rjvId
56+
onSelect
5957
} = this.props;
6058
const { editMode } = this.state;
6159

@@ -130,7 +128,7 @@ class VariableEditor extends React.PureComponent {
130128
hidden={editMode}
131129
src={variable.value}
132130
clickCallback={enableClipboard}
133-
{...{ theme, namespace }}
131+
{...{ theme, namespace: [...namespace, variable.name] }}
134132
/>
135133
) : null}
136134
{onEdit !== false && editMode == false

0 commit comments

Comments
 (0)