Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2250 Rev 2521
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useState } from 'react'
2
import { useForm } from 'react-hook-form'
2
import { useForm } from 'react-hook-form'
3
import { connect, useSelector } from 'react-redux'
3
import { connect, useSelector } from 'react-redux'
4
import { CKEditor } from 'ckeditor4-react'
-
 
Línea 5... Línea 4...
5
 
4
 
6
import { axios, CKEDITOR_OPTIONS } from '@app/utils'
5
import { axios } from '@app/utils'
7
import { addNotification } from '@app/redux/notification/notification.actions'
6
import { addNotification } from '@app/redux/notification/notification.actions'
8
import {
7
import {
9
  closeShareModal,
8
  closeShareModal,
10
  openShareModal,
9
  openShareModal,
Línea 16... Línea 15...
16
import { feedTypes } from '@app/redux/feed/feed.types'
15
import { feedTypes } from '@app/redux/feed/feed.types'
Línea 17... Línea 16...
17
 
16
 
18
import DropzoneComponent from '../dropzone/DropzoneComponent'
17
import DropzoneComponent from '../dropzone/DropzoneComponent'
19
import FormErrorFeedback from '../UI/form/FormErrorFeedback'
18
import FormErrorFeedback from '../UI/form/FormErrorFeedback'
20
import Modal from '../UI/modal/Modal'
19
import Modal from '../UI/modal/Modal'
21
import Spinner from '../UI/Spinner'
20
import CKEditor from '@app/components/UI/Ckeditor'
Línea 22... Línea 21...
22
import ConfirmModal from './ConfirmModal'
21
import ConfirmModal from './ConfirmModal'
23
 
22
 
24
const ShareModal = ({
23
const ShareModal = ({
Línea 32... Línea 31...
32
  closeShareModal, // Redux action
31
  closeShareModal, // Redux action
33
  addNotification, // Redux action
32
  addNotification, // Redux action
34
  addFeed, // Redux action
33
  addFeed, // Redux action
35
  openShareModal // Redux action
34
  openShareModal // Redux action
36
}) => {
35
}) => {
37
  const [isCKEditorLoading, setIsCKEditorLoading] = useState(true)
-
 
38
  const [showConfirmModal, setShowConfirmModal] = useState(false)
36
  const [showConfirmModal, setShowConfirmModal] = useState(false)
39
  const labels = useSelector(({ intl }) => intl.labels)
37
  const labels = useSelector(({ intl }) => intl.labels)
Línea 40... Línea 38...
40
 
38
 
41
  const {
39
  const {
Línea 52... Línea 50...
52
    defaultValues: {
50
    defaultValues: {
53
      description: '',
51
      description: '',
54
      share_width: 'p'
52
      share_width: 'p'
55
    }
53
    }
56
  })
54
  })
-
 
55
  const watchedDescription = watch('description')
Línea 57... Línea 56...
57
 
56
 
58
  const recomendationText = () => {
57
  const recomendationText = () => {
59
    switch (modalType) {
58
    switch (modalType) {
60
      case shareModalTypes.IMAGE:
59
      case shareModalTypes.IMAGE:
Línea 197... Línea 196...
197
            <option value='c'>{labels.connections}</option>
196
            <option value='c'>{labels.connections}</option>
198
          </select>
197
          </select>
199
        ) : null}
198
        ) : null}
Línea 200... Línea 199...
200
 
199
 
201
        <CKEditor
200
        <CKEditor
202
          data={getValues('description')}
-
 
203
          config={CKEDITOR_OPTIONS}
201
          defaultValue={watchedDescription}
204
          onChange={({ editor }) => setValue('description', editor.getData())}
-
 
205
          onDialogShow={() => {
-
 
206
            const modal = document.querySelector('.fade.modal.show')
-
 
207
            modal.removeAttribute('tabindex')
-
 
208
          }}
-
 
209
          onBeforeLoad={() => setIsCKEditorLoading(false)}
202
          onChange={(value) => setValue('description', value)}
Línea 210... Línea -...
210
        />
-
 
211
 
-
 
212
        {isCKEditorLoading && <Spinner />}
203
        />
213
 
204
 
214
        {errors.description && (
205
        {errors.description && (
Línea 215... Línea 206...
215
          <FormErrorFeedback>{errors.description.message}</FormErrorFeedback>
206
          <FormErrorFeedback>{errors.description.message}</FormErrorFeedback>