Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/11102

Vanessa9bb91c3a97a3
diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.ts
index c4b05ae95b..4820a96731 100644
--- a/app/src/protyle/render/av/view.ts
+++ b/app/src/protyle/render/av/view.ts
@@ -6,6 +6,7 @@ import {focusBlock} from "../../util/selection";
import {upDownHint} from "../../../util/upDownHint";
import {escapeAriaLabel, escapeAttr, escapeHtml} from "../../../util/escape";
import {hasClosestByClassName} from "../../util/hasClosest";
+import {Constants} from "../../../constants";
export const openViewMenu = (options: { protyle: IProtyle, blockElement: HTMLElement, element: HTMLElement }) => {
if (options.protyle.disabled) {
@@ -388,14 +389,28 @@ export const getFieldsByData = (data: IAV) => {
};
export const dragoverTab = (event: DragEvent) => {
+ const viewTabElement = window.siyuan.dragElement.parentElement;
+ if (viewTabElement.scrollWidth > viewTabElement.clientWidth) {
+ const viewTabRect = viewTabElement.getBoundingClientRect();
+ if (event.clientX < viewTabRect.left) {
+ viewTabElement.scroll({
+ left: viewTabElement.scrollLeft - Constants.SIZE_SCROLL_STEP,
+ behavior: "smooth"
+ });
+ } else if (event.clientX > viewTabRect.right) {
+ viewTabElement.scroll({
+ left: viewTabElement.scrollLeft + Constants.SIZE_SCROLL_STEP,
+ behavior: "smooth"
+ });
+ }
+ }
const target = hasClosestByClassName(document.elementFromPoint(event.clientX, window.siyuan.dragElement.getBoundingClientRect().top + 10), "item");
if (!target) {
return;
}
- if (!target.parentElement.isSameNode(window.siyuan.dragElement.parentElement) || target.isSameNode(window.siyuan.dragElement)) {
+ if (!viewTabElement.isSameNode(window.siyuan.dragElement.parentElement) || target.isSameNode(window.siyuan.dragElement)) {
return;
}
-
const targetRect = target.getBoundingClientRect();
if (targetRect.left + targetRect.width / 2 < event.clientX) {
if (target.nextElementSibling?.isSameNode(window.siyuan.dragElement)) {