|
|
|
@ -6,18 +6,33 @@ import { deflate, GetCurrentViewPreViewImage } from '../Common/SerializeMaterial
|
|
|
|
|
import { FileServer } from '../DatabaseServices/FileServer';
|
|
|
|
|
import { Command } from '../Editor/CommandMachine';
|
|
|
|
|
import { RightPanelStore } from '../UI/Store/RightPanelStore/RightPanelStore';
|
|
|
|
|
import { appCache } from "../Common/AppCache";
|
|
|
|
|
|
|
|
|
|
export class Save implements Command
|
|
|
|
|
{
|
|
|
|
|
async exec()
|
|
|
|
|
{
|
|
|
|
|
let logo = await uploadLogo(GetCurrentViewPreViewImage());
|
|
|
|
|
if (!logo) return;
|
|
|
|
|
|
|
|
|
|
let fileServer = FileServer.GetInstance() as FileServer;
|
|
|
|
|
|
|
|
|
|
let fileData = app.FileOut().Data;
|
|
|
|
|
let file = deflate(JSON.stringify(fileData));
|
|
|
|
|
let file = JSON.stringify(fileData);
|
|
|
|
|
|
|
|
|
|
if (fileServer.m_CurFileId)
|
|
|
|
|
{
|
|
|
|
|
let finfo = appCache.get("f" + fileServer.m_CurFileId);
|
|
|
|
|
if (finfo && finfo.file)
|
|
|
|
|
{
|
|
|
|
|
if (finfo.file === file)
|
|
|
|
|
{
|
|
|
|
|
app.Editor.Prompt("文件已保存!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
file = deflate(file);
|
|
|
|
|
let logo = await uploadLogo(GetCurrentViewPreViewImage());
|
|
|
|
|
if (!logo) return;
|
|
|
|
|
|
|
|
|
|
if (fileServer.m_CurFileId)
|
|
|
|
|
{
|
|
|
|
|
await fileServer.UpdateFile({ file_id: fileServer.m_CurFileId, file, logo });
|
|
|
|
|