Commit 94d9b2cf authored by 田翔's avatar 田翔

fix: 代码修改

parent 39195280
{
"name": "panda-xform",
"version": "4.9.2",
"description": "4.9.2 设备选择器配置修改",
"version": "4.9.3",
"description": "4.9.3 富文本默认值优化",
"keywords": [
"panda-xform"
],
......
......@@ -560,6 +560,7 @@ const textWidgets = [
presetValue: {
title: '默认值',
type: 'string',
widget: 'RichTextDefault',
},
required: {
title: '必填',
......
......@@ -62,7 +62,7 @@ const XRender = (props, ref) => {
if (disabledField) {
required = false
}
if (!child[s].hidden) {
if (child[s].isDoing) {
array.push(s)
}
childObj[s] = {
......
import React, { useRef, useState } from 'react'
import React, { useEffect, useRef, useState } from 'react'
import ReactSignatureCanvas from 'react-signature-canvas'
import Drag from '../../../components/Drag'
import { UploadFileReturnUrl } from '../../../../apis/process'
......@@ -7,7 +7,7 @@ import styles from './index.less'
const Signature = (props) => {
const { addons, value, onChange, schema } = props
const { disabled } = schema
const { disabled, presetValue } = schema
const [visible, setVisible] = useState(false)
const canvasRef = useRef(null)
......@@ -40,6 +40,10 @@ const Signature = (props) => {
}
}
useEffect(() => {
addons?.setValue(addons?.dataPath, presetValue || '')
}, [presetValue])
return (
<div className={styles.signature}>
<div className={styles.content} onClick={open}>
......
import React, { useState, useEffect, useRef, useImperativeHandle, forwardRef, useMemo, useLayoutEffect } from 'react'
import { Input } from 'antd'
import styles from './index.less'
import { request } from '@wisdom-utils/utils'
import { Editor, Toolbar } from '@wangeditor/editor-for-react'
import { DomEditor } from '@wangeditor/editor'
import '@wangeditor/editor/dist/css/style.css'
import Drag from '../../../../components/Drag'
const uploadFileAPI = `/PandaWorkFlow/WorkFlow/AccountManage/UploaderFiles`;
const downFileAPI = `/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles`;
const RichTextDefault = (props, ref) => {
W
const { schema, onChange, value, addons } = props
const { title } = addons?.formData || {}
const { presetValue, disabled, placeholder } = schema
const [text, setText] = useState('')
const [visible, setVisible] = useState(false)
const [editor, setEditor] = useState(null)
const editorChange = (editor) => {
setText(editor.getHtml())
}
const iconClick = () => {
setText(value)
setVisible(true)
}
const onOk = () => {
onChange(text)
setVisible(false)
}
useEffect(() => {
onChange(presetValue)
}, [presetValue])
useEffect(() => {
return () => {
if (editor == null) return
editor.destroy()
setEditor(null)
}
}, [editor])
return (
<div className={styles.richTextDefault}>
<Input value={value} onFocus={iconClick} />
<Drag
width='60%'
title={`${title}默认值`}
onCancel={() => setVisible(false)}
visible={visible}
onOk={onOk}
>
<div className={styles.richText}>
<Toolbar
editor={editor}
defaultConfig={{
excludeKeys: ['insertLink', 'group-image', 'group-video', 'codeBlock', 'undo', 'redo', 'fullScreen']
}}
mode="default"
style={{ borderBottom: '1px solid #ccc' }}
/>
<Editor
defaultConfig={{
readOnly: disabled,
placeholder: placeholder || '',
focus: false,
pasteFilterStyle: true, // 忽略粘贴样式
pasteIgnoreImg: true, // 忽略粘贴的图片
styleWithCSS: false,
zIndex: 500,
MENU_CONF: {
uploadImage: {
customInsert(res, inserFn) {
const formData = new FormData();
formData.append('file', file);
},
server: uploadFileAPI,
}
}
}}
value={text}
onCreated={setEditor}
onChange={editorChange}
mode="default"
style={{ minHeight: '300px', overflowY: 'hidden' }}
/>
</div>
</Drag>
</div>
)
}
export default forwardRef(RichTextDefault);
@import '~antd/es/style/themes/default.less';
@pandaXform-prefix-cls: ~'@{ant-prefix}-pandaXform';
.richText {
border: 1px solid #ccc;
z-index: 100;
&[disabled] {
border: none;
background: #f8fafc;
.w-e-text-container {
background: none;
}
}
}
.RichText {
width: 100%;
height: auto;
min-height: 300px;
position: relative;
display: flex;
flex-direction: column;
border: 1px solid #d9d9d9;
border-radius: 2px;
&[disabled] {
.w-e-text-container {
background: none;
}
border: none;
background: #f8fafc;
.RichTextToolbar {
display: none;
}
}
.loadingWrap {
width: 100%;
height: 100%;
position: absolute;
display: flex;
align-items: center;
justify-content: center;
top: 0;
left: 0;
background-color: rgba(255, 255, 255, 0.8);
}
ol li {
list-style: decimal !important;
}
ul li {
list-style: disc !important;
}
}
.RichTextContainer {
background-color: #fff;
color: #000000d9;
position: relative;
overflow-y: scroll;
flex: 1;
}
.RichTextToolbar {
border-bottom: 1px solid #d9d9d9; // height: 0;
// overflow: hidden;
.w-e-toolbar .w-e-menu i {
background-color: transparent!important;
}
}
:global {
#RichTextContainer span[data-type='person'] {
font-weight: bold;
color: #44acb6 !important;
} // .w-e-menu[data-title="图片"] {
// display: none;
// }
.RichText-image {
position: relative;
display: inline-block;
}
#RichTextContainer .RichText-image-img {
max-width: calc(100% - 20px);
display: inline-block;
width: auto;
height: auto;
}
.RichText-image-mask {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
background: rgba(0, 0, 0, 0.5);
cursor: pointer;
opacity: 0;
transition: opacity 0.3s;
padding: 0;
margin: 0;
box-sizing: border-box;
}
.RichText-image-mask-info {
padding: 0;
margin: 0;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
cursor: pointer;
color: #fff;
font-size: 20px;
}
.RichText-image-mask-info .anticon {
margin-inline-end: 4px;
}
.anticon svg {
display: inline-block;
}
.RichText-image-mask:hover {
opacity: 1;
}
.r-t-add-file {
color: #999;
font-family: 'w-e-icon' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
padding: 0;
margin: 0;
box-sizing: border-box;
}
.r-t-add-file:before {
content: "\e9cb";
}
.@{ant-prefix}-image-error {
display: block;
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import TimeDefault from './TimeDefault'
import WidgetType from './WidgetType'
import HiddenCondition from './HiddenCondition'
import SwitchDefault from './SwitchDefault'
import RichTextDefault from './RichTextDefault'
const groupBase = {
FieldNames,
......@@ -20,6 +21,7 @@ const groupBase = {
WidgetType,
HiddenCondition,
SwitchDefault,
RichTextDefault,
}
export default groupBase
\ 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