Commit 61a25949 authored by 田翔's avatar 田翔

fix: 文本多行文本富文本支持识别网址跳转

parent b767a194
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.0.31", "version": "6.0.32",
"description": "6.0.31 地址控件不回显问题", "description": "6.0.32 文本多行文本富文本支持识别网址跳转",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
import React, { useState, useEffect, useMemo } from 'react' import React, { useState, useEffect, useMemo } from 'react'
import { Input } from 'antd' import { Input } from 'antd'
import styles from './index.less'
import { urlRegExp } from '../../../../utils'
const TextArea = (props) => { const TextArea = (props) => {
...@@ -14,11 +16,14 @@ const TextArea = (props) => { ...@@ -14,11 +16,14 @@ const TextArea = (props) => {
} }
}, [presetValue]) }, [presetValue])
const handleChange = (e) => { const handleChange = (e) => {
onChange(e.target.value) onChange(e.target.value)
} }
if (disabled && urlRegExp.test(value)) {
return <div className={styles.areaUrl} onClick={() => window.open(value)}>{value}</div>
}
return ( return (
<Input.TextArea <Input.TextArea
maxLength={maxLength} maxLength={maxLength}
......
.areaUrl {
color: #1890ff;
padding: 4px 11px;
background: #f8fafc;
min-height: 90px;
&:hover {
color: #0a7fec;
cursor: pointer;
}
}
\ No newline at end of file
...@@ -4,6 +4,7 @@ import Icon, { PlusOutlined } from '@ant-design/icons' ...@@ -4,6 +4,7 @@ import Icon, { PlusOutlined } from '@ant-design/icons'
import * as icons from '@ant-design/icons' import * as icons from '@ant-design/icons'
import { GetFieldValueFromTable, getUserName, getGroupName } from '../../../../apis/process' import { GetFieldValueFromTable, getUserName, getGroupName } from '../../../../apis/process'
import styles from './index.less' import styles from './index.less'
import { urlRegExp } from '../../../../utils'
const iconList = Object.keys(icons).filter((item) => typeof icons[item] === 'object') const iconList = Object.keys(icons).filter((item) => typeof icons[item] === 'object')
const initUserInfo = { const initUserInfo = {
...@@ -151,8 +152,12 @@ const TextInput = (props) => { ...@@ -151,8 +152,12 @@ const TextInput = (props) => {
} }
}, [otherValue]) }, [otherValue])
if (disabled && urlRegExp.test(showValue)) {
return <div className={styles.textUrl} onClick={() => window.open(showValue)}>{showValue}</div>
}
return ( return (
<div className={styles.textInput} isdisabled={JSON.stringify(disabled)}> <div className={styles.textInput} isdisabled={JSON.stringify(disabled)} >
<Input <Input
style={{ color: loaclPaths.includes(presetValue) ? 'blue' : '' }} style={{ color: loaclPaths.includes(presetValue) ? 'blue' : '' }}
disabled={disabled} disabled={disabled}
......
...@@ -6,3 +6,13 @@ ...@@ -6,3 +6,13 @@
} }
} }
} }
.textUrl {
color: #1890ff;
padding: 4px 11px;
background: #f8fafc;
&:hover {
color: #0a7fec;
cursor: pointer;
}
}
\ No newline at end of file
...@@ -322,3 +322,5 @@ export const getFieldInfo = (formJson) => { ...@@ -322,3 +322,5 @@ export const getFieldInfo = (formJson) => {
} }
return obj return obj
} }
export const urlRegExp = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&amp;'\*\+,;=.]+$/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment