功能:重置所有自定义快捷键

pull/1482/head
ChenX 3 years ago
parent cc9c95e38b
commit 78474ae6b3

@ -0,0 +1,23 @@
import { Intent } from "../Common/Toaster";
import { CommandServer } from "../DatabaseServices/CommandServer";
import { Command } from "../Editor/CommandMachine";
import { AppConfirm } from "../UI/Components/Common/Confirm";
import { AppToaster } from "../UI/Components/Toaster";
export class Command_ResetCustomCommand implements Command
{
async exec()
{
let cmd = CommandServer.GetInstance() as CommandServer;
let status = await AppConfirm.show({ message: "重置所有的快捷键?" });
if (status)
{
await cmd.Reset();
AppToaster.show({
message: "成功重置快捷键,请重启WebCAD!",
timeout: 5000,
intent: Intent.SUCCESS,
});
}
}
}

@ -33,6 +33,13 @@ export class CommandServer extends Singleton
this._needUpload = true; this._needUpload = true;
delete this._customCommand[icommand.command]; delete this._customCommand[icommand.command];
} }
async Reset()
{
this._customCommand = {};
await this.Upload();
}
async Upload() async Upload()
{ {
if (!this._needUpload) return; if (!this._needUpload) return;

@ -143,6 +143,7 @@ import { Command_PLTest } from "../Add-on/polytest";
import { Print } from "../Add-on/Print"; import { Print } from "../Add-on/Print";
import { Command_Purge } from "../Add-on/Purge"; import { Command_Purge } from "../Add-on/Purge";
import { ReOpen } from "../Add-on/ReOpen"; import { ReOpen } from "../Add-on/ReOpen";
import { Command_ResetCustomCommand } from "../Add-on/RestCustomCommand";
import { Command_RestoreColor } from "../Add-on/RestoreColor"; import { Command_RestoreColor } from "../Add-on/RestoreColor";
import { Command_Reverse } from "../Add-on/Reverse"; import { Command_Reverse } from "../Add-on/Reverse";
import { Command_Rotate, Command_RotateRefer } from "../Add-on/Rotate"; import { Command_Rotate, Command_RotateRefer } from "../Add-on/Rotate";
@ -585,6 +586,7 @@ export function registerCommand()
//迁移自定义命令数据 //迁移自定义命令数据
commandMachine.RegisterCommand("upgradedata", new UpgradeData()); commandMachine.RegisterCommand("upgradedata", new UpgradeData());
commandMachine.RegisterCommand("ResetCustomCommand", new Command_ResetCustomCommand());
commandMachine.RegisterCommand(CommandNames.Dist, new Command_Dist()); commandMachine.RegisterCommand(CommandNames.Dist, new Command_Dist());

Loading…
Cancel
Save