Lots of Bugfixes (#2356)

This commit is contained in:
Joe Milazzo 2023-10-27 16:18:56 -05:00 committed by GitHub
parent 86e931dd9a
commit 226d6831df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 359 additions and 225 deletions

View file

@ -124,9 +124,9 @@
<div class="col-md-12">
<div class="mb-3">
<label for="tags" class="form-label">{{t('tags-label')}}</label>
<app-typeahead (selectedData)="updateTags($event)" [settings]="tagsSettings"
<app-typeahead (selectedData)="updateTags($event);metadata.tagsLocked = true" [settings]="tagsSettings"
[(locked)]="metadata.tagsLocked" (onUnlock)="metadata.tagsLocked = false"
(newItemAdded)="metadata.tagsLocked = true" (selectedData)="metadata.tagsLocked = true">
(newItemAdded)="metadata.tagsLocked = true">
<ng-template #badgeItem let-item let-position="idx">
{{item.title}}
</ng-template>

View file

@ -368,7 +368,7 @@ export class EditSeriesModalComponent implements OnInit {
return {id: 0, title: title };
});
this.tagsSettings.selectionCompareFn = (a: Tag, b: Tag) => {
return a.id == b.id;
return a.title.toLowerCase() == b.title.toLowerCase();
}
this.tagsSettings.compareFnForAdd = (options: Tag[], filter: string) => {
return options.filter(m => this.utilityService.filterMatches(m.title, filter));
@ -398,7 +398,7 @@ export class EditSeriesModalComponent implements OnInit {
return options.filter(m => this.utilityService.filterMatches(m.title, filter));
}
this.genreSettings.selectionCompareFn = (a: Genre, b: Genre) => {
return a.title == b.title;
return a.title.toLowerCase() == b.title.toLowerCase();
}
this.genreSettings.addTransformFn = ((title: string) => {

View file

@ -103,11 +103,10 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
}
ctx.drawImage(img, 0, 0);
const dataURL = canvas.toDataURL("image/png");
return dataURL;
return canvas.toDataURL("image/png");
}
selectImage(index: number) {
selectImage(index: number, callback?: Function) {
if (this.selectedIndex === index) { return; }
// If we load custom images of series/chapters/covers, then those urls are not properly encoded, so on select we have to clean them up
@ -116,7 +115,11 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
const img = new Image();
img.crossOrigin = 'Anonymous';
img.src = imgUrl;
img.onload = (e) => this.handleUrlImageAdd(img, index);
img.onload = (e) => {
this.handleUrlImageAdd(img, index);
this.selectedBase64Url.emit(this.imageUrls[this.selectedIndex]);
if (callback) callback(index);
};
img.onerror = (e) => {
this.toastr.error(translate('errors.rejected-cover-upload'));
this.form.get('coverImageUrl')?.setValue('');
@ -124,7 +127,6 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
};
this.form.get('coverImageUrl')?.setValue('');
this.cdRef.markForCheck();
this.selectedBase64Url.emit(this.imageUrls[this.selectedIndex]);
return;
}
@ -135,11 +137,13 @@ export class CoverImageChooserComponent implements OnInit, OnDestroy {
}
applyImage(index: number) {
if (this.showApplyButton) {
if (!this.showApplyButton) return;
this.selectImage(index, () => {
this.applyCover.emit(this.imageUrls[index]);
this.appliedIndex = index;
this.cdRef.markForCheck();
}
});
}
resetImage() {