Skip to content

Commit

Permalink
fix: copy rare headwords when not in simplified copy mode
Browse files Browse the repository at this point in the history
Fixes #1665.
  • Loading branch information
birtles committed Mar 12, 2024
1 parent 3e78aa8 commit 37f121c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ app.

## [Unreleased]

- Made copying to the clipboard include rare headwords again when not using
simplified copy mode
([#1665](https://github.com/birchill/10ten-ja-reader/issues/1665)).

## [1.18.0] - 2024-02-26

- Made the puck persist its position, orientation, and active state between
Expand Down
14 changes: 2 additions & 12 deletions src/content/copy-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,7 @@ function filterRelevantKanjiHeadwords(
}
) {
if (includeLessCommonHeadwords) {
// Exclude search-only / rare headwords unless we matched on them.
//
// The reason we include search-only / rare headwords if we matched on them
// is that it's quite possible that if a user matched on a rare headword
// such as a rare kanji they'd like to copy it to the clipboard for further
// searching.
return headwords.filter(
(k) => (!k.i?.includes('sK') && !k.i?.includes('rK')) || k.matchRange
);
return headwords.filter((k) => !k.i?.includes('sK'));
}

const commonHeadwords = headwords.filter(
Expand Down Expand Up @@ -279,9 +271,7 @@ function filterRelevantKanaHeadwords(
}
) {
if (includeLessCommonHeadwords) {
return headwords.filter(
(k) => (!k.i?.includes('sk') && !k.i?.includes('rk')) || k.matchRange
);
return headwords.filter((k) => !k.i?.includes('sk'));
}

const commonHeadwords = headwords.filter(
Expand Down

0 comments on commit 37f121c

Please sign in to comment.