Add a setting to always use Chinese/English punctuation.
This commit is contained in:
1 parent
30f2446cee
commit
3d0dfd1aef
4 files changed
+51
No files matched your search
@@ -100,6 +100,11 @@ function applyConfigData(data: Record<string, any>): void {
|
||||
if (typeof data?.input?.paired_punctuation === 'boolean') {
|
||||
applyToggleState('pairedPunctuationToggleBtn', data.input.paired_punctuation);
|
||||
}
|
||||
if (data?.input?.punctuation_lock === 'chinese' || data?.input?.punctuation_lock === 'english' ||
|
||||
data?.input?.punctuation_lock === 'follow') {
|
||||
applyToggleState('alwaysChinesePunctuationToggleBtn', data.input.punctuation_lock === 'chinese');
|
||||
applyToggleState('alwaysEnglishPunctuationToggleBtn', data.input.punctuation_lock === 'english');
|
||||
}
|
||||
if (typeof data?.general?.candidate_translations === 'boolean') {
|
||||
applyToggleState('candidateTranslationsToggleBtn', data.general.candidate_translations);
|
||||
document.getElementById('candidateTranslationApiOptions')?.classList.toggle(
|
||||
|
||||
@@ -198,6 +198,22 @@ export function setupInput(): void {
|
||||
setupToggleButton('wordToCharacterToggleBtn', (active) => {
|
||||
updateConfig('input.word_to_character', active);
|
||||
});
|
||||
setupToggleButton('alwaysChinesePunctuationToggleBtn', (active) => {
|
||||
if (active) {
|
||||
applyToggleState('alwaysEnglishPunctuationToggleBtn', false);
|
||||
updateConfig('input.punctuation_lock', 'chinese');
|
||||
} else {
|
||||
updateConfig('input.punctuation_lock', 'follow');
|
||||
}
|
||||
});
|
||||
setupToggleButton('alwaysEnglishPunctuationToggleBtn', (active) => {
|
||||
if (active) {
|
||||
applyToggleState('alwaysChinesePunctuationToggleBtn', false);
|
||||
updateConfig('input.punctuation_lock', 'english');
|
||||
} else {
|
||||
updateConfig('input.punctuation_lock', 'follow');
|
||||
}
|
||||
});
|
||||
setupToggleButton('smartPunctuationToggleBtn', (active) => {
|
||||
updateConfig('input.smart_punctuation', active);
|
||||
});
|
||||
|
||||
@@ -239,6 +239,28 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section punctuation-lock-section">
|
||||
<div class="section-header">
|
||||
<div>
|
||||
<div class="section-title">始终使用中文标点</div>
|
||||
<div class="input-setting-description">切换中英文时仍使用中文标点,与下方选项互斥</div>
|
||||
</div>
|
||||
<div class="ftb-toggle-btn" id="alwaysChinesePunctuationToggleBtn" role="switch" aria-checked="false" tabindex="0">
|
||||
<div class="ftb-toggle-knob"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-option-divider"></div>
|
||||
<div class="section-header">
|
||||
<div>
|
||||
<div class="section-title">始终使用英文标点</div>
|
||||
<div class="input-setting-description">切换中英文时仍使用英文标点,与上方选项互斥</div>
|
||||
</div>
|
||||
<div class="ftb-toggle-btn" id="alwaysEnglishPunctuationToggleBtn" role="switch" aria-checked="false" tabindex="0">
|
||||
<div class="ftb-toggle-knob"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-header">
|
||||
<div>
|
||||
|
||||
@@ -39,6 +39,14 @@
|
||||
min-width: 110px;
|
||||
}
|
||||
|
||||
.punctuation-lock-section .section-header {
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.punctuation-lock-section .input-option-divider {
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.input-setting-description {
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
|
||||
Reference in new issue
Block a user