File tree Expand file tree Collapse file tree 5 files changed +28
-32
lines changed
fixtures/selection-events Expand file tree Collapse file tree 5 files changed +28
-32
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const ReactDOM = window.ReactDOM;
4
4
class IframePortal extends React . Component {
5
5
state = { ref : null } ;
6
6
7
- handleRef = ( ref ) => {
7
+ handleRef = ref => {
8
8
if ( ref !== this . state . ref ) {
9
9
this . setState ( { ref} ) ;
10
10
if ( ref && ref . contentDocument && this . props . head ) {
@@ -19,15 +19,16 @@ class IframePortal extends React.Component {
19
19
if ( ref && ref . contentDocument ) {
20
20
portal = ReactDOM . createPortal (
21
21
this . props . children ,
22
- ref . contentDocument . body ,
22
+ ref . contentDocument . body
23
23
) ;
24
24
}
25
25
26
26
return (
27
27
< div >
28
28
< iframe
29
- style = { { border : 'none' , height : this . props . height } }
30
- ref = { this . handleRef } />
29
+ style = { { border : 'none' , height : this . props . height } }
30
+ ref = { this . handleRef }
31
+ />
31
32
{ portal }
32
33
</ div >
33
34
) ;
@@ -38,16 +39,13 @@ class IframeSubtree extends React.Component {
38
39
warned = false ;
39
40
render ( ) {
40
41
if ( ! this . warned ) {
41
- console . error ( `IFrame has not yet been implemented for React v${ React . version } ` ) ;
42
+ console . error (
43
+ `IFrame has not yet been implemented for React v${ React . version } `
44
+ ) ;
42
45
this . warned = true ;
43
46
}
44
- return (
45
- < div >
46
- { this . props . children }
47
- </ div >
48
- )
47
+ return < div > { this . props . children } </ div > ;
49
48
}
50
49
}
51
50
52
-
53
- export default ReactDOM . createPortal ? IframePortal : IframeSubtree ;
51
+ export default ( ReactDOM . createPortal ? IframePortal : IframeSubtree ) ;
Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ import Iframe from '../../Iframe';
3
3
const React = window . React ;
4
4
const { EditorState, Editor} = window . Draft ;
5
5
6
-
7
6
export default class DraftJsEditorTestCase extends React . Component {
8
7
constructor ( props ) {
9
8
super ( props ) ;
10
9
this . state = { editorState : EditorState . createEmpty ( ) } ;
11
- this . onChange = ( editorState ) => this . setState ( { editorState} ) ;
10
+ this . onChange = editorState => this . setState ( { editorState} ) ;
12
11
}
13
12
render ( ) {
14
13
return (
@@ -19,15 +18,20 @@ export default class DraftJsEditorTestCase extends React.Component {
19
18
works in an iframe." >
20
19
< TestCase . Steps >
21
20
< li > Enter some text into the Draft.js editor (grey outlined box)</ li >
22
- < li > Change your cursor position to somewhere in the middle of the text</ li >
21
+ < li >
22
+ Change your cursor position to somewhere in the middle of the text
23
+ </ li >
23
24
< li > Enter a new character</ li >
24
25
</ TestCase . Steps >
25
26
< TestCase . ExpectedResult >
26
27
The cursor should not jump positions
27
28
</ TestCase . ExpectedResult >
28
29
< Iframe height = { 60 } >
29
- < div style = { { border : '1px solid grey' } } >
30
- < Editor editorState = { this . state . editorState } onChange = { this . onChange } />
30
+ < div style = { { border : '1px solid grey' } } >
31
+ < Editor
32
+ editorState = { this . state . editorState }
33
+ onChange = { this . onChange }
34
+ />
31
35
</ div >
32
36
</ Iframe >
33
37
</ TestCase >
Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ import Iframe from '../../Iframe';
3
3
const React = window . React ;
4
4
5
5
export default class ReorderedInputsTestCase extends React . Component {
6
-
7
- state = { count : 0 } ;
6
+ state = { count : 0 } ;
8
7
9
8
componentDidMount ( ) {
10
9
this . interval = setInterval ( ( ) => {
11
- this . setState ( { count : this . state . count + 1 } ) ;
10
+ this . setState ( { count : this . state . count + 1 } ) ;
12
11
} , 2000 ) ;
13
12
}
14
13
@@ -29,9 +28,7 @@ export default class ReorderedInputsTestCase extends React.Component {
29
28
30
29
render ( ) {
31
30
return (
32
- < TestCase
33
- title = "Reordered input elements in iframes"
34
- description = "" >
31
+ < TestCase title = "Reordered input elements in iframes" description = "" >
35
32
< TestCase . Steps >
36
33
< li > The two inputs below swap positions every two seconds</ li >
37
34
< li > Select the text in either of them</ li >
@@ -40,10 +37,8 @@ export default class ReorderedInputsTestCase extends React.Component {
40
37
< TestCase . ExpectedResult >
41
38
The selection you made should be maintained
42
39
</ TestCase . ExpectedResult >
43
- < Iframe height = { 50 } >
44
- { this . renderInputs ( ) }
45
- </ Iframe >
40
+ < Iframe height = { 50 } > { this . renderInputs ( ) } </ Iframe >
46
41
</ TestCase >
47
- )
42
+ ) ;
48
43
}
49
44
}
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import ReorderedInputsTestCase from './ReorderedInputsTestCase';
5
5
import DraftJsEditorTestCase from './DraftJsEditorTestCase' ;
6
6
const React = window . React ;
7
7
8
-
9
8
export default function SelectionEvents ( ) {
10
9
return (
11
10
< FixtureSet
@@ -21,4 +20,4 @@ export default function SelectionEvents() {
21
20
< DraftJsEditorTestCase />
22
21
</ FixtureSet >
23
22
) ;
24
- } ;
23
+ }
Original file line number Diff line number Diff line change 1
- import semver from 'semver'
1
+ import semver from 'semver' ;
2
2
3
3
/**
4
4
* Take a version from the window query string and load a specific
@@ -41,14 +41,14 @@ export default function loadReact() {
41
41
// @TODO We're using a build of draft-js provided by @acusti in https://github.com/facebook/react/pull/12037
42
42
// This is because currently draft doesn't support iframes. This should be changed back to the official
43
43
// release on unpkg once the draft fixes are merged.
44
- const DRAFT_JS_PATH = 'https://cdn.rawgit.com/brandcast/draft-js-built/d6c2ffc64914b001411356c0bfab24e831bc5429/dist/Draft.js' ;
44
+ const DRAFT_JS_PATH =
45
+ 'https://cdn.rawgit.com/brandcast/draft-js-built/d6c2ffc64914b001411356c0bfab24e831bc5429/dist/Draft.js' ;
45
46
let REACT_PATH = 'react.development.js' ;
46
47
let DOM_PATH = 'react-dom.development.js' ;
47
48
48
49
let query = parseQuery ( window . location . search ) ;
49
50
let version = query . version || 'local' ;
50
51
51
-
52
52
if ( version !== 'local' ) {
53
53
const { major, minor, prerelease} = semver ( version ) ;
54
54
const [ preReleaseStage , preReleaseVersion ] = prerelease ;
You can’t perform that action at this time.
0 commit comments