Parcourir la source

fix: EditForm中textarea过滤掉换行符

lanjianrong il y a 4 ans
Parent
commit
c0f4f903f1
1 fichiers modifiés avec 4 ajouts et 3 suppressions
  1. 4 3
      src/components/EditableForm/src/editableFormItem.jsx

+ 4 - 3
src/components/EditableForm/src/editableFormItem.jsx

@@ -136,8 +136,8 @@ const EditableFormItem = ({
       toggleEdit()
       return
     }
-    await handleConfirm(value)
-    setState({ ...state, val: value, extraVal: local })
+    await handleConfirm(value.replaceAll('\n', ''))
+    setState({ ...state, val: value.replaceAll('\n', ''), extraVal: local })
     toggleEdit()
   }
 
@@ -211,7 +211,8 @@ const EditableFormItem = ({
     cell = (
       <div
         className={['editable-cell-value-wrap', !editable ? 'disable' : ''].join(' ')}
-        onClick={toggleEdit}>
+        onClick={toggleEdit}
+      >
         {content}
       </div>
     )