mirror of
https://github.com/insile/OpenWords.git
synced 2026-07-22 05:48:39 +00:00
2025/6/6
This commit is contained in:
parent
3275799f4f
commit
ee18655280
2 changed files with 6 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { MarkdownView, Notice, Plugin, TFile, normalizePath, moment } from 'obsidian';
|
||||
import { MarkdownView, Notice, Plugin, TFile, normalizePath } from 'obsidian';
|
||||
import { supermemo, SuperMemoGrade } from 'supermemo';
|
||||
import { OpenWordsSettingTab } from './settings';
|
||||
import { LearningTypeModal } from './modals/LearningTypeModal';
|
||||
|
|
@ -201,7 +201,7 @@ export default class OpenWords extends Plugin {
|
|||
// 更新单词属性
|
||||
async updateCard(card: CardInfo, grade: SuperMemoGrade) {
|
||||
const result = supermemo(card, grade);
|
||||
const newDate = moment().add(result.interval, 'day').format('YYYY-MM-DD');
|
||||
const newDate = window.moment().add(result.interval, 'day').format('YYYY-MM-DD');
|
||||
const file = this.app.vault.getFileByPath(card.path);
|
||||
if (!file) {
|
||||
new Notice(`文件 ${card.path} 不存在!`);
|
||||
|
|
@ -235,7 +235,7 @@ export default class OpenWords extends Plugin {
|
|||
continue;
|
||||
}
|
||||
await this.app.fileManager.processFrontMatter(file, (frontMatter) => {
|
||||
frontMatter["到期日"] = moment().format('YYYY-MM-DD');
|
||||
frontMatter["到期日"] = window.moment().format('YYYY-MM-DD');
|
||||
frontMatter["间隔"] = 0;
|
||||
frontMatter["易记因子"] = 250;
|
||||
frontMatter["重复次数"] = 0;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { App, Modal, Notice, TFile, Setting, MarkdownRenderer, Component, moment } from 'obsidian';
|
||||
import { App, Modal, Notice, TFile, Setting, MarkdownRenderer, Component } from 'obsidian';
|
||||
import { SuperMemoGrade } from 'supermemo';
|
||||
import { CardInfo } from '../card';
|
||||
import OpenWords from '../main';
|
||||
|
|
@ -74,7 +74,7 @@ export class LearningModal extends Modal {
|
|||
}
|
||||
|
||||
pickNextCard() {
|
||||
const now = moment(); // 获取当前时间
|
||||
const now = window.moment(); // 获取当前时间
|
||||
let pool: CardInfo[];
|
||||
|
||||
// 新词池是指所有新词, 旧词池是指所有已过期的旧词
|
||||
|
|
@ -87,7 +87,7 @@ export class LearningModal extends Modal {
|
|||
}
|
||||
} else {
|
||||
pool = Array.from(this.plugin.dueCards.values())
|
||||
.filter(card => moment(card.dueDate).isBefore(now)) // 筛选已过期的单词
|
||||
.filter(card => window.moment(card.dueDate).isBefore(now)) // 筛选已过期的单词
|
||||
if (pool.length === 0) {
|
||||
this.close();
|
||||
new Notice("没有需要复习的卡片!");
|
||||
|
|
|
|||
Loading…
Reference in a new issue