Skip to content

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

:iphone: repeat bind event

Vanessa90a4270debc5
diff --git a/app/src/config/repos.ts b/app/src/config/repos.ts
index 26ae55ae56..452c3ff444 100644
--- a/app/src/config/repos.ts
+++ b/app/src/config/repos.ts
@@ -248,7 +248,8 @@ const bindProviderEvent = () => {
export const repos = {
element: undefined as Element,
genHTML: () => {
- return `<div><div style="position: fixed;width: 800px;height: 434px;box-sizing: border-box;text-align: center;display: flex;align-items: center;justify-content: center;z-index: 1;" id="reposLoading">
+ return `<div>
+<div style="position: fixed;width: 800px;height: 434px;box-sizing: border-box;text-align: center;display: flex;align-items: center;justify-content: center;z-index: 1;" id="reposLoading">
<img src="/stage/loading-pure.svg">
</div>
<label class="fn__flex b3-label config__item">
@@ -371,7 +372,7 @@ export const repos = {
loadingElement.style.width = repos.element.clientWidth + "px";
loadingElement.style.height = repos.element.clientHeight + "px";
bindSyncCloudListEvent(syncConfigElement);
- repos.element.addEventListener("click", (event) => {
+ repos.element.firstElementChild.addEventListener("click", (event) => {
const target = event.target as HTMLElement;
if (target.getAttribute("data-type") === "config") {
if (syncConfigElement.classList.contains("fn__none")) {
diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts
index eda2742d28..61df9e53d5 100644
--- a/app/src/mobile/editor.ts
+++ b/app/src/mobile/editor.ts
@@ -13,6 +13,7 @@ import {hideElements} from "../protyle/ui/hideElements";
import {pushBack} from "./util/MobileBackFoward";
import {setStorageVal} from "../protyle/util/compatibility";
import {showMessage} from "../dialog/message";
+import {saveScroll} from "../protyle/scroll/saveScroll";
export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) => {
window.siyuan.storage[Constants.LOCAL_DOCINFO] = {id, action};
@@ -44,6 +45,7 @@ export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) =
return;
}
if (window.siyuan.mobile.editor) {
+ saveScroll(window.siyuan.mobile.editor.protyle);
pushBack();
addLoading(window.siyuan.mobile.editor.protyle);
fetchPost("/api/filetree/getDoc", {
diff --git a/app/src/mobile/menu/getRecentDocs.ts b/app/src/mobile/menu/getRecentDocs.ts
index 33a6a9d422..4dced0f702 100644
--- a/app/src/mobile/menu/getRecentDocs.ts
+++ b/app/src/mobile/menu/getRecentDocs.ts
@@ -20,7 +20,7 @@ ${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, false, "b3-list-item__
icon: "iconList",
html: `<ul class="b3-list b3-list--mobile">${html}</ul>`,
bindEvent(element: HTMLElement) {
- element.addEventListener("click", (event) => {
+ element.firstElementChild.addEventListener("click", (event) => {
const liElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item");
if (liElement) {
openMobileFileById(liElement.dataset.nodeId, [Constants.CB_GET_SCROLL])
diff --git a/app/src/mobile/settings/about.ts b/app/src/mobile/settings/about.ts
index d9460126c5..fd21246062 100644
--- a/app/src/mobile/settings/about.ts
+++ b/app/src/mobile/settings/about.ts
@@ -18,7 +18,8 @@ export const initAbout = () => {
openModel({
title: window.siyuan.languages.about,
icon: "iconInfo",
- html: `<div class="b3-label fn__flex${window.siyuan.config.readonly ? " fn__none" : ""}">
+ html: `<div>
+<div class="b3-label fn__flex${window.siyuan.config.readonly ? " fn__none" : ""}">
<div class="fn__flex-1">
${window.siyuan.languages.about11}
<div class="b3-label__text">${window.siyuan.languages.about12}</div>
@@ -131,12 +132,13 @@ export const initAbout = () => {
</div>
<div style="color:var(--b3-theme-surface);font-family: cursive;">会泽百家&nbsp;至公天下</div>
${window.siyuan.languages.about1}
+</div>
</div>`,
bindEvent(modelMainElement: HTMLElement) {
const workspaceDirElement = modelMainElement.querySelector("#workspaceDir");
genWorkspace(workspaceDirElement);
const importKeyElement = modelMainElement.querySelector("#importKey");
- modelMainElement.addEventListener("click", (event) => {
+ modelMainElement.firstElementChild.addEventListener("click", (event) => {
let target = event.target as HTMLElement;
while (target && !target.isSameNode(modelMainElement)) {
if (target.id === "authCode") {
diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts
index ae3c71798a..5ea7b67866 100644
--- a/app/src/protyle/breadcrumb/index.ts
+++ b/app/src/protyle/breadcrumb/index.ts
@@ -25,6 +25,7 @@ import {onGet} from "../util/onGet";
import {saveScroll} from "../scroll/saveScroll";
import {hideElements} from "../ui/hideElements";
import {confirmDialog} from "../../dialog/confirmDialog";
+import {reloadProtyle} from "../util/reload";
export class Breadcrumb {
public element: HTMLElement;
@@ -314,13 +315,7 @@ export class Breadcrumb {
accelerator: window.siyuan.config.keymap.editor.general.refresh.custom,
label: window.siyuan.languages.refresh,
click: () => {
- fetchPost("/api/filetree/getDoc", {
- id: protyle.block.showAll ? protyle.block.id : protyle.block.rootID,
- mode: 0,
- size: protyle.block.showAll ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,
- }, getResponse => {
- onGet(getResponse, protyle, protyle.block.showAll ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS], saveScroll(protyle, true), true);
- });
+ reloadProtyle(protyle);
}
}).element);
if (!isMobile()) {