Skip to content

Commit

Permalink
feat(core): 图片调整宽高input使用number
Browse files Browse the repository at this point in the history
  • Loading branch information
wowlusitong committed Mar 24, 2019
1 parent 174c29a commit 9430f69
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"workspaces": [
"packages/*"
],
"version": "0.0.1",
"description": "",
"main": "index.js",
"husky": {
Expand Down
12 changes: 10 additions & 2 deletions packages/core/src/scripts/components/tools/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,18 @@ export default class Image extends React.Component {
return (
<>
<Item tip="设置宽度">
<SlateInput value={width} onChange={this.handleChangeWidth} />
<SlateInput
type="number"
value={width}
onChange={this.handleChangeWidth}
/>
</Item>
<Item tip="设置高度">
<SlateInput value={height} onChange={this.handleChangeHeight} />
<SlateInput
type="number"
value={height}
onChange={this.handleChangeHeight}
/>
</Item>
<Item.Split />
<Item hover tip="替换" onClick={this.handleReplace}>
Expand Down
10 changes: 7 additions & 3 deletions packages/core/src/scripts/components/utils/SlateInput.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

export default class SmallInput extends React.Component {
export default class SlateInput extends React.Component {
constructor(props) {
super(props);

Expand Down Expand Up @@ -30,12 +30,12 @@ export default class SmallInput extends React.Component {
}

render() {
const { value } = this.props;
const { value, type } = this.props;

return (
<input
className="slate-input"
type="text"
type={type}
value={value}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
Expand All @@ -45,3 +45,7 @@ export default class SmallInput extends React.Component {
);
}
}

SlateInput.defaultProps = {
type: 'text'
};
2 changes: 1 addition & 1 deletion packages/core/src/styles/tool.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

.slate-input {
padding: 0px 3px;
width: 45px;
width: 50px;
outline: none;
border: 1px solid #d9d9d9;
border-radius: 3px;
Expand Down

0 comments on commit 9430f69

Please sign in to comment.