Skip to content

Commit

Permalink
Merge pull request #2019 from Sefaria/bug/sc-27712/mixed-english-hebr…
Browse files Browse the repository at this point in the history
…ew-verses-not-presenting

make English source text elements always be rendered LTR
  • Loading branch information
nsantacruz authored Sep 17, 2024
2 parents 96d2f35 + ee4329c commit c310057
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions static/js/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ const BoxedSheetElement = ({ attributes, children, element, divineName }) => {
segment: 1,
selected: isActive
};
const heClasses = {he: 1, selected: isActive, editable: activeSourceLangContent == "he" ? true : false };
const heClasses = {he: 1, selected: isActive, editable: activeSourceLangContent == "he" ? true : false};
const enClasses = {en: 1, selected: isActive, editable: activeSourceLangContent == "en" ? true : false };
const dragStart = (e) => {
const slateRange = ReactEditor.findEventRange(parentEditor, e)
Expand Down Expand Up @@ -809,6 +809,15 @@ const BoxedSheetElement = ({ attributes, children, element, divineName }) => {
e.stopPropagation();
parentEditor.dragging = false;
}
const renderEnglishElement = ({attributes, children}) => {
//passed to the English source Editable, to make it always! be rendered as 'ltr'
return (
<span {...attributes} dir='ltr'>
{children}
</span>
)
}


return (
<div
Expand All @@ -833,7 +842,6 @@ const BoxedSheetElement = ({ attributes, children, element, divineName }) => {
readOnly={!sourceActive}
renderLeaf={props => <Leaf {...props} />}
onKeyDown={(e) => onKeyDown(e, sheetSourceHeEditor)}

/>
</Slate>
</div>
Expand All @@ -847,6 +855,7 @@ const BoxedSheetElement = ({ attributes, children, element, divineName }) => {
readOnly={!sourceActive}
renderLeaf={props => <Leaf {...props} />}
onKeyDown={(e) => onKeyDown(e, sheetSourceEnEditor)}
renderElement={renderEnglishElement}
/>
</Slate>
</div>
Expand Down

0 comments on commit c310057

Please sign in to comment.