mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🎨 重建索引时清空 scroll
This commit is contained in:
parent
32413fa11c
commit
f3b0ee51d5
3 changed files with 15 additions and 3 deletions
|
|
@ -278,11 +278,21 @@ export const transactionError = () => {
|
||||||
/// #endif
|
/// #endif
|
||||||
});
|
});
|
||||||
btnsElement[1].addEventListener("click", () => {
|
btnsElement[1].addEventListener("click", () => {
|
||||||
fetchPost("/api/filetree/refreshFiletree", {});
|
refreshFileTree();
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const refreshFileTree = (cb?:() => void) => {
|
||||||
|
window.siyuan.storage[Constants.LOCAL_FILEPOSITION] = {};
|
||||||
|
setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]);
|
||||||
|
fetchPost("/api/filetree/refreshFiletree", {}, () => {
|
||||||
|
if (cb) {
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let statusTimeout: number;
|
let statusTimeout: number;
|
||||||
export const progressStatus = (data: IWebSocketData) => {
|
export const progressStatus = (data: IWebSocketData) => {
|
||||||
const statusElement = document.querySelector("#status") as HTMLElement;
|
const statusElement = document.querySelector("#status") as HTMLElement;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import {openFileById} from "../../editor/util";
|
||||||
import {hasClosestByAttribute, hasClosestByTag, hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
import {hasClosestByAttribute, hasClosestByTag, hasTopClosestByTag} from "../../protyle/util/hasClosest";
|
||||||
import {isTouchDevice} from "../../util/functions";
|
import {isTouchDevice} from "../../util/functions";
|
||||||
import {App} from "../../index";
|
import {App} from "../../index";
|
||||||
|
import {refreshFileTree} from "../../dialog/processSystem";
|
||||||
|
|
||||||
export class Files extends Model {
|
export class Files extends Model {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
|
@ -1074,7 +1075,7 @@ aria-label="${escapeHtml(ariaLabel)}">${getDisplayName(item.name, true, true)}</
|
||||||
click: () => {
|
click: () => {
|
||||||
if (!this.element.getAttribute("disabled")) {
|
if (!this.element.getAttribute("disabled")) {
|
||||||
this.element.setAttribute("disabled", "disabled");
|
this.element.setAttribute("disabled", "disabled");
|
||||||
fetchPost("/api/filetree/refreshFiletree", {}, () => {
|
refreshFileTree(() => {
|
||||||
this.element.removeAttribute("disabled");
|
this.element.removeAttribute("disabled");
|
||||||
this.init(false);
|
this.init(false);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import {confirmDialog} from "../../dialog/confirmDialog";
|
||||||
import {newFile} from "../../util/newFile";
|
import {newFile} from "../../util/newFile";
|
||||||
import {MenuItem} from "../../menus/Menu";
|
import {MenuItem} from "../../menus/Menu";
|
||||||
import {App} from "../../index";
|
import {App} from "../../index";
|
||||||
|
import {refreshFileTree} from "../../dialog/processSystem";
|
||||||
|
|
||||||
export class MobileFiles extends Model {
|
export class MobileFiles extends Model {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
|
@ -113,7 +114,7 @@ export class MobileFiles extends Model {
|
||||||
Array.from(this.element.children).forEach(item => {
|
Array.from(this.element.children).forEach(item => {
|
||||||
notebooks.push(item.getAttribute("data-url"));
|
notebooks.push(item.getAttribute("data-url"));
|
||||||
});
|
});
|
||||||
fetchPost("/api/filetree/refreshFiletree", {}, () => {
|
refreshFileTree(() => {
|
||||||
target.removeAttribute("disabled");
|
target.removeAttribute("disabled");
|
||||||
this.init(false);
|
this.init(false);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue