@@ -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`
126130interface Props {
127131 $hideToolbar : boolean ;
128132 $style : RichTextEditorStyleType ;
133+ $contentScrollBar : boolean ;
129134}
130135
131136const 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
140145const 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
193200const 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 >
0 commit comments