Duplicate scope check all models (#1810)
* Add duplicateScopeCheckAllModels option to createNote * Add duplicateScopeCheckAllModels option * Add setting
This commit is contained in:
parent
d5320c71a6
commit
d058237ba7
@ -812,6 +812,7 @@
|
|||||||
"terms",
|
"terms",
|
||||||
"kanji",
|
"kanji",
|
||||||
"duplicateScope",
|
"duplicateScope",
|
||||||
|
"duplicateScopeCheckAllModels",
|
||||||
"checkForDuplicates",
|
"checkForDuplicates",
|
||||||
"fieldTemplates",
|
"fieldTemplates",
|
||||||
"suspendNewCards",
|
"suspendNewCards",
|
||||||
@ -910,6 +911,10 @@
|
|||||||
"default": "collection",
|
"default": "collection",
|
||||||
"enum": ["collection", "deck", "deck-root"]
|
"enum": ["collection", "deck", "deck-root"]
|
||||||
},
|
},
|
||||||
|
"duplicateScopeCheckAllModels": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"checkForDuplicates": {
|
"checkForDuplicates": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
|
@ -41,6 +41,7 @@ class AnkiNoteBuilder {
|
|||||||
requirements=[],
|
requirements=[],
|
||||||
checkForDuplicates=true,
|
checkForDuplicates=true,
|
||||||
duplicateScope='collection',
|
duplicateScope='collection',
|
||||||
|
duplicateScopeCheckAllModels=false,
|
||||||
resultOutputMode='split',
|
resultOutputMode='split',
|
||||||
glossaryLayoutMode='default',
|
glossaryLayoutMode='default',
|
||||||
compactTags=false,
|
compactTags=false,
|
||||||
@ -98,7 +99,8 @@ class AnkiNoteBuilder {
|
|||||||
duplicateScope,
|
duplicateScope,
|
||||||
duplicateScopeOptions: {
|
duplicateScopeOptions: {
|
||||||
deckName: duplicateScopeDeckName,
|
deckName: duplicateScopeDeckName,
|
||||||
checkChildren: duplicateScopeCheckChildren
|
checkChildren: duplicateScopeCheckChildren,
|
||||||
|
checkAllModels: duplicateScopeCheckAllModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -856,7 +856,11 @@ class OptionsUtil {
|
|||||||
// Handlebars templates updated to use new media format.
|
// Handlebars templates updated to use new media format.
|
||||||
// Added {selection-text} field marker.
|
// Added {selection-text} field marker.
|
||||||
// Added {sentence-furigana} field marker.
|
// Added {sentence-furigana} field marker.
|
||||||
|
// Added anki.duplicateScopeCheckAllModels.
|
||||||
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v13.handlebars');
|
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v13.handlebars');
|
||||||
|
for (const profile of options.profiles) {
|
||||||
|
profile.options.anki.duplicateScopeCheckAllModels = false;
|
||||||
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ class DisplayAnki {
|
|||||||
this._glossaryLayoutMode = 'default';
|
this._glossaryLayoutMode = 'default';
|
||||||
this._displayTags = 'never';
|
this._displayTags = 'never';
|
||||||
this._duplicateScope = 'collection';
|
this._duplicateScope = 'collection';
|
||||||
|
this._duplicateScopeCheckAllModels = false;
|
||||||
this._screenshotFormat = 'png';
|
this._screenshotFormat = 'png';
|
||||||
this._screenshotQuality = 100;
|
this._screenshotQuality = 100;
|
||||||
this._scanLength = 10;
|
this._scanLength = 10;
|
||||||
@ -142,7 +143,7 @@ class DisplayAnki {
|
|||||||
_onOptionsUpdated({options}) {
|
_onOptionsUpdated({options}) {
|
||||||
const {
|
const {
|
||||||
general: {resultOutputMode, glossaryLayoutMode, compactTags},
|
general: {resultOutputMode, glossaryLayoutMode, compactTags},
|
||||||
anki: {tags, duplicateScope, suspendNewCards, checkForDuplicates, displayTags, kanji, terms, screenshot: {format, quality}},
|
anki: {tags, duplicateScope, duplicateScopeCheckAllModels, suspendNewCards, checkForDuplicates, displayTags, kanji, terms, screenshot: {format, quality}},
|
||||||
scanning: {length: scanLength}
|
scanning: {length: scanLength}
|
||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
@ -153,6 +154,7 @@ class DisplayAnki {
|
|||||||
this._glossaryLayoutMode = glossaryLayoutMode;
|
this._glossaryLayoutMode = glossaryLayoutMode;
|
||||||
this._displayTags = displayTags;
|
this._displayTags = displayTags;
|
||||||
this._duplicateScope = duplicateScope;
|
this._duplicateScope = duplicateScope;
|
||||||
|
this._duplicateScopeCheckAllModels = duplicateScopeCheckAllModels;
|
||||||
this._screenshotFormat = format;
|
this._screenshotFormat = format;
|
||||||
this._screenshotQuality = quality;
|
this._screenshotQuality = quality;
|
||||||
this._scanLength = scanLength;
|
this._scanLength = scanLength;
|
||||||
@ -561,6 +563,7 @@ class DisplayAnki {
|
|||||||
tags: this._noteTags,
|
tags: this._noteTags,
|
||||||
checkForDuplicates: this._checkForDuplicates,
|
checkForDuplicates: this._checkForDuplicates,
|
||||||
duplicateScope: this._duplicateScope,
|
duplicateScope: this._duplicateScope,
|
||||||
|
duplicateScopeCheckAllModels: this._duplicateScopeCheckAllModels,
|
||||||
resultOutputMode: this._resultOutputMode,
|
resultOutputMode: this._resultOutputMode,
|
||||||
glossaryLayoutMode: this._glossaryLayoutMode,
|
glossaryLayoutMode: this._glossaryLayoutMode,
|
||||||
compactTags: this._compactTags,
|
compactTags: this._compactTags,
|
||||||
|
@ -1494,6 +1494,28 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-item-children settings-item-children-group" id="anki-card-duplicate-options" hidden>
|
<div class="settings-item-children settings-item-children-group" id="anki-card-duplicate-options" hidden>
|
||||||
|
<div class="settings-item">
|
||||||
|
<div class="settings-item-inner">
|
||||||
|
<div class="settings-item-left">
|
||||||
|
<div class="settings-item-label">
|
||||||
|
Check for duplicates across all models
|
||||||
|
<a class="more-toggle more-only" data-parent-distance="4">(?)</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="settings-item-right">
|
||||||
|
<label class="toggle"><input type="checkbox" data-setting="anki.duplicateScopeCheckAllModels"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="settings-item-children more" hidden>
|
||||||
|
<p>
|
||||||
|
By default, duplicate checks are only performed for notes created with the same model.
|
||||||
|
Enabling this option will check for duplicates across <em>all</em> model types.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a class="more-toggle" data-parent-distance="3">Less…</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="settings-item">
|
<div class="settings-item">
|
||||||
<div class="settings-item-inner settings-item-inner-wrappable">
|
<div class="settings-item-inner settings-item-inner-wrappable">
|
||||||
<div class="settings-item-left">
|
<div class="settings-item-left">
|
||||||
|
@ -236,6 +236,7 @@ async function getRenderResults(dictionaryEntries, type, mode, template, AnkiNot
|
|||||||
tags: ['yomichan'],
|
tags: ['yomichan'],
|
||||||
checkForDuplicates: true,
|
checkForDuplicates: true,
|
||||||
duplicateScope: 'collection',
|
duplicateScope: 'collection',
|
||||||
|
duplicateScopeCheckAllModels: false,
|
||||||
resultOutputMode: mode,
|
resultOutputMode: mode,
|
||||||
glossaryLayoutMode: 'default',
|
glossaryLayoutMode: 'default',
|
||||||
compactTags: false
|
compactTags: false
|
||||||
|
@ -444,6 +444,7 @@ function createProfileOptionsUpdatedTestData1() {
|
|||||||
terms: {deck: '', model: '', fields: {}},
|
terms: {deck: '', model: '', fields: {}},
|
||||||
kanji: {deck: '', model: '', fields: {}},
|
kanji: {deck: '', model: '', fields: {}},
|
||||||
duplicateScope: 'collection',
|
duplicateScope: 'collection',
|
||||||
|
duplicateScopeCheckAllModels: false,
|
||||||
displayTags: 'never',
|
displayTags: 'never',
|
||||||
checkForDuplicates: true,
|
checkForDuplicates: true,
|
||||||
fieldTemplates: null,
|
fieldTemplates: null,
|
||||||
|
Loading…
Reference in New Issue
Block a user