mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-18 10:00:48 +08:00
This commit is contained in:
parent
c1036cd776
commit
b6c540f563
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 {popSearch} from "./search";
|
||||||
import {initAppearance} from "../settings/appearance";
|
import {initAppearance} from "../settings/appearance";
|
||||||
import {closePanel} from "./closePanel";
|
import {closePanel} from "../util/closePanel";
|
||||||
import {mountHelp, newDailyNote, newNotebook} from "../../util/mount";
|
import {mountHelp, newDailyNote, newNotebook} from "../../util/mount";
|
||||||
import {repos} from "../../config/repos";
|
import {repos} from "../../config/repos";
|
||||||
import {exitSiYuan, lockScreen, processSync} from "../../dialog/processSystem";
|
import {exitSiYuan, lockScreen, processSync} from "../../dialog/processSystem";
|
||||||
import {openHistory} from "../../history/history";
|
import {openHistory} from "../../history/history";
|
||||||
import {syncGuide} from "../../sync/syncGuide";
|
import {syncGuide} from "../../sync/syncGuide";
|
||||||
import {openCard} from "../../card/openCard";
|
import {openCard} from "../../card/openCard";
|
||||||
import {activeBlur, hideKeyboardToolbar} from "./keyboardToolbar";
|
import {activeBlur, hideKeyboardToolbar} from "../util/keyboardToolbar";
|
||||||
import {initAI} from "../settings/ai";
|
import {initAI} from "../settings/ai";
|
||||||
import {initRiffCard} from "../settings/riffCard";
|
import {initRiffCard} from "../settings/riffCard";
|
||||||
import {login, showAccountInfo} from "../settings/account";
|
import {login, showAccountInfo} from "../settings/account";
|
||||||
import {openModel} from "./model";
|
import {openModel} from "./model";
|
||||||
import {initAbout} from "../settings/about";
|
import {initAbout} from "../settings/about";
|
||||||
|
import {getRecentDocs} from "./getRecentDocs";
|
||||||
|
|
||||||
export const popMenu = () => {
|
export const popMenu = () => {
|
||||||
activeBlur();
|
activeBlur();
|
||||||
@ -39,6 +40,9 @@ export const popMenu = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="b3-menu__separator"></div>
|
<div class="b3-menu__separator"></div>
|
||||||
${accountHTML}
|
${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">
|
<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>
|
<svg class="b3-menu__icon"><use xlink:href="#iconSearch"></use></svg><span class="b3-menu__label">${window.siyuan.languages.search}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -104,6 +108,11 @@ ${accountHTML}
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
|
} else if (target.id === "menuRecent") {
|
||||||
|
getRecentDocs();
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
break;
|
||||||
} else if (target.id === "menuAppearance") {
|
} else if (target.id === "menuAppearance") {
|
||||||
initAppearance();
|
initAppearance();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
@ -1,4 +1,4 @@
|
|||||||
import {closePanel} from "./closePanel";
|
import {closePanel} from "../util/closePanel";
|
||||||
import {openMobileFileById} from "../editor";
|
import {openMobileFileById} from "../editor";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
@ -7,7 +7,7 @@ import {showMessage} from "../../dialog/message";
|
|||||||
import {openByMobile, writeText} from "../../protyle/util/compatibility";
|
import {openByMobile, writeText} from "../../protyle/util/compatibility";
|
||||||
import {exitSiYuan, processSync} from "../../dialog/processSystem";
|
import {exitSiYuan, processSync} from "../../dialog/processSystem";
|
||||||
import {pathPosix} from "../../util/pathName";
|
import {pathPosix} from "../../util/pathName";
|
||||||
import {openModel} from "../util/model";
|
import {openModel} from "../menu/model";
|
||||||
|
|
||||||
export const initAbout = () => {
|
export const initAbout = () => {
|
||||||
if (!window.siyuan.config.localIPs || window.siyuan.config.localIPs.length === 0 ||
|
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 {getEventName} from "../../protyle/util/compatibility";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {closePanel} from "../util/closePanel";
|
import {closePanel} from "../util/closePanel";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {openModel} from "../util/model";
|
import {openModel} from "../menu/model";
|
||||||
import {ai} from "../../config/ai";
|
import {ai} from "../../config/ai";
|
||||||
|
|
||||||
export const initAI = () => {
|
export const initAI = () => {
|
||||||
|
@ -2,7 +2,7 @@ import {fetchPost} from "../../util/fetch";
|
|||||||
import {setInlineStyle} from "../../util/assets";
|
import {setInlineStyle} from "../../util/assets";
|
||||||
import {genOptions} from "../../util/genOptions";
|
import {genOptions} from "../../util/genOptions";
|
||||||
import {reloadProtyle} from "../../protyle/util/reload";
|
import {reloadProtyle} from "../../protyle/util/reload";
|
||||||
import {openModel} from "../util/model";
|
import {openModel} from "../menu/model";
|
||||||
|
|
||||||
export const initAppearance = () => {
|
export const initAppearance = () => {
|
||||||
openModel({
|
openModel({
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {openModel} from "../util/model";
|
import {openModel} from "../menu/model";
|
||||||
import {flashcard} from "../../config/flashcard";
|
import {flashcard} from "../../config/flashcard";
|
||||||
|
|
||||||
export const initRiffCard = () => {
|
export const initRiffCard = () => {
|
||||||
|
@ -5,7 +5,7 @@ import {MenuItem} from "../../menus/Menu";
|
|||||||
import {Dialog} from "../../dialog";
|
import {Dialog} from "../../dialog";
|
||||||
import {confirmDialog} from "../../dialog/confirmDialog";
|
import {confirmDialog} from "../../dialog/confirmDialog";
|
||||||
import {escapeHtml} from "../../util/escape";
|
import {escapeHtml} from "../../util/escape";
|
||||||
import {popSearch, toolbarSearchEvent} from "./search";
|
import {popSearch, toolbarSearchEvent} from "../menu/search";
|
||||||
|
|
||||||
export class MobileTags {
|
export class MobileTags {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
@ -8,7 +8,7 @@ import {setInlineStyle} from "../../util/assets";
|
|||||||
import {renderSnippet} from "../../config/util/snippets";
|
import {renderSnippet} from "../../config/util/snippets";
|
||||||
import {setEmpty} from "./setEmpty";
|
import {setEmpty} from "./setEmpty";
|
||||||
import {getOpenNotebookCount} from "../../util/pathName";
|
import {getOpenNotebookCount} from "../../util/pathName";
|
||||||
import {popMenu} from "./menu";
|
import {popMenu} from "../menu";
|
||||||
import {MobileFiles} from "./MobileFiles";
|
import {MobileFiles} from "./MobileFiles";
|
||||||
import {MobileOutline} from "./MobileOutline";
|
import {MobileOutline} from "./MobileOutline";
|
||||||
import {hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
import {hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
||||||
|
Loading…
Reference in New Issue
Block a user