File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ export default class ArrayType extends Text {
66 }
77
88 value ( data ) {
9- if ( Array . isArray ( data ) ) return data ;
10- return JSON . parse ( data ) ;
9+ if ( typeof data === 'string' ) return JSON . parse ( data ) ;
10+ return data ;
1111 }
1212
1313 default ( ) {
@@ -18,8 +18,10 @@ export default class ArrayType extends Text {
1818 key,
1919 container,
2020 } ) {
21+ let index = 0 ;
2122 function add ( text ) {
22- $ ( container ) . append ( createArrayItem ( text , key , value , update ) ) ;
23+ $ ( container ) . append ( createArrayItem ( text , `${ key } .${ index } ` , value , update ) ) ;
24+ index += 1 ;
2325 }
2426 value . forEach ( add ) ;
2527 return $ ( '<input type="text">' ) . css ( {
@@ -42,8 +44,7 @@ export default class ArrayType extends Text {
4244 }
4345}
4446
45- function createArrayItem ( text , skey , value , update ) {
46- const key = `${ skey } .${ text } ` ;
47+ function createArrayItem ( text , key , value , update ) {
4748 const ret = $ ( '<div>' )
4849 . on ( 'change.script' , ( ) => {
4950 const i = value . indexOf ( text ) ;
You can’t perform that action at this time.
0 commit comments