mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
clipper doesn't open new tab if the note is already loaded in existing tab
This commit is contained in:
parent
a912b2f23d
commit
95a773e5c9
@ -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() {
|
function getTabContexts() {
|
||||||
return tabContexts;
|
return tabContexts;
|
||||||
}
|
}
|
||||||
@ -544,6 +560,7 @@ export default {
|
|||||||
getTabContexts,
|
getTabContexts,
|
||||||
getActiveTabContext,
|
getActiveTabContext,
|
||||||
getActiveEditor,
|
getActiveEditor,
|
||||||
|
activateOrOpenNote,
|
||||||
clearOpenTabsTask,
|
clearOpenTabsTask,
|
||||||
filterTabs,
|
filterTabs,
|
||||||
openEmptyTab,
|
openEmptyTab,
|
||||||
|
@ -713,10 +713,7 @@ messagingService.subscribeToMessages(message => {
|
|||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
else if (message.type === 'open-note') {
|
else if (message.type === 'open-note') {
|
||||||
noteDetailService.loadNoteDetail(message.noteId, {
|
noteDetailService.activateOrOpenNote(message.noteId);
|
||||||
newTab: true,
|
|
||||||
activate: true
|
|
||||||
});
|
|
||||||
|
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
const currentWindow = require("electron").remote.getCurrentWindow();
|
const currentWindow = require("electron").remote.getCurrentWindow();
|
||||||
|
@ -38,7 +38,7 @@ async function addClipping(req) {
|
|||||||
|
|
||||||
const rewrittenContent = await addImagesToNote(images, clippingNote, content);
|
const rewrittenContent = await addImagesToNote(images, clippingNote, content);
|
||||||
|
|
||||||
await clippingNote.setContent(await clippingNote.getContent() + rewrittenContent);
|
await clippingNote.setContent(await clippingNote.getContent() + '<p>' + rewrittenContent + '</p>');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
noteId: clippingNote.noteId
|
noteId: clippingNote.noteId
|
||||||
|
Loading…
x
Reference in New Issue
Block a user