Skip to content

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

:iphone: https://github.com/siyuan-note/siyuan/issues/1359

Vanessad44dd0123ae6
diff --git a/app/src/mobile/util/MobileFiles.ts b/app/src/mobile/util/MobileFiles.ts
index c15b353633..d313513509 100644
--- a/app/src/mobile/util/MobileFiles.ts
+++ b/app/src/mobile/util/MobileFiles.ts
@@ -477,9 +477,9 @@ export class MobileFiles extends Model {
private onRemove(data: IWebSocketData) {
// "doc2heading" 后删除文件或挂载帮助文档前的 unmount
- const targetElement = this.element.querySelector(`ul[data-url="${data.data.box}"] li[data-path="${data.data.path || "/"}"]`);
if (data.cmd === "unmount") {
setNoteBook((notebooks) => {
+ const targetElement = this.element.querySelector(`ul[data-url="${data.data.box}"] li[data-path="${"/"}"]`);
if (targetElement) {
targetElement.parentElement.remove();
if (Constants.CB_MOUNT_REMOVE !== data.callback) {
@@ -493,45 +493,39 @@ export class MobileFiles extends Model {
}
}
});
- if (window.siyuan.mobileEditor) {
- fetchPost("/api/block/checkBlockExist", {id: window.siyuan.mobileEditor.protyle.block.rootID}, existResponse => {
- if (!existResponse.data) {
- setEmpty();
- }
- });
- }
if (Constants.CB_MOUNT_REMOVE === data.callback) {
const removeElement = this.closeElement.querySelector(`li[data-url="${data.data.box}"]`);
if (removeElement) {
removeElement.remove();
}
}
- } else if (targetElement) {
- // 子节点展开则删除
- if (targetElement.nextElementSibling?.tagName === "UL") {
- targetElement.nextElementSibling.remove();
- }
- // 移除当前节点
- const parentElement = targetElement.parentElement.previousElementSibling as HTMLElement;
- if (targetElement.parentElement.childElementCount === 1) {
- if (parentElement) {
- const iconElement = parentElement.querySelector("svg");
- iconElement.classList.remove("b3-list-item__arrow--open");
- iconElement.parentElement.classList.add("fn__hidden");
- const emojiElement = iconElement.parentElement.nextElementSibling;
- if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) {
- emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE);
+ return;
+ }
+ data.data.ids.forEach((item: string) => {
+ const targetElement = this.element.querySelector(`li.b3-list-item[data-node-id="${item}"]`);
+ if (targetElement) {
+ // 子节点展开则删除
+ if (targetElement.nextElementSibling?.tagName === "UL") {
+ targetElement.nextElementSibling.remove();
+ }
+ // 移除当前节点
+ const parentElement = targetElement.parentElement.previousElementSibling as HTMLElement;
+ if (targetElement.parentElement.childElementCount === 1) {
+ if (parentElement) {
+ const iconElement = parentElement.querySelector("svg");
+ iconElement.classList.remove("b3-list-item__arrow--open");
+ iconElement.parentElement.classList.add("fn__hidden");
+ const emojiElement = iconElement.parentElement.nextElementSibling;
+ if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) {
+ emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE);
+ }
}
+ targetElement.parentElement.remove();
+ } else {
+ targetElement.remove();
}
- targetElement.parentElement.remove();
- } else {
- targetElement.remove();
- }
-
- if (window.siyuan.mobileEditor && window.siyuan.mobileEditor.protyle.path === data.data.path) {
- setEmpty();
}
- }
+ })
}
public onRename(data: { path: string, title: string, box: string }) {