mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fixes in setting/opening tabs
This commit is contained in:
parent
280955b3a2
commit
6295a1825d
@ -66,16 +66,16 @@ export default class Entrypoints extends Component {
|
|||||||
async createNoteIntoDayNoteCommand() {
|
async createNoteIntoDayNoteCommand() {
|
||||||
const todayNote = await dateNoteService.getTodayNote();
|
const todayNote = await dateNoteService.getTodayNote();
|
||||||
|
|
||||||
const {note} = await noteCreateService.createNote(todayNote.noteId, {
|
const {note} = await server.post(`notes/${todayNote.noteId}/children?target=into`, {
|
||||||
isProtected: todayNote.isProtected,
|
|
||||||
type: 'text',
|
|
||||||
title: 'new note',
|
title: 'new note',
|
||||||
content: ''
|
content: '',
|
||||||
|
type: 'text',
|
||||||
|
isProtected: todayNote.isProtected
|
||||||
});
|
});
|
||||||
|
|
||||||
await ws.waitForMaxKnownSyncId();
|
await ws.waitForMaxKnownSyncId();
|
||||||
|
|
||||||
await appContext.tabManager.openTabWithNote(note.noteId, false);
|
await appContext.tabManager.openTabWithNote(note.noteId, true);
|
||||||
|
|
||||||
appContext.triggerEvent('focusAndSelectTitle');
|
appContext.triggerEvent('focusAndSelectTitle');
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class TabContext extends Component {
|
|||||||
return; // note is outside of hoisted subtree and user chose not to unhoist
|
return; // note is outside of hoisted subtree and user chose not to unhoist
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.triggerEvent('beforeNoteSwitch', {tabId: this.tabId});
|
await this.triggerEvent('beforeNoteSwitch', {tabContext: this});
|
||||||
|
|
||||||
utils.closeActiveDialog();
|
utils.closeActiveDialog();
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ export default class TabManager extends Component {
|
|||||||
|
|
||||||
this.triggerEvent('tabNoteSwitchedAndActivated', {
|
this.triggerEvent('tabNoteSwitchedAndActivated', {
|
||||||
tabContext,
|
tabContext,
|
||||||
notePath
|
notePath: tabContext.notePath // resolved note path
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ export default class TabManager extends Component {
|
|||||||
|
|
||||||
// if no tab with this note has been found we'll create new tab
|
// if no tab with this note has been found we'll create new tab
|
||||||
|
|
||||||
await this.openTabWithNote(noteId);
|
await this.openTabWithNote(noteId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
activateTab(tabId, triggerEvent = true) {
|
activateTab(tabId, triggerEvent = true) {
|
||||||
|
@ -90,7 +90,7 @@ function waitForSyncId(desiredSyncId) {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Waiting for", desiredSyncId, 'current is', lastProcessedSyncId);
|
console.debug("Waiting for", desiredSyncId, 'current is', lastProcessedSyncId);
|
||||||
|
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
syncIdReachedListeners.push({
|
syncIdReachedListeners.push({
|
||||||
@ -335,7 +335,7 @@ async function processSyncRows(syncRows) {
|
|||||||
|
|
||||||
if (!loadResults.isEmpty()) {
|
if (!loadResults.isEmpty()) {
|
||||||
const appContext = (await import("./app_context.js")).default;
|
const appContext = (await import("./app_context.js")).default;
|
||||||
appContext.triggerEvent('entitiesReloaded', {loadResults});
|
await appContext.triggerEvent('entitiesReloaded', {loadResults});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,8 +188,8 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async beforeNoteSwitchEvent({tabId}) {
|
async beforeNoteSwitchEvent({tabContext}) {
|
||||||
if (this.isTab(tabId)) {
|
if (this.isTab(tabContext.tabId)) {
|
||||||
await this.spacedUpdate.updateNowIfNecessary();
|
await this.spacedUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
|||||||
this.$noteTitle.prop("readonly", note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable());
|
this.$noteTitle.prop("readonly", note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
async beforeNoteSwitchEvent({tabId}) {
|
async beforeNoteSwitchEvent({tabContext}) {
|
||||||
if (this.isTab(tabId)) {
|
if (this.isTab(tabContext.tabId)) {
|
||||||
await this.spacedUpdate.updateNowIfNecessary();
|
await this.spacedUpdate.updateNowIfNecessary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,9 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (activeNotePath) {
|
if (activeNotePath) {
|
||||||
appContext.tabManager.getActiveTabContext().setNote(activeNotePath);
|
const node = await this.expandToNote(activeNotePath);
|
||||||
|
|
||||||
|
node.setActive(true, {noEvents: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user