Add api method guiEditNote
This commit is contained in:
parent
2313b8ba65
commit
8aa5fdd1de
28
README.md
28
README.md
@ -1059,6 +1059,34 @@ corresponding to when the API was available for use.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **guiEditNote**
|
||||||
|
|
||||||
|
Opens the *Edit* dialog with a note corresponding to given note ID.
|
||||||
|
The dialog is similar to the *Edit Current* dialog, but:
|
||||||
|
* has a Preview button to preview the cards for the note
|
||||||
|
* has a Browse button to open the browser with these cards
|
||||||
|
* has Previous/Back buttons to navigate the history of the dialog
|
||||||
|
* has no bar with the Close button
|
||||||
|
|
||||||
|
*Sample request*:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"action": "guiEditNote",
|
||||||
|
"version": 6,
|
||||||
|
"params": {
|
||||||
|
"note": 1649198355435
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
*Sample result*:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"result": null,
|
||||||
|
"error": null
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
* **guiCurrentCard**
|
* **guiCurrentCard**
|
||||||
|
|
||||||
Returns information about the current card or `null` if not in review mode.
|
Returns information about the current card or `null` if not in review mode.
|
||||||
|
@ -41,6 +41,8 @@ from anki.exporting import AnkiPackageExporter
|
|||||||
from anki.importing import AnkiPackageImporter
|
from anki.importing import AnkiPackageImporter
|
||||||
from anki.notes import Note
|
from anki.notes import Note
|
||||||
|
|
||||||
|
from .edit import Edit
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from anki.rsbackend import NotFoundError
|
from anki.rsbackend import NotFoundError
|
||||||
except:
|
except:
|
||||||
@ -1366,6 +1368,12 @@ class AnkiConnect:
|
|||||||
|
|
||||||
return self.findCards(query)
|
return self.findCards(query)
|
||||||
|
|
||||||
|
|
||||||
|
@util.api()
|
||||||
|
def guiEditNote(self, note):
|
||||||
|
Edit.open_dialog_and_show_note_with_id(note)
|
||||||
|
|
||||||
|
|
||||||
@util.api()
|
@util.api()
|
||||||
def guiSelectedNotes(self):
|
def guiSelectedNotes(self):
|
||||||
(creator, instance) = aqt.dialogs._dialogs['Browser']
|
(creator, instance) = aqt.dialogs._dialogs['Browser']
|
||||||
@ -1706,6 +1714,8 @@ class AnkiConnect:
|
|||||||
# when run inside Anki, `__name__` would be either numeric,
|
# when run inside Anki, `__name__` would be either numeric,
|
||||||
# or, if installed via `link.sh`, `AnkiConnectDev`
|
# or, if installed via `link.sh`, `AnkiConnectDev`
|
||||||
if __name__ != "plugin":
|
if __name__ != "plugin":
|
||||||
|
Edit.register_with_dialog_manager()
|
||||||
|
|
||||||
ac = AnkiConnect()
|
ac = AnkiConnect()
|
||||||
ac.initLogging()
|
ac.initLogging()
|
||||||
ac.startWebServer()
|
ac.startWebServer()
|
||||||
|
Loading…
Reference in New Issue
Block a user