mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-10 22:23:28 +08:00
This commit is contained in:
parent
cfbf166e33
commit
3b29cc7bfc
@ -1,13 +1,20 @@
|
|||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
|
/// #if !MOBILE
|
||||||
import {Tab} from "./Tab";
|
import {Tab} from "./Tab";
|
||||||
|
import {exportLayout} from "./util";
|
||||||
|
/// #endif
|
||||||
import {processMessage} from "../util/processMessage";
|
import {processMessage} from "../util/processMessage";
|
||||||
import {kernelError} from "../dialog/processSystem";
|
import {kernelError} from "../dialog/processSystem";
|
||||||
import {exportLayout} from "./util";
|
|
||||||
|
|
||||||
export class Model {
|
export class Model {
|
||||||
public ws: WebSocket;
|
public ws: WebSocket;
|
||||||
public reqId: number;
|
public reqId: number;
|
||||||
|
/// #if !MOBILE
|
||||||
public parent: Tab;
|
public parent: Tab;
|
||||||
|
/// #else
|
||||||
|
// @ts-ignore
|
||||||
|
public parent: any;
|
||||||
|
/// #endif
|
||||||
|
|
||||||
constructor(options: { id: string, type?: TWS, callback?: () => void, msgCallback?: (data: IWebSocketData) => void }) {
|
constructor(options: { id: string, type?: TWS, callback?: () => void, msgCallback?: (data: IWebSocketData) => void }) {
|
||||||
if (options.msgCallback) {
|
if (options.msgCallback) {
|
||||||
@ -25,7 +32,11 @@ export class Model {
|
|||||||
const logElement = document.getElementById("errorLog");
|
const logElement = document.getElementById("errorLog");
|
||||||
if (logElement) {
|
if (logElement) {
|
||||||
// 内核中断后无法 catch fetch 请求错误,重连会导致无法执行 transactionsTimeout
|
// 内核中断后无法 catch fetch 请求错误,重连会导致无法执行 transactionsTimeout
|
||||||
|
/// #if MOBILE
|
||||||
|
window.location.reload();
|
||||||
|
/// #else
|
||||||
exportLayout(true);
|
exportLayout(true);
|
||||||
|
/// #endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ws.onmessage = (event) => {
|
ws.onmessage = (event) => {
|
||||||
|
@ -12,7 +12,7 @@ const closeMenu = (model: Model) => {
|
|||||||
const leftTabs: Tab[] = [];
|
const leftTabs: Tab[] = [];
|
||||||
const rightTabs: Tab[] = [];
|
const rightTabs: Tab[] = [];
|
||||||
let midIndex = -1;
|
let midIndex = -1;
|
||||||
currentTab.parent.children.forEach((item, index) => {
|
currentTab.parent.children.forEach((item: Tab, index: number) => {
|
||||||
const editor = item.model as Editor;
|
const editor = item.model as Editor;
|
||||||
if (editor.editor?.protyle && !editor.editor?.protyle.updated) {
|
if (editor.editor?.protyle && !editor.editor?.protyle.updated) {
|
||||||
unmodifiedTabs.push(item);
|
unmodifiedTabs.push(item);
|
||||||
|
Loading…
Reference in New Issue
Block a user