mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-24 04:14:57 +08:00
web: try harder to fix editor
This commit is contained in:
@@ -49,9 +49,15 @@ var EditorBase = React.createClass({
|
||||
onBlur={this._stop}
|
||||
onKeyDown={this.onKeyDown}
|
||||
onInput={this.onInput}
|
||||
onPaste={this.onPaste}
|
||||
dangerouslySetInnerHTML={html}
|
||||
/>;
|
||||
},
|
||||
onPaste: function(e){
|
||||
e.preventDefault();
|
||||
var content = e.clipboardData.getData("text/plain");
|
||||
document.execCommand("insertHTML", false, content);
|
||||
},
|
||||
onFocus: function (e) {
|
||||
this.setState({editable: true}, function () {
|
||||
React.findDOMNode(this).focus();
|
||||
@@ -89,7 +95,7 @@ var EditorBase = React.createClass({
|
||||
this.cancel();
|
||||
break;
|
||||
case utils.Key.ENTER:
|
||||
if (this.props.submitOnEnter) {
|
||||
if (this.props.submitOnEnter && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
this.stop();
|
||||
}
|
||||
@@ -101,7 +107,6 @@ var EditorBase = React.createClass({
|
||||
onInput: function () {
|
||||
var node = React.findDOMNode(this);
|
||||
var content = this.props.nodeToContent(node);
|
||||
node.innerHTML = this.props.contentToHtml(content);
|
||||
this.props.onInput && this.props.onInput(content);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user