Merge pull request #330 from siikamiika/query-parser-helper-disabling

Query parser helper disabling
This commit is contained in:
siikamiika 2020-01-25 03:29:55 +02:00 committed by GitHub
commit 7357eaf07a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 2 deletions

View File

@ -419,6 +419,7 @@
"enableScanningParser",
"enableMecabParser",
"selectedParser",
"termSpacing",
"readingMode"
],
"properties": {
@ -434,9 +435,13 @@
"type": ["string", "null"],
"default": null
},
"termSpacing": {
"type": "boolean",
"default": true
},
"readingMode": {
"type": "string",
"enum": ["hiragana", "katakana", "romaji"],
"enum": ["hiragana", "katakana", "romaji", "none"],
"default": "hiragana"
}
}

View File

@ -88,6 +88,11 @@ class QueryParser extends TextScanner {
];
}
setOptions(options) {
super.setOptions(options);
this.queryParser.dataset.termSpacing = `${options.parsing.termSpacing}`;
}
refreshSelectedParser() {
if (this.parseResults.length > 0) {
if (this.selectedParser === null) {

View File

@ -80,6 +80,7 @@ async function formRead(options) {
options.parsing.enableScanningParser = $('#parsing-scan-enable').prop('checked');
options.parsing.enableMecabParser = $('#parsing-mecab-enable').prop('checked');
options.parsing.termSpacing = $('#parsing-term-spacing').prop('checked');
options.parsing.readingMode = $('#parsing-reading-mode').val();
const optionsAnkiEnableOld = options.anki.enable;

View File

@ -526,12 +526,17 @@
<label><input type="checkbox" id="parsing-mecab-enable"> Enable text parsing using MeCab</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="parsing-term-spacing"> Enable small spaces between parsed words</label>
</div>
<div class="form-group">
<label for="parsing-reading-mode">Reading mode</label>
<select class="form-control" id="parsing-reading-mode">
<option value="hiragana">ひらがな</option>
<option value="katakana">カタカナ</option>
<option value="romaji">Romaji</option>
<option value="none">Disabled</option>
</select>
</div>
</div>

View File

@ -132,7 +132,7 @@ html:root[data-yomichan-page=float] .navigation-header:not([hidden])~.navigation
font-size: 2em;
}
.query-parser-term {
#query-parser[data-term-spacing=true] .query-parser-term {
margin-right: 0.2em;
}

View File

@ -209,6 +209,8 @@ function jpConvertReading(expressionFragment, readingFragment, readingMode) {
}
}
return readingFragment;
case 'none':
return null;
default:
return readingFragment;
}