Skip to content

Commit

Permalink
fix: use isFullSegmentImage instead of isImage for AddToSourceSheet b…
Browse files Browse the repository at this point in the history
…ecause we only want to prohibit full segment images.
  • Loading branch information
nsantacruz committed Aug 10, 2023
1 parent d6f0e4f commit 9ddae47
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion static/js/AddToSourceSheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class AddToSourceSheetBox extends Component {
// validate texts corresponding to refs have no images before posting them to sheet
for (let i = 0; i < refs.length; i++) {
let ref = Sefaria.getRefFromCache(refs[i]);
if (ref && (Sefaria.isImage(ref.he) || Sefaria.isImage(ref.text))) {
if (ref && (Sefaria.isFullSegmentImage(ref.he) || Sefaria.isFullSegmentImage(ref.text))) {
alert("We do not currently support adding images to source sheets.");
return false;
}
Expand Down
4 changes: 0 additions & 4 deletions static/js/sefaria/sefaria.js
Original file line number Diff line number Diff line change
Expand Up @@ -1013,10 +1013,6 @@ Sefaria = extend(Sefaria, {
const pattern = /^\s*<img\b[^>]*>\s*$/i;
return pattern.test(text);
},
isImage: function(textChunk) {
const pattern = /<img\b[^>]*>/i;
return pattern.test(textChunk);
},
getRefFromCache: function(ref) {
if (!ref) return null;
const versionedKey = this._refmap[this._refKey(ref)] || this._refmap[this._refKey(ref, {context:1})];
Expand Down

0 comments on commit 9ddae47

Please sign in to comment.