fix: fixed query result codemirror shake issue upon scroll

This commit is contained in:
Anoop M D 2022-01-26 20:31:49 +05:30
parent 1b78a2c223
commit 6af169ffee
6 changed files with 9 additions and 15 deletions

View File

@ -178,13 +178,6 @@ export default class QueryEditor extends React.Component {
); );
} }
/**
* Public API for retrieving the DOM client height for this component.
*/
getClientHeight() {
return this._node && this._node.clientHeight;
}
_onKeyUp = (_cm, event) => { _onKeyUp = (_cm, event) => {
if (AUTO_COMPLETE_AFTER_KEY.test(event.key) && this.editor) { if (AUTO_COMPLETE_AFTER_KEY.test(event.key) && this.editor) {
this.editor.execCommand('autocomplete'); this.editor.execCommand('autocomplete');

View File

@ -149,7 +149,7 @@ const RequestTabPanel = ({dispatch, actions, collections, activeRequestTabId, re
<div className="drag-request" onMouseDown={handleDragbarMouseDown}> <div className="drag-request" onMouseDown={handleDragbarMouseDown}>
</div> </div>
<section className="response-pane px-4 flex-grow"> <section className="response-pane flex-grow">
<ResponsePane <ResponsePane
rightPaneWidth={rightPaneWidth} rightPaneWidth={rightPaneWidth}
response={item.response} response={item.response}

View File

@ -7,6 +7,10 @@ const StyledWrapper = styled.div`
height: calc(100vh - 230px); height: calc(100vh - 230px);
} }
textarea.cm-editor {
position: relative;
}
div.overlay{ div.overlay{
position: absolute; position: absolute;
top: 0; top: 0;

View File

@ -37,7 +37,7 @@ const QueryResult = ({data, isLoading, width}) => {
}, [editor.current, cmEditor, data]); }, [editor.current, cmEditor, data]);
return ( return (
<StyledWrapper className="mt-4 w-full"> <StyledWrapper className="mt-4 px-3 w-full" style={{maxWidth: width}}>
{isLoading && ( {isLoading && (
<div className="overlay"> <div className="overlay">
<div style={{marginBottom: 15, fontSize: 26}}> <div style={{marginBottom: 15, fontSize: 26}}>
@ -55,10 +55,7 @@ const QueryResult = ({data, isLoading, width}) => {
)} )}
<div className="h-full"> <div className="h-full">
<textarea <textarea
id="operation" id="query-result"
style={{
width: `${width}px`,
}}
ref={editor} ref={editor}
className="cm-editor" className="cm-editor"
> >

View File

@ -3,7 +3,7 @@ import StyledWrapper from './StyledWrapper';
const ResponseHeaders = ({headers}) => { const ResponseHeaders = ({headers}) => {
return ( return (
<StyledWrapper className="mt-3"> <StyledWrapper className="mt-3 px-3">
<table> <table>
<thead> <thead>
<tr> <tr>

View File

@ -43,7 +43,7 @@ const ResponsePane = ({rightPaneWidth, response, isLoading}) => {
return ( return (
<StyledWrapper className="flex flex-col h-full"> <StyledWrapper className="flex flex-col h-full">
<div className="flex items-center tabs mt-1" role="tablist"> <div className="flex items-center px-3 tabs mt-1" role="tablist">
<div className={getTabClassname('response')} role="tab" onClick={() => setSelectedTab('response')}>Response</div> <div className={getTabClassname('response')} role="tab" onClick={() => setSelectedTab('response')}>Response</div>
<div className={getTabClassname('headers')} role="tab" onClick={() => setSelectedTab('headers')}>Headers</div> <div className={getTabClassname('headers')} role="tab" onClick={() => setSelectedTab('headers')}>Headers</div>
{!isLoading ? ( {!isLoading ? (