File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export default class ColorsListComponent extends Component<ColorsListSignature>
3434 return palette . colors . sortBy ( 'createdAt' ) . reverse ( ) ;
3535 } else {
3636 return palette . colorOrder . map ( ( color : ColorModel ) => {
37- return palette . colors . findBy ( 'id' , color . id ) ;
37+ return palette . colors . find ( ( c ) => c . id === color . id ) ;
3838 } ) ;
3939 }
4040 }
@@ -77,7 +77,7 @@ export default class ColorsListComponent extends Component<ColorsListSignature>
7777 return { type : 'color' , id : color . id } ;
7878 } ) ;
7979
80- const colorToRemove = colorsList . findBy ( 'id' , color . id ) ;
80+ const colorToRemove = colorsList . find ( ( c ) => c . id === color . id ) ;
8181
8282 if ( colorToRemove ) {
8383 colorsList . removeObject ( colorToRemove ) ;
Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ export default class PaletteRowComponent extends Component<PaletteRowSignature>
157157 ) ,
158158 ] ;
159159
160+ // @ts -expect-error dragSort.on does not seem to exist in TS
160161 this . dragSort . on (
161162 'start' ,
162163 ( event : { draggedItem : { hex : string | null } } ) => {
@@ -175,7 +176,7 @@ export default class PaletteRowComponent extends Component<PaletteRowSignature>
175176 get sortedColors ( ) : ( ColorModel | undefined ) [ ] {
176177 return this . args ?. palette ?. colorOrder ?. map (
177178 ( color : { type : string ; id : string } ) => {
178- return this . args . palette . colors . findBy ( 'id' , color . id ) ;
179+ return this . args . palette . colors . find ( ( c ) => c . id === color . id ) ;
179180 } ,
180181 ) ;
181182 }
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export default class PalettesListComponent extends Component<PalettesListSignatu
6161 } ) : Promise < void > {
6262 if ( sourceList === targetList && sourceIndex === targetIndex ) return ;
6363
64- const movedItem = sourceList . objectAt ( sourceIndex ) as PaletteModel ;
64+ const movedItem = sourceList [ sourceIndex ] as PaletteModel ;
6565
6666 sourceList . removeAt ( sourceIndex ) ;
6767 targetList . insertAt ( targetIndex , movedItem ) ;
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export default class SettingsData extends Component {
5252
5353 IDBExportImport . exportToJsonString (
5454 idbDatabase ,
55- ( err : Event , jsonString : string ) => {
55+ ( err : Event | null , jsonString : string ) => {
5656 if ( err ) {
5757 this . flashMessages . danger ( 'An error occurred.' ) ;
5858 // eslint-disable-next-line no-console
@@ -83,13 +83,13 @@ export default class SettingsData extends Component {
8383 DBOpenRequest . onsuccess = ( ) => {
8484 const idbDatabase = DBOpenRequest . result ;
8585
86- IDBExportImport . clearDatabase ( idbDatabase , ( err : Event ) => {
86+ IDBExportImport . clearDatabase ( idbDatabase , ( err : Event | null ) => {
8787 if ( ! err ) {
8888 // cleared data successfully
8989 IDBExportImport . importFromJsonString (
9090 idbDatabase ,
9191 jsonString ,
92- async ( err : Event ) => {
92+ async ( err : Event | null ) => {
9393 if ( ! err ) {
9494 idbDatabase . close ( ) ;
9595
@@ -106,8 +106,8 @@ export default class SettingsData extends Component {
106106
107107 await this . store . sync ( ( t ) =>
108108 records . map ( ( r ) => {
109- if ( r ?. attributes ?. hex ) {
110- delete r . attributes . hex ;
109+ if ( r ?. attributes ?. [ ' hex' ] ) {
110+ delete r . attributes [ ' hex' ] ;
111111 }
112112
113113 return t . addRecord ( r ) ;
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ export default class PalettesController extends Controller {
107107 // If the palette is locked, we should not allow dragging colors into or out of it
108108 if ( sourcePalette ?. isLocked || targetPalette ?. isLocked ) return ;
109109
110- const sourceColor = sourceList . objectAt ( sourceIndex ) ;
110+ const sourceColor = sourceList [ sourceIndex ] ;
111111
112112 if ( sourceColor ) {
113113 if ( sourceArgs . isColorHistory ) {
You can’t perform that action at this time.
0 commit comments