mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
This commit is contained in:
parent
5f37aaf460
commit
9c9e0a5722
1 changed files with 6 additions and 4 deletions
|
|
@ -229,7 +229,7 @@ export class Files extends Model {
|
||||||
if (event.detail === 1) {
|
if (event.detail === 1) {
|
||||||
needFocus = false;
|
needFocus = false;
|
||||||
clickTimeout = window.setTimeout(() => {
|
clickTimeout = window.setTimeout(() => {
|
||||||
this.setCurrent(target);
|
this.setCurrent(target, false);
|
||||||
if (target.getAttribute("data-type") === "navigation-file") {
|
if (target.getAttribute("data-type") === "navigation-file") {
|
||||||
if (window.siyuan.altIsPressed) {
|
if (window.siyuan.altIsPressed) {
|
||||||
openFileById({
|
openFileById({
|
||||||
|
|
@ -251,7 +251,7 @@ export class Files extends Model {
|
||||||
} else if (event.detail === 2) {
|
} else if (event.detail === 2) {
|
||||||
clearTimeout(clickTimeout);
|
clearTimeout(clickTimeout);
|
||||||
this.getLeaf(target, notebookId);
|
this.getLeaf(target, notebookId);
|
||||||
this.setCurrent(target);
|
this.setCurrent(target, false);
|
||||||
}
|
}
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
@ -764,7 +764,7 @@ export class Files extends Model {
|
||||||
this.setCurrent(this.element.querySelector(`ul[data-url="${data.box}"] li[data-path="${filePath}"]`));
|
this.setCurrent(this.element.querySelector(`ul[data-url="${data.box}"] li[data-path="${filePath}"]`));
|
||||||
}
|
}
|
||||||
|
|
||||||
private setCurrent(target: HTMLElement) {
|
private setCurrent(target: HTMLElement, isScroll = true) {
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -772,7 +772,9 @@ export class Files extends Model {
|
||||||
liItem.classList.remove("b3-list-item--focus");
|
liItem.classList.remove("b3-list-item--focus");
|
||||||
});
|
});
|
||||||
target.classList.add("b3-list-item--focus");
|
target.classList.add("b3-list-item--focus");
|
||||||
this.element.scrollTop = target.offsetTop - this.element.clientHeight / 2 - this.actionsElement.clientHeight;
|
if (isScroll) {
|
||||||
|
this.element.scrollTop = target.offsetTop - this.element.clientHeight / 2 - this.actionsElement.clientHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getLeaf(liElement: Element, notebookId: string) {
|
public getLeaf(liElement: Element, notebookId: string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue