Skip to content

Commit c3f5b1c

Browse files
committed
RichTextEditor: Added Main Content Scrollbar
1 parent 54581e3 commit c3f5b1c

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

client/packages/lowcoder/src/comps/comps/richTextEditorComp.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,13 @@ const localizeStyle = css`
7979
}
8080
`;
8181

82-
const commonStyle = (style: RichTextEditorStyleType) => css`
82+
const commonStyle = (style: RichTextEditorStyleType, contentScrollBar: boolean) => css`
8383
height: 100%;
8484
85+
.ql-editor::-webkit-scrollbar {
86+
display: ${contentScrollBar ? "block" : "none"};
87+
}
88+
8589
& .ql-editor {
8690
min-height: 85px;
8791
}
@@ -126,11 +130,12 @@ const hideToolbarStyle = (style: RichTextEditorStyleType) => css`
126130
interface Props {
127131
$hideToolbar: boolean;
128132
$style: RichTextEditorStyleType;
133+
$contentScrollBar: boolean;
129134
}
130135

131136
const AutoHeightReactQuill = styled.div<Props>`
132137
${localizeStyle}
133-
${(props) => commonStyle(props.$style)}
138+
${(props) => commonStyle(props.$style, props.$contentScrollBar)}
134139
& .ql-container .ql-editor {
135140
min-height: 125px;
136141
}
@@ -139,7 +144,7 @@ const AutoHeightReactQuill = styled.div<Props>`
139144

140145
const FixHeightReactQuill = styled.div<Props>`
141146
${localizeStyle}
142-
${(props) => commonStyle(props.$style)}
147+
${(props) => commonStyle(props.$style, props.$contentScrollBar)}
143148
& .quill {
144149
display: flex;
145150
flex-direction: column;
@@ -169,6 +174,7 @@ const childrenMap = {
169174
hideToolbar: BoolControl,
170175
readOnly: BoolControl,
171176
autoHeight: withDefault(AutoHeightControl, "fixed"),
177+
contentScrollBar: withDefault(BoolControl, false),
172178
placeholder: withDefault(StringControl, trans("richTextEditor.placeholder")),
173179
toolbar: withDefault(StringControl, JSON.stringify(toolbarOptions)),
174180
onEvent: ChangeEventHandlerControl,
@@ -188,6 +194,7 @@ interface IProps {
188194
autoHeight: boolean;
189195
onChange: (value: string) => void;
190196
$style: RichTextEditorStyleType;
197+
contentScrollBar: boolean;
191198
}
192199

193200
const ReactQuillEditor = React.lazy(() => import("react-quill"));
@@ -264,6 +271,7 @@ function RichTextEditor(props: IProps) {
264271
ref={wrapperRef}
265272
$hideToolbar={props.hideToolbar}
266273
$style={props.$style}
274+
$contentScrollBar={props.contentScrollBar}
267275
>
268276
<Suspense fallback={<Skeleton />}>
269277
<ReactQuillEditor
@@ -300,6 +308,7 @@ const RichTextEditorCompBase = new UICompBuilder(childrenMap, (props) => {
300308
placeholder={props.placeholder}
301309
onChange={handleChange}
302310
$style={props.style}
311+
contentScrollBar={props.contentScrollBar}
303312
/>
304313
);
305314
})
@@ -325,6 +334,9 @@ const RichTextEditorCompBase = new UICompBuilder(childrenMap, (props) => {
325334
<>
326335
<Section name={sectionNames.layout}>
327336
{children.autoHeight.getPropertyView()}
337+
{!children.autoHeight.getView() && children.contentScrollBar.propertyView({
338+
label: trans("prop.textAreaScrollBar"),
339+
})}
328340
{children.toolbar.propertyView({ label: trans("richTextEditor.toolbar"), tooltip: trans("richTextEditor.toolbarDescription") })}
329341
{children.hideToolbar.propertyView({ label: trans("richTextEditor.hideToolbar") })}
330342
</Section>

client/packages/lowcoder/src/comps/comps/textInputComp/textAreaComp.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ let TextAreaTmpComp = (function () {
7575
autoHeight: withDefault(AutoHeightControl, "fixed"),
7676
style: styleControl(InputFieldStyle, 'style') ,
7777
labelStyle: styleControl(LabelStyle ,'labelStyle' ),
78+
textAreaScrollBar: withDefault(BoolControl, false),
7879
inputFieldStyle: styleControl(InputLikeStyle , 'inputFieldStyle'),
7980
animationStyle: styleControl(AnimationStyle, 'animationStyle')
8081
};
@@ -114,6 +115,10 @@ let TextAreaTmpComp = (function () {
114115
<><TextInputInteractionSection {...children} />
115116
<Section name={sectionNames.layout}>
116117
{children.autoHeight.getPropertyView()}
118+
{!children.autoHeight.getView() &&
119+
children.textAreaScrollBar.propertyView({
120+
label: trans("prop.textAreaScrollBar"),
121+
})}
117122
{hiddenPropertyView(children)}
118123
</Section>
119124
<Section name={sectionNames.advanced}>

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ export const en = {
206206
"mainScrollbar": "Show Scrollbars in main content",
207207
"modalScrollbar": "Show Scrollbars in Modal",
208208
"drawerScrollbar": "Show Scrollbars in Drawer",
209+
"textAreaScrollBar": "Show Scrollbars in Text Area",
209210
"siderRight" : "Show sider on the Right",
210211
"siderWidth" : "Sider Width",
211212
"siderWidthTooltip" : "Sider width supports percentages (%) and pixels (px).",

translations/locales/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export const en = {
199199
"mainScrollbar": "Show Scrollbars in main content",
200200
"modalScrollbar": "Show Scrollbars in Modal",
201201
"drawerScrollbar": "Show Scrollbars in Drawer",
202+
"textAreaScrollBar": "Show Scrollbars in Text Area",
202203
"siderRight": "Show sider on the Right",
203204
"siderWidth": "Sider Width",
204205
"siderWidthTooltip": "Sider width supports percentages (%) and pixels (px).",

translations/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export const en = {
204204
"mainScrollbar": "Show Scrollbars in main content",
205205
"modalScrollbar": "Show Scrollbars in Modal",
206206
"drawerScrollbar": "Show Scrollbars in Drawer",
207+
"textAreaScrollBar": "Show Scrollbars in Text Area",
207208
"siderRight" : "Show sider on the Right",
208209
"siderWidth" : "Sider Width",
209210
"siderWidthTooltip" : "Sider width supports percentages (%) and pixels (px).",

0 commit comments

Comments
 (0)