Fix Anki integration to support non-English environments and custom models
Problem
The extension only worked with English Anki installations using the "Basic" model with "Front"/"Back" fields,
failing for users with:
- Non-English Anki (Chinese, Japanese, etc.)
- Custom note types
- Different field names
Solution
- Auto-detect compatible models: Scans all available note types and tests compatibility by creating/deleting test
cards
- Language-agnostic: Works with any field names in any language
- Smart fallback: Prefers Front/Back fields but falls back to first two fields of any model
- Better error handling: Clear error messages when no compatible model is found
Changes
- Added findCompatibleModel() to automatically discover usable note types
- Added testModelCompatibility() to verify models work before use
- Removed hardcoded "Basic" model and "Front"/"Back" field names
- Added duplicate prevention with allowDuplicate: false
Testing
Tested with:
- ✅ English Anki (Basic model)
- ✅ Chinese Anki (基础 model)
Fixes #272
合并状态:未合并 1 条评论