mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 07:12:39 +08:00
This commit is contained in:
parent
73fd05c3b3
commit
23fbf94e8a
@ -991,10 +991,10 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||
// 代码块语言选择 https://github.com/siyuan-note/siyuan/issues/14126
|
||||
if (matchHotKey("⌥↩", event) && selectText === "") {
|
||||
const selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||
if (selectElements.length === 0 && nodeElement.classList.contains("code-block")) {
|
||||
if (selectElements.length === 0) {
|
||||
selectElements.push(nodeElement);
|
||||
}
|
||||
if (selectElements.length > 0) {
|
||||
if (selectElements.length > 0 && !isIncludesHotKey("⌥↩")) {
|
||||
const otherElement = selectElements.find(item => {
|
||||
return !item.classList.contains("code-block");
|
||||
});
|
||||
@ -1004,24 +1004,22 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||
languageElements.push(item.querySelector(".protyle-action__language"));
|
||||
});
|
||||
protyle.toolbar.showCodeLanguage(protyle, languageElements);
|
||||
} else {
|
||||
addSubList(protyle, nodeElement, range);
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 回车
|
||||
if (isNotCtrl(event) && event.key === "Enter") {
|
||||
if (event.altKey) {
|
||||
addSubList(protyle, nodeElement, range);
|
||||
} else if (!event.shiftKey) {
|
||||
if (matchHotKey("↩", event)) {
|
||||
enter(nodeElement, range, protyle);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (matchHotKey("⌘A", event)) {
|
||||
event.preventDefault();
|
||||
|
Loading…
Reference in New Issue
Block a user