mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 19:59:08 +08:00
This commit is contained in:
parent
a003837e88
commit
c43869e612
@ -329,30 +329,6 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.shiftKey && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
|
|
||||||
const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
|
|
||||||
if (selectElements.length > 0) {
|
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!range.toString()) {
|
|
||||||
if (event.key === "ArrowRight" && isEndOfBlock(range)) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const nodeEditableElement = getContenteditableElement(nodeElement);
|
|
||||||
const position = getSelectionOffset(nodeEditableElement, protyle.wysiwyg.element, range);
|
|
||||||
if (position.start === 0 && event.key === "ArrowLeft") {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.expandUp.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.expandUp.custom, event)) {
|
||||||
upSelect({
|
upSelect({
|
||||||
protyle, event, nodeElement, editorElement, range,
|
protyle, event, nodeElement, editorElement, range,
|
||||||
@ -1945,6 +1921,31 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 和自定义 alt+shift+左/右 冲突,降低优先级 https://github.com/siyuan-note/siyuan/issues/14638
|
||||||
|
if (event.shiftKey && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
|
||||||
|
const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
|
||||||
|
if (selectElements.length > 0) {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!range.toString()) {
|
||||||
|
if (event.key === "ArrowRight" && isEndOfBlock(range)) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const nodeEditableElement = getContenteditableElement(nodeElement);
|
||||||
|
const position = getSelectionOffset(nodeEditableElement, protyle.wysiwyg.element, range);
|
||||||
|
if (position.start === 0 && event.key === "ArrowLeft") {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 置于最后,太多快捷键会使用到选中元素
|
// 置于最后,太多快捷键会使用到选中元素
|
||||||
if (isNotCtrl(event) && event.key !== "Backspace" && event.key !== "Escape" && event.key !== "Delete" && !event.shiftKey && !event.altKey && event.key !== "Enter") {
|
if (isNotCtrl(event) && event.key !== "Backspace" && event.key !== "Escape" && event.key !== "Delete" && !event.shiftKey && !event.altKey && event.key !== "Enter") {
|
||||||
hideElements(["select"], protyle);
|
hideElements(["select"], protyle);
|
||||||
|
Loading…
Reference in New Issue
Block a user