Skip to content

Commit

Permalink
Fixed a few more locations where id checks were also checking the typ…
Browse files Browse the repository at this point in the history
…e - which doesn't work across id types (integers or strings for ulids.etc.
  • Loading branch information
kirkbushell committed Aug 13, 2023
1 parent afa1dc6 commit f9738f9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions resources/js/curator.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,30 @@ export default function curator({statePath, types, initialSelection = null, isMu
},
removeFile: function (media = null) {
if (media) {
this.files = this.files.filter((obj) => obj.id !== media.id);
this.files = this.files.filter(obj => obj.id != media.id);
this.removeFromSelection(media.id);
}
},
addToSelection: function (mediaId = null, event = null) {
if (this.selected.length === 1 && !this.isMultiple) {
this.selected = [this.files.find(obj => obj.id === mediaId)];
this.selected = [this.files.find(obj => obj.id == mediaId)];
return;
}

if (event && event.metaKey) {
this.selected.push(this.files.find(obj => obj.id === mediaId));
this.selected.push(this.files.find(obj => obj.id == mediaId));
return;
}

this.selected = [this.files.find(obj => obj.id === mediaId)];
this.selected = [this.files.find(obj => obj.id == mediaId)];
},
removeFromSelection: function (mediaId = null) {
this.selected = this.selected.filter((obj) => obj.id !== mediaId);
this.selected = this.selected.filter(obj => obj.id != mediaId);
},
isSelected: function (mediaId = null) {
if (this.selected.length === 0) return false;

return this.selected.find((obj) => obj.id === mediaId) !== undefined;
return this.selected.find((obj) => obj.id == mediaId) !== undefined;
},
insertMedia: function () {
this.$dispatch('insert-media', {
Expand Down

0 comments on commit f9738f9

Please sign in to comment.