@@ -79,9 +79,13 @@ const localizeStyle = css`
79
79
}
80
80
` ;
81
81
82
- const commonStyle = ( style : RichTextEditorStyleType ) => css `
82
+ const commonStyle = ( style : RichTextEditorStyleType , contentScrollBar : boolean ) => css `
83
83
height : 100% ;
84
84
85
+ .ql-editor ::-webkit-scrollbar {
86
+ display : ${ contentScrollBar ? "block" : "none" } ;
87
+ }
88
+
85
89
& .ql-editor {
86
90
min-height : 85px ;
87
91
}
@@ -126,11 +130,12 @@ const hideToolbarStyle = (style: RichTextEditorStyleType) => css`
126
130
interface Props {
127
131
$hideToolbar : boolean ;
128
132
$style : RichTextEditorStyleType ;
133
+ $contentScrollBar : boolean ;
129
134
}
130
135
131
136
const AutoHeightReactQuill = styled . div < Props > `
132
137
${ localizeStyle }
133
- ${ ( props ) => commonStyle ( props . $style ) }
138
+ ${ ( props ) => commonStyle ( props . $style , props . $contentScrollBar ) }
134
139
& .ql-container .ql-editor {
135
140
min-height: 125px;
136
141
}
@@ -139,7 +144,7 @@ const AutoHeightReactQuill = styled.div<Props>`
139
144
140
145
const FixHeightReactQuill = styled . div < Props > `
141
146
${ localizeStyle }
142
- ${ ( props ) => commonStyle ( props . $style ) }
147
+ ${ ( props ) => commonStyle ( props . $style , props . $contentScrollBar ) }
143
148
& .quill {
144
149
display: flex;
145
150
flex-direction: column;
@@ -169,6 +174,7 @@ const childrenMap = {
169
174
hideToolbar : BoolControl ,
170
175
readOnly : BoolControl ,
171
176
autoHeight : withDefault ( AutoHeightControl , "fixed" ) ,
177
+ contentScrollBar : withDefault ( BoolControl , false ) ,
172
178
placeholder : withDefault ( StringControl , trans ( "richTextEditor.placeholder" ) ) ,
173
179
toolbar : withDefault ( StringControl , JSON . stringify ( toolbarOptions ) ) ,
174
180
onEvent : ChangeEventHandlerControl ,
@@ -188,6 +194,7 @@ interface IProps {
188
194
autoHeight : boolean ;
189
195
onChange : ( value : string ) => void ;
190
196
$style : RichTextEditorStyleType ;
197
+ contentScrollBar : boolean ;
191
198
}
192
199
193
200
const ReactQuillEditor = React . lazy ( ( ) => import ( "react-quill" ) ) ;
@@ -264,6 +271,7 @@ function RichTextEditor(props: IProps) {
264
271
ref = { wrapperRef }
265
272
$hideToolbar = { props . hideToolbar }
266
273
$style = { props . $style }
274
+ $contentScrollBar = { props . contentScrollBar }
267
275
>
268
276
< Suspense fallback = { < Skeleton /> } >
269
277
< ReactQuillEditor
@@ -300,6 +308,7 @@ const RichTextEditorCompBase = new UICompBuilder(childrenMap, (props) => {
300
308
placeholder = { props . placeholder }
301
309
onChange = { handleChange }
302
310
$style = { props . style }
311
+ contentScrollBar = { props . contentScrollBar }
303
312
/>
304
313
) ;
305
314
} )
@@ -325,6 +334,9 @@ const RichTextEditorCompBase = new UICompBuilder(childrenMap, (props) => {
325
334
< >
326
335
< Section name = { sectionNames . layout } >
327
336
{ children . autoHeight . getPropertyView ( ) }
337
+ { ! children . autoHeight . getView ( ) && children . contentScrollBar . propertyView ( {
338
+ label : trans ( "prop.textAreaScrollBar" ) ,
339
+ } ) }
328
340
{ children . toolbar . propertyView ( { label : trans ( "richTextEditor.toolbar" ) , tooltip : trans ( "richTextEditor.toolbarDescription" ) } ) }
329
341
{ children . hideToolbar . propertyView ( { label : trans ( "richTextEditor.hideToolbar" ) } ) }
330
342
</ Section >
0 commit comments