Skip to content

Commit b2bcb75

Browse files
committed
Upgrade react-live and handle events for contentEditable CodePane
1 parent 54aa556 commit b2bcb75

File tree

5 files changed

+75
-63
lines changed

5 files changed

+75
-63
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"normalize.css": "^7.0.0",
3131
"prismjs": "^1.6.0",
3232
"react-emotion": "^8.0.8",
33-
"react-live": "^1.8.0-1",
33+
"react-live": "^1.8.0-2",
3434
"react-redux": "^5.0.5",
3535
"react-transition-group": "^1.1.3",
3636
"react-typography": "^0.16.5",

src/components/__snapshots__/code-pane.test.js.snap

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ exports[`<CodePane /> should render correctly. 1`] = `
4343
"
4444
contentEditable={false}
4545
language="jsx"
46+
onClick={[Function]}
47+
onKeyDown={[Function]}
48+
onKeyUp={[Function]}
4649
styles={undefined}
4750
>
4851
<Editor
@@ -59,6 +62,9 @@ exports[`<CodePane /> should render correctly. 1`] = `
5962
"
6063
contentEditable={false}
6164
language="jsx"
65+
onClick={[Function]}
66+
onKeyDown={[Function]}
67+
onKeyUp={[Function]}
6268
styles={undefined}
6369
>
6470
<pre
@@ -67,21 +73,20 @@ exports[`<CodePane /> should render correctly. 1`] = `
6773
dangerouslySetInnerHTML={
6874
Object {
6975
"__html": "
70-
<span class=\\"token keyword\\">const</span> myButton <span class=\\"token operator\\">=</span> <span class=\\"token punctuation\\">(</span>
71-
<span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>CustomButton</span>
72-
<span class=\\"token attr-name\\">style</span><span class=\\"token script language-javascript\\"><span class=\\"token punctuation\\">=</span><span class=\\"token punctuation\\">{</span><span class=\\"token punctuation\\">{</span> background<span class=\\"token punctuation\\">:</span> <span class=\\"token string\\">'#f00'</span> <span class=\\"token punctuation\\">}</span><span class=\\"token punctuation\\">}</span></span>
73-
<span class=\\"token attr-name\\">onClick</span><span class=\\"token script language-javascript\\"><span class=\\"token punctuation\\">=</span><span class=\\"token punctuation\\">{</span><span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>action<span class=\\"token punctuation\\">}</span></span>
74-
<span class=\\"token punctuation\\">></span></span>
75-
Click Me
76-
<span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;/</span>CustomButton</span><span class=\\"token punctuation\\">></span></span>
77-
<span class=\\"token punctuation\\">)</span><span class=\\"token punctuation\\">;</span>
78-
",
76+
<span class=\\"token keyword\\">const</span> myButton <span class=\\"token operator\\">=</span> <span class=\\"token punctuation\\">(</span>
77+
<span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;</span>CustomButton</span>
78+
<span class=\\"token attr-name\\">style</span><span class=\\"token script language-javascript\\"><span class=\\"token punctuation\\">=</span><span class=\\"token punctuation\\">{</span><span class=\\"token punctuation\\">{</span> background<span class=\\"token punctuation\\">:</span> <span class=\\"token string\\">'#f00'</span> <span class=\\"token punctuation\\">}</span><span class=\\"token punctuation\\">}</span></span>
79+
<span class=\\"token attr-name\\">onClick</span><span class=\\"token script language-javascript\\"><span class=\\"token punctuation\\">=</span><span class=\\"token punctuation\\">{</span><span class=\\"token keyword\\">this</span><span class=\\"token punctuation\\">.</span>action<span class=\\"token punctuation\\">}</span></span>
80+
<span class=\\"token punctuation\\">></span></span>
81+
Click Me
82+
<span class=\\"token tag\\"><span class=\\"token tag\\"><span class=\\"token punctuation\\">&lt;/</span>CustomButton</span><span class=\\"token punctuation\\">></span></span>
83+
<span class=\\"token punctuation\\">)</span><span class=\\"token punctuation\\">;</span>
84+
",
7985
}
8086
}
81-
language="jsx"
82-
onClick={false}
83-
onKeyDown={false}
84-
onKeyUp={false}
87+
onClick={undefined}
88+
onKeyDown={undefined}
89+
onKeyUp={undefined}
8590
spellCheck="false"
8691
style={undefined}
8792
styles={undefined}

0 commit comments

Comments
 (0)