Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1607 Rev 1608
Línea 46... Línea 46...
46
    register,
46
    register,
47
    unregister,
47
    unregister,
48
    errors,
48
    errors,
49
    handleSubmit,
49
    handleSubmit,
50
    setValue,
50
    setValue,
51
    watch,
-
 
52
    getValues,
51
    getValues,
53
    clearErrors,
52
    clearErrors,
54
    setError,
53
    setError,
55
    reset
54
    reset
56
  } = useForm({
55
  } = useForm({
Línea 62... Línea 61...
62
 
61
 
63
  useEffect(() => {
62
  useEffect(() => {
64
    register('description', {
63
    register('description', {
65
      required: { value: 'true', message: 'El campo es requerido' }
64
      required: { value: 'true', message: 'El campo es requerido' }
-
 
65
    })
66
    })
66
 
67
    register('posted_or_shared')
67
    register('posted_or_shared')
68
    if (
68
    if (
69
      modalType !== shareModalTypes.POST &&
69
      modalType !== shareModalTypes.POST &&
70
      modalType !== shareModalTypes.SHARE
70
      modalType !== shareModalTypes.SHARE
Línea 93... Línea 93...
93
    const postedOrShared = modalType === shareModalTypes.SHARE ? 's' : 'p'
93
    const postedOrShared = modalType === shareModalTypes.SHARE ? 's' : 'p'
94
    setValue('posted_or_shared', postedOrShared)
94
    setValue('posted_or_shared', postedOrShared)
95
    if (getValues('file') || getValues('description')) {
95
    if (getValues('file') || getValues('description')) {
96
      if (modalType !== lastModalType) {
96
      if (modalType !== lastModalType) {
97
        closeShareModal()
97
        closeShareModal()
98
        handleShowConfirmModal()
98
        toggleConfirmModal()
99
      }
99
      }
100
    }
100
    }
101
  }, [modalType])
101
  }, [modalType])
Línea 102... Línea 102...
102
 
102
 
Línea 113... Línea 113...
113
      }
113
      }
114
    }, 3000)
114
    }, 3000)
115
  }
115
  }
Línea 116... Línea 116...
116
 
116
 
117
  useEffect(() => {
-
 
118
    if (!isOpen) {
-
 
119
      setValue('file', '')
-
 
120
      return
-
 
121
    }
-
 
122
 
117
  useEffect(() => {
123
    clearErrors()
118
    clearErrors()
124
    hideDuplicatedModal()
119
    hideDuplicatedModal()
Línea 125... Línea -...
125
  }, [isOpen])
-
 
126
 
120
  }, [isOpen])
127
  const handleShowConfirmModal = () => {
-
 
Línea 128... Línea 121...
128
    setShowConfirmModal(!showConfirmModal)
121
 
129
  }
122
  const toggleConfirmModal = () => setShowConfirmModal(!showConfirmModal)
130
 
123
 
131
  const handleModalAccept = () => {
124
  const handleModalAccept = () => {
Línea 240... Línea 233...
240
        show={isOpen}
233
        show={isOpen}
241
        title={labels.share_a_post}
234
        title={labels.share_a_post}
242
        labelAccept={labels.send}
235
        labelAccept={labels.send}
243
        labelReject={labels.cancel}
236
        labelReject={labels.cancel}
244
        onClose={closeShareModal}
237
        onClose={closeShareModal}
245
        onReject={closeShareModal}
-
 
246
        onAccept={handleSubmit(onSubmit)}
238
        onAccept={handleSubmit(onSubmit)}
247
      >
239
      >
248
        {SharedWithSelectRender()}
240
        {SharedWithSelectRender()}
Línea 249... Línea 241...
249
 
241
 
250
        <CKEditor
242
        <CKEditor
251
          data={watch('description')}
-
 
252
          onChange={(e) => {
-
 
253
            const text = e.editor.getData()
-
 
254
            setValue('description', text)
-
 
255
          }}
243
          data={getValues('description')}
256
          config={CKEDITOR_OPTIONS}
244
          config={CKEDITOR_OPTIONS}
257
          name='description'
245
          onChange={({ editor }) => setValue('description', editor.getData())}
258
          onDialogShow={() => {
246
          onDialogShow={() => {
259
            const modal = document.querySelector('.fade.modal.show')
247
            const modal = document.querySelector('.fade.modal.show')
260
            modal.removeAttribute('tabindex')
248
            modal.removeAttribute('tabindex')
261
          }}
-
 
262
          onBeforeLoad={() => {
249
          }}
263
            setIsCKEditorLoading(false)
-
 
264
          }}
250
          onBeforeLoad={() => setIsCKEditorLoading(false)}
Línea 265... Línea 251...
265
        />
251
        />
Línea 266... Línea 252...
266
 
252