mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
c8f60547da
commit
7587b91a5c
5 changed files with 52 additions and 0 deletions
|
|
@ -32,6 +32,9 @@ import {loadPlugins, reloadPlugin} from "./plugin/loader";
|
|||
import "./assets/scss/base.scss";
|
||||
import {reloadEmoji} from "./emoji";
|
||||
import {processIOSPurchaseResponse} from "./util/iOSPurchase";
|
||||
/// #if BROWSER
|
||||
import {setLocalShorthandCount} from "./util/noRelyPCFunction";
|
||||
/// #endif
|
||||
|
||||
export class App {
|
||||
public plugins: import("./plugin").Plugin[] = [];
|
||||
|
|
@ -65,6 +68,11 @@ export class App {
|
|||
case "setDefRefCount":
|
||||
setDefRefCount(data.data);
|
||||
break;
|
||||
/// #if BROWSER
|
||||
case "setLocalShorthandCount":
|
||||
setLocalShorthandCount();
|
||||
break;
|
||||
/// #endif
|
||||
case "setRefDynamicText":
|
||||
setRefDynamicText(data.data);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import {isTouchDevice} from "../../util/functions";
|
|||
import {App} from "../../index";
|
||||
import {refreshFileTree} from "../../dialog/processSystem";
|
||||
import {hideTooltip, showTooltip} from "../../dialog/tooltip";
|
||||
import * as dayjs from "dayjs";
|
||||
|
||||
export class Files extends Model {
|
||||
public element: HTMLElement;
|
||||
|
|
@ -322,6 +323,14 @@ export class Files extends Model {
|
|||
x: event.clientX,
|
||||
y: event.clientY
|
||||
});
|
||||
} else if (type === "addLocal") {
|
||||
fetchPost("/api/filetree/moveLocalShorthands", {
|
||||
"notebook": notebookId,
|
||||
"path": dayjs().format("YYYYMMDDHHmmss")
|
||||
});
|
||||
this.element.querySelectorAll('[data-type="addLocal"]').forEach(item => {
|
||||
item.remove();
|
||||
})
|
||||
}
|
||||
}
|
||||
if (type === "more-file") {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {MenuItem} from "../../menus/Menu";
|
|||
import {App} from "../../index";
|
||||
import {refreshFileTree} from "../../dialog/processSystem";
|
||||
import {setStorageVal} from "../../protyle/util/compatibility";
|
||||
import * as dayjs from "dayjs";
|
||||
|
||||
export class MobileFiles extends Model {
|
||||
public element: HTMLElement;
|
||||
|
|
@ -217,6 +218,14 @@ export class MobileFiles extends Model {
|
|||
} else if (type === "more-root") {
|
||||
initNavigationMenu(app, target.parentElement);
|
||||
window.siyuan.menus.menu.fullscreen("bottom");
|
||||
} else if (type === "addLocal") {
|
||||
fetchPost("/api/filetree/moveLocalShorthands", {
|
||||
"notebook": notebookId,
|
||||
"path": dayjs().format("YYYYMMDDHHmmss")
|
||||
});
|
||||
this.element.querySelectorAll('[data-type="addLocal"]').forEach(item => {
|
||||
item.remove();
|
||||
})
|
||||
}
|
||||
}
|
||||
if (type === "more-file") {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
import {App} from "../../index";
|
||||
import {reloadPlugin} from "../../plugin/loader";
|
||||
import {reloadEmoji} from "../../emoji";
|
||||
import {setLocalShorthandCount} from "../../util/noRelyPCFunction";
|
||||
|
||||
export const onMessage = (app: App, data: IWebSocketData) => {
|
||||
if (data) {
|
||||
|
|
@ -16,6 +17,9 @@ export const onMessage = (app: App, data: IWebSocketData) => {
|
|||
case "setDefRefCount":
|
||||
setDefRefCount(data.data);
|
||||
break;
|
||||
case "setLocalShorthandCount":
|
||||
setLocalShorthandCount();
|
||||
break;
|
||||
case "setRefDynamicText":
|
||||
setRefDynamicText(data.data);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ import {fetchPost} from "./fetch";
|
|||
import {isMobile} from "./functions";
|
||||
import {Constants} from "../constants";
|
||||
import {pathPosix} from "./pathName";
|
||||
/// #if !MOBILE
|
||||
import {getDockByType} from "../layout/tabUtil";
|
||||
import {Files} from "../layout/dock/Files";
|
||||
/// #endif
|
||||
|
||||
// 需独立出来,否则移动端引用的时候会引入 pc 端大量无用代码
|
||||
export const renameTag = (labelName: string) => {
|
||||
|
|
@ -45,3 +49,21 @@ export const checkFold = (id: string, cb: (zoomIn: boolean, action: TProtyleActi
|
|||
foldResponse.data.isRoot);
|
||||
});
|
||||
};
|
||||
|
||||
export const setLocalShorthandCount = () => {
|
||||
let fileElement;
|
||||
/// #if MOBILE
|
||||
fileElement = window.siyuan.mobile.docks.file.element;
|
||||
/// #else
|
||||
const dockFile = getDockByType("file");
|
||||
if (!dockFile) {
|
||||
return false;
|
||||
}
|
||||
fileElement = (dockFile.data.file as Files).element;
|
||||
/// #endif
|
||||
fileElement.childNodes.forEach((item: Element) => {
|
||||
item.querySelector('[data-type="more-root"]').insertAdjacentHTML("beforebegin", `<span data-type="addLocal" class="b3-list-item__action">
|
||||
<svg><use xlink:href="#iconRiffCard"></use></svg>
|
||||
</span>`);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue