Merge branch 'main' into next

This commit is contained in:
nocobase[bot] 2025-02-18 14:25:37 +00:00
commit 08bff8f04a
2 changed files with 15 additions and 11 deletions

View File

@ -9,7 +9,7 @@
import { css, cx } from '@emotion/css';
import { useForm } from '@formily/react';
import { Space } from 'antd';
import { Space, theme } from 'antd';
import useInputStyle from 'antd/es/input/style';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { renderToString } from 'react-dom/server';
@ -238,6 +238,7 @@ export function TextArea(props) {
// NOTE: e.g. [startElementIndex, startOffset, endElementIndex, endOffset]
const [range, setRange] = useState<[number, number, number, number]>([-1, 0, -1, 0]);
useInputStyle('ant-input');
const { token } = theme.useToken();
const delimitersString = delimiters.join(' ');
useEffect(() => {
@ -454,6 +455,7 @@ export function TextArea(props) {
{ 'ant-input-disabled': disabled },
// NOTE: `pre-wrap` here for avoid the `&nbsp;` (\x160) issue when paste content, we need normal space (\x32).
css`
min-height: ${token.controlHeight}px;
overflow: auto;
white-space: pre-wrap;
@ -475,15 +477,14 @@ export function TextArea(props) {
contentEditable={!disabled}
dangerouslySetInnerHTML={{ __html: html }}
/>
{!disabled ? (
<VariableSelect
options={options}
setOptions={setOptions}
onInsert={onInsert}
changeOnSelect={changeOnSelect}
fieldNames={fieldNames || defaultFieldNames}
disabled={disabled}
/>
) : null}
</Space.Compact>,
);
}

View File

@ -22,6 +22,7 @@ export function VariableSelect({
changeOnSelect = false,
fieldNames = {},
className,
disabled,
}: {
options: any[];
setOptions: (options: any) => void;
@ -29,6 +30,7 @@ export function VariableSelect({
changeOnSelect?: boolean;
fieldNames?: any;
className?: string;
disabled?: boolean;
}): JSX.Element {
const { t } = useTranslation();
const [selectedVar, setSelectedVar] = useState<string[]>([]);
@ -44,8 +46,9 @@ export function VariableSelect({
}
return wrapSSR(
<XButton className={cx('x-button', componentCls, hashId, className)}>
<XButton disabled={disabled} className={cx('x-button', componentCls, hashId, className)}>
<Cascader
disabled={disabled}
placeholder={t('Select a variable')}
value={[]}
options={options}