Vanessa 2024-03-21 10:14:18 +08:00
parent 580209b165
commit 0606ee127e
2 changed files with 14 additions and 3 deletions

View file

@ -158,7 +158,7 @@ const mergePluginHotkey = (plugin: Plugin) => {
}
window.siyuan.config.keymap.plugin[plugin.name][dockKey]["default"] = dock.config.hotkey;
}
})
});
};
export const afterLoadPlugin = (plugin: Plugin) => {
@ -222,7 +222,7 @@ export const afterLoadPlugin = (plugin: Plugin) => {
});
Object.keys(plugin.docks).forEach(key => {
const dock = plugin.docks[key];
const hotkey = window.siyuan.config.keymap.plugin[plugin.name][key].custom
const hotkey = window.siyuan.config.keymap.plugin[plugin.name][key].custom;
if (dock.config.position.startsWith("Left")) {
window.siyuan.layout.leftDock.genButton([{
type: key,

View file

@ -875,11 +875,17 @@ export class WYSIWYG {
return;
}
let firstBlockElement = hasClosestBlock(firstElement);
if (!firstBlockElement && firstElement.classList.contains("protyle-breadcrumb__bar")) {
firstBlockElement = firstElement.nextElementSibling as HTMLElement;
}
if (moveEvent.clientY > y) {
if (!startFirstElement) {
// 向上选择导致滚动条滚动到顶部再向下选择至 > y 时firstBlockElement 为 undefined https://ld246.com/article/1705233964097
if (!firstBlockElement) {
firstBlockElement = protyle.wysiwyg.element.firstElementChild as HTMLElement;
if (firstBlockElement.classList.contains("protyle-breadcrumb__bar")) {
firstBlockElement = firstBlockElement.nextElementSibling as HTMLElement;
}
}
startFirstElement = firstBlockElement;
}
@ -887,6 +893,9 @@ export class WYSIWYG {
// https://github.com/siyuan-note/siyuan/issues/7580
moveEvent.clientY < protyle.wysiwyg.element.lastElementChild.getBoundingClientRect().bottom) {
firstBlockElement = protyle.wysiwyg.element.firstElementChild as HTMLElement;
if (firstBlockElement.classList.contains("protyle-breadcrumb__bar")) {
firstBlockElement = firstBlockElement.nextElementSibling as HTMLElement;
}
}
let selectElements: Element[] = [];
let currentElement: Element | boolean = firstBlockElement;
@ -915,7 +924,9 @@ export class WYSIWYG {
hasJump = true;
}
} else {
selectElements.push(currentElement);
if (!currentElement.classList.contains("protyle-breadcrumb__bar")) {
selectElements.push(currentElement);
}
currentElement = currentElement.nextElementSibling;
}
} else if (currentElement.parentElement.classList.contains("sb")) {