mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-20 19:10:49 +08:00
This commit is contained in:
parent
e18e9c2750
commit
c14fc344c6
@ -264,7 +264,7 @@ export const keymap = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) ||
|
if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) ||
|
||||||
["⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧Enter", "Enter", "PageUp", "PageDown", "⌫", "⌦", "F9"].includes(keymapStr)) {
|
["⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦", "F9"].includes(keymapStr)) {
|
||||||
showMessage(tip + "] " + window.siyuan.languages.invalid);
|
showMessage(tip + "] " + window.siyuan.languages.invalid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ export abstract class Constants {
|
|||||||
list: {
|
list: {
|
||||||
indent: {default: "⇥", custom: "⇥"},
|
indent: {default: "⇥", custom: "⇥"},
|
||||||
outdent: {default: "⇧⇥", custom: "⇧⇥"},
|
outdent: {default: "⇧⇥", custom: "⇧⇥"},
|
||||||
checkToggle: {default: "⌘Enter", custom: "⌘Enter"},
|
checkToggle: {default: "⌘↩", custom: "⌘↩"},
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
insertRowAbove: {default: "⇧⌘T", custom: "⇧⌘T"},
|
insertRowAbove: {default: "⇧⌘T", custom: "⇧⌘T"},
|
||||||
|
@ -29,7 +29,7 @@ const bindAttrInput = (inputElement: HTMLInputElement, confirmElement: Element)
|
|||||||
if (event.isComposing) {
|
if (event.isComposing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (matchHotKey("⌘Enter", event)) {
|
if (matchHotKey("⌘↩", event)) {
|
||||||
confirmElement.dispatchEvent(new CustomEvent("click"));
|
confirmElement.dispatchEvent(new CustomEvent("click"));
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -879,7 +879,7 @@ export class Toolbar {
|
|||||||
}
|
}
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
||||||
if (event.key === "Escape" || matchHotKey("⌘Enter", event)) {
|
if (event.key === "Escape" || matchHotKey("⌘↩", event)) {
|
||||||
this.subElement.classList.add("fn__none");
|
this.subElement.classList.add("fn__none");
|
||||||
this.subElement.querySelector('[data-type="pin"]').classList.remove("ft__primary");
|
this.subElement.querySelector('[data-type="pin"]').classList.remove("ft__primary");
|
||||||
if (renderElement.tagName === "SPAN") {
|
if (renderElement.tagName === "SPAN") {
|
||||||
|
@ -75,7 +75,8 @@ export const updateHotkeyTip = (hotkey: string) => {
|
|||||||
}
|
}
|
||||||
hotkey = hotkey.replace("⌘", "Ctrl").replace("⇧", "Shift")
|
hotkey = hotkey.replace("⌘", "Ctrl").replace("⇧", "Shift")
|
||||||
.replace("⌥", "Alt").replace("⇥", "Tab")
|
.replace("⌥", "Alt").replace("⇥", "Tab")
|
||||||
.replace("⌫", "Backspace").replace("⌦", "Delete");
|
.replace("⌫", "Backspace").replace("⌦", "Delete")
|
||||||
|
.replace("↩", "Enter");
|
||||||
if (hotkey.indexOf("Shift") > -1) {
|
if (hotkey.indexOf("Shift") > -1) {
|
||||||
hotkey = hotkey.replace(";", ":").replace("=", "+").replace("-", "_").replace(".", ">");
|
hotkey = hotkey.replace(";", ":").replace("=", "+").replace("-", "_").replace(".", ">");
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 软换行
|
// 软换行
|
||||||
if (matchHotKey("⇧Enter", event) && range.toString() === "") {
|
if (matchHotKey("⇧↩", event) && range.toString() === "") {
|
||||||
let startElement = range.startContainer as HTMLElement;
|
let startElement = range.startContainer as HTMLElement;
|
||||||
const nextSibling = hasNextSibling(startElement) as Element;
|
const nextSibling = hasNextSibling(startElement) as Element;
|
||||||
// 图片之前软换行
|
// 图片之前软换行
|
||||||
@ -1309,9 +1309,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||||||
|
|
||||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.vLayout.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.vLayout.custom, event)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||||
if (selectsElement.length === 0) {
|
if (selectsElement.length < 2) {
|
||||||
selectsElement = [nodeElement];
|
return;
|
||||||
}
|
}
|
||||||
turnsIntoTransaction({
|
turnsIntoTransaction({
|
||||||
protyle, selectsElement,
|
protyle, selectsElement,
|
||||||
@ -1323,9 +1323,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||||||
|
|
||||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.hLayout.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.hLayout.custom, event)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
let selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||||
if (selectsElement.length === 0) {
|
if (selectsElement.length < 2) {
|
||||||
selectsElement = [nodeElement];
|
return;
|
||||||
}
|
}
|
||||||
turnsIntoTransaction({
|
turnsIntoTransaction({
|
||||||
protyle, selectsElement,
|
protyle, selectsElement,
|
||||||
|
Loading…
Reference in New Issue
Block a user