Skip to content

Commit 002c5ad

Browse files
committed
editor issue fixed
1 parent 8d632f7 commit 002c5ad

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,16 @@ let JsonEditorTmpComp = (function () {
107107
doc: JSON.stringify(props.value.value, null, 2),
108108
extensions,
109109
});
110-
view.current = new EditorView({ state, parent: wrapperRef.current });
110+
view.current = new EditorView({state, parent: wrapperRef.current});
111111
}
112-
}, [wrapperRef.current]);
112+
if (wrapperRef.current&&(props.showVerticalScrollbar||!props.showVerticalScrollbar)) {
113+
const state = EditorState.create({
114+
doc: JSON.stringify(props.value.value, null, 2),
115+
extensions,
116+
});
117+
view.current = new EditorView({state, parent: wrapperRef.current});
118+
}
119+
}, [wrapperRef.current, props.showVerticalScrollbar]);
113120

114121
if (wrapperRef.current && view.current && !editContent.current) {
115122
const state = EditorState.create({
@@ -125,8 +132,6 @@ let JsonEditorTmpComp = (function () {
125132
style: props.style,
126133
animationStyle: props.animationStyle,
127134
children: (
128-
129-
130135
<ScrollBar hideScrollbar={!props.showVerticalScrollbar}>
131136
<Wrapper
132137
ref={wrapperRef}
@@ -135,7 +140,6 @@ let JsonEditorTmpComp = (function () {
135140
$showVerticalScrollbar={props.showVerticalScrollbar}
136141
/>
137142
</ScrollBar>
138-
139143
),
140144
});
141145
})

0 commit comments

Comments
 (0)