From bd426f9eb4a646d37f4af4a1a39b52f41b5b382b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 27 May 2024 22:06:35 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/11127 --- app/src/block/Panel.ts | 11 ++++++++++- app/src/protyle/header/openTitleMenu.ts | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.ts index b3393ea0f..39b2029ab 100644 --- a/app/src/block/Panel.ts +++ b/app/src/block/Panel.ts @@ -15,6 +15,7 @@ import {showMessage} from "../dialog/message"; import {App} from "../index"; import {isMobile} from "../util/functions"; import {resize} from "../protyle/util/resize"; +import {openFileById} from "../editor/util"; export class BlockPanel { public element: HTMLElement; @@ -118,6 +119,12 @@ export class BlockPanel { /// #if !BROWSER openNewWindowById(this.nodeIds[0]); /// #endif + } else if (type === "stickTab") { + openFileById({ + app: options.app, + id: this.nodeIds[0], + action: this.editors[0].protyle.block.rootID !== this.nodeIds[0] ? [Constants.CB_GET_ALL] : [Constants.CB_GET_CONTEXT], + }); } event.preventDefault(); event.stopPropagation(); @@ -231,7 +238,9 @@ export class BlockPanel { let openHTML = ""; /// #if !BROWSER if (this.nodeIds.length === 1) { - openHTML = ` + openHTML = ` + + `; } /// #endif diff --git a/app/src/protyle/header/openTitleMenu.ts b/app/src/protyle/header/openTitleMenu.ts index 1dd674bd5..0af807957 100644 --- a/app/src/protyle/header/openTitleMenu.ts +++ b/app/src/protyle/header/openTitleMenu.ts @@ -22,6 +22,7 @@ import {openNewWindowById} from "../../window/openNewWindow"; import {genImportMenu} from "../../menus/navigation"; import {transferBlockRef} from "../../menus/block"; import {addEditorToDatabase} from "../render/av/addToDatabase"; +import {openFileById} from "../../editor/util"; export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { hideTooltip(); @@ -195,6 +196,21 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { transferBlockRef(protyle.block.rootID); } window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element); + /// #if !MOBILE + if (!protyle.model) { + window.siyuan.menus.menu.append(new MenuItem({ + label: window.siyuan.languages.openInNewTab, + icon: "iconLayoutRight", + click() { + openFileById({ + app: protyle.app, + id: protyle.block.id, + action: protyle.block.rootID !== protyle.block.id ? [Constants.CB_GET_ALL] : [Constants.CB_GET_CONTEXT], + }); + } + }).element); + } + /// #endif /// #if !BROWSER window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.openByNewWindow,