mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
[web] remove common.ChildFocus
This commit is contained in:
parent
fab9dad940
commit
1d002182e3
@ -481,7 +481,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
value: true
|
value: true
|
||||||
});
|
});
|
||||||
exports.Splitter = exports.Router = exports.ChildFocus = exports.SettingsState = exports.StickyHeadMixin = exports.AutoScrollMixin = undefined;
|
exports.Splitter = exports.Router = exports.SettingsState = exports.StickyHeadMixin = exports.AutoScrollMixin = undefined;
|
||||||
|
|
||||||
var _react = require("react");
|
var _react = require("react");
|
||||||
|
|
||||||
@ -542,17 +542,6 @@ var SettingsState = exports.SettingsState = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var ChildFocus = exports.ChildFocus = {
|
|
||||||
contextTypes: {
|
|
||||||
returnFocus: _react2.default.PropTypes.func
|
|
||||||
},
|
|
||||||
returnFocus: function returnFocus() {
|
|
||||||
_reactDom2.default.findDOMNode(this).blur();
|
|
||||||
window.getSelection().removeAllRanges();
|
|
||||||
this.context.returnFocus();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var Router = exports.Router = {
|
var Router = exports.Router = {
|
||||||
contextTypes: {
|
contextTypes: {
|
||||||
location: _react2.default.PropTypes.object,
|
location: _react2.default.PropTypes.object,
|
||||||
@ -708,8 +697,6 @@ var _reactDom = require("react-dom");
|
|||||||
|
|
||||||
var _reactDom2 = _interopRequireDefault(_reactDom);
|
var _reactDom2 = _interopRequireDefault(_reactDom);
|
||||||
|
|
||||||
var _common = require("./common.js");
|
|
||||||
|
|
||||||
var _utils = require("../utils.js");
|
var _utils = require("../utils.js");
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
@ -927,7 +914,9 @@ var ValidateEditor = _react2.default.createClass({
|
|||||||
var ValueEditor = exports.ValueEditor = _react2.default.createClass({
|
var ValueEditor = exports.ValueEditor = _react2.default.createClass({
|
||||||
displayName: "ValueEditor",
|
displayName: "ValueEditor",
|
||||||
|
|
||||||
mixins: [_common.ChildFocus],
|
contextTypes: {
|
||||||
|
returnFocus: _react2.default.PropTypes.func
|
||||||
|
},
|
||||||
propTypes: {
|
propTypes: {
|
||||||
content: _react2.default.PropTypes.string.isRequired,
|
content: _react2.default.PropTypes.string.isRequired,
|
||||||
onDone: _react2.default.PropTypes.func.isRequired,
|
onDone: _react2.default.PropTypes.func.isRequired,
|
||||||
@ -944,11 +933,11 @@ var ValueEditor = exports.ValueEditor = _react2.default.createClass({
|
|||||||
_reactDom2.default.findDOMNode(this).focus();
|
_reactDom2.default.findDOMNode(this).focus();
|
||||||
},
|
},
|
||||||
onStop: function onStop() {
|
onStop: function onStop() {
|
||||||
this.returnFocus();
|
this.context.returnFocus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},{"../utils.js":26,"./common.js":4,"react":"react","react-dom":"react-dom"}],6:[function(require,module,exports){
|
},{"../utils.js":26,"react":"react","react-dom":"react-dom"}],6:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
@ -2924,7 +2913,9 @@ var FilterDocs = _react2.default.createClass({
|
|||||||
var FilterInput = _react2.default.createClass({
|
var FilterInput = _react2.default.createClass({
|
||||||
displayName: "FilterInput",
|
displayName: "FilterInput",
|
||||||
|
|
||||||
mixins: [_common.ChildFocus],
|
contextTypes: {
|
||||||
|
returnFocus: _react2.default.PropTypes.func
|
||||||
|
},
|
||||||
getInitialState: function getInitialState() {
|
getInitialState: function getInitialState() {
|
||||||
// Consider both focus and mouseover for showing/hiding the tooltip,
|
// Consider both focus and mouseover for showing/hiding the tooltip,
|
||||||
// because onBlur of the input is triggered before the click on the tooltip
|
// because onBlur of the input is triggered before the click on the tooltip
|
||||||
@ -2991,7 +2982,7 @@ var FilterInput = _react2.default.createClass({
|
|||||||
},
|
},
|
||||||
blur: function blur() {
|
blur: function blur() {
|
||||||
_reactDom2.default.findDOMNode(this.refs.input).blur();
|
_reactDom2.default.findDOMNode(this.refs.input).blur();
|
||||||
this.returnFocus();
|
this.context.returnFocus();
|
||||||
},
|
},
|
||||||
select: function select() {
|
select: function select() {
|
||||||
_reactDom2.default.findDOMNode(this.refs.input).select();
|
_reactDom2.default.findDOMNode(this.refs.input).select();
|
||||||
@ -3574,14 +3565,14 @@ var _lodash2 = _interopRequireDefault(_lodash);
|
|||||||
|
|
||||||
var _utils = require("../utils.js");
|
var _utils = require("../utils.js");
|
||||||
|
|
||||||
var _common = require("./common.js");
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
var Prompt = _react2.default.createClass({
|
var Prompt = _react2.default.createClass({
|
||||||
displayName: "Prompt",
|
displayName: "Prompt",
|
||||||
|
|
||||||
mixins: [_common.ChildFocus],
|
contextTypes: {
|
||||||
|
returnFocus: _react2.default.PropTypes.func
|
||||||
|
},
|
||||||
propTypes: {
|
propTypes: {
|
||||||
options: _react2.default.PropTypes.array.isRequired,
|
options: _react2.default.PropTypes.array.isRequired,
|
||||||
done: _react2.default.PropTypes.func.isRequired,
|
done: _react2.default.PropTypes.func.isRequired,
|
||||||
@ -3610,7 +3601,7 @@ var Prompt = _react2.default.createClass({
|
|||||||
},
|
},
|
||||||
done: function done(ret) {
|
done: function done(ret) {
|
||||||
this.props.done(ret);
|
this.props.done(ret);
|
||||||
this.returnFocus();
|
this.context.returnFocus();
|
||||||
},
|
},
|
||||||
getOptions: function getOptions() {
|
getOptions: function getOptions() {
|
||||||
var opts = [];
|
var opts = [];
|
||||||
@ -3689,7 +3680,7 @@ var Prompt = _react2.default.createClass({
|
|||||||
|
|
||||||
exports.default = Prompt;
|
exports.default = Prompt;
|
||||||
|
|
||||||
},{"../utils.js":26,"./common.js":4,"lodash":"lodash","react":"react","react-dom":"react-dom"}],18:[function(require,module,exports){
|
},{"../utils.js":26,"lodash":"lodash","react":"react","react-dom":"react-dom"}],18:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
@ -3785,6 +3776,8 @@ var ProxyAppMain = _react2.default.createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
focus: function focus() {
|
focus: function focus() {
|
||||||
|
document.activeElement.blur();
|
||||||
|
window.getSelection().removeAllRanges();
|
||||||
_reactDom2.default.findDOMNode(this).focus();
|
_reactDom2.default.findDOMNode(this).focus();
|
||||||
},
|
},
|
||||||
getMainComponent: function getMainComponent() {
|
getMainComponent: function getMainComponent() {
|
||||||
|
@ -52,18 +52,6 @@ export var SettingsState = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export var ChildFocus = {
|
|
||||||
contextTypes: {
|
|
||||||
returnFocus: React.PropTypes.func
|
|
||||||
},
|
|
||||||
returnFocus: function () {
|
|
||||||
ReactDOM.findDOMNode(this).blur();
|
|
||||||
window.getSelection().removeAllRanges();
|
|
||||||
this.context.returnFocus();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export var Router = {
|
export var Router = {
|
||||||
contextTypes: {
|
contextTypes: {
|
||||||
location: React.PropTypes.object,
|
location: React.PropTypes.object,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import {ChildFocus} from "./common.js";
|
|
||||||
import {Key} from "../utils.js";
|
import {Key} from "../utils.js";
|
||||||
|
|
||||||
var contentToHtml = function (content) {
|
var contentToHtml = function (content) {
|
||||||
@ -214,7 +213,9 @@ var ValidateEditor = React.createClass({
|
|||||||
Text Editor with mitmweb-specific convenience features
|
Text Editor with mitmweb-specific convenience features
|
||||||
*/
|
*/
|
||||||
export var ValueEditor = React.createClass({
|
export var ValueEditor = React.createClass({
|
||||||
mixins: [ChildFocus],
|
contextTypes: {
|
||||||
|
returnFocus: React.PropTypes.func
|
||||||
|
},
|
||||||
propTypes: {
|
propTypes: {
|
||||||
content: React.PropTypes.string.isRequired,
|
content: React.PropTypes.string.isRequired,
|
||||||
onDone: React.PropTypes.func.isRequired,
|
onDone: React.PropTypes.func.isRequired,
|
||||||
@ -232,6 +233,6 @@ export var ValueEditor = React.createClass({
|
|||||||
ReactDOM.findDOMNode(this).focus();
|
ReactDOM.findDOMNode(this).focus();
|
||||||
},
|
},
|
||||||
onStop: function () {
|
onStop: function () {
|
||||||
this.returnFocus();
|
this.context.returnFocus();
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -4,7 +4,7 @@ import $ from "jquery";
|
|||||||
|
|
||||||
import Filt from "../filt/filt.js";
|
import Filt from "../filt/filt.js";
|
||||||
import {Key} from "../utils.js";
|
import {Key} from "../utils.js";
|
||||||
import {Router, SettingsState, ChildFocus} from "./common.js";
|
import {Router, SettingsState} from "./common.js";
|
||||||
import {SettingsActions, FlowActions} from "../actions.js";
|
import {SettingsActions, FlowActions} from "../actions.js";
|
||||||
import {Query} from "../actions.js";
|
import {Query} from "../actions.js";
|
||||||
|
|
||||||
@ -51,7 +51,9 @@ var FilterDocs = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
var FilterInput = React.createClass({
|
var FilterInput = React.createClass({
|
||||||
mixins: [ChildFocus],
|
contextTypes: {
|
||||||
|
returnFocus: React.PropTypes.func
|
||||||
|
},
|
||||||
getInitialState: function () {
|
getInitialState: function () {
|
||||||
// Consider both focus and mouseover for showing/hiding the tooltip,
|
// Consider both focus and mouseover for showing/hiding the tooltip,
|
||||||
// because onBlur of the input is triggered before the click on the tooltip
|
// because onBlur of the input is triggered before the click on the tooltip
|
||||||
@ -118,7 +120,7 @@ var FilterInput = React.createClass({
|
|||||||
},
|
},
|
||||||
blur: function () {
|
blur: function () {
|
||||||
ReactDOM.findDOMNode(this.refs.input).blur();
|
ReactDOM.findDOMNode(this.refs.input).blur();
|
||||||
this.returnFocus();
|
this.context.returnFocus();
|
||||||
},
|
},
|
||||||
select: function () {
|
select: function () {
|
||||||
ReactDOM.findDOMNode(this.refs.input).select();
|
ReactDOM.findDOMNode(this.refs.input).select();
|
||||||
|
@ -3,10 +3,11 @@ import ReactDOM from 'react-dom';
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
|
||||||
import {Key} from "../utils.js";
|
import {Key} from "../utils.js";
|
||||||
import {ChildFocus} from "./common.js"
|
|
||||||
|
|
||||||
var Prompt = React.createClass({
|
var Prompt = React.createClass({
|
||||||
mixins: [ChildFocus],
|
contextTypes: {
|
||||||
|
returnFocus: React.PropTypes.func
|
||||||
|
},
|
||||||
propTypes: {
|
propTypes: {
|
||||||
options: React.PropTypes.array.isRequired,
|
options: React.PropTypes.array.isRequired,
|
||||||
done: React.PropTypes.func.isRequired,
|
done: React.PropTypes.func.isRequired,
|
||||||
@ -35,7 +36,7 @@ var Prompt = React.createClass({
|
|||||||
},
|
},
|
||||||
done: function (ret) {
|
done: function (ret) {
|
||||||
this.props.done(ret);
|
this.props.done(ret);
|
||||||
this.returnFocus();
|
this.context.returnFocus();
|
||||||
},
|
},
|
||||||
getOptions: function () {
|
getOptions: function () {
|
||||||
var opts = [];
|
var opts = [];
|
||||||
|
@ -55,6 +55,8 @@ var ProxyAppMain = React.createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
focus: function () {
|
focus: function () {
|
||||||
|
document.activeElement.blur();
|
||||||
|
window.getSelection().removeAllRanges();
|
||||||
ReactDOM.findDOMNode(this).focus();
|
ReactDOM.findDOMNode(this).focus();
|
||||||
},
|
},
|
||||||
getMainComponent: function () {
|
getMainComponent: function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user