Skip to content

Commit fa26da8

Browse files
committed
fix: style issues
1 parent 8dfaff8 commit fa26da8

File tree

4 files changed

+42
-11
lines changed

4 files changed

+42
-11
lines changed

src/components/TuiEditor/TuiEditor.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
}
3131

3232
:global {
33+
// add style for heading list in headings selection popup, because 'all:revert' has been setted before
3334
.te-heading-add ul {
3435
list-style: none;
3536
}
3637

38+
// hide 'wysiwyg' and 'markdown' bottom selection
3739
.tui-editor-defaultUI .te-mode-switch-section {
3840
display: none !important
3941
}

src/components/TuiEditor/index.jsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
// wrap toast-ui editor with react and support react 15
1+
/*
2+
* TuiEditor
3+
* wrap toast-ui editor with react and support react 15
4+
*/
5+
26
import React from 'react'
7+
import PropTypes from 'prop-types'
38
import Editor from '@toast-ui/editor'
49
import styles from './TuiEditor.scss'
510
import cn from 'classnames'
611
import 'codemirror/lib/codemirror.css'
712
import '@toast-ui/editor/dist/toastui-editor.css'
813

9-
export default class extends React.Component {
14+
class TuiEditor extends React.Component {
1015
constructor(props) {
1116
super(props)
12-
this.onValueChange = this.onValueChange.bind(this)
17+
this.handleValueChange = this.handleValueChange.bind(this)
1318
}
1419

1520
getRootElement() {
@@ -33,7 +38,7 @@ export default class extends React.Component {
3338
componentDidMount() {
3439
const props = {
3540
...this.props,
36-
onChange: this.onValueChange
41+
onChange: this.handleValueChange
3742
}
3843
this.editorInst = new Editor({
3944
el: this.refs.rootEl,
@@ -42,9 +47,9 @@ export default class extends React.Component {
4247
this.bindEventHandlers(props)
4348
}
4449

45-
onValueChange(){
46-
if (this.props.valueChange) {
47-
this.props.valueChange(this.getInstance().getMarkdown())
50+
handleValueChange(){
51+
if (this.props.onChange) {
52+
this.props.onChange(this.getInstance().getMarkdown())
4853
}
4954
}
5055

@@ -63,7 +68,7 @@ export default class extends React.Component {
6368
if (this.props.className !== className) {
6469
return true
6570
}
66-
this.bindEventHandlers(nextProps, this.props)
71+
// this.bindEventHandlers(nextProps, this.props)
6772

6873
return false
6974
}
@@ -72,3 +77,14 @@ export default class extends React.Component {
7277
return <div ref="rootEl" className={cn(styles.editor, this.props.className)} />
7378
}
7479
}
80+
81+
82+
TuiEditor.propTypes = {
83+
onChange: PropTypes.func.isRequired,
84+
previewStyle: PropTypes.string.isRequired,
85+
height: PropTypes.string.isRequired,
86+
initialEditType: PropTypes.string.isRequired,
87+
initialValue: PropTypes.string,
88+
}
89+
90+
export default TuiEditor
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
/*
2+
* DescriptionField
3+
*/
4+
15
import React from 'react'
6+
import PropTypes from 'prop-types'
27

3-
import Editor from '../../../../components/TuiEditor'
8+
import TuiEditor from '../../../../components/TuiEditor'
49

510
const DescriptionField = (props) => (
6-
<Editor
11+
<TuiEditor
712
{...props}
813
previewStyle="vertical"
914
height="400px"
@@ -12,4 +17,12 @@ const DescriptionField = (props) => (
1217
/>
1318
)
1419

20+
21+
DescriptionField.propTypes = {
22+
onChange: PropTypes.func.isRequired,
23+
className: PropTypes.string,
24+
placeholder: PropTypes.string,
25+
value: PropTypes.string,
26+
}
27+
1528
export default DescriptionField

src/projects/detail/components/JobPickerRow/JobPickerRow.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class JobPickerRow extends React.PureComponent {
238238
</label>
239239
<DescriptionField
240240
className={`${isRowIncomplete && !value.description.trim() ? 'error' : ''}`}
241-
valueChange={this.handleDescriptionChange}
241+
onChange={this.handleDescriptionChange}
242242
placeholder="Job Description"
243243
value={value.description || ''}
244244
/>

0 commit comments

Comments
 (0)