Add an option for [ / ] page turning.

This commit is contained in:
fanlusky committed 2026-09-02 21:13:13 +08:00
1 parent 3d0dfd1aef
commit db2efbaa0d
3 files changed
+19 -1

No files matched your search

@@ -160,6 +160,10 @@ function applyConfigData(data: Record<string, any>): void {
const checkbox = document.getElementById('pagingCommaPeriodCheckbox') as HTMLInputElement | null;
if (checkbox) checkbox.checked = data.general.paging_comma_period;
}
if (typeof data?.general?.paging_brackets === 'boolean') {
const checkbox = document.getElementById('pagingBracketsCheckbox') as HTMLInputElement | null;
if (checkbox) checkbox.checked = data.general.paging_brackets;
}
if (typeof data?.general?.paging_page_up_down === 'boolean') {
const checkbox = document.getElementById('pagingPageUpDownCheckbox') as HTMLInputElement | null;
if (checkbox) checkbox.checked = data.general.paging_page_up_down;
@@ -196,6 +196,13 @@ export function setupInput(): void {
setupPageOptions();
setupFrequencyOptions();
setupToggleButton('wordToCharacterToggleBtn', (active) => {
if (active) {
const pagingBrackets = document.getElementById('pagingBracketsCheckbox') as HTMLInputElement | null;
if (pagingBrackets?.checked) {
pagingBrackets.checked = false;
updateConfig('general.paging_brackets', false);
}
}
updateConfig('input.word_to_character', active);
});
setupToggleButton('alwaysChinesePunctuationToggleBtn', (active) => {
@@ -295,12 +302,17 @@ function setupPageOptions(): void {
const configPaths: Record<string, string> = {
minus: 'general.paging_minus_equal',
comma: 'general.paging_comma_period',
brackets: 'general.paging_brackets',
tab: 'general.paging_tab',
page: 'general.paging_page_up_down',
arrow: 'general.candidate_arrow_navigation'
};
const path = configPaths[checkbox.value];
if (path) updateConfig(path, checkbox.checked);
if (checkbox.value === 'brackets' && checkbox.checked) {
applyToggleState('wordToCharacterToggleBtn', false);
updateConfig('input.word_to_character', false);
}
});
});
}
@@ -107,6 +107,8 @@
<div class="input-option-divider"></div>
<label class="check-option"><input type="checkbox" name="page-method" id="pagingCommaPeriodCheckbox" value="comma"><span>, / .</span></label>
<div class="input-option-divider"></div>
<label class="check-option"><input type="checkbox" name="page-method" id="pagingBracketsCheckbox" value="brackets"><span>[ / ]</span></label>
<div class="input-option-divider"></div>
<label class="check-option"><input type="checkbox" name="page-method" id="pagingTabCheckbox" value="tab"><span>Shift+Tab / Tab</span></label>
<div class="input-option-divider"></div>
<label class="check-option"><input type="checkbox" name="page-method" id="pagingPageUpDownCheckbox" value="page"><span>PageUp / PageDown</span></label>
@@ -231,7 +233,7 @@
<div class="section-header">
<div>
<div class="section-title">以词定字</div>
<div class="input-setting-description">开启后,按 [ 上屏高亮候选的首个汉字,按 ] 上屏末个汉字</div>
<div class="input-setting-description">开启后,按 [ 上屏高亮候选的首个汉字,按 ] 上屏末个汉字;与翻页方式中的 [ / ] 互斥</div>
</div>
<div class="ftb-toggle-btn" id="wordToCharacterToggleBtn" role="switch" aria-checked="false" tabindex="0">
<div class="ftb-toggle-knob"></div>