mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🎨 文件系统读取或写入失败时退出内核 https://github.com/siyuan-note/siyuan/issues/7707
This commit is contained in:
parent
60f390d9e0
commit
7a078d3689
18 changed files with 3 additions and 162 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import {Constants} from "../constants";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
/// #if !MOBILE
|
||||
import {getAllModels} from "../layout/getAll";
|
||||
import {exportLayout} from "../layout/util";
|
||||
/// #endif
|
||||
/// #if !BROWSER
|
||||
|
|
@ -29,47 +28,6 @@ export const lockScreen = () => {
|
|||
/// #endif
|
||||
};
|
||||
|
||||
export const lockFile = (id: string) => {
|
||||
const html = `<div class="b3-dialog__scrim"></div>
|
||||
<div class="b3-dialog__container">
|
||||
<div class="b3-dialog__header" onselectstart="return false;">🔒 ${window.siyuan.languages.lockFile0} <small>v${Constants.SIYUAN_VERSION}</small></div>
|
||||
<div class="b3-dialog__content">
|
||||
<p>${window.siyuan.languages.lockFile1}</p>
|
||||
<p>${window.siyuan.languages.lockFile2}</p>
|
||||
</div>
|
||||
<div class="b3-dialog__action">
|
||||
<button class="b3-button b3-button--cancel">${window.siyuan.languages.closeTab}</button>
|
||||
<div class="fn__space"></div>
|
||||
<button class="b3-button b3-button--text">${window.siyuan.languages.retry}</button>
|
||||
</div>
|
||||
</div>`;
|
||||
let logElement = document.getElementById("errorLog");
|
||||
if (logElement) {
|
||||
logElement.innerHTML = html;
|
||||
} else {
|
||||
document.body.insertAdjacentHTML("beforeend", `<div id="errorLog" class="b3-dialog b3-dialog--open">${html}</div>`);
|
||||
logElement = document.getElementById("errorLog");
|
||||
}
|
||||
logElement.querySelector(".b3-button--cancel").addEventListener("click", () => {
|
||||
/// #if !MOBILE
|
||||
getAllModels().editor.find((item) => {
|
||||
if (item.editor.protyle.block.rootID === id) {
|
||||
item.parent.parent.removeTab(item.parent.id, false, false);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
logElement.remove();
|
||||
/// #endif
|
||||
});
|
||||
logElement.querySelector(".b3-button--text").addEventListener("click", () => {
|
||||
fetchPost("/api/filetree/lockFile", {id}, (response) => {
|
||||
if (response.code === 0) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const kernelError = () => {
|
||||
let iosReStart = "";
|
||||
if (window.siyuan.config.system.container === "ios" && window.webkit?.messageHandlers) {
|
||||
|
|
@ -162,10 +120,6 @@ export const exitSiYuan = () => {
|
|||
};
|
||||
|
||||
export const transactionError = (data: { code: number, data: string }) => {
|
||||
if (data.code === 1) {
|
||||
lockFile(data.data);
|
||||
return;
|
||||
}
|
||||
if (document.getElementById("transactionError")) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue