Skip to content

Commit b238c8f

Browse files
committed
Initial rebuild and prettify.
1 parent f7ec6a4 commit b238c8f

File tree

5 files changed

+74
-73
lines changed

5 files changed

+74
-73
lines changed

build/assets/js/components/logic/ErnestLogic/ErnestLogic.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
RichUtils,
1010
SelectionState
1111
} from 'draft-js';
12-
import {stateToHTML} from 'draft-js-export-html';
12+
import { stateToHTML } from 'draft-js-export-html';
1313

1414
// utils
1515
import Constants from '../../../utils/Constants';
@@ -29,10 +29,11 @@ class ErnestLogic extends React.Component {
2929
super(props);
3030

3131
const value = props.value;
32-
const contentState = value && value.raw && value.raw !== '' ? convertFromRaw(value.raw) : false;
33-
const editorState = contentState
34-
? EditorState.createWithContent(contentState)
35-
: EditorState.createEmpty();
32+
const contentState =
33+
value && value.raw && value.raw !== '' ? convertFromRaw(value.raw) : false;
34+
const editorState = contentState
35+
? EditorState.createWithContent(contentState)
36+
: EditorState.createEmpty();
3637

3738
this.state = {
3839
editor: editorState
@@ -141,7 +142,7 @@ class ErnestLogic extends React.Component {
141142
* @param {RawDraftContentState} newProps.value
142143
* @returns {boolean}
143144
*/
144-
isContentFromPropsNew = (newProps: { value: {raw: RawDraftContentState }}) => {
145+
isContentFromPropsNew = (newProps: { value: { raw: RawDraftContentState } }) => {
145146
const editorState = this.state.editor;
146147
const currentRaw = JSON.stringify(convertToRaw(editorState.getCurrentContent()));
147148
const nextRaw = JSON.stringify(newProps.value.raw);
@@ -155,7 +156,7 @@ class ErnestLogic extends React.Component {
155156
*/
156157
updateEditorStateFromValue = (value: RawDraftContentState) => {
157158
if (value && value !== '') {
158-
const editorState = this.state.editor;
159+
const editorState = this.state.editor;
159160
const contentState = convertFromRaw(value);
160161
const newEditorState = EditorState.push(editorState, contentState);
161162
this.updateState({ editor: newEditorState });
@@ -186,15 +187,15 @@ class ErnestLogic extends React.Component {
186187
console.groupEnd('===ErnestLogic===');
187188
}
188189
return this.state;
189-
};
190-
191-
updateValue = (editor: EditorState) => {
192-
const value = {
193-
raw: this.convertEditorStateToValue(this.state.editor),
194-
html: this.convertEditorStateToHtml(this.state.editor)
195-
};
196-
this.props.onValueChange(value);
197-
}
190+
};
191+
192+
updateValue = (editor: EditorState) => {
193+
const value = {
194+
raw: this.convertEditorStateToValue(this.state.editor),
195+
html: this.convertEditorStateToHtml(this.state.editor)
196+
};
197+
this.props.onValueChange(value);
198+
};
198199

199200
// Event Handlers //////////////////////////////////////////////////////////
200201

@@ -212,10 +213,10 @@ class ErnestLogic extends React.Component {
212213
const newEditorState = StyleHelpers.toggleBlockType(this.state.editor, buttonType);
213214

214215
this.updateState({ editor: newEditorState }, () => {
215-
this.updateValue(this.state.editor);
216+
this.updateValue(this.state.editor);
216217
});
217-
};
218-
218+
};
219+
219220
/**
220221
* @method onInlineClick
221222
* @param {Event} e
@@ -237,7 +238,7 @@ class ErnestLogic extends React.Component {
237238
const newEditorState = StyleHelpers.toggleInlineStyle(this.state.editor, options);
238239

239240
this.updateState({ editor: newEditorState }, () => {
240-
this.updateValue(this.state.editor);
241+
this.updateValue(this.state.editor);
241242
});
242243
};
243244

@@ -261,7 +262,7 @@ class ErnestLogic extends React.Component {
261262
this.updateState({ editor: cleaned }, () => {
262263
const highlighted = this.highlightSuggestions(this.state.editor);
263264
this.updateState({ editor: highlighted }, () => {
264-
this.updateValue(this.state.editor);
265+
this.updateValue(this.state.editor);
265266
});
266267
});
267268
};

build/assets/js/components/views/Ernest/Ernest.js

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -39,53 +39,53 @@ const styleMap = {
3939
* @returns {JSX.Element}
4040
*/
4141
class Ernest extends React.Component {
42-
constructor (props) {
43-
super(props);
44-
}
42+
constructor(props) {
43+
super(props);
44+
}
45+
46+
// React Lifecycle Methods /////////////////////////////////////////////////
47+
48+
// Helper Functions ////////////////////////////////////////////////////////
4549

46-
// React Lifecycle Methods /////////////////////////////////////////////////
47-
48-
// Helper Functions ////////////////////////////////////////////////////////
49-
5050
// Event Handlers //////////////////////////////////////////////////////////
5151

52-
/**
53-
* @method onFocusClick - If the user clicks on the container outside of the
54-
* actual editor, focus on the editor.
55-
* @param {Event} e
56-
* @returns {void}
57-
*/
58-
onFocusClick = (e) => {
59-
if (e) {
60-
e.preventDefault();
61-
}
62-
this.refs.editor.focus();
63-
}
52+
/**
53+
* @method onFocusClick - If the user clicks on the container outside of the
54+
* actual editor, focus on the editor.
55+
* @param {Event} e
56+
* @returns {void}
57+
*/
58+
onFocusClick = (e) => {
59+
if (e) {
60+
e.preventDefault();
61+
}
62+
this.refs.editor.focus();
63+
};
6464

6565
// Render Assisting Methods ////////////////////////////////////////////////
6666

67-
// Render //////////////////////////////////////////////////////////////////
67+
// Render //////////////////////////////////////////////////////////////////
6868

69-
render = () => {
70-
const events = this.props.events;
71-
const editor = this.props.editor;
72-
const value = editor ? editor : EditorState.createEmpty();
69+
render = () => {
70+
const events = this.props.events;
71+
const editor = this.props.editor;
72+
const value = editor ? editor : EditorState.createEmpty();
7373

74-
return (
75-
<div className="ernest-container">
76-
<Toolbar events={events} />
77-
<div className="text-editor-wrapper" onClick={this.onFocusClick}>
78-
<Editor
79-
customStyleMap={styleMap}
80-
editorState={value}
81-
onChange={events.onValueChange}
82-
ref="editor"
83-
/>
84-
</div>
85-
<Suggestions suggestions={this.props.suggestions} />
86-
</div>
87-
);
88-
}
89-
};
74+
return (
75+
<div className="ernest-container">
76+
<Toolbar events={events} />
77+
<div className="text-editor-wrapper" onClick={this.onFocusClick}>
78+
<Editor
79+
customStyleMap={styleMap}
80+
editorState={value}
81+
onChange={events.onValueChange}
82+
ref="editor"
83+
/>
84+
</div>
85+
<Suggestions suggestions={this.props.suggestions} />
86+
</div>
87+
);
88+
};
89+
}
9090

9191
module.exports = Ernest;

build/assets/js/controllers/AngularWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const AngularWrapper = function($scope, $element) {
2626
* the Angular controller's state.
2727
*/
2828
$scope.updateAngular = function(value) {
29-
$scope.model.value = value;
29+
$scope.model.value = value;
3030
$scope.$apply();
3131
};
3232

build/assets/js/utils/Constants.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ const Constants = {
1111
UNORDERED_LIST: 'unordered-list-item',
1212
ORDERED_LIST: 'ordered-list-item'
1313
},
14-
DEFAULT_REASON_KEYS: 'passive,illusion,so,thereIs,weasel,adverb,tooWordy,cliches',
15-
HIGHLIGHT_COLORS: {
16-
LIGHT_GREEN: 'lightgreen',
17-
ADVERB: '#c4e3f3',
18-
PASSIVE: '#c4ed9d',
19-
TOOWORDY: '#e4b9b9',
20-
SOTHEREISWEASEL: '#e3b7e8',
21-
CLICHETOBEILLUSION: '#f7ecb5'
22-
},
14+
DEFAULT_REASON_KEYS: 'passive,illusion,so,thereIs,weasel,adverb,tooWordy,cliches',
15+
HIGHLIGHT_COLORS: {
16+
LIGHT_GREEN: 'lightgreen',
17+
ADVERB: '#c4e3f3',
18+
PASSIVE: '#c4ed9d',
19+
TOOWORDY: '#e4b9b9',
20+
SOTHEREISWEASEL: '#e3b7e8',
21+
CLICHETOBEILLUSION: '#f7ecb5'
22+
},
2323
StyleKeys: {
2424
BOLD: 'BOLD',
2525
HIGHLIGHT: 'HIGHLIGHT',
@@ -29,7 +29,7 @@ const Constants = {
2929
HIGHLIGHT_SOTHEREISWEASEL: 'HIGHLIGHT_SOTHEREISWEASEL',
3030
HIGHLIGHT_CLICHETOBEILLUSION: 'HIGHLIGHT_CLICHETOBEILLUSION',
3131
ITALIC: 'ITALIC'
32-
}
32+
}
3333
};
3434

3535
module.exports = Constants;

build/dist/App_Plugins/Ernest/js/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)