|
|
|
@ -41,14 +41,20 @@ async function reload() {
|
|
|
|
await loadNoteDetail(getActiveTabContext().notePath);
|
|
|
|
await loadNoteDetail(getActiveTabContext().notePath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function reloadAllTabs() {
|
|
|
|
async function reloadTab(tabContext) {
|
|
|
|
for (const tabContext of tabContexts) {
|
|
|
|
if (tabContext.note) {
|
|
|
|
const note = await loadNote(tabContext.note.noteId);
|
|
|
|
const note = await loadNote(tabContext.note.noteId);
|
|
|
|
|
|
|
|
|
|
|
|
await loadNoteDetailToContext(tabContext, note, tabContext.notePath);
|
|
|
|
await loadNoteDetailToContext(tabContext, note, tabContext.notePath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function reloadAllTabs() {
|
|
|
|
|
|
|
|
for (const tabContext of tabContexts) {
|
|
|
|
|
|
|
|
await reloadTab(tabContext);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function openInTab(notePath) {
|
|
|
|
async function openInTab(notePath) {
|
|
|
|
await loadNoteDetail(notePath, { newTab: true });
|
|
|
|
await loadNoteDetail(notePath, { newTab: true });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -289,6 +295,14 @@ async function noteDeleted(noteId) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function refreshTabs(sourceTabId, noteId) {
|
|
|
|
|
|
|
|
for (const tc of tabContexts) {
|
|
|
|
|
|
|
|
if (tc.noteId === noteId && tc.tabId !== sourceTabId) {
|
|
|
|
|
|
|
|
await reloadTab(tc);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function focusOnTitle() {
|
|
|
|
function focusOnTitle() {
|
|
|
|
getActiveTabContext().$noteTitle.focus();
|
|
|
|
getActiveTabContext().$noteTitle.focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -322,10 +336,10 @@ function fireDetailLoaded() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
messagingService.subscribeToSyncMessages(syncData => {
|
|
|
|
messagingService.subscribeToSyncMessages(syncData => {
|
|
|
|
if (syncData.some(sync => sync.entityName === 'notes' && sync.entityId === getActiveNoteId())) {
|
|
|
|
if (syncData.some(sync => sync.entityName === 'notes')) {
|
|
|
|
infoService.showMessage('Reloading note because of background changes');
|
|
|
|
infoService.showMessage('Reloading note because of background changes');
|
|
|
|
|
|
|
|
|
|
|
|
reload();
|
|
|
|
refreshTabs(null, sync.entityId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -505,5 +519,6 @@ export default {
|
|
|
|
clearOpenTabsTask,
|
|
|
|
clearOpenTabsTask,
|
|
|
|
filterTabs,
|
|
|
|
filterTabs,
|
|
|
|
openEmptyTab,
|
|
|
|
openEmptyTab,
|
|
|
|
noteDeleted
|
|
|
|
noteDeleted,
|
|
|
|
|
|
|
|
refreshTabs
|
|
|
|
};
|
|
|
|
};
|