feat: add an option to show/hide original text in translation, also closes #1492 (#1511)

This commit is contained in:
Huang Xin
2025-07-02 13:27:05 +08:00
committed by GitHub
parent a254139200
commit 8eefba2bee
34 changed files with 203 additions and 53 deletions
@@ -57,7 +57,7 @@ const TOCItemView = React.memo<{
);
return (
<span
<div
role='treeitem'
tabIndex={-1}
onClick={item.href ? handleClickItem : undefined}
@@ -87,7 +87,7 @@ const TOCItemView = React.memo<{
{createExpanderIcon(flatItem.isExpanded || false)}
</span>
)}
<span
<div
className='ms-2 truncate text-ellipsis'
style={{
maxWidth: 'calc(100% - 24px)',
@@ -96,13 +96,13 @@ const TOCItemView = React.memo<{
}}
>
{item.label}
</span>
</div>
{item.location && (
<span className='text-base-content/50 ms-auto ps-1 text-xs sm:pe-1'>
<div className='text-base-content/50 ms-auto ps-1 text-xs sm:pe-1'>
{item.location.current + 1}
</span>
</div>
)}
</span>
</div>
);
});
@@ -45,7 +45,7 @@ const TOCView: React.FC<{
const vitualListRef = useRef<VirtualList | null>(null);
const staticListRef = useRef<HTMLDivElement | null>(null);
useTextTranslation(bookKey, containerRef.current);
useTextTranslation(bookKey, containerRef.current, false, 'translation-target-toc');
useEffect(() => {
const updateHeight = () => {