Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
Substitute image placeholder on the client side
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Jul 24, 2019
1 parent 74e7c17 commit 933187a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,13 @@
client(`${this.defaultFile.storage_url}${this.itemId}.json`)
.then(itemResponse => {
if (this.validateItemData(itemResponse.entity)) {
this.item = itemResponse.entity;
// Replace any placeholder values for image URLs with
// the base URL for the perseus file we are reading from
const value = JSON.stringify(itemResponse.entity).replace(
/\$\{☣ LOCALPATH\}\//,
`${window.location.protocol}//${window.location.host}${this.defaultFile.storage_url}`
);
this.item = JSON.parse(value);
if (this.$el) {
// Don't try to render if our component is not mounted yet.
this.renderItem();
Expand Down

0 comments on commit 933187a

Please sign in to comment.