clipper doesn't open new tab if the note is already loaded in existing tab

This commit is contained in:
zadam
2019-07-07 11:15:55 +02:00
parent a912b2f23d
commit 95a773e5c9
3 changed files with 19 additions and 5 deletions

View File

@@ -76,6 +76,22 @@ function getActiveEditor() {
}
}
async function activateOrOpenNote(noteId) {
for (const tabContext of tabContexts) {
if (tabContext.note && tabContext.note.noteId === noteId) {
await tabContext.activate();
return;
}
}
// if no tab with this note has been found we'll create new tab
await loadNoteDetail(noteId, {
newTab: true,
activate: true
});
}
function getTabContexts() {
return tabContexts;
}
@@ -544,6 +560,7 @@ export default {
getTabContexts,
getActiveTabContext,
getActiveEditor,
activateOrOpenNote,
clearOpenTabsTask,
filterTabs,
openEmptyTab,