mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
This commit is contained in:
parent
0ba7a47472
commit
1b3173d6f4
2 changed files with 8 additions and 7 deletions
|
|
@ -504,13 +504,13 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.copyBlockRef.custom, event)) {
|
||||
if (range && !isFileFocus && matchHotKey(window.siyuan.config.keymap.editor.general.copyBlockRef.custom, event)) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (hasClosestByClassName(range?.startContainer, "protyle-title")) {
|
||||
if (hasClosestByClassName(range.startContainer, "protyle-title")) {
|
||||
copyTextByType([protyle.block.rootID], "ref");
|
||||
} else {
|
||||
const nodeElement = hasClosestBlock(range?.startContainer);
|
||||
const nodeElement = hasClosestBlock(range.startContainer);
|
||||
if (!nodeElement) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -519,9 +519,9 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
copyPNGByLink(selectImgElement.querySelector("img").getAttribute("src"));
|
||||
return true;
|
||||
}
|
||||
const selectBlocks = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
|
||||
if (selectBlocks.length !== 0) {
|
||||
copyTextByType(Array.from(selectBlocks).map(item => item.getAttribute("data-node-id")), "ref");
|
||||
const ids = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")).map(item => item.getAttribute("data-node-id"));
|
||||
if (ids.length > 0) {
|
||||
copyTextByType(ids, "ref");
|
||||
return true;
|
||||
}
|
||||
if (range.toString() !== "") {
|
||||
|
|
|
|||
|
|
@ -2158,7 +2158,8 @@ export class WYSIWYG {
|
|||
}
|
||||
|
||||
// 按下方向键后块高亮跟随光标移动 https://github.com/siyuan-note/siyuan/issues/8918
|
||||
if ((event.key === "ArrowLeft" || event.key === "ArrowRight") &&
|
||||
if ((event.key === "ArrowLeft" || event.key === "ArrowRight" ||
|
||||
event.key === "Alt" || event.key === "Shift") && // 选中后 alt+shift+arrowRight 会导致光标和选中块不一致
|
||||
nodeElement && !nodeElement.classList.contains("protyle-wysiwyg--select")) {
|
||||
const selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||
let containRange = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue