Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 7052 | Rev 7054 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 7052 Rev 7053
Línea 19... Línea 19...
19
}) => {
19
}) => {
20
  const [loading, setLoading] = useState(false)
20
  const [loading, setLoading] = useState(false)
21
  const labels = useSelector(({ intl }) => intl.labels)
21
  const labels = useSelector(({ intl }) => intl.labels)
22
  const dispatch = useDispatch()
22
  const dispatch = useDispatch()
Línea 23... Línea 23...
23
 
23
 
-
 
24
  const { handleSubmit, register, setValue, errors, getValues, watch } =
-
 
25
    useForm()
-
 
26
 
Línea 24... Línea 27...
24
  const { handleSubmit, register, setValue, errors, getValues } = useForm()
27
  const watchDescription = watch('description', '<p></p>')
25
 
28
 
26
  const onSubmit = handleSubmit((data) => {
29
  const onSubmit = handleSubmit((data) => {
27
    setLoading(true)
30
    setLoading(true)
28
    const formData = new FormData()
31
    const formData = new FormData()
29
    Object.entries(data).map(([key, value]) => {
32
    Object.entries(data).map(([key, value]) => {
30
      if (key === 'image' || key === 'attachment') {
33
      if (['attachment', 'image'].includes(key) && value) {
31
        formData.append(key, value[0])
34
        formData.append(key, value[0])
32
        return
35
        return
33
      }
36
      }
Línea 138... Línea 141...
138
          </Form.Group>
141
          </Form.Group>
Línea 139... Línea 142...
139
 
142
 
140
          {show && (
143
          {show && (
141
            <CKEditor
144
            <CKEditor
142
              onChange={(e) => setValue('description', e.editor.getData())}
145
              onChange={(e) => setValue('description', e.editor.getData())}
143
              initData={getValues('description')}
146
              initData={watchDescription}
144
              config={CKEDITOR_OPTIONS}
147
              config={CKEDITOR_OPTIONS}
145
            />
148
            />
146
          )}
149
          )}
147
          {errors.description && (
150
          {errors.description && (