mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 14:25:51 +01:00
launchbar WIP
This commit is contained in:
32
src/public/app/menus/link_context_menu.js
Normal file
32
src/public/app/menus/link_context_menu.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import contextMenu from "./context_menu.js";
|
||||
import appContext from "../services/app_context.js";
|
||||
|
||||
function openContextMenu(notePath, e) {
|
||||
contextMenu.show({
|
||||
x: e.pageX,
|
||||
y: e.pageY,
|
||||
items: [
|
||||
{title: "Open note in a new tab", command: "openNoteInNewTab", uiIcon: "bx bx-empty"},
|
||||
{title: "Open note in a new split", command: "openNoteInNewSplit", uiIcon: "bx bx-dock-right"},
|
||||
{title: "Open note in a new window", command: "openNoteInNewWindow", uiIcon: "bx bx-window-open"}
|
||||
],
|
||||
selectMenuItemHandler: ({command}) => {
|
||||
if (command === 'openNoteInNewTab') {
|
||||
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
||||
}
|
||||
else if (command === 'openNoteInNewSplit') {
|
||||
const subContexts = appContext.tabManager.getActiveContext().getSubContexts();
|
||||
const {ntxId} = subContexts[subContexts.length - 1];
|
||||
|
||||
appContext.triggerCommand("openNewNoteSplit", {ntxId, notePath});
|
||||
}
|
||||
else if (command === 'openNoteInNewWindow') {
|
||||
appContext.triggerCommand('openInWindow', {notePath, hoistedNoteId: 'root'});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
openContextMenu
|
||||
}
|
||||
Reference in New Issue
Block a user