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/13336
Vanessa7cdc42e1909d
diff --git a/app/src/protyle/upload/index.ts b/app/src/protyle/upload/index.tsindex dbe71bd46a..eef0ad793d 100644--- a/app/src/protyle/upload/index.ts+++ b/app/src/protyle/upload/index.ts@@ -9,6 +9,7 @@ import {genAssetHTML} from "../../asset/renderAssets";import {hasClosestBlock} from "../util/hasClosest";import {getContenteditableElement} from "../wysiwyg/getBlock";import {getTypeByCellElement, updateCellsValue} from "../render/av/cell";+import {scrollCenter} from "../../util/highlightById";export class Upload {public element: HTMLElement;@@ -118,28 +119,30 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {}}}- let succFileText = "";+ let successFileText = "";const keys = Object.keys(response.data.succMap);const avAssets: IAVCellAssetValue[] = [];+ let hasImage = false;keys.forEach((key, index) => {const path = response.data.succMap[key];const type = pathPosix().extname(key).toLowerCase();const filename = protyle.options.upload.filename(key);const name = filename.substring(0, filename.length - type.length);+ hasImage = Constants.SIYUAN_ASSETS_IMAGE.includes(type)avAssets.push({type: Constants.SIYUAN_ASSETS_IMAGE.includes(type) ? "image" : "file",content: path,name: name});- succFileText += genAssetHTML(type, path, name, filename);+ successFileText += genAssetHTML(type, path, name, filename);if (!Constants.SIYUAN_ASSETS_AUDIO.includes(type) && !Constants.SIYUAN_ASSETS_VIDEO.includes(type) &&keys.length - 1 !== index) {if (nodeElement && nodeElement.classList.contains("table")) {- succFileText += "<br>";+ successFileText += "<br>";} else if (insertBlock) {- succFileText += "\n\n";+ successFileText += "\n\n";} else {- succFileText += "\n";+ successFileText += "\n";}}});@@ -191,7 +194,11 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {}}// 避免插入代码块中,其次因为都要独立成块 https://github.com/siyuan-note/siyuan/issues/7607- insertHTML(succFileText, protyle, insertBlock);+ insertHTML(successFileText, protyle, insertBlock);+ // 粘贴图片后定位不准确 https://github.com/siyuan-note/siyuan/issues/13336+ setTimeout(() => {+ scrollCenter(protyle, undefined, false, "smooth");+ }, hasImage ? 0 : Constants.TIMEOUT_LOAD);};export const uploadLocalFiles = (files: string[], protyle: IProtyle, isUpload: boolean) => {diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex c79045ca67..f87de12739 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -502,6 +502,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvenreturn;} else if (files && files.length > 0) {uploadFiles(protyle, files);+ return;} else if (textPlain.trim() !== "" && files && files.length === 0) {if (range.toString() !== "") {const firstLine = textPlain.split("\n")[0];