mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 04:07:50 +08:00
fix(client): fix special white space happens when paste content (#5497)
This commit is contained in:
parent
4203b7c7d5
commit
4a6bf09737
@ -210,7 +210,7 @@ function getCurrentRange(element: HTMLElement): RangeIndexes {
|
||||
|
||||
export function TextArea(props) {
|
||||
const { wrapSSR, hashId, componentCls } = useStyles();
|
||||
const { value = '', scope, onChange, multiline = true, changeOnSelect, style } = props;
|
||||
const { value = '', scope, onChange, changeOnSelect, style } = props;
|
||||
const inputRef = useRef<HTMLDivElement>(null);
|
||||
const [options, setOptions] = useState([]);
|
||||
const form = useForm();
|
||||
@ -420,9 +420,10 @@ export function TextArea(props) {
|
||||
hashId,
|
||||
'ant-input',
|
||||
{ 'ant-input-disabled': disabled },
|
||||
// NOTE: `pre-wrap` here for avoid the ` ` (\x160) issue when paste content, we need normal space (\x32).
|
||||
css`
|
||||
overflow: auto;
|
||||
white-space: ${multiline ? 'normal' : 'nowrap'};
|
||||
white-space: pre-wrap;
|
||||
|
||||
&[placeholder]:empty::before {
|
||||
content: attr(placeholder);
|
||||
|
@ -25,8 +25,8 @@ export type RequestConfig = Pick<AxiosRequestConfig, 'url' | 'method' | 'params'
|
||||
};
|
||||
|
||||
const ContentTypeTransformers = {
|
||||
'application/json'(data) {
|
||||
return data;
|
||||
'text/plain'(data) {
|
||||
return data.toString();
|
||||
},
|
||||
'application/x-www-form-urlencoded'(data: { name: string; value: string }[]) {
|
||||
return new URLSearchParams(
|
||||
@ -52,6 +52,7 @@ async function request(config) {
|
||||
|
||||
// TODO(feat): only support JSON type for now, should support others in future
|
||||
headers['Content-Type'] = contentType;
|
||||
const transformer = ContentTypeTransformers[contentType];
|
||||
|
||||
return axios.request({
|
||||
url: trim(url),
|
||||
@ -61,7 +62,7 @@ async function request(config) {
|
||||
timeout,
|
||||
...(method.toLowerCase() !== 'get' && data != null
|
||||
? {
|
||||
data: ContentTypeTransformers[contentType](data),
|
||||
data: transformer ? transformer(data) : data,
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user