mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 00:35:50 +01:00
fix import
This commit is contained in:
@@ -132,7 +132,7 @@ function getSomePath(note, path = []) {
|
||||
}
|
||||
|
||||
function getSomePathInner(note, path, respectHoistng) {
|
||||
if (note.noteId === 'root') {
|
||||
if (note.isRoot()) {
|
||||
path.push(note.noteId);
|
||||
path.reverse();
|
||||
|
||||
@@ -174,7 +174,7 @@ function getNotePath(noteId) {
|
||||
|
||||
let branchId;
|
||||
|
||||
if (note.noteId === 'root') {
|
||||
if (note.isRoot()) {
|
||||
branchId = 'root';
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -252,6 +252,10 @@ class NoteShort {
|
||||
return noteAttributeCache.attributes[this.noteId];
|
||||
}
|
||||
|
||||
isRoot() {
|
||||
return this.noted
|
||||
}
|
||||
|
||||
getAllNotePaths(encounteredNoteIds = null) {
|
||||
if (this.noteId === 'root') {
|
||||
return [['root']];
|
||||
|
||||
@@ -304,9 +304,15 @@ export default class TabManager extends Component {
|
||||
await this.triggerEvent('beforeTabRemove', { ntxIds: ntxIdsToRemove });
|
||||
|
||||
if (!noteContextToRemove.isMainContext()) {
|
||||
await this.activateNoteContext(noteContextToRemove.getMainContext().ntxId);
|
||||
const ntxId1 = noteContextToRemove.getMainContext().ntxId;
|
||||
|
||||
console.log(`Isn't main context, will try to activate ${ntxId1}`);
|
||||
|
||||
await this.activateNoteContext(ntxId1);
|
||||
}
|
||||
else if (this.mainNoteContexts.length <= 1) {
|
||||
console.log("No main context remaining, opening new one");
|
||||
|
||||
await this.openAndActivateEmptyTab();
|
||||
}
|
||||
else if (ntxIdsToRemove.includes(this.activeNtxId)) {
|
||||
@@ -358,16 +364,20 @@ export default class TabManager extends Component {
|
||||
|
||||
async activateNextTabCommand() {
|
||||
const oldIdx = this.mainNoteContexts.findIndex(nc => nc.ntxId === this.activeNtxId);
|
||||
const newActiveTabId = this.mainNoteContexts[oldIdx === this.noteContexts.length - 1 ? 0 : oldIdx + 1].ntxId;
|
||||
const newActiveNtxId = this.mainNoteContexts[oldIdx === this.noteContexts.length - 1 ? 0 : oldIdx + 1].ntxId;
|
||||
|
||||
await this.activateNoteContext(newActiveTabId);
|
||||
console.log(`Activating next one ${newActiveNtxId}`);
|
||||
|
||||
await this.activateNoteContext(newActiveNtxId);
|
||||
}
|
||||
|
||||
async activatePreviousTabCommand() {
|
||||
const oldIdx = this.mainNoteContexts.findIndex(nc => nc.ntxId === this.activeNtxId);
|
||||
const newActiveTabId = this.mainNoteContexts[oldIdx === 0 ? this.noteContexts.length - 1 : oldIdx - 1].ntxId;
|
||||
const newActiveNtxId = this.mainNoteContexts[oldIdx === 0 ? this.noteContexts.length - 1 : oldIdx - 1].ntxId;
|
||||
|
||||
await this.activateNoteContext(newActiveTabId);
|
||||
console.log(`Activating previous one ${newActiveNtxId}`);
|
||||
|
||||
await this.activateNoteContext(newActiveNtxId);
|
||||
}
|
||||
|
||||
async closeActiveTabCommand() {
|
||||
|
||||
@@ -6,6 +6,7 @@ const zipImportService = require('../../services/import/zip');
|
||||
const singleImportService = require('../../services/import/single');
|
||||
const cls = require('../../services/cls');
|
||||
const path = require('path');
|
||||
const becca = require('../../becca/becca');
|
||||
const beccaLoader = require('../../becca/becca_loader');
|
||||
const log = require('../../services/log');
|
||||
const TaskContext = require('../../services/task_context');
|
||||
@@ -81,7 +82,7 @@ async function importToBranch(req) {
|
||||
|
||||
beccaLoader.load();
|
||||
|
||||
return note;
|
||||
return note.getPojo();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user