-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/development'
# Conflicts: # README.md
- Loading branch information
Showing
52 changed files
with
1,543 additions
and
1,196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { PropTypes } from 'react'; | ||
|
||
|
||
const Icon = ({ children, iconLib }) => ( | ||
<i className={iconLib}>{children}</i> | ||
); | ||
|
||
Icon.defaultProps = { | ||
iconLib: 'material-icons' | ||
}; | ||
|
||
Icon.propTypes = { | ||
iconLib: PropTypes.string, | ||
children: PropTypes.any.isRequired | ||
} | ||
export default Icon; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React, { Component } from 'react'; | ||
import { EditorState, convertToRaw, ContentState } from 'draft-js'; | ||
import { Editor } from 'react-draft-wysiwyg'; | ||
import draftToHtml from 'draftjs-to-html'; | ||
import htmlToDraft from 'html-to-draftjs'; | ||
|
||
class EditorConvertToHTML extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
editorState: this.buildEditorState(this.props.value) | ||
} | ||
this.customOnChange = this.customOnChange.bind(this); | ||
this.catchEvent = this.catchEvent.bind(this); | ||
} | ||
|
||
buildEditorState(value) { | ||
const contentBlock = htmlToDraft(value || ''); | ||
const contentState = contentBlock ? ContentState.createFromBlockArray(contentBlock.contentBlocks) : ContentState.createFromText(''); | ||
const editorState = EditorState.createWithContent(contentState); | ||
return editorState; | ||
} | ||
|
||
componentWillReceiveProps({ value }) { | ||
if ((value && !this.props.value) || (!this.props.isEdit && value !== !this.props.value)) { | ||
this.setState({ editorState: this.buildEditorState(value) }); | ||
} | ||
} | ||
|
||
customOnChange(editorState) { | ||
this.setState({ | ||
editorState: editorState | ||
}); | ||
this.props.onChange(draftToHtml(convertToRaw(editorState.getCurrentContent()))); | ||
} | ||
|
||
catchEvent(evt) { | ||
evt.preventDefault(); | ||
evt.stopPropagation(); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div onKeyUp={this.catchEvent} > | ||
<Editor | ||
toolbarHidden={!this.props.isEdit} | ||
editorState={this.state.editorState} | ||
wrapperClassName='rich-text-wrapper' | ||
editorClassName='rich-text-editor' | ||
onEditorStateChange={this.customOnChange} | ||
readOnly={!this.props.isEdit} | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default EditorConvertToHTML; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { PropTypes } from 'react'; | ||
|
||
const onClickTab = (onClick) => (evt) => { | ||
evt.preventDefault(); | ||
evt.stopPropagation(); | ||
onClick(); | ||
}; | ||
|
||
const TabComponent = ({ tabs, children }) => ( | ||
<div className='mdl-tabs mdl-js-tabs mdl-js-ripple-effect is-upgraded'> | ||
<div className='mdl-tabs__tab-bar'> | ||
{tabs.map(({ label, isActive, onClick }, idx) => ( | ||
<a | ||
key={idx} | ||
href='#' | ||
onClick={onClickTab(onClick)} | ||
className={`mdl-tabs__tab ${isActive ? 'is-active' : ''}`} | ||
> | ||
{label} | ||
</a>) | ||
)} | ||
</div> | ||
<div className='mdl-tabs__panel is-active'>{children}</div> | ||
</div> | ||
); | ||
|
||
TabComponent.propTypes = { | ||
children: PropTypes.any.isRequired, | ||
tabs: PropTypes.arrayOf({ | ||
label: PropTypes.string.isRequired, | ||
isActive: PropTypes.bool.isRequired, | ||
onClick: PropTypes.func.isRequired | ||
}).isRequired | ||
} | ||
|
||
export default TabComponent; |
Oops, something went wrong.