diff --git a/app/renderer/services/reference-service.ts b/app/renderer/services/reference-service.ts index 5cefa24e..1243e9d2 100644 --- a/app/renderer/services/reference-service.ts +++ b/app/renderer/services/reference-service.ts @@ -351,7 +351,7 @@ export class ReferenceService { case "BibTex": copyStr = this.exportBibTexBody(this.toCite(paperEntityDrafts)); break; - case "BibTexKey": + case "BibTex-Key": copyStr = this.exportBibTexKey(this.toCite(paperEntityDrafts)); break; case "PlainText": diff --git a/app/repositories/db-repository/categorizer-repository.ts b/app/repositories/db-repository/categorizer-repository.ts index 37c88a16..666e4bd8 100644 --- a/app/repositories/db-repository/categorizer-repository.ts +++ b/app/repositories/db-repository/categorizer-repository.ts @@ -57,10 +57,22 @@ export class CategorizerRepository extends Eventable( - type, - new Realm.BSON.ObjectId(categorizer._id) - ); + let object: ICategorizerObject | null; + if (categorizer._id) { + object = realm.objectForPrimaryKey( + type, + new Realm.BSON.ObjectId(categorizer._id) + ); + } else { + const objects = realm + .objects(type) + .filtered(`name == "${categorizer.name}"`); + if (objects.length > 0) { + object = objects[0]; + } else { + object = null; + } + } return object as ICategorizerRealmObject | null; } }