mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-15 00:21:00 +08:00
This commit is contained in:
parent
84b29657f8
commit
5c034d93d0
@ -1158,15 +1158,6 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.recentDocs.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.general.recentDocs.custom, event)) {
|
||||||
const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
|
|
||||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (openRecentDocsDialog) {
|
|
||||||
hideElements(["dialog"]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
openRecentDocs();
|
openRecentDocs();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
@ -8,8 +8,18 @@ import {getAllDocks} from "../layout/getAll";
|
|||||||
import {Dialog} from "../dialog";
|
import {Dialog} from "../dialog";
|
||||||
import {focusByRange} from "../protyle/util/selection";
|
import {focusByRange} from "../protyle/util/selection";
|
||||||
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||||
|
import {hideElements} from "../protyle/ui/hideElements";
|
||||||
|
|
||||||
export const openRecentDocs = () => {
|
export const openRecentDocs = () => {
|
||||||
|
const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
|
||||||
|
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (openRecentDocsDialog) {
|
||||||
|
hideElements(["dialog"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
fetchPost("/api/storage/getRecentDocs", {}, (response) => {
|
fetchPost("/api/storage/getRecentDocs", {}, (response) => {
|
||||||
let range: Range;
|
let range: Range;
|
||||||
if (getSelection().rangeCount > 0) {
|
if (getSelection().rangeCount > 0) {
|
||||||
|
@ -188,15 +188,6 @@ export const newCenterEmptyTab = (app: App) => {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
break;
|
break;
|
||||||
} else if (target.id === "editorEmptyRecent") {
|
} else if (target.id === "editorEmptyRecent") {
|
||||||
const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
|
|
||||||
if (item.element.getAttribute("data-key") === window.siyuan.config.keymap.general.recentDocs.custom) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (openRecentDocsDialog) {
|
|
||||||
hideElements(["dialog"]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
openRecentDocs();
|
openRecentDocs();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -25,6 +25,7 @@ import {confirmDialog} from "../dialog/confirmDialog";
|
|||||||
import {App} from "../index";
|
import {App} from "../index";
|
||||||
import {isBrowser} from "../util/functions";
|
import {isBrowser} from "../util/functions";
|
||||||
import {unbindSaveUI} from "../boot/onGetConfig";
|
import {unbindSaveUI} from "../boot/onGetConfig";
|
||||||
|
import {openRecentDocs} from "../business/openRecentDocs";
|
||||||
|
|
||||||
const togglePinDock = (dock: Dock, icon: string) => {
|
const togglePinDock = (dock: Dock, icon: string) => {
|
||||||
return {
|
return {
|
||||||
@ -371,6 +372,14 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
}).element);
|
}).element);
|
||||||
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
label: window.siyuan.languages.recentDocs,
|
||||||
|
icon: "iconFile",
|
||||||
|
accelerator: window.siyuan.config.keymap.general.recentDocs.custom,
|
||||||
|
click: () => {
|
||||||
|
openRecentDocs();
|
||||||
|
}
|
||||||
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.lockScreen,
|
label: window.siyuan.languages.lockScreen,
|
||||||
icon: "iconLock",
|
icon: "iconLock",
|
||||||
|
Loading…
Reference in New Issue
Block a user