Skip to content

Commit

Permalink
Update Form
Browse files Browse the repository at this point in the history
Add peerDependencies
  • Loading branch information
e1emeb0t committed Aug 7, 2017
1 parent d224e5c commit dc3f07a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
8 changes: 7 additions & 1 deletion libs/editor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ export default class Editor extends Component {
this.cm.setValue(value)

this.cm.on('changes', cm => {
onChange && onChange(cm.getValue())
if (onChange) {
clearTimeout(this.timeout);

this.timeout = setTimeout(() => {
onChange(cm.getValue());
}, 300);
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "element-react",
"version": "1.1.4",
"version": "1.1.5",
"description": "Element UI for React",
"private": false,
"main": "dist/npm/es5/index.js",
Expand Down Expand Up @@ -86,6 +86,10 @@
"react-transition-group": "^1.2.0",
"throttle-debounce": "^1.0.1"
},
"peerDependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1"
},
"jest": {
"testRegex": "(/jest/.+\\.(js|jsx)$)|_test.jsx?$",
"testPathIgnorePatterns": [
Expand Down
8 changes: 4 additions & 4 deletions site/docs/en-US/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ render() {
</Form.Item>
<Form.Item label="Activity time">
<Layout.Col span="11">
<Form.Item prop="date1">
<Form.Item prop="date1" labelWidth="0px">
<DatePicker
value={this.state.form.date1}
placeholder="Pick a date"
Expand All @@ -59,7 +59,7 @@ render() {
</Layout.Col>
<Layout.Col className="line" span="2">-</Layout.Col>
<Layout.Col span="11">
<Form.Item prop="date2">
<Form.Item prop="date2" labelWidth="0px">
<TimePicker
value={this.state.form.date2}
selectableRange="18:30:00 - 20:30:00"
Expand Down Expand Up @@ -295,7 +295,7 @@ render() {
</Form.Item>
<Form.Item label="Activity time" required={true}>
<Layout.Col span="11">
<Form.Item prop="date1">
<Form.Item prop="date1" labelWidth="0px">
<DatePicker
value={this.state.form.date1}
placeholder="Pick a date"
Expand All @@ -305,7 +305,7 @@ render() {
</Layout.Col>
<Layout.Col className="line" span="2">-</Layout.Col>
<Layout.Col span="11">
<Form.Item prop="date2">
<Form.Item prop="date2" labelWidth="0px">
<TimePicker
value={this.state.form.date2}
selectableRange="18:30:00 - 20:30:00"
Expand Down
8 changes: 4 additions & 4 deletions site/docs/zh-CN/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ render() {
</Form.Item>
<Form.Item label="活动时间">
<Layout.Col span="11">
<Form.Item prop="date1">
<Form.Item prop="date1" labelWidth="0px">
<DatePicker
value={this.state.form.date1}
placeholder="选择日期"
Expand All @@ -59,7 +59,7 @@ render() {
</Layout.Col>
<Layout.Col className="line" span="2">-</Layout.Col>
<Layout.Col span="11">
<Form.Item prop="date2">
<Form.Item prop="date2" labelWidth="0px">
<TimePicker
value={this.state.form.date2}
selectableRange="18:30:00 - 20:30:00"
Expand Down Expand Up @@ -294,7 +294,7 @@ render() {
</Form.Item>
<Form.Item label="活动时间" required={true}>
<Layout.Col span="11">
<Form.Item prop="date1">
<Form.Item prop="date1" labelWidth="0px">
<DatePicker
value={this.state.form.date1}
placeholder="选择日期"
Expand All @@ -304,7 +304,7 @@ render() {
</Layout.Col>
<Layout.Col className="line" span="2">-</Layout.Col>
<Layout.Col span="11">
<Form.Item prop="date2">
<Form.Item prop="date2" labelWidth="0px">
<TimePicker
value={this.state.form.date2}
selectableRange="18:30:00 - 20:30:00"
Expand Down

0 comments on commit dc3f07a

Please sign in to comment.