mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 14:58:49 +01:00
This commit is contained in:
parent
0d03ebbffa
commit
d44dd0123a
1 changed files with 27 additions and 33 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
targetElement.parentElement.remove();
|
||||
} else {
|
||||
targetElement.remove();
|
||||
}
|
||||
|
||||
if (window.siyuan.mobileEditor && window.siyuan.mobileEditor.protyle.path === data.data.path) {
|
||||
setEmpty();
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
public onRename(data: { path: string, title: string, box: string }) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue