Skip to content

Commit

Permalink
Merge pull request #1098 from internetarchive/webdev-4812-subfile-boo…
Browse files Browse the repository at this point in the history
…kmark

Bookmarks in multiple file items should work by subfile, so identifier should be either `jack-sparow` or `jack-sparow/subfilename`
  • Loading branch information
nsharma123 authored Dec 15, 2022
2 parents 362e395 + d7c7a31 commit 87fefd2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/BookNavigator/bookmarks/ia-bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,27 @@ class IABookmarks extends LitElement {
}

setup() {
this.api.identifier = this.bookreader.bookId;
this.api.identifier = this.getIdentifier();
if (this.displayMode === 'login') {
return;
}
this.fetchUserBookmarks();
this.setBREventListeners();
}

/**
* get identifier for current book including sub-files
*
* @returns Identifer
*/
getIdentifier() {
if (this.bookreader.bookId !== this.bookreader.subPrefix) {
return `${this.bookreader.bookId}/${this.bookreader.subPrefix}`;
}

return this.bookreader.bookId;
}

updateDisplay() {
if (this.displayMode === 'bookmarks') {
this.fetchUserBookmarks();
Expand Down

0 comments on commit 87fefd2

Please sign in to comment.