@@ -507,15 +507,15 @@ export class ArrayEditor extends AbstractEditor {
507507 self . rows [ i ] . delete_button = this . getButton ( self . getItemTitle ( ) , 'delete' , this . translate ( 'button_delete_row_title' , [ self . getItemTitle ( ) ] ) )
508508 self . rows [ i ] . delete_button . classList . add ( 'delete' , 'json-editor-btntype-delete' )
509509 self . rows [ i ] . delete_button . setAttribute ( 'data-i' , i )
510- self . rows [ i ] . delete_button . addEventListener ( 'click' , function ( e ) {
510+ self . rows [ i ] . delete_button . addEventListener ( 'click' , e => {
511511 e . preventDefault ( )
512512 e . stopPropagation ( )
513513
514514 if ( ! self . askConfirmation ( ) ) {
515515 return false
516516 }
517517
518- const i = this . getAttribute ( 'data-i' ) * 1
518+ const i = e . currentTarget . getAttribute ( 'data-i' ) * 1
519519 const newval = self . getValue ( ) . filter ( ( row , j ) => j !== i )
520520 let newActiveTab = null
521521
@@ -548,11 +548,11 @@ export class ArrayEditor extends AbstractEditor {
548548 self . rows [ i ] . copy_button = this . getButton ( self . getItemTitle ( ) , 'copy' , `Copy ${ self . getItemTitle ( ) } ` )
549549 self . rows [ i ] . copy_button . classList . add ( 'copy' , 'json-editor-btntype-copy' )
550550 self . rows [ i ] . copy_button . setAttribute ( 'data-i' , i )
551- self . rows [ i ] . copy_button . addEventListener ( 'click' , function ( e ) {
551+ self . rows [ i ] . copy_button . addEventListener ( 'click' , e => {
552552 const value = self . getValue ( )
553553 e . preventDefault ( )
554554 e . stopPropagation ( )
555- const i = this . getAttribute ( 'data-i' ) * 1
555+ const i = e . currentTarget . getAttribute ( 'data-i' ) * 1
556556
557557 value . forEach ( ( row , j ) => {
558558 if ( j === i ) {
@@ -572,10 +572,10 @@ export class ArrayEditor extends AbstractEditor {
572572 self . rows [ i ] . moveup_button = this . getButton ( '' , ( this . schema . format === 'tabs-top' ? 'moveleft' : 'moveup' ) , this . translate ( 'button_move_up_title' ) )
573573 self . rows [ i ] . moveup_button . classList . add ( 'moveup' , 'json-editor-btntype-move' )
574574 self . rows [ i ] . moveup_button . setAttribute ( 'data-i' , i )
575- self . rows [ i ] . moveup_button . addEventListener ( 'click' , function ( e ) {
575+ self . rows [ i ] . moveup_button . addEventListener ( 'click' , e => {
576576 e . preventDefault ( )
577577 e . stopPropagation ( )
578- const i = this . getAttribute ( 'data-i' ) * 1
578+ const i = e . currentTarget . getAttribute ( 'data-i' ) * 1
579579
580580 if ( i <= 0 ) return
581581 const rows = self . getValue ( )
@@ -601,10 +601,10 @@ export class ArrayEditor extends AbstractEditor {
601601 self . rows [ i ] . movedown_button = this . getButton ( '' , ( this . schema . format === 'tabs-top' ? 'moveright' : 'movedown' ) , this . translate ( 'button_move_down_title' ) )
602602 self . rows [ i ] . movedown_button . classList . add ( 'movedown' , 'json-editor-btntype-move' )
603603 self . rows [ i ] . movedown_button . setAttribute ( 'data-i' , i )
604- self . rows [ i ] . movedown_button . addEventListener ( 'click' , function ( e ) {
604+ self . rows [ i ] . movedown_button . addEventListener ( 'click' , e => {
605605 e . preventDefault ( )
606606 e . stopPropagation ( )
607- const i = this . getAttribute ( 'data-i' ) * 1
607+ const i = e . currentTarget . getAttribute ( 'data-i' ) * 1
608608
609609 const rows = self . getValue ( )
610610 if ( i >= rows . length - 1 ) return
@@ -642,7 +642,7 @@ export class ArrayEditor extends AbstractEditor {
642642
643643 const rowHolderDisplay = self . row_holder . style . display
644644 const controlsDisplay = self . controls . style . display
645- this . toggle_button . addEventListener ( 'click' , function ( e ) {
645+ this . toggle_button . addEventListener ( 'click' , e => {
646646 e . preventDefault ( )
647647 e . stopPropagation ( )
648648 if ( self . collapsed ) {
@@ -651,14 +651,14 @@ export class ArrayEditor extends AbstractEditor {
651651 self . row_holder . style . display = rowHolderDisplay
652652 if ( self . tabs_holder ) self . tabs_holder . style . display = ''
653653 self . controls . style . display = controlsDisplay
654- self . setButtonText ( this , '' , 'collapse' , self . translate ( 'button_collapse' ) )
654+ self . setButtonText ( e . currentTarget , '' , 'collapse' , self . translate ( 'button_collapse' ) )
655655 } else {
656656 self . collapsed = true
657657 self . row_holder . style . display = 'none'
658658 if ( self . tabs_holder ) self . tabs_holder . style . display = 'none'
659659 self . controls . style . display = 'none'
660660 if ( self . panel ) self . panel . style . display = 'none'
661- self . setButtonText ( this , '' , 'expand' , self . translate ( 'button_expand' ) )
661+ self . setButtonText ( e . currentTarget , '' , 'expand' , self . translate ( 'button_expand' ) )
662662 }
663663 } )
664664
0 commit comments