This commit is contained in:
Vanessa 2023-11-15 23:26:05 +08:00
parent 5cce04da49
commit 87032626e2
3 changed files with 5 additions and 4 deletions

View file

@ -382,7 +382,7 @@ export const keymap = {
} }
let hasConflict = false; let hasConflict = false;
if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) || if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) ||
["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr)) { ["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D", "⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr)) {
showMessage(`${window.siyuan.languages.invalid} [${adoptKeymapStr}]`); showMessage(`${window.siyuan.languages.invalid} [${adoptKeymapStr}]`);
hasConflict = true; hasConflict = true;
} }

View file

@ -221,7 +221,7 @@ export abstract class Constants {
}; };
// 冲突不使用 "⌘S/Q" // 冲突不使用 "⌘S/Q"
// "⌘", "⇧", "⌥", "⌃" // "⌘", "⇧", "⌥", "⌃"
// "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←", // "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D","⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←",
// "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦" 不可自定义 // "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦" 不可自定义
public static readonly SIYUAN_KEYMAP: IKeymap = { public static readonly SIYUAN_KEYMAP: IKeymap = {
general: { general: {

View file

@ -718,7 +718,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// 删除,不可使用 isNotCtrl(event),否则软删除回导致 https://github.com/siyuan-note/siyuan/issues/5607 // 删除,不可使用 isNotCtrl(event),否则软删除回导致 https://github.com/siyuan-note/siyuan/issues/5607
// 不可使用 !event.shiftKey否则 https://ld246.com/article/1666434796806 // 不可使用 !event.shiftKey否则 https://ld246.com/article/1666434796806
if (!event.altKey && (event.key === "Backspace" || event.key === "Delete")) { if ((!event.altKey && (event.key === "Backspace" || event.key === "Delete")) ||
matchHotKey("⌃D", event)) {
if (protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select")) { if (protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select")) {
removeBlock(protyle, nodeElement, range); removeBlock(protyle, nodeElement, range);
event.stopPropagation(); event.stopPropagation();
@ -800,7 +801,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
return; return;
} }
const position = getSelectionOffset(editElement, protyle.wysiwyg.element, range); const position = getSelectionOffset(editElement, protyle.wysiwyg.element, range);
if (event.key === "Delete") { if (event.key === "Delete" || matchHotKey("⌃D", event)) {
// 段末反向删除 https://github.com/siyuan-note/insider/issues/274 // 段末反向删除 https://github.com/siyuan-note/insider/issues/274
if (position.end === editElement.textContent.length) { if (position.end === editElement.textContent.length) {
const nextElement = getNextBlock(getTopAloneElement(nodeElement)); const nextElement = getNextBlock(getTopAloneElement(nodeElement));