File tree Expand file tree Collapse file tree
components/TextArrayInput
pages/SettingsPage/components/CustomFieldsPanel/CustomFieldForm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { TextInput } from '@strapi/design-system' ;
22import { isArray } from 'lodash' ;
3- import React , { useState } from 'react' ;
3+ import React , { useEffect , useState } from 'react' ;
44
55import { Effect } from '../../types' ;
66
@@ -15,8 +15,9 @@ interface IProps {
1515
1616const TextArrayInput : React . FC < IProps > = ( { onChange, initialValue, ...props } ) => {
1717 const [ value , setValue ] = useState (
18- isArray ( initialValue ) ? initialValue . reduce ( ( acc , cur ) => ` ${ acc } ${ cur } ; ` , ' ') : ''
18+ isArray ( initialValue ) ? initialValue . join ( '; ') : ''
1919 ) ;
20+
2021 const handleOnChange = ( event : { target : { value ?: string } } ) => {
2122 const newValue : string = event ?. target . value ?? '' ;
2223 const valuesArray = newValue
Original file line number Diff line number Diff line change @@ -59,14 +59,18 @@ const CustomFieldForm: React.FC<ICustomFieldFormProps> = ({
5959
6060 const { formatMessage } = useIntl ( ) ;
6161
62- const [ formValue , setFormValue ] = useState < NavigationItemCustomField > ( {
63- name : '' ,
64- label : '' ,
65- type : 'string' ,
66- required : false ,
67- multi : false ,
68- enabled : true ,
69- } ) ;
62+ const [ formValue , setFormValue ] = useState < NavigationItemCustomField > (
63+ customField ? {
64+ ...customField ,
65+ } : {
66+ name : '' ,
67+ label : '' ,
68+ type : 'string' ,
69+ required : false ,
70+ multi : false ,
71+ enabled : true ,
72+ } ,
73+ ) ;
7074 const [ formError , setFormError ] = useState < FormItemErrorSchema < NavigationItemCustomField > > ( ) ;
7175
7276 const { type } = formValue ;
Original file line number Diff line number Diff line change 11{
22 "name" : " strapi-plugin-navigation" ,
3- "version" : " 3.3.1 " ,
3+ "version" : " 3.3.2 " ,
44 "description" : " Strapi - Navigation plugin" ,
55 "strapi" : {
66 "name" : " navigation" ,
You can’t perform that action at this time.
0 commit comments