mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-27 17:19:42 -04:00
Fix key-value-editor jumping
This commit is contained in:
1 parent
3df49dd410
commit
bb0b5df096
2 files changed
+12
-12
No files matched your search
@@ -988,7 +988,7 @@ export function _getAwsAuthHeaders(
|
||||
method: string,
|
||||
region?: string,
|
||||
service?: string,
|
||||
): Array<{ name: string, value: string, disabled?: boolean }> {
|
||||
): Array<{ name: string, value: string, description?: string, disabled?: boolean }> {
|
||||
const parsedUrl = urlParse(url);
|
||||
const contentTypeHeader = getContentTypeHeader(headers);
|
||||
|
||||
|
||||
@@ -38,16 +38,10 @@ class Editor extends PureComponent {
|
||||
|
||||
this.state = {
|
||||
pairs: pairs,
|
||||
displayDescription: false,
|
||||
};
|
||||
|
||||
// If any pair has a description, display description field.
|
||||
for (const pair of this.props.pairs) {
|
||||
if (pair.description) {
|
||||
this.state.displayDescription = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If any pair has a description, display description field
|
||||
displayDescription: props.pairs.some(p => p.description),
|
||||
};
|
||||
}
|
||||
|
||||
_setRowRef(n) {
|
||||
@@ -241,7 +235,10 @@ class Editor extends PureComponent {
|
||||
if (this._focusedField === NAME) {
|
||||
this._focusedField = VALUE;
|
||||
this._updateFocus();
|
||||
} else if (this._focusedField === VALUE) {
|
||||
} else if (this._focusedField === VALUE && this.state.displayDescription) {
|
||||
this._focusedField = DESCRIPTION;
|
||||
this._updateFocus();
|
||||
} else if (this._focusedField === VALUE || this._focusedField === DESCRIPTION) {
|
||||
this._focusedField = NAME;
|
||||
if (addIfValue) {
|
||||
this._addPair(this._getFocusedPairIndex() + 1);
|
||||
@@ -252,7 +249,10 @@ class Editor extends PureComponent {
|
||||
}
|
||||
|
||||
_focusPrevious(deleteIfEmpty = false) {
|
||||
if (this._focusedField === VALUE) {
|
||||
if (this._focusedField === DESCRIPTION) {
|
||||
this._focusedField = VALUE;
|
||||
this._updateFocus();
|
||||
} else if (this._focusedField === VALUE) {
|
||||
this._focusedField = NAME;
|
||||
this._updateFocus();
|
||||
} else if (this._focusedField === NAME) {
|
||||
|
||||
Reference in new issue
Block a user