Skip to content

Commit

Permalink
Fix: #385 quickpast window cannot export citatin keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyChen777 committed Feb 28, 2024
1 parent 06d0d16 commit 8e2cc15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/renderer/services/reference-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
20 changes: 16 additions & 4 deletions app/repositories/db-repository/categorizer-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,22 @@ export class CategorizerRepository extends Eventable<ICategorizerRepositoryState
return object as ICategorizerRealmObject | null;
}
} else {
const object = realm.objectForPrimaryKey<Categorizer>(
type,
new Realm.BSON.ObjectId(categorizer._id)
);
let object: ICategorizerObject | null;
if (categorizer._id) {
object = realm.objectForPrimaryKey<Categorizer>(
type,
new Realm.BSON.ObjectId(categorizer._id)
);
} else {
const objects = realm
.objects<Categorizer>(type)
.filtered(`name == "${categorizer.name}"`);
if (objects.length > 0) {
object = objects[0];
} else {
object = null;
}
}
return object as ICategorizerRealmObject | null;
}
}
Expand Down

0 comments on commit 8e2cc15

Please sign in to comment.