Feat/Disable parameter editing until right clicked 3 times

This commit is contained in:
Luc Mcgrady 2025-09-30 22:43:02 +01:00
parent 0986af4f81
commit 22539933bf
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C
2 changed files with 12 additions and 0 deletions

View file

@ -383,6 +383,7 @@ deck-config-which-deck = Which deck would you like to display options for?
deck-config-updating-cards = Updating cards: { $current_cards_count }/{ $total_cards_count }...
deck-config-invalid-parameters = The provided FSRS parameters are invalid. Leave them blank to use the default parameters.
deck-config-manual-parameter-edit-warning = The parameters should only be generated with the optimize button. Manually editing them is heavily advised against.
deck-config-not-enough-history = Insufficient review history to perform this operation.
deck-config-must-have-400-reviews =
{ $count ->

View file

@ -46,6 +46,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
input.value = stringValue;
}
}
const UNLOCK_EDIT_COUNT = 3;
let rightClickCount = 0;
function onRightClick() {
rightClickCount += 1;
if (rightClickCount == UNLOCK_EDIT_COUNT) {
alert(tr.deckConfigManualParameterEditWarning());
}
}
</script>
<svelte:window onresize={updateHeight} />
@ -56,6 +65,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
on:blur={update}
class="w-100"
placeholder={render(defaults)}
disabled={rightClickCount < UNLOCK_EDIT_COUNT}
on:contextmenu={onRightClick}
></textarea>
<style>