diff options
author | StefanVukovic99 <stefanvukovic44@gmail.com> | 2024-05-21 18:55:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 16:55:02 +0000 |
commit | ba9fa339a43a5f494785877018b10f111ccafff5 (patch) | |
tree | 1a4a0b141e08cfe767170425d5afda253bf92990 /types/ext | |
parent | 737e7eab8182fc4e083f7fd6df840327ab83287c (diff) |
add support for overwriting existing card (#859)
* frontend
* wip
* minimum viable
* minor simplification
* simplify gradients in duplicate svg
* simplify add-duplicate svg
* colors good
* arrows shape
* disable overwrite if no valid duplicate IDs
* add warning
Diffstat (limited to 'types/ext')
-rw-r--r-- | types/ext/anki.d.ts | 2 | ||||
-rw-r--r-- | types/ext/api.d.ts | 6 | ||||
-rw-r--r-- | types/ext/display-anki.d.ts | 3 | ||||
-rw-r--r-- | types/ext/settings.d.ts | 2 |
4 files changed, 12 insertions, 1 deletions
diff --git a/types/ext/anki.d.ts b/types/ext/anki.d.ts index 4a903c52..8ad0890f 100644 --- a/types/ext/anki.d.ts +++ b/types/ext/anki.d.ts @@ -22,6 +22,8 @@ export type NoteId = number; export type CardId = number; +export type NoteWithId = Note & {id: NoteId}; + export type Note = { fields: NoteFields; tags: string[]; diff --git a/types/ext/api.d.ts b/types/ext/api.d.ts index 9a922fb0..3a2fc0b8 100644 --- a/types/ext/api.d.ts +++ b/types/ext/api.d.ts @@ -169,6 +169,12 @@ type ApiSurface = { }; return: Anki.NoteId | null; }; + updateAnkiNote: { + params: { + noteWithId: Anki.NoteWithId; + }; + return: null; + }; getAnkiNoteInfo: { params: { notes: Anki.Note[]; diff --git a/types/ext/display-anki.d.ts b/types/ext/display-anki.d.ts index 1b0dd4ff..4b6c6e37 100644 --- a/types/ext/display-anki.d.ts +++ b/types/ext/display-anki.d.ts @@ -46,6 +46,9 @@ export type DictionaryEntryModeDetails = { requirements: AnkiNoteBuilder.Requirement[]; canAdd: boolean; valid: boolean; + /** + * Anki IDs of duplicate notes. May contain INVALID_NOTE_ID for notes whose ID could not be found. + */ noteIds: Anki.NoteId[] | null; noteInfos?: (Anki.NoteInfo | null)[]; ankiError: Error | null; diff --git a/types/ext/settings.d.ts b/types/ext/settings.d.ts index 1fce0f59..48a66728 100644 --- a/types/ext/settings.d.ts +++ b/types/ext/settings.d.ts @@ -395,7 +395,7 @@ export type AnkiScreenshotFormat = 'png' | 'jpeg'; export type AnkiDuplicateScope = 'collection' | 'deck' | 'deck-root'; -export type AnkiDuplicateBehavior = 'prevent' | 'new'; +export type AnkiDuplicateBehavior = 'prevent' | 'overwrite' | 'new'; export type AnkiDisplayTags = 'never' | 'always' | 'non-standard'; |