Vanessa 2022-06-29 20:48:06 +08:00
parent cfbf166e33
commit 3b29cc7bfc
2 changed files with 13 additions and 2 deletions

View File

@ -1,13 +1,20 @@
import {Constants} from "../constants";
/// #if !MOBILE
import {Tab} from "./Tab";
import {exportLayout} from "./util";
/// #endif
import {processMessage} from "../util/processMessage";
import {kernelError} from "../dialog/processSystem";
import {exportLayout} from "./util";
export class Model {
public ws: WebSocket;
public reqId: number;
/// #if !MOBILE
public parent: Tab;
/// #else
// @ts-ignore
public parent: any;
/// #endif
constructor(options: { id: string, type?: TWS, callback?: () => void, msgCallback?: (data: IWebSocketData) => void }) {
if (options.msgCallback) {
@ -25,7 +32,11 @@ export class Model {
const logElement = document.getElementById("errorLog");
if (logElement) {
// 内核中断后无法 catch fetch 请求错误,重连会导致无法执行 transactionsTimeout
/// #if MOBILE
window.location.reload();
/// #else
exportLayout(true);
/// #endif
}
};
ws.onmessage = (event) => {

View File

@ -12,7 +12,7 @@ const closeMenu = (model: Model) => {
const leftTabs: Tab[] = [];
const rightTabs: Tab[] = [];
let midIndex = -1;
currentTab.parent.children.forEach((item, index) => {
currentTab.parent.children.forEach((item: Tab, index: number) => {
const editor = item.model as Editor;
if (editor.editor?.protyle && !editor.editor?.protyle.updated) {
unmodifiedTabs.push(item);