UI: add UI to enable/disable auto-derived templates

This commit is contained in:
Karl-Johan Alm
2024-11-20 00:23:59 +09:00
parent bb062f5ec9
commit 50ffaeb06a
4 changed files with 40 additions and 5 deletions

View File

@ -39,6 +39,7 @@ const controls = [
{ id: 'instruct_first_input_sequence', property: 'first_input_sequence', isCheckbox: false },
{ id: 'instruct_last_input_sequence', property: 'last_input_sequence', isCheckbox: false },
{ id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },
{ id: 'instruct_derived', property: 'derived', isCheckbox: true },
{ id: 'instruct_bind_to_context', property: 'bind_to_context', isCheckbox: true },
{ id: 'instruct_skip_examples', property: 'skip_examples', isCheckbox: true },
{ id: 'instruct_names_behavior', property: 'names_behavior', isCheckbox: false },
@ -100,6 +101,7 @@ export async function loadInstructMode(data) {
$('#instruct_enabled').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.enabled);
$('#instructSettingsBlock, #InstructSequencesColumn').toggleClass('disabled', !power_user.instruct.enabled);
$('#instruct_derived').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.derived);
$('#instruct_bind_to_context').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.bind_to_context);
controls.forEach(control => {
@ -715,6 +717,10 @@ jQuery(() => {
}
});
$('#instruct_derived').on('change', function () {
$('#instruct_derived').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.derived);
});
$('#instruct_bind_to_context').on('change', function () {
$('#instruct_bind_to_context').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.bind_to_context);
});