mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-23 15:34:06 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
7ad5cdd067
31 changed files with 155 additions and 249 deletions
|
|
@ -10,7 +10,6 @@ import {openNewWindowById} from "../window/openNewWindow";
|
|||
/// #endif
|
||||
import {disabledProtyle} from "../protyle/util/onGet";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {lockFile} from "../dialog/processSystem";
|
||||
import {showMessage} from "../dialog/message";
|
||||
|
||||
export class BlockPanel {
|
||||
|
|
@ -245,11 +244,6 @@ export class BlockPanel {
|
|||
private initProtyle(editorElement: HTMLElement) {
|
||||
const index = parseInt(editorElement.getAttribute("data-index"));
|
||||
fetchPost("api/block/getBlockInfo", {id: this.nodeIds[index]}, (response) => {
|
||||
if (response.code === 2) {
|
||||
// 文件被锁定
|
||||
lockFile(response.data);
|
||||
return false;
|
||||
}
|
||||
if (response.code === 3) {
|
||||
showMessage(response.msg);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import {pushBack} from "../util/backForward";
|
|||
import {Asset} from "../asset";
|
||||
import {Layout} from "../layout";
|
||||
import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName,} from "../protyle/util/hasClosest";
|
||||
import {lockFile, setTitle} from "../dialog/processSystem";
|
||||
import {setTitle} from "../dialog/processSystem";
|
||||
import {zoomOut} from "../menus/protyle";
|
||||
import {countBlockWord, countSelectWord} from "../layout/status";
|
||||
import {showMessage} from "../dialog/message";
|
||||
|
|
@ -34,11 +34,6 @@ export const openFileById = (options: {
|
|||
removeCurrentTab?: boolean
|
||||
}) => {
|
||||
fetchPost("/api/block/getBlockInfo", {id: options.id}, (data) => {
|
||||
if (data.code === 2) {
|
||||
// 文件被锁定
|
||||
lockFile(data.data);
|
||||
return;
|
||||
}
|
||||
if (data.code === 3) {
|
||||
showMessage(data.msg);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import {disabledProtyle, onGet} from "../protyle/util/onGet";
|
|||
import {addLoading} from "../protyle/ui/initUI";
|
||||
import {focusBlock} from "../protyle/util/selection";
|
||||
import {scrollCenter} from "../util/highlightById";
|
||||
import {lockFile} from "../dialog/processSystem";
|
||||
import {hasClosestByAttribute} from "../protyle/util/hasClosest";
|
||||
import {setEditMode} from "../protyle/util/setEditMode";
|
||||
import {hideElements} from "../protyle/ui/hideElements";
|
||||
|
|
@ -40,11 +39,6 @@ export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) =
|
|||
}
|
||||
|
||||
fetchPost("/api/block/getBlockInfo", {id}, (data) => {
|
||||
if (data.code === 2) {
|
||||
// 文件被锁定
|
||||
lockFile(data.data);
|
||||
return;
|
||||
}
|
||||
if (data.code === 3) {
|
||||
showMessage(data.msg);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import {confirmDialog} from "../../dialog/confirmDialog";
|
|||
import {getThemeMode, setInlineStyle} from "../../util/assets";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {Dialog} from "../../dialog";
|
||||
import {lockFile} from "../../dialog/processSystem";
|
||||
import {pathPosix} from "../../util/pathName";
|
||||
import {replaceLocalPath} from "../../editor/rename";
|
||||
import {setStorageVal} from "../util/compatibility";
|
||||
|
|
@ -468,11 +467,6 @@ const getExportPath = (option: { type: string, id: string }, removeAssets?: bool
|
|||
fetchPost("/api/block/getBlockInfo", {
|
||||
id: option.id
|
||||
}, (response) => {
|
||||
if (response.code === 2) {
|
||||
// 文件被锁定
|
||||
lockFile(response.data);
|
||||
return;
|
||||
}
|
||||
if (response.code === 3) {
|
||||
showMessage(response.msg);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {lockFile, setTitle} from "../../dialog/processSystem";
|
||||
import {setTitle} from "../../dialog/processSystem";
|
||||
import {Constants} from "../../constants";
|
||||
import {hideElements} from "../ui/hideElements";
|
||||
import {genEmptyElement} from "../../block/util";
|
||||
|
|
@ -36,12 +36,6 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]
|
|||
}
|
||||
protyle.notebookId = data.data.box;
|
||||
protyle.path = data.data.path;
|
||||
if (data.code === 2) {
|
||||
// 文件被锁定
|
||||
protyle.block.rootID = data.data;
|
||||
lockFile(data.data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.data.eof) {
|
||||
if (action.includes(Constants.CB_GET_BEFORE)) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import {blockRender} from "../markdown/blockRender";
|
|||
import {processRender} from "../util/processCode";
|
||||
import {highlightRender} from "../markdown/highlightRender";
|
||||
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
|
||||
import {lockFile} from "../../dialog/processSystem";
|
||||
import {setFold} from "../../menus/protyle";
|
||||
import {onGet} from "../util/onGet";
|
||||
/// #if !MOBILE
|
||||
|
|
@ -69,10 +68,7 @@ const promiseTransaction = () => {
|
|||
} else {
|
||||
promiseTransaction();
|
||||
}
|
||||
if (response.code === 1) {
|
||||
lockFile(protyle.block.rootID);
|
||||
return;
|
||||
}
|
||||
|
||||
countBlockWord([], protyle.block.rootID, true);
|
||||
/// #if MOBILE
|
||||
if ((0 !== window.siyuan.config.sync.provider || (0 === window.siyuan.config.sync.provider && !needSubscribe(""))) &&
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {Tab} from "../layout/Tab";
|
|||
import {Editor} from "../editor";
|
||||
import {onGet} from "../protyle/util/onGet";
|
||||
import {scrollCenter} from "./highlightById";
|
||||
import {lockFile} from "../dialog/processSystem";
|
||||
import {zoomOut} from "../menus/protyle";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {saveScroll} from "../protyle/scroll/saveScroll";
|
||||
|
|
@ -39,11 +38,6 @@ const focusStack = async (stack: IBackStack) => {
|
|||
}
|
||||
if (wnd) {
|
||||
const info = await fetchSyncPost("/api/block/getBlockInfo", {id: stack.id});
|
||||
if (info.code === 2) {
|
||||
// 文件被锁定
|
||||
lockFile(info.data);
|
||||
return false;
|
||||
}
|
||||
if (info.code === 3) {
|
||||
showMessage(info.msg);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import {getCurrentWindow} from "@electron/remote";
|
|||
import {Constants} from "../constants";
|
||||
import {Tab} from "../layout/Tab";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {lockFile} from "../dialog/processSystem";
|
||||
import {showMessage} from "../dialog/message";
|
||||
|
||||
export const openNewWindow = (tab: Tab) => {
|
||||
|
|
@ -23,11 +22,6 @@ export const openNewWindow = (tab: Tab) => {
|
|||
|
||||
export const openNewWindowById = (id: string) => {
|
||||
fetchPost("api/block/getBlockInfo", {id}, (response) => {
|
||||
if (response.code === 2) {
|
||||
// 文件被锁定
|
||||
lockFile(response.data);
|
||||
return false;
|
||||
}
|
||||
if (response.code === 3) {
|
||||
showMessage(response.msg);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue