mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Escape special search characters in preset name (#3554)
This commit is contained in:
parent
442ddb085a
commit
4dcbcdb0ce
2 changed files with 8 additions and 4 deletions
|
@ -64,7 +64,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
optimalRetention = 0;
|
optimalRetention = 0;
|
||||||
}
|
}
|
||||||
$: computing = computingParams || checkingParams || computingRetention;
|
$: computing = computingParams || checkingParams || computingRetention;
|
||||||
$: defaultparamSearch = `preset:"${state.getCurrentName()}" -is:suspended`;
|
$: defaultparamSearch = `preset:"${state.getCurrentNameForSearch()}" -is:suspended`;
|
||||||
$: roundedRetention = Number($config.desiredRetention.toFixed(2));
|
$: roundedRetention = Number($config.desiredRetention.toFixed(2));
|
||||||
$: desiredRetentionWarning = getRetentionWarning(roundedRetention);
|
$: desiredRetentionWarning = getRetentionWarning(roundedRetention);
|
||||||
$: retentionWarningClass = getRetentionWarningClass(roundedRetention);
|
$: retentionWarningClass = getRetentionWarningClass(roundedRetention);
|
||||||
|
@ -92,7 +92,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
newLimit: $config.newPerDay,
|
newLimit: $config.newPerDay,
|
||||||
reviewLimit: $config.reviewsPerDay,
|
reviewLimit: $config.reviewsPerDay,
|
||||||
maxInterval: $config.maximumReviewInterval,
|
maxInterval: $config.maximumReviewInterval,
|
||||||
search: `preset:"${state.getCurrentName()}" -is:suspended`,
|
search: `preset:"${state.getCurrentNameForSearch()}" -is:suspended`,
|
||||||
});
|
});
|
||||||
|
|
||||||
function getRetentionWarning(retention: number): string {
|
function getRetentionWarning(retention: number): string {
|
||||||
|
@ -236,7 +236,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
async () => {
|
async () => {
|
||||||
optimalRetentionRequest.maxInterval = $config.maximumReviewInterval;
|
optimalRetentionRequest.maxInterval = $config.maximumReviewInterval;
|
||||||
optimalRetentionRequest.params = fsrsParams($config);
|
optimalRetentionRequest.params = fsrsParams($config);
|
||||||
optimalRetentionRequest.search = `preset:"${state.getCurrentName()}" -is:suspended`;
|
optimalRetentionRequest.search = `preset:"${state.getCurrentNameForSearch()}" -is:suspended`;
|
||||||
const resp = await computeOptimalRetention(optimalRetentionRequest);
|
const resp = await computeOptimalRetention(optimalRetentionRequest);
|
||||||
optimalRetention = resp.optimalRetention;
|
optimalRetention = resp.optimalRetention;
|
||||||
computeRetentionProgress = undefined;
|
computeRetentionProgress = undefined;
|
||||||
|
@ -322,7 +322,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
async () => {
|
async () => {
|
||||||
simulateFsrsRequest.params = fsrsParams($config);
|
simulateFsrsRequest.params = fsrsParams($config);
|
||||||
simulateFsrsRequest.desiredRetention = $config.desiredRetention;
|
simulateFsrsRequest.desiredRetention = $config.desiredRetention;
|
||||||
simulateFsrsRequest.search = `preset:"${state.getCurrentName()}" -is:suspended`;
|
simulateFsrsRequest.search = `preset:"${state.getCurrentNameForSearch()}" -is:suspended`;
|
||||||
simulateProgressString = "processing...";
|
simulateProgressString = "processing...";
|
||||||
resp = await simulateFsrsReview(simulateFsrsRequest);
|
resp = await simulateFsrsReview(simulateFsrsRequest);
|
||||||
},
|
},
|
||||||
|
|
|
@ -139,6 +139,10 @@ export class DeckOptionsState {
|
||||||
return this.configs[this.selectedIdx].config.name;
|
return this.configs[this.selectedIdx].config.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCurrentNameForSearch(): string {
|
||||||
|
return this.getCurrentName().replace(/([\\"])/g, "\\$1");
|
||||||
|
}
|
||||||
|
|
||||||
setCurrentName(name: string): void {
|
setCurrentName(name: string): void {
|
||||||
if (this.configs[this.selectedIdx].config.name === name) {
|
if (this.configs[this.selectedIdx].config.name === name) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue