From 7ee76d708934adeef06479f7757beb22c6c01d14 Mon Sep 17 00:00:00 2001 From: Eloy Robillard Date: Mon, 18 Mar 2024 12:19:27 +0100 Subject: Add an option to allow both viewing and adding duplicates (#693) * Detect duplicates when checking if can add note * Display the stacked add buttons --- types/ext/anki-connect.d.ts | 22 ++++++++++++++++++++++ types/ext/anki-note-builder.d.ts | 1 - types/ext/backend.d.ts | 5 +++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 types/ext/anki-connect.d.ts (limited to 'types') diff --git a/types/ext/anki-connect.d.ts b/types/ext/anki-connect.d.ts new file mode 100644 index 00000000..07e6dd7f --- /dev/null +++ b/types/ext/anki-connect.d.ts @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2023-2024 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +type CanAddNote = {canAdd: true}; + +type CannotAddNote = {canAdd: false, error: string}; + +export type CanAddResult = CanAddNote | CannotAddNote; diff --git a/types/ext/anki-note-builder.d.ts b/types/ext/anki-note-builder.d.ts index 8aec3342..e3a1ed6a 100644 --- a/types/ext/anki-note-builder.d.ts +++ b/types/ext/anki-note-builder.d.ts @@ -35,7 +35,6 @@ export type CreateNoteDetails = { fields: Field[]; tags: string[]; requirements: Requirement[]; - checkForDuplicates: boolean; duplicateScope: Settings.AnkiDuplicateScope; duplicateScopeCheckAllModels: boolean; resultOutputMode: Settings.ResultOutputMode; diff --git a/types/ext/backend.d.ts b/types/ext/backend.d.ts index a832e434..c7d66522 100644 --- a/types/ext/backend.d.ts +++ b/types/ext/backend.d.ts @@ -32,3 +32,8 @@ export type TabInfo = { }; export type FindTabsPredicate = (tabInfo: TabInfo) => boolean | Promise; + +export type CanAddResults = { + canAddArray: {note: import('anki').Note, isDuplicate: boolean}[]; + cannotAddArray: import('anki').Note[]; +}; -- cgit v1.2.3