mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
⚡
This commit is contained in:
parent
20d27a93bd
commit
2b3b78485d
17 changed files with 36 additions and 25 deletions
|
|
@ -13,7 +13,8 @@ import {initTabMenu} from "../../menus/tab";
|
|||
import {getInstanceById} from "../../layout/util";
|
||||
import {Tab} from "../../layout/Tab";
|
||||
import {hideTooltip} from "../../dialog/tooltip";
|
||||
import {checkFold, openFileById} from "../../editor/util";
|
||||
import {openFileById} from "../../editor/util";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export const initWindowEvent = (app: App) => {
|
||||
document.body.addEventListener("mouseleave", () => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as path from "path";
|
|||
/// #endif
|
||||
import {matchHotKey} from "../../protyle/util/hotKey";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {checkFold, openFileById} from "../../editor/util";
|
||||
import {openFileById} from "../../editor/util";
|
||||
import {Constants} from "../../constants";
|
||||
import {newFileByName} from "../../util/newFile";
|
||||
import {App} from "../../index";
|
||||
|
|
@ -15,6 +15,7 @@ import {showFileInFolder} from "../../util/pathName";
|
|||
import {assetInputEvent, renderPreview, toggleAssetHistory} from "../../search/assets";
|
||||
import {initSearchMenu} from "../../menus/search";
|
||||
import {writeText} from "../../protyle/util/compatibility";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export const searchKeydown = (app: App, event: KeyboardEvent) => {
|
||||
if (getSelection().rangeCount === 0) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {appearance} from "../config/appearance";
|
|||
import {fetchPost, fetchSyncPost} from "../util/fetch";
|
||||
import {addGA, initAssets, setInlineStyle} from "../util/assets";
|
||||
import {renderSnippet} from "../config/util/snippets";
|
||||
import {checkFold, openFile, openFileById} from "../editor/util";
|
||||
import {openFile, openFileById} from "../editor/util";
|
||||
import {focusByRange} from "../protyle/util/selection";
|
||||
import {exitSiYuan} from "../dialog/processSystem";
|
||||
import {isWindow} from "../util/functions";
|
||||
|
|
@ -28,6 +28,7 @@ import {App} from "../index";
|
|||
import {initWindowEvent} from "./globalEvent/event";
|
||||
import {sendGlobalShortcut} from "./globalEvent/keydown";
|
||||
import {closeWindow} from "../window/closeWin";
|
||||
import {checkFold} from "../util/noRelyPCFunction";
|
||||
|
||||
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
|
||||
if (key1 === "general") {
|
||||
|
|
|
|||
|
|
@ -29,15 +29,6 @@ import {App} from "../index";
|
|||
import {newCardModel} from "../card/newCardTab";
|
||||
import {preventScroll} from "../protyle/scroll/preventScroll";
|
||||
|
||||
export const checkFold = (id: string, cb: (zoomIn: boolean, action: string[]) => void) => {
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||
cb(foldResponse.data, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
|
||||
});
|
||||
};
|
||||
|
||||
export const openFileById = async (options: {
|
||||
app: App,
|
||||
id: string,
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ import {setPanelFocus} from "../util";
|
|||
import {getDockByType} from "../tabUtil";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {updateHotkeyTip} from "../../protyle/util/compatibility";
|
||||
import {checkFold, openFileById} from "../../editor/util";
|
||||
import {openFileById} from "../../editor/util";
|
||||
import {hasClosestByClassName} from "../../protyle/util/hasClosest";
|
||||
import {openBookmarkMenu} from "../../menus/bookmark";
|
||||
import {App} from "../../index";
|
||||
import {Constants} from "../../constants";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export class Bookmark extends Model {
|
||||
private openNodes: string[];
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@ import {addScript} from "../../protyle/util/addScript";
|
|||
import {BlockPanel} from "../../block/Panel";
|
||||
import {fullscreen} from "../../protyle/breadcrumb/action";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {checkFold, isCurrentEditor, openFileById} from "../../editor/util";
|
||||
import {isCurrentEditor, openFileById} from "../../editor/util";
|
||||
import {updateHotkeyTip} from "../../protyle/util/compatibility";
|
||||
import {openGlobalSearch} from "../../search/util";
|
||||
import {App} from "../../index";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
declare const vis: any;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@ import {fetchPost} from "../../util/fetch";
|
|||
import {getAllModels} from "../getAll";
|
||||
import {hasClosestBlock, hasClosestByClassName, hasTopClosestByClassName} from "../../protyle/util/hasClosest";
|
||||
import {updateHotkeyTip} from "../../protyle/util/compatibility";
|
||||
import {checkFold, openFileById} from "../../editor/util";
|
||||
import {openFileById} from "../../editor/util";
|
||||
import {Constants} from "../../constants";
|
||||
import {escapeHtml} from "../../util/escape";
|
||||
import {unicode2Emoji} from "../../emoji";
|
||||
import {onGet} from "../../protyle/util/onGet";
|
||||
import {getPreviousBlock} from "../../protyle/wysiwyg/getBlock";
|
||||
import {App} from "../../index";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export class Outline extends Model {
|
||||
public tree: Tree;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import {onGet} from "../protyle/util/onGet";
|
|||
import {getAllModels} from "../layout/getAll";
|
||||
import {pasteAsPlainText, pasteEscaped, pasteText} from "../protyle/util/paste";
|
||||
/// #if !MOBILE
|
||||
import {checkFold, openFileById, updateBacklinkGraph} from "../editor/util";
|
||||
import {openFileById, updateBacklinkGraph} from "../editor/util";
|
||||
import {openGlobalSearch} from "../search/util";
|
||||
import {openNewWindowById} from "../window/openNewWindow";
|
||||
/// #endif
|
||||
|
|
@ -45,7 +45,7 @@ import {pushBack} from "../mobile/util/MobileBackFoward";
|
|||
import {copyPNG, exportAsset} from "./util";
|
||||
import {removeInlineType} from "../protyle/toolbar/util";
|
||||
import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey";
|
||||
import {renameTag} from "../util/noRelyPCFunction";
|
||||
import {checkFold, renameTag} from "../util/noRelyPCFunction";
|
||||
import {hideElements} from "../protyle/ui/hideElements";
|
||||
import {emitOpenMenu} from "../plugin/EventBus";
|
||||
import {openMobileFileById} from "../mobile/editor";
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ import * as path from "path";
|
|||
/// #endif
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {getAssetName, pathPosix, showFileInFolder} from "../util/pathName";
|
||||
import {checkFold, openFileById} from "../editor/util";
|
||||
import {openFileById} from "../editor/util";
|
||||
import {Constants} from "../constants";
|
||||
import {openNewWindowById} from "../window/openNewWindow";
|
||||
import {MenuItem} from "./Menu";
|
||||
import {App} from "../index";
|
||||
import {isInAndroid, updateHotkeyTip} from "../protyle/util/compatibility";
|
||||
import {checkFold} from "../util/noRelyPCFunction";
|
||||
|
||||
export const exportAsset = (src: string) => {
|
||||
/// #if !BROWSER
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {hasClosestByClassName} from "../../protyle/util/hasClosest";
|
|||
import {openMobileFileById} from "../editor";
|
||||
import {openBookmarkMenu} from "../../menus/bookmark";
|
||||
import {App} from "../../index";
|
||||
import {checkFold} from "../../editor/util";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export class MobileBookmarks {
|
||||
public element: HTMLElement;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {Constants} from "../../constants";
|
|||
import {getEventName} from "../../protyle/util/compatibility";
|
||||
import {App} from "../../index";
|
||||
import {closePanel} from "../util/closePanel";
|
||||
import {checkFold} from "../../editor/util";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export class MobileOutline {
|
||||
private tree: Tree;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import {
|
|||
renderPreview,
|
||||
} from "../../search/assets";
|
||||
import {addClearButton} from "../../util/addClearButton";
|
||||
import {checkFold} from "../../editor/util";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
const replace = (element: Element, config: ISearchOption, isAll: boolean) => {
|
||||
if (config.method === 1 || config.method === 2) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import {syncGuide} from "../../sync/syncGuide";
|
|||
import {Inbox} from "../../layout/dock/Inbox";
|
||||
import {App} from "../../index";
|
||||
import {setTitle} from "../../dialog/processSystem";
|
||||
import {checkFold} from "../../editor/util";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export const initFramework = (app: App, isStart: boolean) => {
|
||||
setInlineStyle();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ import {blockRender} from "../render/blockRender";
|
|||
/// #if !MOBILE
|
||||
import {getAllModels} from "../../layout/getAll";
|
||||
import {pushBack} from "../../util/backForward";
|
||||
import {checkFold, openAsset, openBy, openFileById} from "../../editor/util";
|
||||
import {openAsset, openBy, openFileById} from "../../editor/util";
|
||||
import {openGlobalSearch} from "../../search/util";
|
||||
/// #else
|
||||
import {popSearch} from "../../mobile/menu/search";
|
||||
|
|
@ -80,6 +80,7 @@ import {stickyRow, updateHeader} from "../render/av/row";
|
|||
import {showColMenu} from "../render/av/col";
|
||||
import {openViewMenu} from "../render/av/view";
|
||||
import {avRender} from "../render/av/render";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export class WYSIWYG {
|
||||
public lastHTMLs: { [key: string]: string } = {};
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import {newFileContentBySelect, rename, replaceFileName} from "../../editor/rena
|
|||
import {insertEmptyBlock, jumpToParentNext} from "../../block/util";
|
||||
import {isLocalPath, pathPosix} from "../../util/pathName";
|
||||
/// #if !MOBILE
|
||||
import {checkFold, openBy, openFileById} from "../../editor/util";
|
||||
import {openBy, openFileById} from "../../editor/util";
|
||||
/// #endif
|
||||
import {
|
||||
alignImgCenter, alignImgLeft,
|
||||
|
|
@ -68,6 +68,7 @@ import {escapeHtml} from "../../util/escape";
|
|||
import {insertHTML} from "../util/insertHTML";
|
||||
import {removeSearchMark} from "../toolbar/util";
|
||||
import {avKeydown} from "../render/av/keydown";
|
||||
import {checkFold} from "../../util/noRelyPCFunction";
|
||||
|
||||
export const getContentByInlineHTML = (range: Range, cb: (content: string) => void) => {
|
||||
let html = "";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import * as path from "path";
|
|||
import {Constants} from "../constants";
|
||||
import {escapeAriaLabel, escapeGreat, escapeHtml} from "../util/escape";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {checkFold, openFile, openFileById} from "../editor/util";
|
||||
import {openFile, openFileById} from "../editor/util";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {reloadProtyle} from "../protyle/util/reload";
|
||||
import {MenuItem} from "../menus/Menu";
|
||||
|
|
@ -40,6 +40,7 @@ import {
|
|||
import {resize} from "../protyle/util/resize";
|
||||
import {Menu} from "../plugin/Menu";
|
||||
import {addClearButton} from "../util/addClearButton";
|
||||
import {checkFold} from "../util/noRelyPCFunction";
|
||||
|
||||
export const toggleReplaceHistory = (searchElement: Element) => {
|
||||
const list = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {Dialog} from "../dialog";
|
||||
import {fetchPost} from "./fetch";
|
||||
import {isMobile} from "./functions";
|
||||
import {Constants} from "../constants";
|
||||
|
||||
// 需独立出来,否则移动端引用的时候会引入 pc 端大量无用代码
|
||||
export const renameTag = (labelName: string) => {
|
||||
|
|
@ -31,3 +32,12 @@ export const renameTag = (labelName: string) => {
|
|||
export const getWorkspaceName = () => {
|
||||
return window.siyuan.config.system.workspaceDir.replace(/^.*[\\\/]/, "");
|
||||
};
|
||||
|
||||
export const checkFold = (id: string, cb: (zoomIn: boolean, action: string[]) => void) => {
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||
cb(foldResponse.data, foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL]);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue