Skip to content

Commit 5e67cc2

Browse files
committed
♻️ #16141
1 parent 68cf4c6 commit 5e67cc2

File tree

6 files changed

+5
-13
lines changed

6 files changed

+5
-13
lines changed

app/src/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ export abstract class Constants {
236236
public static readonly MENU_BLOCK_SINGLE = "block-single"; // 单选块菜单
237237
public static readonly MENU_BLOCK_MULTI = "block-multi"; // 多选块菜单
238238
public static readonly MENU_TITLE = "titleMenu"; // 文档块菜单
239-
public static readonly MENU_TITLE_PROTYLE = "title-protyle"; // 在 Protyle 触发的文档块菜单
240-
public static readonly MENU_TITLE_BREADCRUMB = "title-breadcrumb"; // 在面包屑触发的文档块菜单
241239
public static readonly MENU_BREADCRUMB_MORE = "breadcrumbMore"; // 面包屑更多菜单
242240
public static readonly MENU_BREADCRUMB_MOBILE_PATH = "breadcrumb-mobile-path"; // 移动端面包屑菜单
243241

app/src/menus/Menu.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ export class Menu {
120120
this.element.classList.remove("b3-menu--list", "b3-menu--fullscreen");
121121
this.element.removeAttribute("style"); // zIndex
122122
this.element.removeAttribute("data-name"); // 标识再次点击不消失
123-
this.element.removeAttribute("data-subname");
124123
this.element.removeAttribute("data-from"); // 标识是否在浮窗内打开
125124
this.data = undefined; // 移除数据
126125
}

app/src/menus/navigation.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {openByMobile} from "../protyle/util/compatibility";
3232
import {addFilesToDatabase} from "../protyle/render/av/addToDatabase";
3333

3434
const initMultiMenu = (selectItemElements: NodeListOf<Element>, app: App) => {
35-
window.siyuan.menus.menu.element.setAttribute("data-subname", Constants.MENU_DOC_TREE_MORE_DOCS);
3635
const fileItemElement = Array.from(selectItemElements).find(item => {
3736
if (item.getAttribute("data-type") === "navigation-file") {
3837
return true;
@@ -204,8 +203,6 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => {
204203
const selectItemElements = fileElement.querySelectorAll(".b3-list-item--focus");
205204
if (selectItemElements.length > 1) {
206205
return initMultiMenu(selectItemElements, app);
207-
} else {
208-
window.siyuan.menus.menu.element.setAttribute("data-subname", Constants.MENU_DOC_TREE_MORE_NOTEBOOK);
209206
}
210207
const notebookId = liElement.parentElement.getAttribute("data-url");
211208
const name = getNotebookName(notebookId);
@@ -711,7 +708,6 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
711708
separatorPosition: "top",
712709
});
713710
}
714-
window.siyuan.menus.menu.element.setAttribute("data-subname", Constants.MENU_DOC_TREE_MORE_DOC);
715711
return window.siyuan.menus.menu;
716712
};
717713

app/src/protyle/breadcrumb/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ ${padHTML}
9797
});
9898
} else {
9999
const targetRect = target.getBoundingClientRect();
100-
openTitleMenu(protyle, {x: targetRect.right, y: targetRect.bottom, isLeft: true}, Constants.MENU_TITLE_BREADCRUMB);
100+
openTitleMenu(protyle, {x: targetRect.right, y: targetRect.bottom, isLeft: true});
101101
}
102102
event.stopPropagation();
103103
event.preventDefault();

app/src/protyle/header/Title.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ export class Title {
194194
});
195195
} else {
196196
const iconRect = iconElement.getBoundingClientRect();
197-
openTitleMenu(protyle, {x: iconRect.left, y: iconRect.bottom}, Constants.MENU_TITLE_PROTYLE);
197+
openTitleMenu(protyle, {x: iconRect.left, y: iconRect.bottom});
198198
}
199199
});
200200
this.element.addEventListener("contextmenu", (event) => {
201201
if (event.shiftKey) {
202202
return;
203203
}
204-
if (iconElement.contains((event.target as HTMLElement))) {
205-
openTitleMenu(protyle, {x: event.clientX, y: event.clientY}, Constants.MENU_TITLE_PROTYLE);
204+
if (getSelection().rangeCount === 0 || iconElement.contains((event.target as HTMLElement))) {
205+
openTitleMenu(protyle, {x: event.clientX, y: event.clientY});
206206
return;
207207
}
208208
protyle.toolbar?.element.classList.add("fn__none");

app/src/protyle/header/openTitleMenu.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {addEditorToDatabase} from "../render/av/addToDatabase";
2626
import {openFileById} from "../../editor/util";
2727
import {hasTopClosestByClassName} from "../util/hasClosest";
2828

29-
export const openTitleMenu = (protyle: IProtyle, position: IPosition, subname: string) => {
29+
export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {
3030
hideTooltip();
3131
if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
3232
window.siyuan.menus.menu.element.getAttribute("data-name") === Constants.MENU_TITLE) {
@@ -38,7 +38,6 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition, subname: s
3838
}, (response) => {
3939
window.siyuan.menus.menu.remove();
4040
window.siyuan.menus.menu.element.setAttribute("data-name", Constants.MENU_TITLE);
41-
window.siyuan.menus.menu.element.setAttribute("data-subname", subname);
4241
window.siyuan.menus.menu.append(new MenuItem({
4342
id: "copy",
4443
label: window.siyuan.languages.copy,

0 commit comments

Comments
 (0)