mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-08 00:04:21 +01:00
This commit is contained in:
parent
8720bc1a4d
commit
3be88c7b9f
4 changed files with 13 additions and 7 deletions
|
|
@ -42,6 +42,7 @@ import {Wnd} from "../../../layout/Wnd";
|
|||
import {unsplitWnd} from "../../../menus/tab";
|
||||
import {openFile} from "../../../editor/util";
|
||||
import {fetchPost} from "../../../util/fetch";
|
||||
import {setStorageVal} from "../../../protyle/util/compatibility";
|
||||
|
||||
export const globalCommand = (command: string, app: App) => {
|
||||
/// #if MOBILE
|
||||
|
|
@ -151,8 +152,9 @@ export const globalCommand = (command: string, app: App) => {
|
|||
openRecentDocs();
|
||||
return true;
|
||||
case "recentClosed":
|
||||
if (window.siyuan.closedTabs.length > 0) {
|
||||
const closeData = window.siyuan.closedTabs.pop();
|
||||
if (window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].length > 0) {
|
||||
const closeData = window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].pop();
|
||||
setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]);
|
||||
const childData = closeData.children as ILayoutJSON;
|
||||
if (childData.instance === "Search") {
|
||||
openFile({
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ export abstract class Constants {
|
|||
public static readonly LOCAL_EMOJIS = "local-emojis";
|
||||
public static readonly LOCAL_MOVE_PATH = "local-move-path";
|
||||
public static readonly LOCAL_RECENT_DOCS = "local-recent-docs";
|
||||
public static readonly LOCAL_CLOSED_TABS = "local-closed-tabs";
|
||||
|
||||
// dialog
|
||||
public static readonly DIALOG_CONFIRM = "dialog-confirm";
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ import {setPadding} from "../protyle/ui/initUI";
|
|||
import {setPosition} from "../util/setPosition";
|
||||
import {clearOBG} from "./dock/util";
|
||||
import {recordBeforeResizeTop} from "../protyle/util/resize";
|
||||
import {setStorageVal} from "../protyle/util/compatibility";
|
||||
|
||||
export class Wnd {
|
||||
private app: App;
|
||||
|
|
@ -783,13 +784,13 @@ export class Wnd {
|
|||
clearCounter();
|
||||
this.children.find((item, index) => {
|
||||
if (item.id === id) {
|
||||
if (window.siyuan.closedTabs.length > Constants.SIZE_UNDO) {
|
||||
window.siyuan.closedTabs.pop();
|
||||
if (window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].length > Constants.SIZE_UNDO) {
|
||||
window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].pop();
|
||||
}
|
||||
const tabJSON = {};
|
||||
layoutToJSON(item, tabJSON);
|
||||
window.siyuan.closedTabs.push(tabJSON);
|
||||
|
||||
window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].push(tabJSON);
|
||||
setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]);
|
||||
if (item.model instanceof Custom && item.model.beforeDestroy) {
|
||||
item.model.beforeDestroy();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -467,6 +467,7 @@ export const getLocalStorage = (cb: () => void) => {
|
|||
currentTab: "emoji"
|
||||
};
|
||||
defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
|
||||
defaultStorage[Constants.LOCAL_CLOSED_TABS] = [];
|
||||
defaultStorage[Constants.LOCAL_FILESPATHS] = []; // IFilesPath[]
|
||||
defaultStorage[Constants.LOCAL_SEARCHDATA] = {
|
||||
removed: true,
|
||||
|
|
@ -506,7 +507,8 @@ export const getLocalStorage = (cb: () => void) => {
|
|||
Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD,
|
||||
Constants.LOCAL_DIALOGPOSITION, Constants.LOCAL_SEARCHUNREF, Constants.LOCAL_HISTORY,
|
||||
Constants.LOCAL_OUTLINE, Constants.LOCAL_FILEPOSITION, Constants.LOCAL_FILESPATHS, Constants.LOCAL_IMAGES,
|
||||
Constants.LOCAL_PLUGIN_DOCKS, Constants.LOCAL_EMOJIS, Constants.LOCAL_MOVE_PATH, Constants.LOCAL_RECENT_DOCS].forEach((key) => {
|
||||
Constants.LOCAL_PLUGIN_DOCKS, Constants.LOCAL_EMOJIS, Constants.LOCAL_MOVE_PATH, Constants.LOCAL_RECENT_DOCS,
|
||||
Constants.LOCAL_CLOSED_TABS].forEach((key) => {
|
||||
if (typeof response.data[key] === "string") {
|
||||
try {
|
||||
const parseData = JSON.parse(response.data[key]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue