@kedao/editor
Version:
Rich Text Editor Based On Draft.js
36 lines • 1.51 kB
JavaScript
import './style.scss';
import React from 'react';
export default class Dropdown extends React.Component {
constructor() {
super(...arguments);
this.state = {
rows: 3,
columns: 3
};
this.inputValue = (event) => {
this.setState({
[event.target.name]: event.target.value
});
};
this.confirmInsert = () => {
this.props.onConfirm(this.state);
};
this.cancelInsert = () => {
this.props.onCancel();
};
}
componentDidMount() {
this.setState({
rows: this.props.defaultRows,
columns: this.props.defaultColumns
});
}
render() {
return (React.createElement("div", { className: "bf-table-dropdown-control" },
React.createElement("input", { placeholder: this.props.language.columns, className: "input", type: "text", name: "columns", value: this.state.columns, onChange: this.inputValue }),
React.createElement("label", { className: "label" }, "x"),
React.createElement("input", { placeholder: this.props.language.rows, className: "input", type: "text", name: "rows", value: this.state.rows, onChange: this.inputValue }),
React.createElement("button", { disabled: !this.state.rows || !this.state.columns, className: "button primary", onClick: this.confirmInsert }, this.props.language.insertTable)));
}
}
//# sourceMappingURL=dropdown.js.map