Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
feat: refactored json-formatter.scss;
Browse files Browse the repository at this point in the history
  • Loading branch information
zsmatrix62 committed Mar 1, 2022
1 parent ff2362e commit a8d3d6e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
17 changes: 14 additions & 3 deletions web-src/src/app/tool-blocks/json-formatter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
width: 96%;
}


.json-formatter-container {
height: 100%;
padding: 0 10px;
Expand Down Expand Up @@ -31,20 +32,30 @@
.cm-block {
height: 100%;

.cm-theme-light, .cm-theme-dark, .cm-editor {
overflow-y: scroll;
.cm-theme-light, .cm-theme-dark, .cm-editor, .cm-scroller {
}


.mod-cm-sider-collapsed {
.cm-theme-light, .cm-theme-dark, .cm-editor {
width: calc((100vw - 80px) / 2);
}

.cm-content, .cm-line {
width: calc((100vw - 80px) / 2 - 43px);
//border: red 1px solid;
}
}

.mod-cm-sider-expanded {
.cm-theme-light, .cm-theme-dark, .cm-editor {
.cm-theme-light, .cm-theme-dark, .cm-editor, .cm-line {
width: calc((100vw - 260px) / 2);
}

.cm-content, .cm-line {
width: calc((100vw - 250px) / 2 - 46px);
//border: red 1px solid;
}
}

.mod-cm-in-tauri {
Expand Down
14 changes: 12 additions & 2 deletions web-src/src/app/tool-blocks/json-formatter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Banner, Button, Col, Input, Layout, Row, Select, SideSheet, Space, Toast} from "@douyinfe/semi-ui";
import {Banner, Button, Col, Input, Row, Select, SideSheet, Space, Toast} from "@douyinfe/semi-ui";
import "./json-formatter.scss"
import {IconArrowUp, IconCopy, IconHelpCircle, IconLayers} from "@douyinfe/semi-icons";
import * as React from "react";
Expand Down Expand Up @@ -91,7 +91,6 @@ export const JsonFormatterBlock = () => {
const [jsonPathValue, setJsonPathValue] = useState<string>('')
const [showJsonPathGuide, setShowJsonPathGuide] = useState<boolean>(false)
const api = useContext(APIServiceContext)
const jsonFormatterRef = useRef<Layout>(null)
const inputRef = useRef<HTMLTextAreaElement>(null)
const jsonPathRef = useRef<HTMLInputElement>(null)
const [isAPILoading, setIsAPILoading] = useObservableState<boolean>(obs => {
Expand Down Expand Up @@ -201,6 +200,16 @@ export const JsonFormatterBlock = () => {

const isSidebarCollapsed = useObservableState(Pref.getInstance().toolsSiderCollapsed.$)

// const cmRef = useRef<ReactCodeMirrorRef>(null);

// useEffect(() => {
// if (ref?.current?.view) {
// console.log("reconfigure");
// ref.current.view.dispatch({
// filter: true
// });
// }
// });

// noinspection RequiredAttributes
return (
Expand Down Expand Up @@ -272,6 +281,7 @@ export const JsonFormatterBlock = () => {
`} type={"flex"} gutter={10}>
<Row>
<ReactCodeMirror
// ref={cmRef}
value={outputValue}
lang="json"
extensions={[json()]}
Expand Down
4 changes: 4 additions & 0 deletions web-src/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ body {
-moz-osx-font-smoothing: grayscale;
}

body, html {
overflow: hidden;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
Expand Down

0 comments on commit a8d3d6e

Please sign in to comment.