[Fix] Hide binding prompt if auto complete is open (#5911)
* temp * hiding binding prompt if auto suggestion box is open * slash btn click works in api pane * removed unnecessary code
This commit is contained in:
parent
82d887338a
commit
3f34ce08e3
|
|
@ -3,9 +3,12 @@ import { isString } from "lodash";
|
||||||
export const showBindingPrompt = (
|
export const showBindingPrompt = (
|
||||||
showEvaluatedValue: boolean,
|
showEvaluatedValue: boolean,
|
||||||
inputValue: any,
|
inputValue: any,
|
||||||
|
isHinterOpen: boolean,
|
||||||
): boolean => {
|
): boolean => {
|
||||||
return (
|
return (
|
||||||
showEvaluatedValue &&
|
showEvaluatedValue &&
|
||||||
(!isString(inputValue) || !inputValue?.includes("{{") || !inputValue)
|
(!isString(inputValue) ||
|
||||||
|
(!inputValue && !isHinterOpen) ||
|
||||||
|
(!inputValue?.includes("{{") && !inputValue?.includes("/")))
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,7 @@ type State = {
|
||||||
isFocused: boolean;
|
isFocused: boolean;
|
||||||
isOpened: boolean;
|
isOpened: boolean;
|
||||||
autoCompleteVisible: boolean;
|
autoCompleteVisible: boolean;
|
||||||
|
hinterOpen: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CommandBtnContainer = styled.div<{ isFocused: boolean }>`
|
const CommandBtnContainer = styled.div<{ isFocused: boolean }>`
|
||||||
|
|
@ -153,6 +154,7 @@ class CodeEditor extends Component<Props, State> {
|
||||||
isFocused: false,
|
isFocused: false,
|
||||||
isOpened: false,
|
isOpened: false,
|
||||||
autoCompleteVisible: false,
|
autoCompleteVisible: false,
|
||||||
|
hinterOpen: false,
|
||||||
};
|
};
|
||||||
this.updatePropertyValue = this.updatePropertyValue.bind(this);
|
this.updatePropertyValue = this.updatePropertyValue.bind(this);
|
||||||
}
|
}
|
||||||
|
|
@ -407,6 +409,7 @@ class CodeEditor extends Component<Props, State> {
|
||||||
});
|
});
|
||||||
if (hinterOpen) break;
|
if (hinterOpen) break;
|
||||||
}
|
}
|
||||||
|
this.setState({ hinterOpen });
|
||||||
};
|
};
|
||||||
|
|
||||||
handleAutocompleteHide = (cm: any, event: KeyboardEvent) => {
|
handleAutocompleteHide = (cm: any, event: KeyboardEvent) => {
|
||||||
|
|
@ -427,10 +430,10 @@ class CodeEditor extends Component<Props, State> {
|
||||||
cursor?: number,
|
cursor?: number,
|
||||||
preventAutoComplete = false,
|
preventAutoComplete = false,
|
||||||
) {
|
) {
|
||||||
|
this.editor.focus();
|
||||||
if (value) {
|
if (value) {
|
||||||
this.editor.setValue(value);
|
this.editor.setValue(value);
|
||||||
}
|
}
|
||||||
this.editor.focus();
|
|
||||||
this.editor.setCursor({
|
this.editor.setCursor({
|
||||||
line: cursor || this.editor.lineCount() - 1,
|
line: cursor || this.editor.lineCount() - 1,
|
||||||
ch: this.editor.getLine(this.editor.lineCount() - 1).length - 2,
|
ch: this.editor.getLine(this.editor.lineCount() - 1).length - 2,
|
||||||
|
|
@ -578,8 +581,11 @@ class CodeEditor extends Component<Props, State> {
|
||||||
<BindingPrompt
|
<BindingPrompt
|
||||||
editorTheme={this.props.theme}
|
editorTheme={this.props.theme}
|
||||||
isOpen={
|
isOpen={
|
||||||
showBindingPrompt(showEvaluatedValue, input.value) &&
|
showBindingPrompt(
|
||||||
!_.get(this.editor, "state.completionActive")
|
showEvaluatedValue,
|
||||||
|
input.value,
|
||||||
|
this.state.hinterOpen,
|
||||||
|
) && !_.get(this.editor, "state.completionActive")
|
||||||
}
|
}
|
||||||
promptMessage={this.props.promptMessage}
|
promptMessage={this.props.promptMessage}
|
||||||
showLightningMenu={this.props.showLightningMenu}
|
showLightningMenu={this.props.showLightningMenu}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user