This commit is contained in:
parent
c1036cd776
commit
b6c540f563
11 changed files with 51 additions and 10 deletions
32
app/src/mobile/menu/getRecentDocs.ts
Normal file
32
app/src/mobile/menu/getRecentDocs.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import {fetchPost} from "../../util/fetch";
|
||||
import {unicode2Emoji} from "../../emoji";
|
||||
import {Constants} from "../../constants";
|
||||
import {escapeHtml} from "../../util/escape";
|
||||
import {hasClosestByClassName} from "../../protyle/util/hasClosest";
|
||||
import {openModel} from "./model";
|
||||
import {openMobileFileById} from "../editor";
|
||||
|
||||
export const getRecentDocs = () => {
|
||||
fetchPost("/api/storage/getRecentDocs", {}, (response) => {
|
||||
let html = "";
|
||||
response.data.forEach((item: any, index: number) => {
|
||||
html += `<li data-index="${index}" data-node-id="${item.rootID}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">
|
||||
${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__graphic", true)}
|
||||
<span class="b3-list-item__text">${escapeHtml(item.title)}</span>
|
||||
</li>`;
|
||||
});
|
||||
openModel({
|
||||
title: window.siyuan.languages.recentDocs,
|
||||
icon: "iconList",
|
||||
html: `<ul class="b3-list b3-list--mobile">${html}</ul>`,
|
||||
bindEvent(element: HTMLElement) {
|
||||
element.addEventListener("click", (event) => {
|
||||
const liElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item");
|
||||
if (liElement) {
|
||||
openMobileFileById(liElement.dataset.nodeId, [Constants.CB_GET_SCROLL])
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
|
@ -1,18 +1,19 @@
|
|||
import {popSearch} from "./search";
|
||||
import {initAppearance} from "../settings/appearance";
|
||||
import {closePanel} from "./closePanel";
|
||||
import {closePanel} from "../util/closePanel";
|
||||
import {mountHelp, newDailyNote, newNotebook} from "../../util/mount";
|
||||
import {repos} from "../../config/repos";
|
||||
import {exitSiYuan, lockScreen, processSync} from "../../dialog/processSystem";
|
||||
import {openHistory} from "../../history/history";
|
||||
import {syncGuide} from "../../sync/syncGuide";
|
||||
import {openCard} from "../../card/openCard";
|
||||
import {activeBlur, hideKeyboardToolbar} from "./keyboardToolbar";
|
||||
import {activeBlur, hideKeyboardToolbar} from "../util/keyboardToolbar";
|
||||
import {initAI} from "../settings/ai";
|
||||
import {initRiffCard} from "../settings/riffCard";
|
||||
import {login, showAccountInfo} from "../settings/account";
|
||||
import {openModel} from "./model";
|
||||
import {initAbout} from "../settings/about";
|
||||
import {getRecentDocs} from "./getRecentDocs";
|
||||
|
||||
export const popMenu = () => {
|
||||
activeBlur();
|
||||
|
@ -39,6 +40,9 @@ export const popMenu = () => {
|
|||
</div>
|
||||
<div class="b3-menu__separator"></div>
|
||||
${accountHTML}
|
||||
<div id="menuRecent" class="b3-menu__item">
|
||||
<svg class="b3-menu__icon"><use xlink:href="#iconList"></use></svg><span class="b3-menu__label">${window.siyuan.languages.recentDocs}</span>
|
||||
</div>
|
||||
<div id="menuSearch" class="b3-menu__item">
|
||||
<svg class="b3-menu__icon"><use xlink:href="#iconSearch"></use></svg><span class="b3-menu__label">${window.siyuan.languages.search}</span>
|
||||
</div>
|
||||
|
@ -104,6 +108,11 @@ ${accountHTML}
|
|||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "menuRecent") {
|
||||
getRecentDocs();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "menuAppearance") {
|
||||
initAppearance();
|
||||
event.preventDefault();
|
|
@ -1,4 +1,4 @@
|
|||
import {closePanel} from "./closePanel";
|
||||
import {closePanel} from "../util/closePanel";
|
||||
import {openMobileFileById} from "../editor";
|
||||
import {Constants} from "../../constants";
|
||||
import {fetchPost} from "../../util/fetch";
|
|
@ -7,7 +7,7 @@ import {showMessage} from "../../dialog/message";
|
|||
import {openByMobile, writeText} from "../../protyle/util/compatibility";
|
||||
import {exitSiYuan, processSync} from "../../dialog/processSystem";
|
||||
import {pathPosix} from "../../util/pathName";
|
||||
import {openModel} from "../util/model";
|
||||
import {openModel} from "../menu/model";
|
||||
|
||||
export const initAbout = () => {
|
||||
if (!window.siyuan.config.localIPs || window.siyuan.config.localIPs.length === 0 ||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {openModel} from "../util/model";
|
||||
import {openModel} from "../menu/model";
|
||||
import {getEventName} from "../../protyle/util/compatibility";
|
||||
import {fetchPost} from "../../util/fetch";
|
||||
import {closePanel} from "../util/closePanel";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {openModel} from "../util/model";
|
||||
import {openModel} from "../menu/model";
|
||||
import {ai} from "../../config/ai";
|
||||
|
||||
export const initAI = () => {
|
||||
|
|
|
@ -2,7 +2,7 @@ import {fetchPost} from "../../util/fetch";
|
|||
import {setInlineStyle} from "../../util/assets";
|
||||
import {genOptions} from "../../util/genOptions";
|
||||
import {reloadProtyle} from "../../protyle/util/reload";
|
||||
import {openModel} from "../util/model";
|
||||
import {openModel} from "../menu/model";
|
||||
|
||||
export const initAppearance = () => {
|
||||
openModel({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {openModel} from "../util/model";
|
||||
import {openModel} from "../menu/model";
|
||||
import {flashcard} from "../../config/flashcard";
|
||||
|
||||
export const initRiffCard = () => {
|
||||
|
|
|
@ -5,7 +5,7 @@ import {MenuItem} from "../../menus/Menu";
|
|||
import {Dialog} from "../../dialog";
|
||||
import {confirmDialog} from "../../dialog/confirmDialog";
|
||||
import {escapeHtml} from "../../util/escape";
|
||||
import {popSearch, toolbarSearchEvent} from "./search";
|
||||
import {popSearch, toolbarSearchEvent} from "../menu/search";
|
||||
|
||||
export class MobileTags {
|
||||
public element: HTMLElement;
|
||||
|
|
|
@ -8,7 +8,7 @@ import {setInlineStyle} from "../../util/assets";
|
|||
import {renderSnippet} from "../../config/util/snippets";
|
||||
import {setEmpty} from "./setEmpty";
|
||||
import {getOpenNotebookCount} from "../../util/pathName";
|
||||
import {popMenu} from "./menu";
|
||||
import {popMenu} from "../menu";
|
||||
import {MobileFiles} from "./MobileFiles";
|
||||
import {MobileOutline} from "./MobileOutline";
|
||||
import {hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
||||
|
|
Loading…
Add table
Reference in a new issue