feat: Add rest of Anki fields to Note

This commit is contained in:
Dendy 2025-02-06 15:56:28 +09:00
parent 230f5f18a1
commit 39e6bc9af5
1 changed files with 16 additions and 1 deletions

View File

@ -15,6 +15,13 @@ class Note
private int $id; private int $id;
private int $mod; private int $mod;
private array $terms = []; private array $terms = [];
private string $profile;
private array $tags = [];
private string $model;
// Maybe these doesn't make sense to keep but leaving it here just in
// case for handiness' sake
private array $fields = [];
private array $cardIds;
const HIGHLIGHT_PATTERN = '/<span\s+([^>]*)>(.*?)<\/span>/i'; const HIGHLIGHT_PATTERN = '/<span\s+([^>]*)>(.*?)<\/span>/i';
const HIGHLIGHT_ATTR_KANJI = 'style="color: rgb(255, 78, 8);"'; const HIGHLIGHT_ATTR_KANJI = 'style="color: rgb(255, 78, 8);"';
@ -39,7 +46,15 @@ class Note
{ {
$note = new self(); $note = new self();
['noteId' => $note->id, 'mod' => $note->mod] = $noteInfo; [
'noteId' => $note->id,
'mod' => $note->mod,
'profile' => $note->profile,
'tags' => $note->tags,
'fields' => $note->fields,
'modelName' => $note->model,
'cards' => $note->cardIds,
] = $noteInfo;
$fields = array_map(fn($x) => $x['value'], $noteInfo['fields']); $fields = array_map(fn($x) => $x['value'], $noteInfo['fields']);