An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: https://github.com/siyuan-note/siyuan/issues/15174
Vanessa42e9d00c4ce2
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex 34532199c5..b8d898ae87 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -809,12 +809,19 @@ const dragSame = async (protyle: IProtyle, sourceElements: Element[], targetElemexport const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {editorElement.addEventListener("dragstart", (event) => {- const target = event.target as HTMLElement;+ let target = event.target as HTMLElement;+ if (target.classList.contains("av__gallery-img")) {+ target = hasClosestByClassName(target, "av__gallery-item") as HTMLElement;+ }+ if (!target) {+ return;+ }if (target.tagName === "IMG") {window.siyuan.dragElement = undefined;event.preventDefault();return;}+if (target.classList) {if (hasClosestByClassName(target, "protyle-wysiwyg__embed")) {window.siyuan.dragElement = undefined;@@ -848,6 +855,9 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {blockElement.querySelectorAll(".av__gallery-item--select").forEach(item => {selectIds.push(item.getAttribute("data-id"));});+ if (selectIds.length === 0) {+ selectIds.push(target.getAttribute("data-id"));+ }event.dataTransfer.setData(`${Constants.SIYUAN_DROP_GUTTER}NodeAttributeView${Constants.ZWSP}GalleryItem${Constants.ZWSP}${selectIds}`,target.outerHTML);}diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex e41ddac317..37e86fc807 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -619,10 +619,18 @@ export class WYSIWYG {}return;}-+ const documentSelf = document;// https://github.com/siyuan-note/siyuan/issues/15100if (galleryItemElement) {- clearSelect(["galleryItem"], protyle.wysiwyg.element);+ documentSelf.onmouseup = () => {+ documentSelf.onmousemove = null;+ documentSelf.onmouseup = null;+ documentSelf.ondragstart = null;+ documentSelf.onselectstart = null;+ documentSelf.onselect = null;+ clearSelect(["galleryItem"], protyle.wysiwyg.element);+ return false;+ };return;}const avDragFillElement = hasClosestByClassName(target, "av__drag-fill");@@ -638,7 +646,6 @@ export class WYSIWYG {(hasClosestByClassName(target, "av__cell--header") && !hasClosestByClassName(target, "av__widthdrag"))) {return;}- const documentSelf = document;const wysiwygRect = protyle.wysiwyg.element.getBoundingClientRect();const wysiwygStyle = window.getComputedStyle(protyle.wysiwyg.element);const mostLeft = wysiwygRect.left + (parseInt(wysiwygStyle.paddingLeft) || 24) + 1;