mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
08bff8f04a
@ -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 ` ` (\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}
|
||||
/>
|
||||
) : null}
|
||||
<VariableSelect
|
||||
options={options}
|
||||
setOptions={setOptions}
|
||||
onInsert={onInsert}
|
||||
changeOnSelect={changeOnSelect}
|
||||
fieldNames={fieldNames || defaultFieldNames}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</Space.Compact>,
|
||||
);
|
||||
}
|
||||
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user