mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2025-12-08 13:49:37 +00:00
feat: 添加自定义卡片内容为空时删除卡片的功能
This commit is contained in:
parent
1831c9144d
commit
ac508d5eb4
@ -1143,6 +1143,16 @@ export default {
|
|||||||
this.state.boardData.homework[this.currentEditSubject]?.content || "";
|
this.state.boardData.homework[this.currentEditSubject]?.content || "";
|
||||||
|
|
||||||
if (content !== originalContent.trim()) {
|
if (content !== originalContent.trim()) {
|
||||||
|
// 如果内容为空且是自定义卡片,则删除该卡片
|
||||||
|
if (!content && this.currentEditSubject.startsWith('custom-')) {
|
||||||
|
delete this.state.boardData.homework[this.currentEditSubject];
|
||||||
|
this.state.synced = false;
|
||||||
|
if (this.autoSave) {
|
||||||
|
await this.trySave(true);
|
||||||
|
}
|
||||||
|
this.state.dialogVisible = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 如果是自定义卡片,保留其他属性
|
// 如果是自定义卡片,保留其他属性
|
||||||
if (this.state.boardData.homework[this.currentEditSubject].type === 'custom') {
|
if (this.state.boardData.homework[this.currentEditSubject].type === 'custom') {
|
||||||
this.state.boardData.homework[this.currentEditSubject].content = content;
|
this.state.boardData.homework[this.currentEditSubject].content = content;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user