mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 08:15:52 +01:00
refactored TabContext => NoteContext
This commit is contained in:
@@ -74,8 +74,8 @@ export default class Entrypoints extends Component {
|
||||
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
const hoistedNoteId = appContext.tabManager.getActiveTabContext()
|
||||
? appContext.tabManager.getActiveTabContext().hoistedNoteId
|
||||
const hoistedNoteId = appContext.tabManager.getActiveNoteContext()
|
||||
? appContext.tabManager.getActiveNoteContext().hoistedNoteId
|
||||
: 'root';
|
||||
|
||||
await appContext.tabManager.openTabWithNote(note.noteId, true, null, hoistedNoteId);
|
||||
@@ -84,29 +84,29 @@ export default class Entrypoints extends Component {
|
||||
}
|
||||
|
||||
async toggleNoteHoistingCommand() {
|
||||
const tabContext = appContext.tabManager.getActiveTabContext();
|
||||
const noteContext = appContext.tabManager.getActiveNoteContext();
|
||||
|
||||
if (tabContext.note.noteId === tabContext.hoistedNoteId) {
|
||||
await tabContext.unhoist();
|
||||
if (noteContext.note.noteId === noteContext.hoistedNoteId) {
|
||||
await noteContext.unhoist();
|
||||
}
|
||||
else if (tabContext.note.type !== 'search') {
|
||||
await tabContext.setHoistedNoteId(tabContext.note.noteId);
|
||||
else if (noteContext.note.type !== 'search') {
|
||||
await noteContext.setHoistedNoteId(noteContext.note.noteId);
|
||||
}
|
||||
}
|
||||
|
||||
async hoistNoteCommand({noteId}) {
|
||||
const tabContext = appContext.tabManager.getActiveTabContext();
|
||||
const noteContext = appContext.tabManager.getActiveNoteContext();
|
||||
|
||||
if (tabContext.hoistedNoteId !== noteId) {
|
||||
await tabContext.setHoistedNoteId(noteId);
|
||||
if (noteContext.hoistedNoteId !== noteId) {
|
||||
await noteContext.setHoistedNoteId(noteId);
|
||||
}
|
||||
}
|
||||
|
||||
async unhoistCommand() {
|
||||
const activeTabContext = appContext.tabManager.getActiveTabContext();
|
||||
const activeNoteContext = appContext.tabManager.getActiveNoteContext();
|
||||
|
||||
if (activeTabContext) {
|
||||
activeTabContext.unhoist();
|
||||
if (activeNoteContext) {
|
||||
activeNoteContext.unhoist();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,8 +194,8 @@ export default class Entrypoints extends Component {
|
||||
}
|
||||
|
||||
async runActiveNoteCommand() {
|
||||
const tabContext = appContext.tabManager.getActiveTabContext();
|
||||
const note = tabContext.note;
|
||||
const noteContext = appContext.tabManager.getActiveNoteContext();
|
||||
const note = noteContext.note;
|
||||
|
||||
// ctrl+enter is also used elsewhere so make sure we're running only when appropriate
|
||||
if (!note || note.type !== 'code') {
|
||||
@@ -210,7 +210,7 @@ export default class Entrypoints extends Component {
|
||||
} else if (note.mime === 'text/x-sqlite;schema=trilium') {
|
||||
const result = await server.post("sql/execute/" + note.noteId);
|
||||
|
||||
this.triggerEvent('sqlQueryResults', {tabId: tabContext.tabId, results: result.results});
|
||||
this.triggerEvent('sqlQueryResults', {ntxId: noteContext.ntxId, results: result.results});
|
||||
}
|
||||
|
||||
toastService.showMessage("Note executed");
|
||||
|
||||
Reference in New Issue
Block a user