mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
This commit is contained in:
parent
68cf4c601f
commit
5e67cc22a3
6 changed files with 5 additions and 13 deletions
|
|
@ -236,8 +236,6 @@ export abstract class Constants {
|
|||
public static readonly MENU_BLOCK_SINGLE = "block-single"; // 单选块菜单
|
||||
public static readonly MENU_BLOCK_MULTI = "block-multi"; // 多选块菜单
|
||||
public static readonly MENU_TITLE = "titleMenu"; // 文档块菜单
|
||||
public static readonly MENU_TITLE_PROTYLE = "title-protyle"; // 在 Protyle 触发的文档块菜单
|
||||
public static readonly MENU_TITLE_BREADCRUMB = "title-breadcrumb"; // 在面包屑触发的文档块菜单
|
||||
public static readonly MENU_BREADCRUMB_MORE = "breadcrumbMore"; // 面包屑更多菜单
|
||||
public static readonly MENU_BREADCRUMB_MOBILE_PATH = "breadcrumb-mobile-path"; // 移动端面包屑菜单
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ export class Menu {
|
|||
this.element.classList.remove("b3-menu--list", "b3-menu--fullscreen");
|
||||
this.element.removeAttribute("style"); // zIndex
|
||||
this.element.removeAttribute("data-name"); // 标识再次点击不消失
|
||||
this.element.removeAttribute("data-subname");
|
||||
this.element.removeAttribute("data-from"); // 标识是否在浮窗内打开
|
||||
this.data = undefined; // 移除数据
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import {openByMobile} from "../protyle/util/compatibility";
|
|||
import {addFilesToDatabase} from "../protyle/render/av/addToDatabase";
|
||||
|
||||
const initMultiMenu = (selectItemElements: NodeListOf<Element>, app: App) => {
|
||||
window.siyuan.menus.menu.element.setAttribute("data-subname", Constants.MENU_DOC_TREE_MORE_DOCS);
|
||||
const fileItemElement = Array.from(selectItemElements).find(item => {
|
||||
if (item.getAttribute("data-type") === "navigation-file") {
|
||||
return true;
|
||||
|
|
@ -204,8 +203,6 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => {
|
|||
const selectItemElements = fileElement.querySelectorAll(".b3-list-item--focus");
|
||||
if (selectItemElements.length > 1) {
|
||||
return initMultiMenu(selectItemElements, app);
|
||||
} else {
|
||||
window.siyuan.menus.menu.element.setAttribute("data-subname", Constants.MENU_DOC_TREE_MORE_NOTEBOOK);
|
||||
}
|
||||
const notebookId = liElement.parentElement.getAttribute("data-url");
|
||||
const name = getNotebookName(notebookId);
|
||||
|
|
@ -711,7 +708,6 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
|
|||
separatorPosition: "top",
|
||||
});
|
||||
}
|
||||
window.siyuan.menus.menu.element.setAttribute("data-subname", Constants.MENU_DOC_TREE_MORE_DOC);
|
||||
return window.siyuan.menus.menu;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ ${padHTML}
|
|||
});
|
||||
} else {
|
||||
const targetRect = target.getBoundingClientRect();
|
||||
openTitleMenu(protyle, {x: targetRect.right, y: targetRect.bottom, isLeft: true}, Constants.MENU_TITLE_BREADCRUMB);
|
||||
openTitleMenu(protyle, {x: targetRect.right, y: targetRect.bottom, isLeft: true});
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -194,15 +194,15 @@ export class Title {
|
|||
});
|
||||
} else {
|
||||
const iconRect = iconElement.getBoundingClientRect();
|
||||
openTitleMenu(protyle, {x: iconRect.left, y: iconRect.bottom}, Constants.MENU_TITLE_PROTYLE);
|
||||
openTitleMenu(protyle, {x: iconRect.left, y: iconRect.bottom});
|
||||
}
|
||||
});
|
||||
this.element.addEventListener("contextmenu", (event) => {
|
||||
if (event.shiftKey) {
|
||||
return;
|
||||
}
|
||||
if (iconElement.contains((event.target as HTMLElement))) {
|
||||
openTitleMenu(protyle, {x: event.clientX, y: event.clientY}, Constants.MENU_TITLE_PROTYLE);
|
||||
if (getSelection().rangeCount === 0 || iconElement.contains((event.target as HTMLElement))) {
|
||||
openTitleMenu(protyle, {x: event.clientX, y: event.clientY});
|
||||
return;
|
||||
}
|
||||
protyle.toolbar?.element.classList.add("fn__none");
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import {addEditorToDatabase} from "../render/av/addToDatabase";
|
|||
import {openFileById} from "../../editor/util";
|
||||
import {hasTopClosestByClassName} from "../util/hasClosest";
|
||||
|
||||
export const openTitleMenu = (protyle: IProtyle, position: IPosition, subname: string) => {
|
||||
export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
|
||||
hideTooltip();
|
||||
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
|
||||
window.siyuan.menus.menu.element.getAttribute("data-name") === Constants.MENU_TITLE) {
|
||||
|
|
@ -38,7 +38,6 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition, subname: s
|
|||
}, (response) => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
window.siyuan.menus.menu.element.setAttribute("data-name", Constants.MENU_TITLE);
|
||||
window.siyuan.menus.menu.element.setAttribute("data-subname", subname);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
id: "copy",
|
||||
label: window.siyuan.languages.copy,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue