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: fix https://github.com/siyuan-note/siyuan/issues/5713
Vanessa092035c564a0
diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.tsindex 5ad2bfc6f2..67ae73aebf 100644--- a/app/src/protyle/header/Background.ts+++ b/app/src/protyle/header/Background.ts@@ -49,31 +49,59 @@ export class Background {this.tagsElement = this.element.querySelector(".protyle-background__tags") as HTMLElement;this.iconElement = this.element.querySelector(".protyle-background__icon") as HTMLElement;this.imgElement = this.element.firstElementChild.firstElementChild as HTMLImageElement;- this.imgElement.addEventListener("mousedown", (event: MouseEvent & { target: HTMLElement }) => {- event.preventDefault();- if (!this.element.firstElementChild.querySelector(".protyle-icons").classList.contains("fn__none")) {- return;- }- const y = event.clientY;- const documentSelf = document;- const height = this.imgElement.naturalHeight * this.imgElement.clientWidth / this.imgElement.naturalWidth - this.imgElement.clientHeight;- let originalPositionY = parseFloat(this.imgElement.style.objectPosition.substring(7)) || 50;- if (this.imgElement.style.objectPosition.endsWith("px")) {- originalPositionY = -parseInt(this.imgElement.style.objectPosition.substring(7)) / height * 100;- }- documentSelf.onmousemove = (moveEvent: MouseEvent) => {- this.imgElement.style.objectPosition = `center ${((y - moveEvent.clientY) / height * 100 + originalPositionY).toFixed(2)}%`;+ if (isMobile()) {+ this.imgElement.addEventListener("touchstart", (event: TouchEvent & { target: HTMLElement }) => {event.preventDefault();- };+ if (!this.element.firstElementChild.querySelector(".protyle-icons").classList.contains("fn__none")) {+ return;+ }+ const y = event.touches[0].clientY;+ const documentSelf = document;+ const height = this.imgElement.naturalHeight * this.imgElement.clientWidth / this.imgElement.naturalWidth - this.imgElement.clientHeight;+ let originalPositionY = parseFloat(this.imgElement.style.objectPosition.substring(7)) || 50;+ if (this.imgElement.style.objectPosition.endsWith("px")) {+ originalPositionY = -parseInt(this.imgElement.style.objectPosition.substring(7)) / height * 100;+ }+ documentSelf.ontouchmove = (moveEvent) => {+ this.imgElement.style.objectPosition = `center ${((y - moveEvent.touches[0].clientY) / height * 100 + originalPositionY).toFixed(2)}%`;+ event.preventDefault();+ };- documentSelf.onmouseup = () => {- documentSelf.onmousemove = null;- documentSelf.onmouseup = null;- documentSelf.ondragstart = null;- documentSelf.onselectstart = null;- documentSelf.onselect = null;- };- });+ documentSelf.ontouchend = () => {+ documentSelf.ontouchmove = null;+ documentSelf.ontouchstart = null;+ documentSelf.ondragstart = null;+ documentSelf.onselectstart = null;+ documentSelf.onselect = null;+ };+ });+ } else {+ this.imgElement.addEventListener("mousedown", (event: MouseEvent & { target: HTMLElement }) => {+ event.preventDefault();+ if (!this.element.firstElementChild.querySelector(".protyle-icons").classList.contains("fn__none")) {+ return;+ }+ const y = event.clientY;+ const documentSelf = document;+ const height = this.imgElement.naturalHeight * this.imgElement.clientWidth / this.imgElement.naturalWidth - this.imgElement.clientHeight;+ let originalPositionY = parseFloat(this.imgElement.style.objectPosition.substring(7)) || 50;+ if (this.imgElement.style.objectPosition.endsWith("px")) {+ originalPositionY = -parseInt(this.imgElement.style.objectPosition.substring(7)) / height * 100;+ }+ documentSelf.onmousemove = (moveEvent: MouseEvent) => {+ this.imgElement.style.objectPosition = `center ${((y - moveEvent.clientY) / height * 100 + originalPositionY).toFixed(2)}%`;+ event.preventDefault();+ };++ documentSelf.onmouseup = () => {+ documentSelf.onmousemove = null;+ documentSelf.onmouseup = null;+ documentSelf.ondragstart = null;+ documentSelf.onselectstart = null;+ documentSelf.onselect = null;+ };+ });+ }this.element.querySelector("input").addEventListener("change", (event: InputEvent & { target: HTMLInputElement }) => {if (event.target.files.length === 0) {return;