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: Improve multi-block reference insertion when dragging blocks https://github.com/siyuan-note/siyuan/issues/15042
Daniel97de65e79634
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex 67b3eaba68..c305f92ec6 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -1019,12 +1019,18 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {document.onmouseup = null;});const insertBlockRefs = async (ids: string[]) => {- let html = "";- for (const id of ids) {- const response = await fetchSyncPost("/api/block/getRefText", {id});- html += protyle.lute.Md2BlockDOM(`((${id} '${response.data}'))`);+ let markdown = "";+ for (let i = 0; i < ids.length; i++) {+ if (ids.length > 1) {+ markdown += "- ";+ }+ const response = await fetchSyncPost("/api/block/getRefText", {id: ids[i]});+ markdown += `((${ids[i]} '${response.data}'))`;+ if (ids.length > 1 && i !== ids.length - 1) {+ markdown += "\n";+ }}- insertHTML(html, protyle);+ insertHTML(protyle.lute.Md2BlockDOM(markdown), protyle);};const focusBlockRefDrop = (event: DragEvent) => {if (event.y > protyle.wysiwyg.element.lastElementChild.getBoundingClientRect().bottom) {@@ -1698,18 +1704,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {focusByRange(range);}}- let html = "";- for (let i = 0; i < ids.length; i++) {- if (ids.length > 1) {- html += "- ";- }- const response = await fetchSyncPost("/api/block/getRefText", {id: ids[i]});- html += `((${ids[i]} '${response.data}'))`;- if (ids.length > 1 && i !== ids.length - 1) {- html += "\n";- }- }- insertHTML(protyle.lute.Md2BlockDOM(html), protyle);+ await insertBlockRefs(ids);} else if (targetElement && !protyle.options.backlinkData && targetElement.className.indexOf("dragover__") > -1) {const scrollTop = protyle.contentElement.scrollTop;if (targetElement.classList.contains("av__row") ||