Navigation Menu

Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #758 from GraysonNull/16604-key-commands
Browse files Browse the repository at this point in the history
16604 key commands
  • Loading branch information
GraysonNull committed Dec 13, 2018
2 parents 66561aa + 469eb29 commit 04831e9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion web/init/package.json
Expand Up @@ -20,7 +20,7 @@
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.17.11",
"rc-progress": "^2.2.5",
"react-ace": "^6.1.4",
"react-ace": "^6.2.0",
"react-document-title": "^2.0.3",
"react-modal": "^3.5.1",
"react-monaco-editor": "^0.18.0",
Expand Down
20 changes: 18 additions & 2 deletions web/init/src/components/kustomize/HelmValuesEditor.jsx
Expand Up @@ -31,19 +31,22 @@ export default class HelmValuesEditor extends React.Component {
}

componentDidMount() {
if(this.props.getStep.values) {
window.addEventListener("keydown", this.handleKeyboardSave);
if (this.props.getStep.values) {
this.setState({
initialSpecValue: this.props.getStep.values,
specValue: this.props.getStep.values,
initialHelmReleaseName: this.props.getStep.helmName,
helmReleaseName: this.props.getStep.helmName,
});
this.helmEditor.editor.getSession().setValue(this.props.getStep.values); // this resets the UndoManager and prevents the editor from being able to be wiped out by too many CMD+Z's
}
}



getLinterErrors = (specContents) => {
if (specContents === "") return;

const errors = new linter.Linter(specContents).lint();
let markers = [];
for (let error of errors) {
Expand Down Expand Up @@ -138,6 +141,19 @@ export default class HelmValuesEditor extends React.Component {
}
}

handleKeyboardSave = (e) => {
const sKey = e.keyCode === 83;
if (sKey && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
e.stopPropagation();
this.handleSaveValues(false);
}
}

componentWillUnmount() {
window.removeEventListener("keydown", this.handleKeyboardSave);
}

handleOnChangehelmReleaseName = (helmReleaseName) => this.setState({ helmReleaseName })

render() {
Expand Down
22 changes: 11 additions & 11 deletions web/init/yarn.lock
Expand Up @@ -2234,7 +2234,7 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0"
concat-map "0.0.1"

brace@^0.11.0, brace@^0.11.1:
brace@^0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/brace/-/brace-0.11.1.tgz#4896fcc9d544eef45f4bb7660db320d3b379fe58"
integrity sha1-SJb8ydVE7vRfS7dmDbMg07N5/lg=
Expand Down Expand Up @@ -3469,7 +3469,7 @@ dezalgo@^1.0.0, dezalgo@^1.0.1, dezalgo@^1.0.2, dezalgo@~1.0.3:
asap "^2.0.0"
wrappy "1"

diff-match-patch@^1.0.0:
diff-match-patch@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.4.tgz#6ac4b55237463761c4daf0dc603eb869124744b1"
integrity sha512-Uv3SW8bmH9nAtHKaKSanOQmj2DnlH65fUpcrMdfdaOxUG02QQ4YGZ8AE7kKOMisF7UqvOlGKVYWRvezdncW9lg==
Expand Down Expand Up @@ -6339,7 +6339,7 @@ lodash.isequal@^3.0:
lodash._baseisequal "^3.0.0"
lodash._bindcallback "^3.0.0"

lodash.isequal@^4.1.1, lodash.isequal@^4.5.0:
lodash.isequal@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=
Expand Down Expand Up @@ -8347,16 +8347,16 @@ rc@^1.1.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"

react-ace@^6.1.4:
version "6.1.4"
resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-6.1.4.tgz#33d93a83ae46c61f23b1801df79b71837a328b75"
integrity sha512-a8/lAsy2bfi7Ho+3Kaj8hBPR+PEiCTG9xFG9LIjCJrv5WQFYFpeFTiPWA96M3t+LgIDFFltwfVTwD2pmdAVOxQ==
react-ace@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/react-ace/-/react-ace-6.2.0.tgz#9ab0fd88cd1ef6712fec4b243b61431964481c11"
integrity sha512-Cr27xFNZV2wlQi+mFjgUWfd3yPZV84Sf7XVrEXkDBZmQ5I/oY3x4KvtBjX6ImN7SCWu3sU6z9F3Zh6jH3/jtzw==
dependencies:
brace "^0.11.0"
diff-match-patch "^1.0.0"
brace "^0.11.1"
diff-match-patch "^1.0.4"
lodash.get "^4.4.2"
lodash.isequal "^4.1.1"
prop-types "^15.5.8"
lodash.isequal "^4.5.0"
prop-types "^15.6.2"

react-docgen@^2.7.0:
version "2.21.0"
Expand Down

0 comments on commit 04831e9

Please sign in to comment.