mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
This commit is contained in:
parent
019291bd08
commit
8908149a27
1 changed files with 26 additions and 31 deletions
|
|
@ -183,8 +183,11 @@ export class Files extends Model {
|
||||||
}
|
}
|
||||||
setPanelFocus(this.element.parentElement);
|
setPanelFocus(this.element.parentElement);
|
||||||
});
|
});
|
||||||
let clickTimeout: number;
|
|
||||||
this.element.addEventListener("click", (event) => {
|
this.element.addEventListener("click", (event) => {
|
||||||
|
if (event.detail !== 1) {
|
||||||
|
setPanelFocus(this.element.parentElement);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let target = event.target as HTMLElement;
|
let target = event.target as HTMLElement;
|
||||||
const ulElement = hasTopClosestByTag(target, "UL");
|
const ulElement = hasTopClosestByTag(target, "UL");
|
||||||
let needFocus = true;
|
let needFocus = true;
|
||||||
|
|
@ -227,9 +230,7 @@ export class Files extends Model {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
} else if (target.tagName === "LI") {
|
} else if (target.tagName === "LI") {
|
||||||
if (event.detail === 1) {
|
|
||||||
needFocus = false;
|
needFocus = false;
|
||||||
clickTimeout = window.setTimeout(() => {
|
|
||||||
if (!event.metaKey && !event.ctrlKey) {
|
if (!event.metaKey && !event.ctrlKey) {
|
||||||
this.setCurrent(target, false);
|
this.setCurrent(target, false);
|
||||||
if (target.getAttribute("data-type") === "navigation-file") {
|
if (target.getAttribute("data-type") === "navigation-file") {
|
||||||
|
|
@ -253,12 +254,6 @@ export class Files extends Model {
|
||||||
setPanelFocus(this.element.parentElement);
|
setPanelFocus(this.element.parentElement);
|
||||||
target.classList.toggle("b3-list-item--focus");
|
target.classList.toggle("b3-list-item--focus");
|
||||||
}
|
}
|
||||||
}, Constants.TIMEOUT_DBLCLICK);
|
|
||||||
} else if (!event.metaKey && !event.ctrlKey && event.detail === 2) {
|
|
||||||
clearTimeout(clickTimeout);
|
|
||||||
this.getLeaf(target, notebookId);
|
|
||||||
this.setCurrent(target, false);
|
|
||||||
}
|
|
||||||
this.element.querySelector('[select-end="true"]')?.removeAttribute("select-end");
|
this.element.querySelector('[select-end="true"]')?.removeAttribute("select-end");
|
||||||
this.element.querySelector('[select-start="true"]')?.removeAttribute("select-start");
|
this.element.querySelector('[select-start="true"]')?.removeAttribute("select-start");
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue