import { commandMachine } from './Editor/CommandMachine'; import './UI/Css/style.less'; import './UI/Css/golden.less'; import './UI/Css/blue.less'; import { WebCAD } from './UI/Layout/ApplicationLayout'; import { Classes } from '@blueprintjs/core'; //禁止用户选中 document.addEventListener("selectionchange", () => { let s = document.getSelection(); if (s.anchorNode !== s.focusNode) s.empty(); else if (s.rangeCount > 0) { let range = s.getRangeAt(0); if (range.startContainer.nodeName === "#text" && s.focusNode.parentElement.contentEditable !== "true") s.empty(); } }); document.body.className = Classes.DARK; //禁止右键 document.oncontextmenu = () => false; window.onload = function () { new WebCAD("app"); // -----热模块替换的代码. async function loadFirst() { let cmd = (await import("./Add-on/testEntity/test")).Test; commandMachine.RegisterCommand("tt", new cmd()); } loadFirst(); // 必须先加载一次,否则无法触发热模块替换 if (module.hot) module.hot.accept('./Add-on/testEntity/test', loadFirst); };