An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/12461
Vanessa9f0eaa6a0b7b
diff --git a/app/src/boot/globalEvent/dragover.ts b/app/src/boot/globalEvent/dragover.tsindex b9a7fae837..177bb833a6 100644--- a/app/src/boot/globalEvent/dragover.ts+++ b/app/src/boot/globalEvent/dragover.ts@@ -30,6 +30,7 @@ const dragoverScroll: {space?: number // -1 向上;1 向下lastTime?: number} = {};+export const stopScrollAnimation = () => {if (dragoverScroll.animationId) {cancelAnimationFrame(dragoverScroll.animationId);@@ -39,6 +40,7 @@ export const stopScrollAnimation = () => {dragoverScroll.lastTime = null;}};+const scrollAnimation = (timestamp: number) => {if (!dragoverScroll.lastTime) {dragoverScroll.lastTime = timestamp - 8;diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.tsindex d0a79a37e6..02a4ac3bd3 100644--- a/app/src/protyle/gutter/index.ts+++ b/app/src/protyle/gutter/index.ts@@ -63,6 +63,7 @@ import * as path from "path";/// #endifimport {checkFold} from "../../util/noRelyPCFunction";import {clearSelect} from "../util/clear";+import {stopScrollAnimation} from "../../boot/globalEvent/dragover";export class Gutter {public element: HTMLElement;@@ -183,6 +184,7 @@ export class Gutter {item.style.opacity = "";});window.siyuan.dragElement = undefined;+ stopScrollAnimation();});this.element.addEventListener("click", (event: MouseEvent & { target: HTMLInputElement }) => {const buttonElement = hasClosestByTag(event.target, "BUTTON");diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex 30eb9fec69..f690a7c52a 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -36,6 +36,7 @@ import {processClonePHElement} from "../render/util";import {insertGalleryItemAnimation} from "../render/av/gallery/item";import {clearSelect} from "./clear";import {dragoverTab} from "../render/av/view";+import {dragOverScroll, stopScrollAnimation} from "../../boot/globalEvent/dragover";// position: afterbegin 为拖拽成超级块; "afterend", "beforebegin" 一般拖拽const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElement: Element,@@ -1174,6 +1175,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {window.siyuan.dragElement.style.opacity = "";window.siyuan.dragElement = undefined;}+ stopScrollAnimation();});let dragoverElement: Element;let disabledPosition: string;@@ -1196,12 +1198,8 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {return;}const contentRect = protyle.contentElement.getBoundingClientRect();- if (!hasClosestByClassName(event.target, "av__cell") &&- (event.clientY < contentRect.top + Constants.SIZE_SCROLL_TB || event.clientY > contentRect.bottom - Constants.SIZE_SCROLL_TB)) {- protyle.contentElement.scroll({- top: protyle.contentElement.scrollTop + (event.clientY < contentRect.top + Constants.SIZE_SCROLL_TB ? -Constants.SIZE_SCROLL_STEP : Constants.SIZE_SCROLL_STEP),- behavior: "smooth"- });+ if (!hasClosestByClassName(event.target, "av__cell")) {+ dragOverScroll(event, contentRect, protyle.contentElement);}let targetElement: HTMLElement | false;// 设置了的话 drop 就无法监听 shift/control event.dataTransfer.dropEffect = "move";@@ -1597,6 +1595,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {window.siyuan.dragElement = undefined;document.onmousemove = null;}+ stopScrollAnimation();});};