From afd4db67739766be3f9163fc19b8cc7e9fc2f7c0 Mon Sep 17 00:00:00 2001 From: arunvjn Date: Tue, 24 Aug 2021 14:25:52 +0530 Subject: [PATCH 1/2] Fixed api url input height. Fixed mouse click bug for datasource url --- .../editorComponents/CodeEditor/index.tsx | 15 ++++++++++++--- .../form/fields/EmbeddedDatasourcePathField.tsx | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx index 6f2a233b8b0e..f6425916bb96 100644 --- a/app/client/src/components/editorComponents/CodeEditor/index.tsx +++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx @@ -326,7 +326,11 @@ class CodeEditor extends Component { handleEditorFocus = () => { this.setState({ isFocused: true }); - if (this.editor.getValue().length === 0) + const entityInformation = this.getEntityInformation(); + if ( + entityInformation.entityType === ENTITY_TYPE.WIDGET && + this.editor.getValue().length === 0 + ) this.handleAutocompleteVisibility(this.editor); }; @@ -372,8 +376,7 @@ class CodeEditor extends Component { CodeEditor.updateMarkings(this.editor, this.props.marking); }; - handleAutocompleteVisibility = (cm: CodeMirror.Editor) => { - if (!this.state.isFocused) return; + getEntityInformation = (): FieldEntityInformation => { const { dataTreePath, dynamicData, expected } = this.props; const entityInformation: FieldEntityInformation = { expectedType: expected?.autocompleteDataType, @@ -397,6 +400,12 @@ class CodeEditor extends Component { if (isWidgetEntity(entity)) entityInformation.entityId = entity.widgetId; entityInformation.propertyPath = propertyPath; } + return entityInformation; + }; + + handleAutocompleteVisibility = (cm: CodeMirror.Editor) => { + if (!this.state.isFocused) return; + const entityInformation: FieldEntityInformation = this.getEntityInformation(); let hinterOpen = false; for (let i = 0; i < this.hinters.length; i++) { hinterOpen = this.hinters[i].showHint(cm, entityInformation, { diff --git a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx b/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx index 08a78cc4dd75..e95beb0ab3c3 100644 --- a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx +++ b/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx @@ -306,7 +306,7 @@ class EmbeddedDatasourcePathComponent extends React.Component { return ( - + {displayValue && datasource && !("id" in datasource) ? ( ) : datasource && "id" in datasource ? ( From bbd3e50708bfb257abb002d970e88abd5c318f2d Mon Sep 17 00:00:00 2001 From: arunvjn Date: Tue, 24 Aug 2021 14:25:52 +0530 Subject: [PATCH 2/2] Fixed API pane URL input height and mouse click --- .../editorComponents/CodeEditor/index.tsx | 15 ++++++++++++--- .../form/fields/EmbeddedDatasourcePathField.tsx | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx index 6f2a233b8b0e..f6425916bb96 100644 --- a/app/client/src/components/editorComponents/CodeEditor/index.tsx +++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx @@ -326,7 +326,11 @@ class CodeEditor extends Component { handleEditorFocus = () => { this.setState({ isFocused: true }); - if (this.editor.getValue().length === 0) + const entityInformation = this.getEntityInformation(); + if ( + entityInformation.entityType === ENTITY_TYPE.WIDGET && + this.editor.getValue().length === 0 + ) this.handleAutocompleteVisibility(this.editor); }; @@ -372,8 +376,7 @@ class CodeEditor extends Component { CodeEditor.updateMarkings(this.editor, this.props.marking); }; - handleAutocompleteVisibility = (cm: CodeMirror.Editor) => { - if (!this.state.isFocused) return; + getEntityInformation = (): FieldEntityInformation => { const { dataTreePath, dynamicData, expected } = this.props; const entityInformation: FieldEntityInformation = { expectedType: expected?.autocompleteDataType, @@ -397,6 +400,12 @@ class CodeEditor extends Component { if (isWidgetEntity(entity)) entityInformation.entityId = entity.widgetId; entityInformation.propertyPath = propertyPath; } + return entityInformation; + }; + + handleAutocompleteVisibility = (cm: CodeMirror.Editor) => { + if (!this.state.isFocused) return; + const entityInformation: FieldEntityInformation = this.getEntityInformation(); let hinterOpen = false; for (let i = 0; i < this.hinters.length; i++) { hinterOpen = this.hinters[i].showHint(cm, entityInformation, { diff --git a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx b/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx index 08a78cc4dd75..e95beb0ab3c3 100644 --- a/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx +++ b/app/client/src/components/editorComponents/form/fields/EmbeddedDatasourcePathField.tsx @@ -306,7 +306,7 @@ class EmbeddedDatasourcePathComponent extends React.Component { return ( - + {displayValue && datasource && !("id" in datasource) ? ( ) : datasource && "id" in datasource ? (