mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 19:41:05 +08:00
This commit is contained in:
parent
4ee2fa6c0f
commit
f65d0d1d0a
@ -191,7 +191,7 @@ export class Files extends Model {
|
|||||||
if (ulElement) {
|
if (ulElement) {
|
||||||
const notebookId = ulElement.getAttribute("data-url");
|
const notebookId = ulElement.getAttribute("data-url");
|
||||||
while (target && !target.isEqualNode(this.element)) {
|
while (target && !target.isEqualNode(this.element)) {
|
||||||
if (target.classList.contains("b3-list-item__icon") && window.siyuan.config.system.container !== "ios") {
|
if (!event.metaKey && !event.ctrlKey && target.classList.contains("b3-list-item__icon") && window.siyuan.config.system.container !== "ios") {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (target.parentElement.getAttribute("data-type") === "navigation-file") {
|
if (target.parentElement.getAttribute("data-type") === "navigation-file") {
|
||||||
@ -200,14 +200,14 @@ export class Files extends Model {
|
|||||||
openEmojiPanel(target.parentElement.parentElement.getAttribute("data-url"), target, true);
|
openEmojiPanel(target.parentElement.parentElement.getAttribute("data-url"), target, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-list-item__toggle")) {
|
} else if (!event.metaKey && !event.ctrlKey && target.classList.contains("b3-list-item__toggle")) {
|
||||||
this.getLeaf(target.parentElement, notebookId);
|
this.getLeaf(target.parentElement, notebookId);
|
||||||
this.setCurrent(target.parentElement);
|
this.setCurrent(target.parentElement);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-list-item__action")) {
|
} else if (!event.metaKey && !event.ctrlKey && target.classList.contains("b3-list-item__action")) {
|
||||||
const type = target.getAttribute("data-type");
|
const type = target.getAttribute("data-type");
|
||||||
const pathString = target.parentElement.getAttribute("data-path");
|
const pathString = target.parentElement.getAttribute("data-path");
|
||||||
if (!window.siyuan.config.readonly) {
|
if (!window.siyuan.config.readonly) {
|
||||||
@ -230,7 +230,7 @@ export class Files extends Model {
|
|||||||
if (event.detail === 1) {
|
if (event.detail === 1) {
|
||||||
needFocus = false;
|
needFocus = false;
|
||||||
clickTimeout = window.setTimeout(() => {
|
clickTimeout = window.setTimeout(() => {
|
||||||
if (!window.siyuan.ctrlIsPressed) {
|
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") {
|
||||||
if (window.siyuan.altIsPressed) {
|
if (window.siyuan.altIsPressed) {
|
||||||
@ -254,7 +254,7 @@ export class Files extends Model {
|
|||||||
target.classList.toggle("b3-list-item--focus");
|
target.classList.toggle("b3-list-item--focus");
|
||||||
}
|
}
|
||||||
}, Constants.TIMEOUT_DBLCLICK);
|
}, Constants.TIMEOUT_DBLCLICK);
|
||||||
} else if (event.detail === 2) {
|
} else if (!event.metaKey && !event.ctrlKey && event.detail === 2) {
|
||||||
clearTimeout(clickTimeout);
|
clearTimeout(clickTimeout);
|
||||||
this.getLeaf(target, notebookId);
|
this.getLeaf(target, notebookId);
|
||||||
this.setCurrent(target, false);
|
this.setCurrent(target, false);
|
||||||
|
@ -26,15 +26,16 @@ import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
|||||||
import {deleteFile, deleteFiles} from "../editor/deleteFile";
|
import {deleteFile, deleteFiles} from "../editor/deleteFile";
|
||||||
|
|
||||||
export const initNavigationMenu = (liElement: HTMLElement) => {
|
export const initNavigationMenu = (liElement: HTMLElement) => {
|
||||||
|
const fileElement = hasClosestByClassName(liElement, "sy__file")
|
||||||
|
if (!fileElement) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!liElement.classList.contains("b3-list-item--focus")) {
|
if (!liElement.classList.contains("b3-list-item--focus")) {
|
||||||
const fileElement = hasClosestByClassName(liElement, "sy__file")
|
fileElement.querySelectorAll(".b3-list-item--focus").forEach(item => {
|
||||||
if (fileElement) {
|
item.classList.remove("b3-list-item--focus");
|
||||||
fileElement.querySelectorAll(".b3-list-item--focus").forEach(item => {
|
item.removeAttribute("select-end")
|
||||||
item.classList.remove("b3-list-item--focus");
|
item.removeAttribute("select-start")
|
||||||
item.removeAttribute("select-end")
|
})
|
||||||
item.removeAttribute("select-start")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
liElement.classList.add("b3-list-item--focus");
|
liElement.classList.add("b3-list-item--focus");
|
||||||
}
|
}
|
||||||
const notebookId = liElement.parentElement.getAttribute("data-url");
|
const notebookId = liElement.parentElement.getAttribute("data-url");
|
||||||
@ -92,13 +93,7 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
|||||||
label: window.siyuan.languages.delete,
|
label: window.siyuan.languages.delete,
|
||||||
accelerator: "⌦",
|
accelerator: "⌦",
|
||||||
click: () => {
|
click: () => {
|
||||||
confirmDialog(window.siyuan.languages.deleteOpConfirm,
|
deleteFiles(Array.from(fileElement.querySelectorAll(".b3-list-item--focus")))
|
||||||
`${window.siyuan.languages.confirmDelete} <b>${Lute.EscapeHTMLStr(name)}</b>?`, () => {
|
|
||||||
fetchPost("/api/notebook/removeNotebook", {
|
|
||||||
notebook: notebookId,
|
|
||||||
callback: Constants.CB_MOUNT_REMOVE
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user