Skip to content

Commit 8d7b3d1

Browse files
authored
Merge pull request #569 from raheeliftikhar5/editor-fixes
Editor fixes
2 parents fab5301 + b1e50c4 commit 8d7b3d1

File tree

6 files changed

+31
-21
lines changed

6 files changed

+31
-21
lines changed

client/packages/lowcoder-design/src/components/option.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ const OptionItem = (props: {
153153
popoverTitle?: string;
154154
draggable?: boolean;
155155
optionExtra?: React.ReactNode;
156+
scrollable?: boolean;
156157
}) => {
157-
const { content, config, title, popoverTitle, draggable = true, optionExtra } = props;
158+
const { content, config, title, popoverTitle, draggable = true, optionExtra, scrollable } = props;
158159
const [visible, setVisible] = useState(false);
159160
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
160161
id: config.dataIndex,
@@ -182,6 +183,7 @@ const OptionItem = (props: {
182183
setVisible={(vis) => {
183184
setVisible(vis);
184185
}}
186+
scrollable={scrollable}
185187
>
186188
{optionRow}
187189
</SimplePopover>
@@ -204,6 +206,7 @@ function Option<T extends ConstructorToComp<MultiCompConstructor>>(props: {
204206
optionToolbar?: React.ReactNode;
205207
headerItem?: React.ReactNode;
206208
itemExtra?: (comp: T) => React.ReactNode;
209+
scrollable?: boolean;
207210
}) {
208211
const { items, uniqVal, headerItem, optionToolbar, itemExtra } = props;
209212
const itemsDistinctValCount = uniqVal
@@ -286,6 +289,7 @@ function Option<T extends ConstructorToComp<MultiCompConstructor>>(props: {
286289
title={props.itemTitle(item)}
287290
config={{ dataIndex: dataIndex }}
288291
optionExtra={optionExtra}
292+
scrollable={props.scrollable}
289293
/>
290294
);
291295
})}

client/packages/lowcoder-design/src/components/popover.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ const SimplePopover = (props: {
5151
setVisible?: (vis: boolean) => void;
5252
children: JSX.Element | React.ReactNode;
5353
content: JSX.Element | React.ReactNode;
54+
scrollable?: boolean;
5455
}) => {
5556
const { visible, setVisible } = props;
5657
const contentWithBox = (
5758
<SuspensionBox
5859
title={props.title}
5960
onClose={() => setVisible?.(false)}
6061
content={props.content}
62+
scrollable={props.scrollable}
6163
/>
6264
);
6365
return (
@@ -66,7 +68,7 @@ const SimplePopover = (props: {
6668
align={{
6769
offset: [-12, 0, 0, 0],
6870
}}
69-
destroyTooltipOnHide
71+
// destroyTooltipOnHide
7072
content={contentWithBox}
7173
trigger="click"
7274
open={visible}

client/packages/lowcoder/src/app.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ class AppIndex extends React.Component<AppIndexProps, any> {
159159
)}
160160
</Switch>
161161
</Router>
162-
<CodeEditorTooltipContainer />
163162
</Wrapper>
164163
);
165164
}

client/packages/lowcoder/src/base/codeEditor/codeEditor.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ function useCodeMirror(
227227
...props,
228228
showLineNum,
229229
onChange: handleChange,
230+
tooltipContainer: container.current,
230231
});
231232
useEffect(() => reconfigure(viewRef.current), [reconfigure]);
232233
useEffect(() => {
@@ -385,24 +386,26 @@ export function CodeEditor(props: CodeEditorProps) {
385386
const { expandable = true, ...editorProps } = props;
386387
const [disabled, setDisabled] = useState(false);
387388
return (
388-
<CodeEditorCommon {...editorProps} editor={editor} disabled={disabled}>
389-
<Container
390-
styleName={props.styleName}
391-
bordered={props.bordered}
392-
disabled={disabled}
393-
error={props.hasError}
394-
ref={editor as MutableRefObject<HTMLDivElement>}
395-
enableClickCompName={props.enableClickCompName}
396-
>
397-
{expandable && (
398-
<CodeEditorPanel
399-
breadcrumb={[props.label ?? ""]}
400-
editor={<CodeEditorForPanel {...props} styleName="window" showLineNum />}
401-
onVisibleChange={(visible) => setDisabled(visible)}
402-
/>
403-
)}
404-
</Container>
405-
</CodeEditorCommon>
389+
<CodeEditorTooltipContainer>
390+
<CodeEditorCommon {...editorProps} editor={editor} disabled={disabled}>
391+
<Container
392+
styleName={props.styleName}
393+
bordered={props.bordered}
394+
disabled={disabled}
395+
error={props.hasError}
396+
ref={editor as MutableRefObject<HTMLDivElement>}
397+
enableClickCompName={props.enableClickCompName}
398+
>
399+
{expandable && (
400+
<CodeEditorPanel
401+
breadcrumb={[props.label ?? ""]}
402+
editor={<CodeEditorForPanel {...props} styleName="window" showLineNum />}
403+
onVisibleChange={(visible) => setDisabled(visible)}
404+
/>
405+
)}
406+
</Container>
407+
</CodeEditorCommon>
408+
</CodeEditorTooltipContainer>
406409
);
407410
}
408411

client/packages/lowcoder/src/comps/comps/tableComp/tablePropertyView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ function ColumnPropertyView<T extends MultiBaseComp<TableChildrenType>>(props: {
390390
comp.children.columns.dispatch(action);
391391
}}
392392
dataIndex={(column) => column.getView().dataIndex}
393+
scrollable={true}
393394
/>
394395
</>
395396
);

client/packages/lowcoder/src/pages/editor/codeEditorPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export const CodeEditorPanel = (props: {
129129
maskClosable={true}
130130
onPopupVisibleChange={(visible) => setVisible(visible)}
131131
afterPopupVisibleChange={(visible) => props.onVisibleChange(visible)}
132+
getPopupContainer={(node: any) => node.parentNode.parentNode}
132133
popup={() => (
133134
<Draggable
134135
positionOffset={{ x: "-50%", y: "-50%" }}

0 commit comments

Comments
 (0)