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