Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizable editor #39

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
node_modules
.vscode-test/
*.vsix
postCode.code-workspace
2 changes: 1 addition & 1 deletion webview/components/RequestOptionsWindow/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.request-options-window-wrapper {
flex: 1;
padding: 5px 20px 10px 20px;
overflow: scroll;
overflow: auto;
}
1 change: 1 addition & 0 deletions webview/features/response/ResponseBody/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const ResponseBody = (props) => {
<div className="response-window">
<React.Suspense fallback={<div>loading</div>}>
<Editor
automaticLayout={true}
className="response-editor"
value={response.data || ""}
language={language}
Expand Down
6 changes: 4 additions & 2 deletions webview/pages/Postcode/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
.request-options-wrapper {
display: flex;
flex-direction: column;
min-height: 50%;
height: inherit;
resize: vertical;
overflow: auto;
}

.response-wrapper {
display: flex;
flex-direction: column;
height: 50%;
height: inherit;
}
14 changes: 12 additions & 2 deletions webview/shared/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ import { useAppDispatch } from "../../redux/hooks";
import { requestBodyRawFormatUpdated } from "../../features/requestBody/requestBodySlice";

const Editor = (props) => {
const { value, language, onChange, readOnly, className, copyButton, format } =
props;
const {
value,
language,
onChange,
readOnly,
className,
copyButton,
format,
automaticLayout,
} = props;

const divEl = React.useRef<HTMLDivElement>(null);
const [editor, setEditor] = React.useState(undefined);
Expand All @@ -20,6 +28,7 @@ const Editor = (props) => {
minimap: { enabled: false },
scrollBeyondLastLine: false,
theme: "vs-dark",
automaticLayout,
value,
language,
readOnly,
Expand Down Expand Up @@ -93,6 +102,7 @@ Editor.propTypes = {
readOnly: propTypes.bool,
copyButton: propTypes.bool,
format: propTypes.bool,
automaticLayout: propTypes.bool,
};

export default Editor;