Fix pre-filling rename dialog with file name
This commit is contained in:
@ -30343,9 +30343,8 @@ var Dialog = (function (_Component) {
|
||||
var title = _props.title;
|
||||
var description = _props.description;
|
||||
var active = _props.active;
|
||||
var value = _props.value;
|
||||
|
||||
var conditionalInput = input ? _react2['default'].createElement('input', { ref: 'input', defaultValue: value }) : '';
|
||||
var conditionalInput = input ? _react2['default'].createElement('input', { ref: 'input' }) : '';
|
||||
|
||||
var buttons = this.props.buttons.map(function (button, i) {
|
||||
return _react2['default'].createElement(
|
||||
@ -30388,6 +30387,15 @@ var Dialog = (function (_Component) {
|
||||
groupButtons
|
||||
);
|
||||
}
|
||||
}, {
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate() {
|
||||
if (!this.props.value) return;
|
||||
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
input.value = this.props.value;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Dialog;
|
||||
@ -31584,6 +31592,8 @@ var _store = require('store');
|
||||
|
||||
var _store2 = _interopRequireDefault(_store);
|
||||
|
||||
var INVALID_NAME = 'Please enter a valid name.';
|
||||
|
||||
exports['default'] = {
|
||||
createDialog: {
|
||||
title: 'Create',
|
||||
@ -31594,6 +31604,8 @@ exports['default'] = {
|
||||
action: function action() {
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
||||
|
||||
var cwd = _store2['default'].getState().get('cwd');
|
||||
var path = cwd + '/' + input.value;
|
||||
var action = (0, _actionsFile.create)(path.replace(/^\//, ''));
|
||||
@ -31607,6 +31619,8 @@ exports['default'] = {
|
||||
action: function action() {
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
||||
|
||||
var cwd = _store2['default'].getState().get('cwd');
|
||||
var path = cwd + '/' + input.value;
|
||||
var action = (0, _actionsFile.create)(path.replace(/^\//, ''), true);
|
||||
@ -31640,6 +31654,8 @@ exports['default'] = {
|
||||
action: function action() {
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
||||
|
||||
var activeFile = _store2['default'].getState().get('activeFile');
|
||||
this.props.dispatch((0, _actionsFile.rename)(activeFile, input.value));
|
||||
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||
@ -31689,6 +31705,8 @@ exports['default'] = {
|
||||
action: function action() {
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
||||
|
||||
var action = (0, _actionsFilesView.search)(input.value);
|
||||
this.props.dispatch(action);
|
||||
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||
|
Reference in New Issue
Block a user