forked from EduCraft/curriculum-project-hub
fix(filelib-web): 文件内容无变化时不提交 commit
This commit is contained in:
@@ -47,6 +47,11 @@
|
|||||||
|
|
||||||
async function save(): Promise<void> {
|
async function save(): Promise<void> {
|
||||||
if (file === null) return;
|
if (file === null) return;
|
||||||
|
// 内容未变化时不提交,避免产生空 commit。
|
||||||
|
if (draft === file.content) {
|
||||||
|
toastOk("内容无变化,未提交");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const r = await api<{ version: string }>(`/database/api/projects/${projectId}/file/commits`, {
|
const r = await api<{ version: string }>(`/database/api/projects/${projectId}/file/commits`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|||||||
Reference in New Issue
Block a user