Skip to content

Commit

Permalink
♻️ fix #6641
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Nov 24, 2022
1 parent de529c2 commit ecf6721
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/src/constants.ts
Expand Up @@ -103,10 +103,12 @@ export abstract class Constants {
"221": ["]", "}"],
"222": ["'", '"'],
};
// 冲突不使用 "⌘S/Q"
// "⌘", "⇧", "⌥", "⌃"
// "⌘A", "⌘X", "⌘C", "⌘V", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌘⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦" 不可自定义
public static readonly SIYUAN_KEYMAP: IKeymap = {
general: {
editMode: {default: "⌘.", custom: "⌘."},
syncNow: {default: "F9", custom: "F9"},
enterBack: {default: "⌥←", custom: "⌥←"},
enter: {default: "⌥→", custom: "⌥→"},
Expand Down
7 changes: 7 additions & 0 deletions app/src/util/globalShortcut.ts
Expand Up @@ -40,6 +40,7 @@ import {syncGuide} from "../sync/syncGuide";
import {showPopover} from "../block/popover";
import {getStartEndElement} from "../protyle/wysiwyg/commonHotkey";
import {getNextFileLi, getPreviousFileLi} from "../protyle/wysiwyg/getBlock";
import {editor} from "../config/editor";

const getRightBlock = (element: HTMLElement, x: number, y: number) => {
let index = 1;
Expand Down Expand Up @@ -422,6 +423,12 @@ export const globalShortcut = () => {
syncGuide(document.querySelector("#barSync"));
return;
}
if (matchHotKey(window.siyuan.config.keymap.general.editMode.custom, event)) {
event.preventDefault();
event.stopPropagation();
editor.setMode();
return;
}
if (matchHotKey(window.siyuan.config.keymap.general.lockScreen.custom, event)) {
exportLayout(false, () => {
fetchPost("/api/system/logoutAuth", {}, () => {
Expand Down
2 changes: 1 addition & 1 deletion app/src/util/onGetConfig.ts
Expand Up @@ -182,7 +182,7 @@ const initBar = () => {
<div id="barSearch" class="toolbar__item b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.globalSearch} ${updateHotkeyTip(window.siyuan.config.keymap.general.globalSearch.custom)}">
<svg><use xlink:href="#iconSearch"></use></svg>
</div>
<div id="barReadonly" class="toolbar__item b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.use} ${window.siyuan.config.editor.readOnly ? window.siyuan.languages.editMode : window.siyuan.languages.editReadonly}">
<div id="barReadonly" class="toolbar__item b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.use} ${window.siyuan.config.editor.readOnly ? window.siyuan.languages.editMode : window.siyuan.languages.editReadonly} ${updateHotkeyTip(window.siyuan.config.keymap.general.editMode.custom)}">
<svg><use xlink:href="#icon${window.siyuan.config.editor.readOnly ? "Preview" : "Edit"}"></use></svg>
</div>
<div id="barMode" class="toolbar__item b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.appearanceMode}">
Expand Down

0 comments on commit ecf6721

Please sign in to comment.