Skip to content

Commit 8d632f7

Browse files
author
MenamAfzal
committed
Scroll Fixed in JSONEditor Comp
1 parent 9b7f49b commit 8d632f7

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

client/packages/lowcoder/src/comps/comps/jsonComp/jsonEditorComp.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Section, sectionNames } from "lowcoder-design";
1+
import { ScrollBar, Section, sectionNames } from "lowcoder-design";
22
import { UICompBuilder } from "../../generators";
33
import { NameConfigHidden, NameConfig, withExposingConfigs } from "../../generators/withExposing";
44
import { defaultData } from "./jsonConstants";
@@ -27,16 +27,12 @@ import { AutoHeightControl, BoolControl } from "@lowcoder-ee/index.sdk";
2727
* JsonEditor Comp
2828
*/
2929

30-
const Wrapper = styled.div<{$height: boolean; $showVerticalScrollbar:boolean}>`
30+
const Wrapper = styled.div<{$height: boolean; $showVerticalScrollbar: boolean}>`
3131
background-color: #fff;
3232
border: 1px solid #d7d9e0;
3333
border-radius: 4px;
34-
overflow-y: scroll;
3534
height: 100%;
36-
&::-webkit-scrollbar {
37-
width: 16px;
38-
display: ${props=>props.$showVerticalScrollbar&&'block !important'};
39-
}
35+
overflow-y: ${props => (props.$showVerticalScrollbar ? 'scroll' : 'auto')};
4036
`;
4137

4238
/**
@@ -129,12 +125,17 @@ let JsonEditorTmpComp = (function () {
129125
style: props.style,
130126
animationStyle: props.animationStyle,
131127
children: (
132-
<Wrapper
133-
ref={wrapperRef}
134-
onFocus={() => (editContent.current = 'focus')}
135-
$height={props.autoHeight}
136-
$showVerticalScrollbar={props.showVerticalScrollbar}
137-
/>
128+
129+
130+
<ScrollBar hideScrollbar={!props.showVerticalScrollbar}>
131+
<Wrapper
132+
ref={wrapperRef}
133+
onFocus={() => (editContent.current = 'focus')}
134+
$height={props.autoHeight}
135+
$showVerticalScrollbar={props.showVerticalScrollbar}
136+
/>
137+
</ScrollBar>
138+
138139
),
139140
});
140141
})
@@ -157,8 +158,9 @@ let JsonEditorTmpComp = (function () {
157158
{children.autoHeight.propertyView({ label: trans('prop.height') })}
158159
</Section>
159160
{!children.autoHeight.getView()&&<Section name={sectionNames.layout}>
160-
{children.showVerticalScrollbar.propertyView({label:trans('prop.showVerticalScrollbar')})}
161-
</Section>}
161+
{children.showVerticalScrollbar.propertyView({label: trans('prop.showVerticalScrollbar')})}
162+
163+
</Section>}
162164
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && ( children.label.getPropertyView() )}
163165
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
164166
<>

0 commit comments

Comments
 (0)