Skip to content

Commit

Permalink
Fix bolding/reporting errors for side-by-side english view
Browse files Browse the repository at this point in the history
  • Loading branch information
ronshapiro committed Oct 10, 2024
1 parent 4d9405c commit 213bd2e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/ref_selection_snackbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ const findSefariaRef = (node: Node | null): FindSefariaRefReturnType => {
let highlightId;
while (node?.parentElement) {
const $parentElement = $(node.parentElement);
isEnglish = isEnglish || $parentElement.hasClass("english");
console.log($parentElement);
isEnglish = (
isEnglish
|| $parentElement.hasClass("english")
|| $parentElement.hasClass("english-ref-text"));
const isTranslationOfSourceText = $parentElement.hasClass("translation");
const ref = $parentElement.attr("sefaria-ref");
highlightId ||= $parentElement.attr("highlight-id");
Expand Down Expand Up @@ -142,6 +146,7 @@ class SelectionState {
const selection = document.getSelection()!;
this.selectedText = selection.toString().trim() ?? "";
const {isEnglish, hebrew, translation} = this.sefariaRef;
console.log(isEnglish, translation, hebrew);
const entireNodeAndText = isEnglish ? translation : hebrew;
if (entireNodeAndText === undefined) {
throw new Error(`Text is undefined: ${JSON.stringify(this.sefariaRef)}`);
Expand Down

0 comments on commit 213bd2e

Please sign in to comment.