Skip to content

Commit 1dd917e

Browse files
committed
fixed imports and fixed bug with default printer code
1 parent 1960e1d commit 1dd917e

File tree

19 files changed

+27
-24
lines changed

19 files changed

+27
-24
lines changed

src/editor/document/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,22 @@ class Document extends Component {
3535
constructor(props) {
3636
super(props);
3737

38+
this.defaultCode =
39+
'// Welcome to codeprinter!\n' +
40+
'const foo = () => {\n' +
41+
" console.log('This is where your code will be printed out!');\n" +
42+
'};';
43+
3844
this.state = {
39-
code:
40-
'// Welcome to codeprinter!\n' +
41-
'const foo = () => {\n' +
42-
" console.log('This is where your code will be printed out!');\n" +
43-
'};'
45+
code: this.defaultCode
4446
};
4547

4648
this.onChange = this.onChange.bind(this);
4749
}
4850

4951
onChange(event) {
50-
this.setState({ code: event.target.value });
52+
const code = event.target.value === '' ? this.defaultCode : event.target.value;
53+
this.setState({ code });
5154
}
5255

5356
render() {

src/editor/document/index.story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { storiesOf } from '@storybook/react';
33
import 'bootstrap/dist/css/bootstrap.css';
4-
import Document from './index.js';
4+
import Document from './index';
55

66
storiesOf('Editor/Document', module).add('default', () => (
77
<Document font={'Anonymous Pro'} size={12} theme={'GitHub'} numbers={true} />

src/editor/document/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
3-
import { Document, themes } from './index.js';
3+
import { Document, themes } from './index';
44
import { Input } from 'reactstrap';
55
import SyntaxHighlighter from 'react-syntax-highlighter';
66

src/editor/index.story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { storiesOf } from '@storybook/react';
33
import 'bootstrap/dist/css/bootstrap.css';
4-
import Editor from './index.js';
4+
import Editor from './index';
55

66
storiesOf('Editor', module).add('default', () => <Editor />);

src/editor/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { shallow, mount } from 'enzyme';
3-
import Editor from './index.js';
3+
import Editor from './index';
44
import Toolbar from './toolbar';
55
import Document from './document';
66
import FontDropdown from './toolbar/font-dropdown';

src/editor/toolbar/font-dropdown/index.story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { storiesOf } from '@storybook/react';
33
import { action } from '@storybook/addon-actions';
44
import 'bootstrap/dist/css/bootstrap.css';
5-
import FontDropdown from './index.js';
5+
import FontDropdown from './index';
66

77
storiesOf('Editor/Toolbar/FontDropdown', module).add('default', () => {
88
const fonts = ['Anonymous Pro', 'Cousine', 'Cutive Mono'];

src/editor/toolbar/font-dropdown/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
3-
import FontDropdown from './index.js';
3+
import FontDropdown from './index';
44
import { DropdownItem } from 'reactstrap';
55

66
describe('Editor Toolbar FontDropdown', () => {

src/editor/toolbar/index.story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { storiesOf } from '@storybook/react';
33
import { action } from '@storybook/addon-actions';
44
import 'bootstrap/dist/css/bootstrap.css';
5-
import Toolbar from './index.js';
5+
import Toolbar from './index';
66

77
storiesOf('Editor/Toolbar', module).add('default', () => {
88
const fonts = ['Anonymous Pro', 'Cousine', 'Cutive Mono'];

src/editor/toolbar/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
3-
import Toolbar from './index.js';
3+
import Toolbar from './index';
44
import FontDropdown from './font-dropdown';
55
import SizeDropdown from './size-dropdown';
66
import ThemeDropdown from './theme-dropdown';

src/editor/toolbar/size-dropdown/index.story.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { storiesOf } from '@storybook/react';
33
import { action } from '@storybook/addon-actions';
44
import 'bootstrap/dist/css/bootstrap.css';
5-
import SizeDropdown from './index.js';
5+
import SizeDropdown from './index';
66

77
storiesOf('Editor/Toolbar/SizeDropdown', module).add('default', () => {
88
const sizes = [8, 9, 10, 11, 12];

0 commit comments

Comments
 (0)