Skip to content

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

:bug: Reject tab drops in Agent input https://github.com/siyuan-note/siyuan/issues/18843

Daniel54966105a389
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 675e89950c..b7c40bc4db 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -964,6 +964,8 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
let kanbanGroupDragoverElement: HTMLElement;
let kanbanGroupDragoverPosition: "left" | "right";
let kanbanGroupDragHeight = "";
+ const isLiteTabDrag = (event: DragEvent) => protyle.lite &&
+ event.dataTransfer.types.includes(Constants.SIYUAN_DROP_TAB);
const clearKanbanGroupDragover = () => {
if (kanbanGroupDragoverElement) {
kanbanGroupDragoverElement.classList.remove("dragover__left", "dragover__right");
@@ -1306,8 +1308,8 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
counter = 0;
hideDragTip();
window.siyuan.dragTitle = "";
- if (protyle.disabled || event.dataTransfer.getData(Constants.SIYUAN_DROP_EDITOR)) {
- // 只读模式/编辑器内选中文字拖拽
+ if (protyle.disabled || isLiteTabDrag(event) || event.dataTransfer.getData(Constants.SIYUAN_DROP_EDITOR)) {
+ // 只读模式、lite 模式中的页签拖拽或编辑器内选中文字拖拽
event.preventDefault();
event.stopPropagation();
return;
@@ -2235,7 +2237,8 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
let cachedTargetText = "";
let cachedIsCol = false;
editorElement.addEventListener("dragover", (event: DragEvent & { target: HTMLElement }) => {
- if (protyle.disabled || event.dataTransfer.types.includes(Constants.SIYUAN_DROP_EDITOR)) {
+ if (protyle.disabled || isLiteTabDrag(event) ||
+ event.dataTransfer.types.includes(Constants.SIYUAN_DROP_EDITOR)) {
event.preventDefault();
event.stopPropagation();
event.dataTransfer.dropEffect = "none";