Skip to content

Commit

Permalink
fix: Code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnThomson committed Jan 2, 2025
1 parent dd4d841 commit ee56df8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions src/bloom-player-core.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1577,11 +1577,6 @@ export class BloomPlayerCore extends React.Component<IProps, IPlayerState> {
const srcName = item.getAttribute("src");
const srcPath = this.fullUrl(srcName);
item.setAttribute("src", srcPath);

// Add ondragstart="return false" to img elements
if (item.tagName.toLowerCase() === "img") {
item.setAttribute("ondragstart", "return false");
}
}

// now we need to fix elements with attributes like this:
Expand Down Expand Up @@ -2413,11 +2408,15 @@ export class BloomPlayerCore extends React.Component<IProps, IPlayerState> {

private handlePageClick(e: React.MouseEvent): void {
if (
!this.state.ignorePhonyClick || // if we're dragging, that isn't a click we want to propagate
!this.activityManager.getActivityAbsorbsClicking() ||
// clicks in video containers are probably aimed at the video controls.
// Check for special circumstance that should prevent normal click handling. That is,
// we're not processing a phony click from touching a nav button
!this.state.ignorePhonyClick &&
// this page isn't an activity that needs to handle all clicks itself
!this.activityManager.getActivityAbsorbsClicking() &&
// the click isn't in a video container
// (clicks in video containers are probably aimed at the video controls.
// I tried adding another click handler to the video container with stopPropagation,
// but for some reason it didn't work.
// but for some reason it didn't work. (JT: probably a capturing handler on an outer element))
!(e.target as HTMLElement).closest(".bloom-videoContainer")
) {
const newLocation = checkClickForBookOrPageJump(
Expand Down
2 changes: 1 addition & 1 deletion src/stories/BloomPlayerIframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function BloomPlayerIframe({
: "";
return (
<iframe
src={`/bloomplayer.htm?url=${encodeURIComponent(bookUrl)}&start-page=${bookPageIndex}${backButtonParam};${allowToggleAppBarParam}`}
src={`/bloomplayer.htm?url=${encodeURIComponent(bookUrl)}&start-page=${bookPageIndex}${backButtonParam}${allowToggleAppBarParam}`}
style={{ width: "100%", height: "500px" }}
/>
);
Expand Down

0 comments on commit ee56df8

Please sign in to comment.