mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-09 00:45:32 +08:00
feat: add copy missed words to result screen (fehmer) (#5086)
* feat: Add copy missed words to result screen * remove margin * update icons --------- Co-authored-by: Miodec <jack@monkeytype.com>
This commit is contained in:
parent
67881cace8
commit
a1f883b99f
3 changed files with 33 additions and 12 deletions
|
|
@ -567,7 +567,6 @@
|
|||
margin-bottom: 1rem;
|
||||
.textButton {
|
||||
padding: 0;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
.heatmapLegend {
|
||||
margin-left: 0.5rem;
|
||||
|
|
|
|||
|
|
@ -1249,23 +1249,37 @@ $(".pageTest").on("click", "#saveScreenshotButton", () => {
|
|||
});
|
||||
|
||||
$(".pageTest #copyWordsListButton").on("click", async () => {
|
||||
let words;
|
||||
if (Config.mode === "zen") {
|
||||
words = TestInput.input.history.join(" ");
|
||||
} else {
|
||||
words = (TestWords.words.get() as string[])
|
||||
.slice(0, TestInput.input.history.length)
|
||||
.join(" ");
|
||||
}
|
||||
await copyToClipboard(words);
|
||||
});
|
||||
|
||||
$(".pageTest #copyMissedWordsListButton").on("click", async () => {
|
||||
let words;
|
||||
if (Config.mode === "zen") {
|
||||
words = TestInput.input.history.join(" ");
|
||||
} else {
|
||||
words = Object.keys(TestInput.missedWords ?? {}).join(" ");
|
||||
}
|
||||
await copyToClipboard(words);
|
||||
});
|
||||
|
||||
async function copyToClipboard(content: string): Promise<void> {
|
||||
try {
|
||||
let words;
|
||||
if (Config.mode === "zen") {
|
||||
words = TestInput.input.history.join(" ");
|
||||
} else {
|
||||
words = (TestWords.words.get() as string[])
|
||||
.slice(0, TestInput.input.history.length)
|
||||
.join(" ");
|
||||
}
|
||||
await navigator.clipboard.writeText(words);
|
||||
await navigator.clipboard.writeText(content);
|
||||
Notifications.add("Copied to clipboard", 0, {
|
||||
duration: 2,
|
||||
});
|
||||
} catch (e) {
|
||||
Notifications.add("Could not copy to clipboard: " + e, -1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(".pageTest #toggleBurstHeatmap").on("click", async () => {
|
||||
UpdateConfig.setBurstHeatmap(!Config.burstHeatmap);
|
||||
|
|
|
|||
|
|
@ -303,7 +303,15 @@
|
|||
data-balloon-pos="up"
|
||||
style="display: inline-block"
|
||||
>
|
||||
<i class="fas fa-fw fa-copy"></i>
|
||||
<i class="fas fa-fw fa-align-left"></i>
|
||||
</span>
|
||||
<span
|
||||
id="copyMissedWordsListButton"
|
||||
class="textButton"
|
||||
aria-label="Copy missed words list"
|
||||
data-balloon-pos="up"
|
||||
>
|
||||
<i class="fas fa-fw fa-times"></i>
|
||||
</span>
|
||||
<span
|
||||
id="toggleBurstHeatmap"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue