Skip to content

Commit 54581e3

Browse files
committedSep 24, 2024
TextDisplay: Added Main Content Scrollbar
1 parent d529033 commit 54581e3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎client/packages/lowcoder/src/comps/comps/textComp.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { dropdownControl } from "comps/controls/dropdownControl";
22
import { stringExposingStateControl } from "comps/controls/codeStateControl";
33
import { AutoHeightControl } from "comps/controls/autoHeightControl";
4-
import { Section, sectionNames } from "lowcoder-design";
4+
import { ScrollBar, Section, sectionNames } from "lowcoder-design";
55
import styled, { css } from "styled-components";
66
import { AlignCenter } from "lowcoder-design";
77
import { AlignLeft } from "lowcoder-design";
@@ -24,6 +24,7 @@ import { clickEvent, eventHandlerControl } from "../controls/eventHandlerControl
2424
import { NewChildren } from "../generators/uiCompBuilder";
2525
import { RecordConstructorToComp } from "lowcoder-core";
2626
import { ToViewReturn } from "../generators/multi";
27+
import { BoolControl } from "@lowcoder-ee/index.sdk";
2728

2829
const EventOptions = [clickEvent] as const;
2930

@@ -142,6 +143,7 @@ const childrenMap = {
142143
autoHeight: AutoHeightControl,
143144
type: dropdownControl(typeOptions, "markdown"),
144145
horizontalAlignment: alignWithJustifyControl(),
146+
contentScrollBar: withDefault(BoolControl, true),
145147
verticalAlignment: dropdownControl(VerticalAlignmentOptions, "center"),
146148
style: styleControl(TextStyle, 'style'),
147149
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
@@ -176,6 +178,10 @@ const TextPropertyView = React.memo((props: {
176178
<>
177179
<Section name={sectionNames.layout}>
178180
{props.children.autoHeight.getPropertyView()}
181+
{!props.children.autoHeight.getView() &&
182+
props.children.contentScrollBar.propertyView({
183+
label: trans("prop.contentScrollbar"),
184+
})}
179185
{!props.children.autoHeight.getView() &&
180186
props.children.verticalAlignment.propertyView({
181187
label: trans("textShow.verticalAlignment"),
@@ -214,7 +220,9 @@ const TextView = React.memo((props: ToViewReturn<ChildrenType>) => {
214220
}}
215221
onClick={() => props.onEvent("click")}
216222
>
217-
{props.type === "markdown" ? <TacoMarkDown>{value}</TacoMarkDown> : value}
223+
<ScrollBar hideScrollbar={!props.contentScrollBar}>
224+
{props.type === "markdown" ? <TacoMarkDown>{value}</TacoMarkDown> : value}
225+
</ScrollBar>
218226
</TextContainer>
219227
);
220228
}, (prev, next) => JSON.stringify(prev) === JSON.stringify(next));

0 commit comments

Comments
 (0)