Rev 14387 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
import React, { useState, useEffect } from 'react'import { CKEditor } from 'ckeditor4-react'const DescriptionInput = ({ name, onChange, defaultValue, outputValue }) => {const [myVal ,setMyVal] = useState((defaultValue !== '' )? defaultValue:'' )useEffect(() => {setMyVal((defaultValue !== '' )? defaultValue:'')},[defaultValue])return (<CKEditorinitData={myVal}onChange={(e) => {const text = e.editor.getData()onChange(name, text)setMyVal(text)outputValue(text)}}onInstanceReady={(e) => e.editor.setData(myVal)}config={{toolbar: [{ name: 'editing', items: ['Scayt'] },{ name: 'links', items: ['Link', 'Unlink'] },{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },{ name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },'/',{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },{ name: 'styles', items: ['Styles', 'Format'] },{ name: 'tools', items: ['Maximize'] }],language_list: ['es:Spanish'],language: 'es',removePlugins: 'elementspath,Anchor',heigth: 100}}id={name}name="description"/>)}export default DescriptionInput